class Prst : public genNamedObj<Prst*>, public rcFsm

Control object that controls the states of a bunch of process units

Inheritance:


Public Methods

Prst(const char *name, const char *type, const char *rcPartition, const char *purpose = NULL)
Constructor with name, type, the partition
int TakeEvent( rcEvent *pEvent )
Takevent from rcFsm class
~Prst()
Destructor

Public

Accessor member functions
static int getNbStages()
Returns the number of stages
static void show_status( ostream &os = cout )
Dumps a status summary to ostream os
void identify( ostream &os = cout )
Prints a one line summary
void dump( ostream &os = cout )
Dumps a lot of information about the stage to ostream os
static void dump_all( ostream &os = cout )
Static member that calls dump on all stages
static void listAll( ostream &os = cout )
Calls identify on all stages
void dumpPu( ostream &os = cout )
Calls dump on all process units
void listPu( ostream &os = cout )
Calls identify on all process units
int getNPu_outstanding()
Gets the number of process units that are still outstanding
const char* getName()
Returns the name
int setPuState( int iNewState )
Sets the state of the process state
int enforcePuState( const char *pcNewState )
Set the internal state of the process unit and also make sure that every process unit attached to the stage is in that state
int getiPuState()
Returns the summary state of the process untis
const char* getPuState()
Returns the summary state of the process unit as a string
void setTimeout( int iTimeout )
Sets the timeout value
void setManaged( bool managed )
Sets the managed boolean parameter of the process stage
int add(Pud *)
Adds a process unit design to the process stage
int sub(Pud *)
Removes the process unit design from the process stage
int getPud( list<Pud*> &rlistPud )
Returns a list of process unit designs, that are attached to this stage
int getPu( list<Pu*> &rlistPu )
Returns a list of all process units that are controlled by this stage
int getNbPu()
Returns the number of process units attached
inline bool IsEnabled()
Returns true if the stage is enabled
int Enable()
Enables the process stage and all process units that are attached to it
int Disable()
Disables the process stage and all attached process units
inline void setDebug( bool aBool )
Sets the debug to true or false
inline bool getDebug()
Returns the value of the debug flag
inline void setStepMode( bool bValue )
Sets the boolean flag for the step mode
inline bool inStepMode()
Returns true if we are in the step mode
int Reset()
Resets the stage to the waiting for command state
void enableTimers()
Enables the timers
void disableTimers()
Disables the timers
inline char* getCorbaName()
Returns the name of the corresponding corba proxy
int sendCorbaEvent( evdata &refEventData )
Sends the corba event
ProcessStage_i* getCorbaProxy()
Returns a poitner to the corba proxy
State machine member functions
int updatePuState()
Finds the lowest common state of all PU attached to this stage
int waiting_for_command()
Waiting for a command from the partition object
int initiate_state_transition( const char *transition, int scope = 0, int level = 0 )
State in which the process stage starts state transitions of the process units by calling their overloaded initialise, download, start/stop run member functions
int waiting_for_pu( char *name, int iStatus )
State in which the process stages waits for the process units to report that they arrived in the desired state
int all_pu_done()
State reached once all process units are in the desired state
int error_occured( const char *msg )
State reached if a process unit reported an error or the waiting for pu timed out
int check_pu(const char *name)
State reached if a process unit reports back while the process stage is not in the waiting for pu
bool checkReady( int iCheckLevel = 0 )
Checks whether all ProcessUnits that are enabled for datataking are in the ready state

Private Fields

bool bDisableTimer
If true, no timers will be used during state transitions
bool bStepMode
True if we are in step mode
int eState_on_success
State that the process units will have when the state transition operation successfully completes
static int iLastCorbaEvId
Id of the last corba event that was sent
int iPuState
Lowest common state of all pu attached to the stage
list <Pud*> listPud
List of process unit designs that are controlled by this stage
ProcessStage_i* myImplObj
Pointer to the corba proxy
int nPu_outstanding
Number of process units that haven't responded yet during the state transition
int nTimeout_ms
Timeout in milliseconds
char* pcCorbaName
Name of the corba proxy - same name as in Event notifier
char* pcCurrentTransition
which transition is currently going on?
static char* pcLastCorbaEvDest
Name of the object where the last corba command was sent to
static char* pcLastCorbaEvSrc
Pu that sent the last corba event
char* pcName
Name of the object
char* pcPurpose
Purpose
const char* pcPuState
Same as iPuState but as a string
const char* pcState_on_success
Same as eState_on_success but as string
char* pcType
type of the stage [hardware or software]
smTimer* pMyTimer
Pointer to the timer object

Private Methods

int setState( int iNewState )
Sets the state of the process stage

Inherited from genNamedObj:

Public Methods

static void add( const char *name, X x )
inline static X begin()
inline static X end()
static bool exists( const char *name )
static X get( const char *name )
int getLocation()
inline static int getNbElements()
static X getObject( const char *name )
static int getObjects( const char *name, list<X> &theList )
inline const char* getObjName()
inline static X next()
static void remove( const char *name )

Private Fields

static map < const char*, X, cstring_ordering_t > ::iterator m_It
static map < const char*, X, cstring_ordering_t > m_Map
char* m_Name

Inherited from rcFsm:

Public Methods

const char* getcCurrentState()
int getCurrentState()
bool getEventTrace()
char* getFsmName()
virtual void setCurrentState(int iNewState )
void setEventTrace( bool bTrace )

Protected Fields

bool bEventTrace
bool bNoTimersAccepted
int iCurrentState
const char* pcCurrentState
char* pcFsmName

Protected Methods

virtual int canthappenEvent( rcEvent *pEvent )
virtual int ignoreEvent( rcEvent *pEvent )

Documentation

Control object that controls the states of a bunch of process units. Typical examples of the process stages are the FEMstage (all FEMs that are allocated to a partition), the DCMstage (all DCMs), etc etc... The different types of process stages are defined in the file generic.pcf

The process stage has a very simple state model: (see the user guide for details). It normally sits and waits for commands, which it receives in the form "bring all your stages into the state XXX", XXX being ready, running, etc.

The process stage then calls the corresponding member function on all process units, that it controls. The member functions are initialise, download, start_run and stop_run. These functions are all virtual for the process unit, with the idea that the subtype of the process unit implements the specific action. An example the dcm object may send the loadDSP code command to the DCM. Once this is done, the process stage drops into a wait state.

As the corba return events come in (via the corba proxy object of the process stage), the prst checks to which process unit they belong and calls the member function update_pu on that specific process unit. update_pu is also a virtual function, which returns a boolean. The process unit has the knowledge what will happen next. Eg it may send another corba command to the hardware, and the return command will lead to another update_pu call. Once the process unit is done, it returns a true value. The process stage then decrements a counter, which indicates, how many process units have arrived in the desired state. When no more process units are outstanding, the process stage informs the partition object that all is honky dory!

Prst(const char *name, const char *type, const char *rcPartition, const char *purpose = NULL)
Constructor with name, type, the partition

~Prst()
Destructor

int TakeEvent( rcEvent *pEvent )
Takevent from rcFsm class

Accessor member functions

static int getNbStages()
Returns the number of stages

static void show_status( ostream &os = cout )
Dumps a status summary to ostream os

void identify( ostream &os = cout )
Prints a one line summary

void dump( ostream &os = cout )
Dumps a lot of information about the stage to ostream os

static void dump_all( ostream &os = cout )
Static member that calls dump on all stages

static void listAll( ostream &os = cout )
Calls identify on all stages

void dumpPu( ostream &os = cout )
Calls dump on all process units

void listPu( ostream &os = cout )
Calls identify on all process units

int getNPu_outstanding()
Gets the number of process units that are still outstanding

const char* getName()
Returns the name

int setPuState( int iNewState )
Sets the state of the process state. Note that this member only sets the internal variable that reflects the state of the proces sunits. It does not talk to the process units themselves.

int enforcePuState( const char *pcNewState )
Set the internal state of the process unit and also make sure that every process unit attached to the stage is in that state

int getiPuState()
Returns the summary state of the process untis. This state is the lowest common state of all process units.

const char* getPuState()
Returns the summary state of the process unit as a string

void setTimeout( int iTimeout )
Sets the timeout value. This parameter is the number of milliseconds that the process stage waits for the process units to respond.

void setManaged( bool managed )
Sets the managed boolean parameter of the process stage. If true, this means that the stage is completely controlled by another stage and there is no need to have the process stage undergo state transitions.

int add(Pud *)
Adds a process unit design to the process stage

int sub(Pud *)
Removes the process unit design from the process stage

int getPud( list<Pud*> &rlistPud )
Returns a list of process unit designs, that are attached to this stage

int getPu( list<Pu*> &rlistPu )
Returns a list of all process units that are controlled by this stage

int getNbPu()
Returns the number of process units attached

inline bool IsEnabled()
Returns true if the stage is enabled

int Enable()
Enables the process stage and all process units that are attached to it

int Disable()
Disables the process stage and all attached process units

inline void setDebug( bool aBool )
Sets the debug to true or false

inline bool getDebug()
Returns the value of the debug flag

inline void setStepMode( bool bValue )
Sets the boolean flag for the step mode. In the step mode the process stage stops whenever it received events or undergoes state transitions and waits for the user input on cin. This mode is meant for debugging only and should normally be used with the timers disabled.

inline bool inStepMode()
Returns true if we are in the step mode

int Reset()
Resets the stage to the waiting for command state

void enableTimers()
Enables the timers

void disableTimers()
Disables the timers

inline char* getCorbaName()
Returns the name of the corresponding corba proxy

int sendCorbaEvent( evdata &refEventData )
Sends the corba event

ProcessStage_i* getCorbaProxy()
Returns a poitner to the corba proxy

State machine member functions

int updatePuState()
Finds the lowest common state of all PU attached to this stage

int waiting_for_command()
Waiting for a command from the partition object. This is the state in which the process stage resides outside global state transitions of the DAQ.

int initiate_state_transition( const char *transition, int scope = 0, int level = 0 )
State in which the process stage starts state transitions of the process units by calling their overloaded initialise, download, start/stop run member functions

int waiting_for_pu( char *name, int iStatus )
State in which the process stages waits for the process units to report that they arrived in the desired state

int all_pu_done()
State reached once all process units are in the desired state

int error_occured( const char *msg )
State reached if a process unit reported an error or the waiting for pu timed out

int check_pu(const char *name)
State reached if a process unit reports back while the process stage is not in the waiting for pu. This can happen if a pu takes so long to finish and the prst timed out in the meantime. If this happens we find the lowest common state of all pu and update the prst correspondingly.

bool checkReady( int iCheckLevel = 0 )
Checks whether all ProcessUnits that are enabled for datataking are in the ready state. Note that it does not update the state of the device. This is done in the member function checkReady of the PU.
Returns:
true or false depending whether all process units have reported true or false.
Parameters:
iVerifyLevel - : an integer indicating the level of testing that should be done.

int setState( int iNewState )
Sets the state of the process stage

char* pcName
Name of the object

char* pcType
type of the stage [hardware or software]

char* pcPurpose
Purpose

char* pcCurrentTransition
which transition is currently going on?

int eState_on_success
State that the process units will have when the state transition operation successfully completes

const char* pcState_on_success
Same as eState_on_success but as string

int iPuState
Lowest common state of all pu attached to the stage

const char* pcPuState
Same as iPuState but as a string

int nPu_outstanding
Number of process units that haven't responded yet during the state transition

int nTimeout_ms
Timeout in milliseconds

bool bDisableTimer
If true, no timers will be used during state transitions

smTimer* pMyTimer
Pointer to the timer object

list <Pud*> listPud
List of process unit designs that are controlled by this stage

bool bStepMode
True if we are in step mode

char* pcCorbaName
Name of the corba proxy - same name as in Event notifier

static char* pcLastCorbaEvSrc
Pu that sent the last corba event

static char* pcLastCorbaEvDest
Name of the object where the last corba command was sent to

static int iLastCorbaEvId
Id of the last corba event that was sent

ProcessStage_i* myImplObj
Pointer to the corba proxy


This class has no child classes.

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