1 #include "artdaq/Application/TaskType.hh"
2 #include "artdaq/Application/BoardReaderApp.hh"
3 #include "artdaq/Application/MPI2/MPISentry.hh"
5 #include "artdaq/ExternalComms/xmlrpc_commander.hh"
6 #include "artdaq/BuildInfo/GetPackageBuildInfo.hh"
7 #include "artdaq/DAQdata/Globals.hh"
8 #include "cetlib/exception.h"
10 #include "boost/program_options.hpp"
11 #include "boost/lexical_cast.hpp"
16 int main(
int argc,
char* argv[])
21 int const wanted_threading_level{MPI_THREAD_FUNNELED};
23 MPI_Comm local_group_comm;
24 std::unique_ptr<artdaq::MPISentry> mpiSentry;
28 mpiSentry.reset(
new artdaq::MPISentry(&argc, &argv, wanted_threading_level, artdaq::TaskType::BoardReaderTask, local_group_comm));
30 catch (cet::exception& errormsg)
32 TLOG_ERROR(
"BoardReaderMain") << errormsg << TLOG_ENDL;
33 TLOG_ERROR(
"BoardReaderMain") <<
"MPISentry error encountered in BoardReaderMain; exiting..." << TLOG_ENDL;
39 std::string usage = std::string(argv[0]) +
" -p port_number -n name <other-options>";
40 boost::program_options::options_description desc(usage);
43 (
"port,p", boost::program_options::value<unsigned short>(),
"Port number")
44 (
"name,n", boost::program_options::value<std::string>(),
"Application Nickname")
45 (
"help,h",
"produce help message");
47 boost::program_options::variables_map vm;
50 boost::program_options::store(boost::program_options::command_line_parser(argc, argv).options(desc).run(), vm);
51 boost::program_options::notify(vm);
53 catch (boost::program_options::error
const& e)
55 TLOG_ERROR(
"Option") <<
"exception from command line processing in " << argv[0] <<
": " << e.what() << TLOG_ENDL;
61 std::cout << desc << std::endl;
65 if (!vm.count(
"port"))
67 TLOG_ERROR(
"Option") << argv[0] <<
" port number not suplied" << std::endl <<
"For usage and an options list, please do '" << argv[0] <<
" --help'" << TLOG_ENDL;
71 std::string name =
"BoardReader";
74 name = vm[
"name"].as<std::string>();
75 TLOG_DEBUG(name +
"Main") <<
"Setting application name to " << name << TLOG_ENDL;
79 TLOG_DEBUG(name +
"Main") <<
"artdaq version " <<
BoardReaderApp is an artdaq::Commandable derived class which controls the BoardReaderCore state machi...
The MPISentry class initializes and finalizes the MPI context that the artdaq applciations run in...
int rank() const
Get the MPI rank of the application.
static artdaq::PackageBuildInfo getPackageBuildInfo()
Gets the version number and build timestmap for artdaq.
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...