JANA2
JApplication Class Reference

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 ()
 
JParameterManagerGetJParameterManager ()
 
template<typename T >
GetParameterValue (std::string name)
 A convenience method which delegates to JParameterManager.
 
template<typename T >
JParameterGetParameter (std::string name, T &val)
 
template<typename T >
JParameterSetParameterValue (std::string name, T val)
 A convenience method which delegates to JParameterManager.
 
template<typename T >
JParameterSetDefaultParameter (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...
 

Detailed Description

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.

Member Function Documentation

void JApplication::Add ( JEventSourceGenerator source_generator)

Add the given JFactoryGenerator to the list of queues

Parameters
source_generatorpointer 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

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

Here is the caller graph for this function:

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.

template<typename T >
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().

Here is the call graph for this function:

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

Here is the call graph for this function:

template<typename T >
void JApplication::ProvideService ( std::shared_ptr< T >  service)

Call this from InitPlugin.

A convenience method which delegates to JServiceLocator.

References JServiceLocator::provide().

Here is the call graph for this function:

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.


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