SourceForge.net Logo

DAQpp::RunManager Class Reference
[DAQ++ objects]

class RunManager More...

#include <RunManager.h>

Inheritance diagram for DAQpp::RunManager:

Inheritance graph
[legend]
Collaboration diagram for DAQpp::RunManager:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 RunManager (RunCommand *rc=0)
 Constructor with a RunCommand.
 RunManager (const DAQid &, RunCommand *rc=0)
 Constructor with DAQid and RunCommand.
virtual ~RunManager ()
 Destructor.
void set_run_number (int x)
 Set the current run number.
int get_run_number () const
 returns the current run number
int get_event_number () const
 returns the current event number
RunCommandoperator() ()
 Returns the RunCommand that communicates with the Module's.
void addModule (Module *o)
 Adds a new Module.
void deleteModule (Module *o)
 Removes a Module from the list.
void deleteModules ()
 Delete all the modules in the list.
int countModules ()
 Returns the number of Modules in the list.
template<class _Function>
_Function for_each_module (_Function __f)
 Loops on all the modules.
void PrepareToStop (bool z)
 Set the Stop flag.
bool HaveToStop () const
 Checks if the RUnManager needs to stop.
bool isActive () const
 Returns true is the RunManager is active.
void deActivate ()
 Deactivates the RUnManager.
void Activate ()
 Activates the RunManager.
void set_MxEvts (int n)
 Sets the maximum number of events.
int get_MxEvts ()
 returns the maximum number of events permitted.
virtual void PrepareForRun ()
 Prepares to start the run.
virtual void EndOfRun ()
 This is called right before the run is stopped.
virtual bool CheckEndOfRun ()
 Checks.
virtual void GetReady ()
 Sends the GetReady command to the Modules.
virtual void Start ()
 Sends the Start command to the modules.
virtual void Stop ()
 Sends the Stop Command to the Modules.
virtual void Pause ()
 Sends the Pause command to the Modules.
virtual void Continue ()
 Sends the Continue command to the Modules.
virtual void Trigger ()
 Sends the Trigger command to the Modules This is call from the DAQ loop and can be used to issue a software trigger if the function is defined.
virtual void EndOfEvent ()
 Called at the end of an event in some data has been detected.
virtual void Reset ()
 Sends the Reset command to the Modules.
virtual void Acquire ()
 Acquire.
virtual int writeData (int size, const char *data)
 Writes the data into whatever storage medium.
Monitorget_monitor () const
 returns the Monitor associated
void set_monitor (Monitor *m)
 Associates a Monitor object to the RunManager.

Static Public Member Functions

static void moveModules (RunManager *from, RunManager *to)
 Moves the Modules from one RunManager to the other.

Protected Attributes

int run_number
 Run number.
int event_number
 Event number.

Private Member Functions

void init ()
 Common Initialization at construction.

Private Attributes

RunCommandcmd
 RunCommand.
Monitormonitor
 Monitor.
bool active
 Flag to now whether the RunManager is active or not.
bool has_to_stop
 flag to force the RunManager to stop
int mxEvts
 Number of events for the run.
Mutex theCondition
 A DAQ mutex to be used internally.

Static Private Attributes

static unsigned long cntr = 0
 RunManager counter.

Classes

struct  ModuleAcquire
 struct ModuleAcquire. More...


Detailed Description

class RunManager

A RunManager controls the acquisition of a number of Module objects that share a common acquisition style. It will also handle in the same way the storage of the data from the different Modules. This class is an interface between the DAQmanager and the Modules. It transmits the DAQ commands to the different Modules. This is done with a RunCommand that can be given in the constructor. If none is given, one will be automatically generated. RunManager will delete the RunCommand in the destructor, even if it is given in the constructor. The operations that a RunManager can make on its list of Modules are

All those operations can be overloaded but this is not recomended unless you really know what you are doing, since that may change the acquisition process. The default action is to send the command to all the Modules in the list.

RunManager also provide a number of hooks at some stages of the acquisition and this is the place where one can savely introduce his/her own code.

Module's should be registered to a RunManager with the RunManager::addModule( Module *). To unregister a Module RunManager::deleteModule(Module *) should be used. The list of Modules can be emptied with RunManager::deleteModules().

The data is read from the modules in ModuleAcquire. Modules should get the memory to pass the data to the RunManager with Module::allocate. The run manager will take care of deallocating the memory.

A RunManager derives from ParameterHolder and, therefore, can mantain a list of named Parameters. The use of named parameters assumes the knowledge of the Parameter type.

Author:
: Carlos Lacasta

Constructor & Destructor Documentation

RunManager::RunManager ( RunCommand rc = 0  ) 

Constructor with a RunCommand.

The DAQid associated with this RunManager will be generated automatically by the system.

References init().


Member Function Documentation

void DAQpp::RunManager::set_MxEvts ( int  n  )  [inline]

Sets the maximum number of events.

When this value is reached the RunManager will stop the run if CkeckEndOfRun() is not overloaded.

References mxEvts.

virtual int DAQpp::RunManager::writeData ( int  size,
const char *  data 
) [inline, virtual]

Writes the data into whatever storage medium.

Should return 1 on success and 0 in case of failure

Referenced by DAQpp::RunManager::ModuleAcquire::operator()().


Member Data Documentation

Number of events for the run.

In the default implementation of CheckEndOfRun() a negative value, or zero, will make an infinite run, otherwise this this will set the maximum number of events to be saved. If CheckEndOfRun is overloaded, then you will have to define the proper behaviour.

Referenced by CheckEndOfRun(), get_MxEvts(), and set_MxEvts().


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

Generated on Mon Apr 21 10:00:05 2008 for DAQ++ by  doxygen 1.5.5