class Pu

Generic run control process unit

Inheritance:


Public

Accessors common to all PU
const char* getPudName()
Returns the name of the Process Unit Design
const char* getPrstName()
Return the name of the process stage, which controls this PU
Prst* getPrst()
Return a pointer to the process stage, which controls this PU
inline void enable()
To set the enable flag of the PU to true
inline void disable()
To set the disable flag of the PU to false
virtual bool isEnabled( const char* pccTransition = NULL )
To find out whether a process unit is enabled
void setSimulate( bool bValue )
To set the simulate mode
void setDebug( bool aBool )
To set the debug mode
bool getDebug()
Returns true if we are in debug mode
Architectural common member functions for all PU
Pu(const char *name, const char *pud_name )
constructor with the name and design as input
virtual ~Pu()
virtual destructor for handling dtor of subtypes
static mapPu_t mapPu
The PUs are organized in a global STL map
static bool exists( const char *name )
Returns true if a PU of this name exists
static mapPu_t::iterator locate( const char *name )
given the name of the PU return an STL map iterator to it
static Pu* get( char *name )
given the name return a pointer to the object itself
static int getPuByTag( const char* pcTag, list<Pu*> &theList )
To get a whole bunch of Pu that start with a given name
virtual void identify( ostream &os = cout )
To print out a one-line identifing message to the ostream os
virtual void dump( ostream &os = cout )
To print out a detailed summary of the Pu to ostream os
static void dump_all( ostream &os = cout )
To print out a detailed summary for all PU to ostream os
static void listAll( ostream &os = cout )
To print out a one-line summary for all PU to ostream os
Simple implementation of RTTI (see note above)
virtual Rdev* castToRdev()
virtual casts to Rdev
virtual Rout* castToRout()
virtual casts to Rout
virtual EvPool* castToEvPool()
virtual casts to EvPool
virtual Swpu* castToSwpu()
virtual casts to Swpu
virtual rcGTM* castToGTM()
virtual casts to GTM
virtual FEM* castToFEM()
virtual casts to FEM
virtual DCM* castToDCM()
virtual casts to DCM
virtual DDsocket* castToDDsocket()
virtual casts to DDsocket
virtual ROobject* castToROobject()
virtual casts to ROobject
virtual ddEventServer* castToddEventServer()
virtual casts to ddEventServer
virtual DataLogger* castToDataLogger()
virtual casts to DataLogger
virtual rcDataLogger* castToRcDataLogger()
virtual casts to rcDataLogger
virtual DummyDevice* castToDummyDevice()
virtual casts to Dummy device
virtual Par* castToPar()
virtual casts to Par
virtual EvbComponent* castToEvbComponent()
virtual casts to EvbComponent
State transitions
enum states
enum with the different possible states - these are common to all PU!!!
static const char* pcStates[]
the names of the state transitions as static const char*
int setState(int state )
Sets the state to the new state given by the enum int
int setState( const char *pcState )
Sets the state to the new state given by the name of the state
int getState()
Returns the state to the new state as enum int
const char* getcState()
Returns the state to the new state as a string
static int setStateAndUpdateStage( const char *pcPuGroup, const char *pcNewState )
Function that searches for a named PU (or group of PUs), sets its STT to the pcNewState and updates the ProcessStage at the same time
virtual functions for generic configuring, starting/updating/continuing a state transition
virtual int configure( const char* config_req, const char* value, const char *param = NULL )
To configure a PU
virtual int connect()
Connect is called once at initialisation time
virtual int initialise()
To initialise the PU
virtual int download()
To download the PU
virtual int start_run()
To start a new run
virtual int end_run()
To stop a run in progress
virtual bool updatePu( int iStatus, int eState_on_success )
Whenever a PU reports to the prst that is has done a state transition, the prst calls this virtual function
virtual bool checkReady( int iLevel )
Returns true if the process unit is in a ready state

Protected Fields

bool bDebug
Flag, which is true if we are running this PU in debug mode
bool bEnabled
Boolean flag which is true if the PU is enabled
bool bIgnoreErrorOnTransition[ eNStates ]
Boolean flag which determines whether we ignore possible errors in a given state transition
bool bSimulate
Boolean flag which is true if we are running in simulate mode
int eState
Current state of the PU as an int (enum)
char* pcName
Name of the PU
char* pcPud_name
Name of the Process stage, that controls this PU
const char* pcState
Current state of the PU as a string

Protected Methods

int sendEventPuDone( int eState_on_success )
Sends a success event to the process stage
int updateStateAfterConfigReq( int eNewState = eInitialised )
Updates the state after a configuration request

Private Methods

int setIgnoreErrorOnTransition( const char* pcTransition, bool bValue )
To set the parameter whether to ignore any state transition errors from the "real" process unit (not the run control proxy)

Documentation

Generic run control process unit. This class is the supertype for all process units, which inherit from this class the following things:

Architectural common member functions for all PU

Pu(const char *name, const char *pud_name )
constructor with the name and design as input

virtual ~Pu()
virtual destructor for handling dtor of subtypes

static mapPu_t mapPu
The PUs are organized in a global STL map

static bool exists( const char *name )
Returns true if a PU of this name exists

static mapPu_t::iterator locate( const char *name )
given the name of the PU return an STL map iterator to it

static Pu* get( char *name )
given the name return a pointer to the object itself

static int getPuByTag( const char* pcTag, list<Pu*> &theList )
To get a whole bunch of Pu that start with a given name. For example: pcTag can be of the form DCM.DC.W.N.* to get all DCM of the DC.W granule in the north half.

virtual void identify( ostream &os = cout )
To print out a one-line identifing message to the ostream os

virtual void dump( ostream &os = cout )
To print out a detailed summary of the Pu to ostream os

static void dump_all( ostream &os = cout )
To print out a detailed summary for all PU to ostream os

static void listAll( ostream &os = cout )
To print out a one-line summary for all PU to ostream os

Accessors common to all PU

const char* getPudName()
Returns the name of the Process Unit Design

const char* getPrstName()
Return the name of the process stage, which controls this PU

Prst* getPrst()
Return a pointer to the process stage, which controls this PU

inline void enable()
To set the enable flag of the PU to true

inline void disable()
To set the disable flag of the PU to false

virtual bool isEnabled( const char* pccTransition = NULL )
To find out whether a process unit is enabled. Note that this function is a virtual functions, that can be redefined by the subtypes of PU. The reason for that is the following: The DCMs that belong to a partition module must all be initialised regardless whether one reads them out or not. In other words we must treat them as if we are taking data with them with the exception of the actual start/stop run. We achieve this behaviour by making isEnabled virtual and adding parameter to the member function that specifies which transition is going on right now. That way the DCMs can return true for the initialise and download, but false for the start/stop run. As of now the DCMs are the only PU that has this kind of behavior. All other PUs just return the value of the private boolean parameter bEnabled.
Returns:
true of false, depending on whether the the operation belonging to the transition pccTransition should be performed or not.
Parameters:
pccTransition - which transition is going on (initialise, download, start_run, stop_run.

void setSimulate( bool bValue )
To set the simulate mode. In the simulate mode, the run control performs all state transitions without actually talking to the real PU. E.g. no events are sent from the run control to the DCMs, but we simply return success of the operation.

void setDebug( bool aBool )
To set the debug mode. If true, the PU prints out information what is going on to cout.

bool getDebug()
Returns true if we are in debug mode

State transitions

enum states
enum with the different possible states - these are common to all PU!!!

static const char* pcStates[]
the names of the state transitions as static const char*

int setState(int state )
Sets the state to the new state given by the enum int

int setState( const char *pcState )
Sets the state to the new state given by the name of the state

int getState()
Returns the state to the new state as enum int

const char* getcState()
Returns the state to the new state as a string

static int setStateAndUpdateStage( const char *pcPuGroup, const char *pcNewState )
Function that searches for a named PU (or group of PUs), sets its STT to the pcNewState and updates the ProcessStage at the same time
Returns:
: rcSuccess or rcFailure (if no object has been found).

virtual functions for generic configuring, starting/updating/continuing a state transition

virtual int configure( const char* config_req, const char* value, const char *param = NULL )
To configure a PU. Generic virtual function that configures a process unit. The subtypes redefine this function and set the actual parameters. The supertype implements configuration requests that are generic to the PU (such as setDebug and setIgnoreErrorOnTransition). The overloaded configure member function of the subtype is supposed to call Pu::configure first to pick up any generic configure command. If the return value is rcSuccess, then we had indeed a generic config request, otherwise a subtype specific config request must be dealt with by the subtype member function configure.
Returns:
rcSuccess if the configuration parameter was recognized and executed properly,
rcUnknownConfigurationCommand if the pu does not support this config requirement,
rcFailure if the config req is not a generic PU config request and it must be implemented by the subtype.
Parameters:
config_req - : the configuration requirement that is set
value - : the value of the configuration requirement
param - : an additional parameter depending on config_req

virtual int connect()
Connect is called once at initialisation time. This routine is a place holder to performing all initialisation tasks that have to be done only once, such as is the object really present in VxWorks, initialisation of static variables etc

virtual int initialise()
To initialise the PU. This member function is typically called once at startup, when the PU is initialised. However it may be that the user requests that is being repeated (in contrast to connnect which always can be called only once).

virtual int download()
To download the PU

virtual int start_run()
To start a new run

virtual int end_run()
To stop a run in progress

virtual bool updatePu( int iStatus, int eState_on_success )
Whenever a PU reports to the prst that is has done a state transition, the prst calls this virtual function. The following 3 cases are then possible:
1. the state transition is complete, updatePu returns true,
2. the Pu sends another event to the real PU,
3. the PU knows that it has to wait for one more event to come in so it does nothing

virtual bool checkReady( int iLevel )
Returns true if the process unit is in a ready state. Ready means ready for data taking. The definition of the ready state depends on the object. Typically only a few objects can provide this information, most of the simply return a true value. Example: The DCMs are ready if their glink is locked. However we want to avoid having every dcm making a RMI to find out whether its proxy in VxWorks has a glink that is locked, We therefore give this task to the readout object, who checks in one call all DCMs in a given crate for that particular partition. The DCMs simply return true.
Parameters:
iLevel - : level at which the readiness check can be performed. This parameter is currently not used, but one could foresee several levels of sophistication in testing the readiness.

Simple implementation of RTTI (see note above)

virtual Rdev* castToRdev()
virtual casts to Rdev

virtual Rout* castToRout()
virtual casts to Rout

virtual EvPool* castToEvPool()
virtual casts to EvPool

virtual Swpu* castToSwpu()
virtual casts to Swpu

virtual rcGTM* castToGTM()
virtual casts to GTM

virtual FEM* castToFEM()
virtual casts to FEM

virtual DCM* castToDCM()
virtual casts to DCM

virtual DDsocket* castToDDsocket()
virtual casts to DDsocket

virtual ROobject* castToROobject()
virtual casts to ROobject

virtual ddEventServer* castToddEventServer()
virtual casts to ddEventServer

virtual DataLogger* castToDataLogger()
virtual casts to DataLogger

virtual rcDataLogger* castToRcDataLogger()
virtual casts to rcDataLogger

virtual DummyDevice* castToDummyDevice()
virtual casts to Dummy device

virtual Par* castToPar()
virtual casts to Par

virtual EvbComponent* castToEvbComponent()
virtual casts to EvbComponent

int sendEventPuDone( int eState_on_success )
Sends a success event to the process stage. This routine is used when we are running in simulate mode.

int updateStateAfterConfigReq( int eNewState = eInitialised )
Updates the state after a configuration request. This may be necessary if we configure the PU and must keep track which ones have been reconfigured in order to download them at download time.

char* pcName
Name of the PU

char* pcPud_name
Name of the Process stage, that controls this PU

bool bEnabled
Boolean flag which is true if the PU is enabled

bool bSimulate
Boolean flag which is true if we are running in simulate mode

bool bDebug
Flag, which is true if we are running this PU in debug mode

bool bIgnoreErrorOnTransition[ eNStates ]
Boolean flag which determines whether we ignore possible errors in a given state transition. This feature is normally only used during the debugging.

int eState
Current state of the PU as an int (enum)

const char* pcState
Current state of the PU as a string

int setIgnoreErrorOnTransition( const char* pcTransition, bool bValue )
To set the parameter whether to ignore any state transition errors from the "real" process unit (not the run control proxy)
Returns:
rcSuccess: valid state, rcFailure if state is not defined


Direct child classes:
rcGTM
ddFrameReceiver
ddEventServer
Swpu
ROobject
Par
FEM
EvbComponent
EvPool
DataLogger
DCM
Author:
C.Witzig
Date: First version Mar 3, 98
Version:
Last update: July 17, 99

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de