72 using std::ostringstream;
74 using namespace genie;
87 int main(
int argc,
char ** argv)
95 vector<string>::const_iterator file_iter =
gAllFiles.begin();
96 for( ; file_iter !=
gAllFiles.end(); ++file_iter) {
97 string filename = *file_iter;
98 LOG(
"gspladd",
pNOTICE) <<
" ---- >> Loading file : " << filename;
106 <<
" ****** Saving all loaded splines into : " <<
gOutFile;
114 vector<string> files;
116 vector<string>::const_iterator file_iter;
117 vector<string>::const_iterator dir_iter;
121 for( ; file_iter !=
gInpFiles.end(); ++file_iter) {
122 string filename = *file_iter;
123 files.push_back(filename);
128 for( ; dir_iter !=
gInpDirs.end(); ++dir_iter) {
129 string path = *dir_iter;
133 file_iter = path_files.begin();
134 for( ; file_iter != path_files.end(); ++file_iter) {
135 string filename = *file_iter;
136 files.push_back(filename);
145 LOG(
"gspladd",
pNOTICE) <<
"Parsing command line arguments";
154 if( parser.OptionExists(
'f') ) {
155 LOG(
"gspladd",
pINFO) <<
"Reading input files";
156 string inpfiles = parser.ArgAsString(
'f');
157 if(inpfiles.find(
",") != string::npos) {
166 if( parser.OptionExists(
'd') ) {
167 LOG(
"gspladd",
pINFO) <<
"Reading input directories";
168 string inpdirs = parser.ArgAsString(
'd');
169 if(inpdirs.find(
",") != string::npos) {
178 if( parser.OptionExists(
'o') ) {
179 LOG(
"gspladd",
pINFO) <<
"Reading output file name";
182 LOG(
"gspladd",
pFATAL) <<
"You must specify an output file name";
189 LOG(
"gspladd",
pFATAL) <<
"There must be at least 2 input files";
198 <<
"\n\n" <<
"Syntax:" <<
"\n"
199 <<
" gspladd -f file_list -d directory_list -o output.xml\n"
200 <<
" [--message-thresholds xml_file]\n";
vector< string > gInpFiles
list of input XML files
vector< string > GetAllInputFiles(void)
vector< string > gAllFiles
list of all input files
void ReadFromCommandLine(int argc, char **argv)
vector< string > GetAllFilesInPath(string path, string extension="")
static XSecSplineList * Instance()
int main(int argc, char **argv)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
vector< string > gInpDirs
list of input dirs (to look for XML files)
void SaveAsXml(const string &filename, bool save_init=true) const
static RunOpt * Instance(void)
vector< string > Split(string input, string delim)
void MesgThresholds(string inpfile)
Command line argument parser.
void GetCommandLineArgs(int argc, char **argv)
enum genie::EXmlParseStatus XmlParserStatus_t
List of cross section vs energy splines.
XmlParserStatus_t LoadFromXml(const string &filename, bool keep=false)
string gOutFile
output XML file