JANA2
|
JANA application class (singleton). More...
#include <JApplication.h>
Public Member Functions | |
JApplication (JParameterManager *params=nullptr) | |
void | AddPlugin (std::string plugin_name) |
void | AddPluginPath (std::string path) |
void | Add (std::string event_source_name) |
void | Add (JEventSourceGenerator *source_generator) |
void | Add (JFactoryGenerator *factory_generator) |
void | Add (JEventSource *event_source) |
void | Add (JEventProcessor *processor) |
void | Initialize (void) |
void | Run (bool wait_until_finished=true) |
void | Scale (int nthreads) |
void | Stop (bool wait_until_idle=false) |
void | Resume () |
void | Quit (bool skip_join=false) |
void | SetExitCode (int exit_code) |
int | GetExitCode (void) |
bool | IsInitialized (void) |
bool | IsQuitting (void) |
bool | IsDrainingQueues (void) |
void | SetTicker (bool ticker_on=true) |
void | PrintStatus () |
void | PrintFinalReport () |
uint64_t | GetNThreads () |
Returns the number of threads currently being used. More... | |
uint64_t | GetNEventsProcessed () |
Returns the number of events processed since Run() was called. More... | |
float | GetIntegratedRate () |
Returns the total integrated throughput so far in Hz since Run() was called. More... | |
float | GetInstantaneousRate () |
Returns the 'instantaneous' throughput in Hz since the last perf measurement was made. More... | |
JComponentSummary | GetComponentSummary () |
JParameterManager * | GetJParameterManager () |
template<typename T > | |
T | GetParameterValue (std::string name) |
A convenience method which delegates to JParameterManager. | |
template<typename T > | |
JParameter * | GetParameter (std::string name, T &val) |
template<typename T > | |
JParameter * | SetParameterValue (std::string name, T val) |
A convenience method which delegates to JParameterManager. | |
template<typename T > | |
JParameter * | SetDefaultParameter (std::string name, T &val, std::string description="") |
template<typename T > | |
std::shared_ptr< T > | GetService () |
Use this in EventSources, Factories, or EventProcessors. More... | |
template<typename T > | |
void | ProvideService (std::shared_ptr< T > service) |
Call this from InitPlugin. More... | |
JANA application class (singleton).
The JApplication class serves as a central access point for getting to most things in the JANA application. It owns the JThreadManager, JParameterManager, etc. It is also responsible for making sure all of the plugins are attached and other user specified configurations for the run are implemented before starting the processing of the data. User code (e.g. plugins) will generally register things like event sources and processors with the JApplication so they can be called up later at the appropriate time.
void JApplication::Add | ( | JEventSourceGenerator * | source_generator | ) |
Add the given JFactoryGenerator to the list of queues
source_generator | pointer to source generator to add. Ownership is passed to JApplication |
void JApplication::Add | ( | JFactoryGenerator * | factory_generator | ) |
Add the given JFactoryGenerator to the list of queues
factory_generator | pointer to factory generator to add. Ownership is passed to JApplication |
JComponentSummary JApplication::GetComponentSummary | ( | ) |
Returns a data object describing all components currently running
Referenced by Initialize(), and JSignalHandler::produce_overall_report().
int JApplication::GetExitCode | ( | void | ) |
Returns the currently set exit code. This can be used by JProcessor/JFactory classes to communicate an appropriate exit code that a jana program can return upon exit. The value can be set via the SetExitCode method.
float JApplication::GetInstantaneousRate | ( | ) |
Returns the 'instantaneous' throughput in Hz since the last perf measurement was made.
Note: This data gets stale. If you need event counts and rates which are more consistent with one another, call GetStatus() instead.
float JApplication::GetIntegratedRate | ( | ) |
Returns the total integrated throughput so far in Hz since Run() was called.
Note: This data gets stale. If you need event counts and rates which are more consistent with one another, call GetStatus() instead.
uint64_t JApplication::GetNEventsProcessed | ( | ) |
Returns the number of events processed since Run() was called.
Note: This data gets stale. If you need event counts and rates which are more consistent with one another, call GetStatus() instead.
uint64_t JApplication::GetNThreads | ( | ) |
Returns the number of threads currently being used.
Note: This data gets stale. If you need event counts and rates which are more consistent with one another, call GetStatus() instead.
std::shared_ptr< T > JApplication::GetService | ( | ) |
Use this in EventSources, Factories, or EventProcessors.
A convenience method which delegates to JServiceLocator.
Do not call this from InitPlugin(), as not all JServices may have been loaded yet. When initializing a Service, use acquire_services() instead.
References JServiceLocator::get().
void JApplication::Initialize | ( | void | ) |
Initialize the application in preparation for data processing. This is called by the Run method so users will usually not need to call this directly.
References JServiceLocator::get(), GetComponentSummary(), and JServiceLocator::provide().
void JApplication::ProvideService | ( | std::shared_ptr< T > | service | ) |
Call this from InitPlugin.
A convenience method which delegates to JServiceLocator.
References JServiceLocator::provide().
void JApplication::SetExitCode | ( | int | exit_code | ) |
Set a value of the exit code in that can be later retrieved using GetExitCode. This is so the executable can return a meaningful error code if processing is stopped prematurely, but the program is able to stop gracefully without a hard exit. See also GetExitCode.