MarlinMT  0.1.0
marlinmt::Application Class Reference

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 CmdLineParseResultcmdLineParseResult () 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 GeometryManagergeometryManager () const
 Get the geometry manager. More...
 
const RandomSeedManagerrandomSeedManager () const
 Get the random seed manager. More...
 
RandomSeedManagerrandomSeedManager ()
 Get the random seed manager. More...
 
BookStoreManagerbookStoreManager ()
 Get book store manager. More...
 
const BookStoreManagerbookStoreManager () const
 Get book store manager. More...
 
const Configurationconfiguration () 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...
 

Detailed Description

Application class Base application interface for running a Marlin application.

See daughter classes for details.

Definition at line 25 of file Application.h.

Member Typedef Documentation

◆ CmdLineParseResult

◆ ConditionsMap

using marlinmt::Application::ConditionsMap = std::map<std::string, std::string>

Definition at line 32 of file Application.h.

◆ DataSource

Definition at line 31 of file Application.h.

◆ EventList

using marlinmt::Application::EventList = std::vector<std::shared_ptr<EventStore> >

Definition at line 30 of file Application.h.

◆ Logger

Definition at line 27 of file Application.h.

◆ Scheduler

using marlinmt::Application::Scheduler = std::shared_ptr<IScheduler>

Definition at line 29 of file Application.h.

Constructor & Destructor Documentation

◆ Application()

marlinmt::Application::Application ( )
default

◆ ~Application()

marlinmt::Application::~Application ( )
default

Member Function Documentation

◆ bookStoreManager() [1/2]

◆ bookStoreManager() [2/2]

const BookStoreManager & marlinmt::Application::bookStoreManager ( ) const

Get book store manager.

For const object.

Returns
const ref to book store manager.

Definition at line 272 of file Application.cc.

◆ cmdLineParseResult()

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().

◆ configuration()

◆ createLogger()

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.

Parameters
namethe logger name

Definition at line 189 of file Application.cc.

Referenced by marlinmt::Component::setup().

◆ dumpExampleConfig()

void marlinmt::Application::dumpExampleConfig ( )
private

◆ geometryManager()

const GeometryManager & marlinmt::Application::geometryManager ( ) const

Get the geometry manager.

Definition at line 237 of file Application.cc.

Referenced by marlinmt::ProcessorApi::geometry().

◆ init()

void marlinmt::Application::init ( int  argc,
char **  argv 
)

Initialize the application.

Parameters
argcargc from main function
argvargv 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().

◆ isInitialized()

bool marlinmt::Application::isInitialized ( ) const

Whether the application has been initialized.

Definition at line 177 of file Application.cc.

◆ logger()

Application::Logger marlinmt::Application::logger ( ) const

Get the application logger instance.

Definition at line 183 of file Application.cc.

Referenced by main().

◆ main()

int marlinmt::Application::main ( int  argc,
char **  argv 
)
static

Create and run an application.

Parameters
argcargc from main function
argvargv from main function

Definition at line 24 of file Application.cc.

References init(), logger(), run(), and marlinmt::Exception::what().

◆ onEventRead()

void marlinmt::Application::onEventRead ( std::shared_ptr< EventStore event)
private

Callback function to process an event received from the data source.

Parameters
eventthe event to process

Definition at line 200 of file Application.cc.

◆ onRunHeaderRead()

void marlinmt::Application::onRunHeaderRead ( std::shared_ptr< RunHeader rhdr)
private

Callback function to process a run header received from the data source.

Parameters
rhdrthe run header to process

Definition at line 230 of file Application.cc.

◆ processFinishedEvents()

void marlinmt::Application::processFinishedEvents ( const EventList events) const
private

Processed finished events from the output queue.

Parameters
eventsthe list of finished events

Definition at line 255 of file Application.cc.

◆ programName()

const std::string & marlinmt::Application::programName ( ) const

Get the program name.

Definition at line 171 of file Application.cc.

References marlinmt::CmdLineParser::ParseResult::_programName.

◆ randomSeedManager() [1/2]

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() [2/2]

RandomSeedManager & marlinmt::Application::randomSeedManager ( )

Get the random seed manager.

Definition at line 249 of file Application.cc.

◆ run()

void marlinmt::Application::run ( )

Run the application.

Definition at line 138 of file Application.cc.

Referenced by main().

Member Data Documentation

◆ _bookStoreManager

BookStoreManager marlinmt::Application::_bookStoreManager {}
private

Managed data object shared between threads.

Definition at line 160 of file Application.h.

◆ _conditions

ConditionsMap marlinmt::Application::_conditions {}
private

Initial processor runtime conditions from steering file.

Definition at line 168 of file Application.h.

◆ _configuration

Configuration marlinmt::Application::_configuration {}
private

The main application configuration.

Definition at line 152 of file Application.h.

◆ _dataSource

DataSource marlinmt::Application::_dataSource {nullptr}
private

The data source plugin.

Definition at line 166 of file Application.h.

◆ _geometryMgr

GeometryManager marlinmt::Application::_geometryMgr {}
private

The geometry manager.

Definition at line 154 of file Application.h.

◆ _initialized

bool marlinmt::Application::_initialized {false}
private

Whether the application has been initialized.

Definition at line 162 of file Application.h.

◆ _loggerMgr

LoggerManager marlinmt::Application::_loggerMgr {}
private

The logger manager.

Definition at line 158 of file Application.h.

◆ _parseResult

CmdLineParser::ParseResult marlinmt::Application::_parseResult {}
private

The command line parse result.

Definition at line 150 of file Application.h.

◆ _randomSeedMgr

RandomSeedManager marlinmt::Application::_randomSeedMgr {}
private

The random seed manager.

Definition at line 156 of file Application.h.

◆ _scheduler

Scheduler marlinmt::Application::_scheduler {nullptr}
private

The event processing scheduler instance.

Definition at line 164 of file Application.h.


The documentation for this class was generated from the following files: