1 #include "artdaq/Application/Commandable.hh"
2 #include "artdaq/Application/MPI2/MPISentry.hh"
3 #include "artdaq/DAQdata/configureMessageFacility.hh"
5 #include "artdaq/DAQdata/Globals.hh"
6 #include "artdaq/ExternalComms/xmlrpc_commander.hh"
8 #include "boost/program_options.hpp"
9 #include "boost/lexical_cast.hpp"
13 int main(
int argc,
char* argv[])
16 int const wanted_threading_level{MPI_THREAD_FUNNELED};
19 TLOG_DEBUG(
"Commandable::main")
20 <<
"MPI initialized with requested thread support level of "
21 << wanted_threading_level <<
", actual support level = "
22 << mpiSentry.threading_level() <<
"." << TLOG_ENDL;
23 TLOG_DEBUG(
"Commandable::main")
27 << mpiSentry.rank() << TLOG_ENDL;
30 std::string usage = std::string(argv[0]) +
" -p port_number <other-options>";
31 boost::program_options::options_description desc(usage);
34 (
"port,p", boost::program_options::value<unsigned short>(),
"Port number")
35 (
"help,h",
"produce help message");
37 boost::program_options::variables_map vm;
40 boost::program_options::store(boost::program_options::command_line_parser(argc, argv).options(desc).run(), vm);
41 boost::program_options::notify(vm);
43 catch (boost::program_options::error
const& e)
45 TLOG_ERROR(
"Option") <<
"exception from command line processing in " << argv[0] <<
": " << e.what() << TLOG_ENDL;
51 std::cout << desc << std::endl;
55 if (!vm.count(
"port"))
57 TLOG_ERROR(
"Option") << argv[0] <<
" port number not suplied" << std::endl <<
"For usage and an options list, please do '" << argv[0] <<
" --help'" << TLOG_ENDL;
Commandable is the base class for all artdaq components which implement the artdaq state machine...
The MPISentry class initializes and finalizes the MPI context that the artdaq applciations run in...
void configureMessageFacility(char const *progname, bool useConsole=true)
Configure and start the message facility. Provide the program name so that messages will be appropria...
The xmlrpc_commander class serves as the XMLRPC server run in each artdaq application.
void setMsgFacAppName(const std::string &appType, unsigned short port)
Set the message facility application name using the specified application type and port number...