1 #include "otsdaq/MessageFacility/MessageFacility.h"
9 #include "otsdaq/ConfigurationInterface/ConfigurationInterface.h"
10 #include "otsdaq/ConfigurationInterface/ConfigurationManagerRW.h"
17 #define TRACE_NAME "LoadJSON_Document"
27 void LoadJSON_Document(
int argc,
char* argv[])
30 if(getenv(
"SERVICE_DATA_PATH") == NULL)
31 setenv(
"SERVICE_DATA_PATH",
32 (std::string(__ENV__(
"USER_DATA")) +
"/ServiceData").c_str(),
35 __COUT__ <<
"=================================================\n";
36 __COUT__ <<
"=================================================\n";
37 __COUT__ <<
"=================================================\n";
38 __COUT__ <<
"\nLoading Trigger Document!" << std::endl;
40 __COUT__ <<
"\n\nusage: Two arguments:\n\t <document_name_to_load> "
41 "<document_version_to_load> <path_to_save_JSON>"
45 __COUT__ <<
"argc = " << argc << std::endl;
46 for(
int i = 0; i < argc; i++)
47 __COUT__ <<
"argv[" << i <<
"] = " << argv[i] << std::endl;
51 __COUT__ <<
"\n\nError! Must provide 3 parameters.\n\n" << std::endl;
83 __COUT__ <<
"Loading JSON Document..." << std::endl;
89 theInterface_->loadCustomJSON(argv[1],
TableVersion(atoi(argv[2])));
91 FILE* fp = std::fopen(argv[3],
"w");
94 __COUT__ <<
"\n\nERROR! Could not open file at " << argv[1]
95 <<
". Error: " << errno <<
" - " << strerror(errno) << __E__;
98 fputs(json.c_str(), fp);
103 int main(
int argc,
char* argv[])
105 if(getenv(
"OTSDAQ_LOG_FHICL") == NULL)
106 setenv(
"OTSDAQ_LOG_FHICL",
107 (std::string(__ENV__(
"USER_DATA")) +
108 "/MessageFacilityConfigurations/MessageFacilityWithCout.fcl")
112 if(getenv(
"OTSDAQ_LOG_ROOT") == NULL)
114 "OTSDAQ_LOG_ROOT", (std::string(__ENV__(
"USER_DATA")) +
"/Logs").c_str(), 1);
117 LoadJSON_Document(argc, argv);