MarlinMT
0.1.0
|
Application class Base application interface for running a Marlin application. More...
#include <Application.h>
Public Types | |
using | Logger = Logging::Logger |
using | CmdLineParseResult = CmdLineParser::ParseResult |
using | Scheduler = std::shared_ptr< IScheduler > |
using | EventList = std::vector< std::shared_ptr< EventStore > > |
using | DataSource = std::shared_ptr< DataSourcePlugin > |
using | ConditionsMap = std::map< std::string, std::string > |
Public Member Functions | |
Application ()=default | |
~Application ()=default | |
void | init (int argc, char **argv) |
Initialize the application. More... | |
void | run () |
Run the application. More... | |
const CmdLineParseResult & | cmdLineParseResult () const |
Get the command line parsing result (after init) More... | |
const std::string & | programName () const |
Get the program name. More... | |
bool | isInitialized () const |
Whether the application has been initialized. More... | |
Logger | logger () const |
Get the application logger instance. More... | |
Logger | createLogger (const std::string &name) const |
Create a new logger instance. More... | |
const GeometryManager & | geometryManager () const |
Get the geometry manager. More... | |
const RandomSeedManager & | randomSeedManager () const |
Get the random seed manager. More... | |
RandomSeedManager & | randomSeedManager () |
Get the random seed manager. More... | |
BookStoreManager & | bookStoreManager () |
Get book store manager. More... | |
const BookStoreManager & | bookStoreManager () const |
Get book store manager. More... | |
const Configuration & | configuration () const |
Get the main application configuration object. More... | |
Static Public Member Functions | |
static int | main (int argc, char **argv) |
Create and run an application. More... | |
Private Member Functions | |
void | onEventRead (std::shared_ptr< EventStore > event) |
Callback function to process an event received from the data source. More... | |
void | onRunHeaderRead (std::shared_ptr< RunHeader > rhdr) |
Callback function to process a run header received from the data source. More... | |
void | processFinishedEvents (const EventList &events) const |
Processed finished events from the output queue. More... | |
void | dumpExampleConfig () |
Dump an example configuation. More... | |
Private Attributes | |
CmdLineParser::ParseResult | _parseResult {} |
The command line parse result. More... | |
Configuration | _configuration {} |
The main application configuration. More... | |
GeometryManager | _geometryMgr {} |
The geometry manager. More... | |
RandomSeedManager | _randomSeedMgr {} |
The random seed manager. More... | |
LoggerManager | _loggerMgr {} |
The logger manager. More... | |
BookStoreManager | _bookStoreManager {} |
Managed data object shared between threads. More... | |
bool | _initialized {false} |
Whether the application has been initialized. More... | |
Scheduler | _scheduler {nullptr} |
The event processing scheduler instance. More... | |
DataSource | _dataSource {nullptr} |
The data source plugin. More... | |
ConditionsMap | _conditions {} |
Initial processor runtime conditions from steering file. More... | |
Application class Base application interface for running a Marlin application.
See daughter classes for details.
Definition at line 25 of file Application.h.
Definition at line 28 of file Application.h.
using marlinmt::Application::ConditionsMap = std::map<std::string, std::string> |
Definition at line 32 of file Application.h.
using marlinmt::Application::DataSource = std::shared_ptr<DataSourcePlugin> |
Definition at line 31 of file Application.h.
using marlinmt::Application::EventList = std::vector<std::shared_ptr<EventStore> > |
Definition at line 30 of file Application.h.
Definition at line 27 of file Application.h.
using marlinmt::Application::Scheduler = std::shared_ptr<IScheduler> |
Definition at line 29 of file Application.h.
|
default |
|
default |
BookStoreManager & marlinmt::Application::bookStoreManager | ( | ) |
Get book store manager.
Definition at line 266 of file Application.cc.
Referenced by marlinmt::ProcessorApi::Book::bookHist1D(), marlinmt::ProcessorApi::Book::bookHist1F(), marlinmt::ProcessorApi::Book::bookHist1I(), marlinmt::ProcessorApi::Book::bookHist2D(), marlinmt::ProcessorApi::Book::bookHist2F(), marlinmt::ProcessorApi::Book::bookHist2I(), marlinmt::ProcessorApi::Book::bookHist3D(), marlinmt::ProcessorApi::Book::bookHist3F(), marlinmt::ProcessorApi::Book::bookHist3I(), marlinmt::ProcessorApi::Book::dontWrite(), marlinmt::ProcessorApi::Book::getHist1D(), marlinmt::ProcessorApi::Book::getHist1F(), marlinmt::ProcessorApi::Book::getHist1I(), marlinmt::ProcessorApi::Book::getHist2D(), marlinmt::ProcessorApi::Book::getHist2F(), marlinmt::ProcessorApi::Book::getHist2I(), marlinmt::ProcessorApi::Book::getHist3D(), marlinmt::ProcessorApi::Book::getHist3F(), marlinmt::ProcessorApi::Book::getHist3I(), and marlinmt::ProcessorApi::Book::write().
const BookStoreManager & marlinmt::Application::bookStoreManager | ( | ) | const |
Get book store manager.
For const object.
Definition at line 272 of file Application.cc.
const Application::CmdLineParseResult & marlinmt::Application::cmdLineParseResult | ( | ) | const |
Get the command line parsing result (after init)
Definition at line 165 of file Application.cc.
Referenced by marlinmt::BookStoreManager::bookHist(), and marlinmt::concurrency::PEPScheduler::preConfigure().
const Configuration & marlinmt::Application::configuration | ( | ) | const |
Get the main application configuration object.
Definition at line 278 of file Application.cc.
Referenced by marlinmt::concurrency::PEPScheduler::configureProcessors(), marlinmt::SimpleScheduler::initialize(), marlinmt::IScheduler::initialize(), marlinmt::BookStoreManager::initialize(), marlinmt::LoggerManager::initialize(), marlinmt::GeometryManager::initialize(), marlinmt::GeometryPlugin::initialize(), marlinmt::DataSourcePlugin::initialize(), and marlinmt::Processor::initialize().
Application::Logger marlinmt::Application::createLogger | ( | const std::string & | name | ) | const |
Create a new logger instance.
If the logger manager is initialized, the logger will share the same sinks as the main logger, else a fresh new logger is created.
name | the logger name |
Definition at line 189 of file Application.cc.
Referenced by marlinmt::Component::setup().
|
private |
Dump an example configuation.
Definition at line 284 of file Application.cc.
References marlinmt::Configuration::createSection(), marlinmt::Component::getParameters(), marlinmt::Component::setName(), and marlinmt::ConfigSection::setParameter().
const GeometryManager & marlinmt::Application::geometryManager | ( | ) | const |
Get the geometry manager.
Definition at line 237 of file Application.cc.
Referenced by marlinmt::ProcessorApi::geometry().
void marlinmt::Application::init | ( | int | argc, |
char ** | argv | ||
) |
Initialize the application.
argc | argc from main function |
argv | argv from main function |
Definition at line 52 of file Application.cc.
References MARLINMT_THROW, marlinmt::CmdLineParser::parse(), and marlinmt::details::print_banner().
Referenced by main().
bool marlinmt::Application::isInitialized | ( | ) | const |
Whether the application has been initialized.
Definition at line 177 of file Application.cc.
Application::Logger marlinmt::Application::logger | ( | ) | const |
Get the application logger instance.
Definition at line 183 of file Application.cc.
Referenced by main().
|
static |
Create and run an application.
argc | argc from main function |
argv | argv from main function |
Definition at line 24 of file Application.cc.
References init(), logger(), run(), and marlinmt::Exception::what().
|
private |
Callback function to process an event received from the data source.
event | the event to process |
Definition at line 200 of file Application.cc.
|
private |
Callback function to process a run header received from the data source.
rhdr | the run header to process |
Definition at line 230 of file Application.cc.
|
private |
Processed finished events from the output queue.
events | the list of finished events |
Definition at line 255 of file Application.cc.
const std::string & marlinmt::Application::programName | ( | ) | const |
Get the program name.
Definition at line 171 of file Application.cc.
References marlinmt::CmdLineParser::ParseResult::_programName.
const RandomSeedManager & marlinmt::Application::randomSeedManager | ( | ) | const |
Get the random seed manager.
Definition at line 243 of file Application.cc.
Referenced by marlinmt::ProcessorApi::registerForRandomSeeds().
RandomSeedManager & marlinmt::Application::randomSeedManager | ( | ) |
Get the random seed manager.
Definition at line 249 of file Application.cc.
void marlinmt::Application::run | ( | ) |
|
private |
Managed data object shared between threads.
Definition at line 160 of file Application.h.
|
private |
Initial processor runtime conditions from steering file.
Definition at line 168 of file Application.h.
|
private |
The main application configuration.
Definition at line 152 of file Application.h.
|
private |
The data source plugin.
Definition at line 166 of file Application.h.
|
private |
The geometry manager.
Definition at line 154 of file Application.h.
|
private |
Whether the application has been initialized.
Definition at line 162 of file Application.h.
|
private |
The logger manager.
Definition at line 158 of file Application.h.
|
private |
The command line parse result.
Definition at line 150 of file Application.h.
|
private |
The random seed manager.
Definition at line 156 of file Application.h.
|
private |
The event processing scheduler instance.
Definition at line 164 of file Application.h.