Public Member Functions | Protected Member Functions | Static Protected Attributes | Private Member Functions | Private Attributes | Friends

baci::BACIComponent Class Reference

#include <baciBACIComponent.h>

Collaboration diagram for baci::BACIComponent:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 BACIComponent (ACS::ThreadManager *thrMgr, const ACE_CString &name, const ACE_CString &type, CharacteristicModelImpl *characteristicModel, size_t actionThreadStackSize, size_t monitorThreadStackSize, const ACS::TimeInterval &actionThreadResponseTime=defaultRTResponseTime_m, const ACS::TimeInterval &actionThreadSleepTime=minRTSleepTime_m, const ACS::TimeInterval &monitorThreadResponseTime=defaultMTResponseTime_m, const ACS::TimeInterval &monitorThreadSleepTime=minMTSleepTime_m)
 ~BACIComponent ()
const char * getName () const
const char * getType () const
int registerCallback (const BACIValue::Type type, Callback_ptr callback_p, const CBDescIn descIn)
int registerAction (const BACIValue::Type type, Callback_ptr callback_p, const CBDescIn descIn, ActionImplementator *actionImplementator_, int actionFunction_)
int registerAction (const BACIValue::Type type, Callback_ptr callback_p, const CBDescIn descIn, ActionImplementator *actionImplementator_, int actionFunction, const BACIValue &value)
BACIThreadManagergetThreadManager () const
ACS::TimeInterval getMTResponseTime () const
void setMTResponseTime (const ACS::TimeInterval &_monitorThreadResponseTime)
ACS::TimeInterval getMTSleepTime () const
void setMTSleepTime (const ACS::TimeInterval &_monitorThreadSleepTime)
ACS::TimeInterval getRTResponseTime () const
void setRTResponseTime (const ACS::TimeInterval &_actionThreadResponseTime)
ACS::TimeInterval getRTSleepTime () const
void setRTSleepTime (const ACS::TimeInterval &_actionThreadSleepTime)
bool dispatchCallback (int callbackID, const BACIValue &value, CBDescOut &descOut, const Completion &completion, const BACIMonitor *archiver=0)
bool finishCallback (int callbackID, const BACIValue &value, CBDescOut &descOut, const Completion &completion)
bool isInDestructionState () const
int getActionCount () const
void pushAction (BACIAction *action)
BACIActionpopAction ()
void removeCallbackAndAction (int callbackID)
BACICallbackgetCallback (int callbackID)
void removeCallback (int callbackID)
int getPropertyCount () const
BACIPropertygetPropertyAt (int pos) const
void stopAllThreads ()
bool startAllThreads ()
void startMonitoringThread ()
void startActionThread ()
void stopMonitoringThread ()
void stopActionThread ()
void cancelMonitoringThread ()
void cancelActionThread ()
bool isMonitoringActive ()
bool isActionThreadActive ()
CharacteristicModelImplgetCharacteristicModel () const

Protected Member Functions

BACIThreadgetActionThread () const
BACIThreadgetMonitorThread () const
int getThreadCount () const
void removeAction (int callbackID)
void addProperty (BACIProperty *property)
void removeProperty (BACIProperty *property)

Static Protected Attributes

static const ACS::TimeInterval defaultRTResponseTime_m
static const ACS::TimeInterval minRTSleepTime_m
static const ACS::TimeInterval defaultMTResponseTime_m
static const ACS::TimeInterval minMTSleepTime_m

Private Member Functions

void operator= (const BACIComponent &)
 BACIComponent (const BACIComponent &)

Private Attributes

ACE_CString name_m
ACE_CString type_m
CharacteristicModelImplcharacteristicModel_mp
BACICallbackTable callbackTable_m
BACIActionQueue actionQueue_m
BACIPropertyVector propertyVector_m
ACS::TimeInterval actionThreadResponseTime_m
ACS::TimeInterval actionThreadSleepTime_m
ACS::TimeInterval monitorThreadResponseTime_m
ACS::TimeInterval monitorThreadSleepTime_m
BACIThreadactionThread_mp
BACIThreadmonitorThread_mp
BACIThreadManagerthreadManager_mp
bool inDestructionState_m
BACIMutex actionQueueMutex_m
BACIMutex propertyVectorMutex_m
BACIMutex callbackTableMutex_m
size_t actionThreadStackSize_m
size_t monitoringThreadStackSize_m

Friends

class BACIProperty

Detailed Description

Class represeting BACI Component Component is responsible for action, monitor dispatching

Author:
Matej Sekoranja, Jozef Stefan Institute, Slovenia

Constructor & Destructor Documentation

baci::BACIComponent::BACIComponent ( ACS::ThreadManager thrMgr,
const ACE_CString &  name,
const ACE_CString &  type,
CharacteristicModelImpl characteristicModel,
size_t  actionThreadStackSize,
size_t  monitorThreadStackSize,
const ACS::TimeInterval &  actionThreadResponseTime = defaultRTResponseTime_m,
const ACS::TimeInterval &  actionThreadSleepTime = minRTSleepTime_m,
const ACS::TimeInterval &  monitorThreadResponseTime = defaultMTResponseTime_m,
const ACS::TimeInterval &  monitorThreadSleepTime = minMTSleepTime_m 
)

Component constructor that allows to pass thread manager This class is a property containder providing action and monitor queues.

Parameters:
threadManager ACS Thread Manager
name name of the Component
characteristicModel characteristic model to be used to retrieve data
actionThreadResponseTime response time of the action thread in 100ns unit
actionThreadSleepTime sleep time of the action thread in 100ns unit
monitorThreadResponseTime response time of the monitor thread in 100ns unit
monitorThreadSleepTime sleep time of the monitor thread in 100ns unit
baci::BACIComponent::~BACIComponent (  ) 
baci::BACIComponent::BACIComponent ( const BACIComponent  )  [private]

ALMA C++ coding standards state copy constructors should be disabled.


Member Function Documentation

void baci::BACIComponent::addProperty ( BACIProperty property  )  [protected]
void baci::BACIComponent::cancelActionThread (  ) 

Cancels the Action thread if one has been created. We need to cancel the thread to avoid waiting unneccessary waiting in sleep of the thread, because cancel

void baci::BACIComponent::cancelMonitoringThread (  ) 

Cancels the Monitoring thread if one has been created. We need to cancel the thread to avoid waiting unneccessary waiting in sleep of the thread, because cancel

bool baci::BACIComponent::dispatchCallback ( int  callbackID,
const BACIValue value,
CBDescOut descOut,
const Completion completion,
const BACIMonitor archiver = 0 
)
bool baci::BACIComponent::finishCallback ( int  callbackID,
const BACIValue value,
CBDescOut descOut,
const Completion completion 
)
int baci::BACIComponent::getActionCount (  )  const [inline]
BACIThread* baci::BACIComponent::getActionThread (  )  const [inline, protected]
BACICallback* baci::BACIComponent::getCallback ( int  callbackID  ) 
CharacteristicModelImpl* baci::BACIComponent::getCharacteristicModel (  )  const [inline]
BACIThread* baci::BACIComponent::getMonitorThread (  )  const [inline, protected]
ACS::TimeInterval baci::BACIComponent::getMTResponseTime (  )  const [inline]
ACS::TimeInterval baci::BACIComponent::getMTSleepTime (  )  const [inline]
const char* baci::BACIComponent::getName ( void   )  const [inline]
BACIProperty* baci::BACIComponent::getPropertyAt ( int  pos  )  const
int baci::BACIComponent::getPropertyCount (  )  const [inline]
ACS::TimeInterval baci::BACIComponent::getRTResponseTime (  )  const [inline]
ACS::TimeInterval baci::BACIComponent::getRTSleepTime (  )  const [inline]
int baci::BACIComponent::getThreadCount (  )  const [inline, protected]
BACIThreadManager* baci::BACIComponent::getThreadManager (  )  const [inline]
const char* baci::BACIComponent::getType (  )  const [inline]
bool baci::BACIComponent::isActionThreadActive (  ) 

Returns true if Action Thread is active, i.e. if the action thread is created and resumed.

bool baci::BACIComponent::isInDestructionState (  )  const [inline]
bool baci::BACIComponent::isMonitoringActive (  ) 

Returns true if monitoring is active, i.e. if monitoring thread is created and resumed.

void baci::BACIComponent::operator= ( const BACIComponent  )  [private]

ALMA C++ coding standards state assignment operators should be disabled.

BACIAction* baci::BACIComponent::popAction (  ) 
void baci::BACIComponent::pushAction ( BACIAction action  ) 
int baci::BACIComponent::registerAction ( const BACIValue::Type  type,
Callback_ptr  callback_p,
const CBDescIn  descIn,
ActionImplementator actionImplementator_,
int  actionFunction_ 
)

Register action to BACI

Parameters:
type callback type (e.g. type double means callback is type of CBdouble)
callback callback reference
descIn callback descriptor (passed by client)
actionImplemenator action implementator
actionFunction action function to be invoked in execute action
value action data (e.g. value to be set)
Returns:
callback ID (0 on failure)
int baci::BACIComponent::registerAction ( const BACIValue::Type  type,
Callback_ptr  callback_p,
const CBDescIn  descIn,
ActionImplementator actionImplementator_,
int  actionFunction,
const BACIValue value 
)

Register action to BACI

Parameters:
type callback type (e.g. type double means callback is type of CBdouble)
callback callback reference
descIn callback descriptor (passed by client)
actionImplemenator action implementator
actionFunction_ action function to be invoked in execute action
Returns:
callback ID (0 on failure)
int baci::BACIComponent::registerCallback ( const BACIValue::Type  type,
Callback_ptr  callback_p,
const CBDescIn  descIn 
)

Register callback to BACI

Parameters:
type callback type (e.g. type double means callback is type of CBdouble)
callback callback reference
descIn callback descriptor (passed by client)
Returns:
callback ID (0 on failure)
void baci::BACIComponent::removeAction ( int  callbackID  )  [protected]
void baci::BACIComponent::removeCallback ( int  callbackID  ) 
void baci::BACIComponent::removeCallbackAndAction ( int  callbackID  ) 
void baci::BACIComponent::removeProperty ( BACIProperty property  )  [protected]
void baci::BACIComponent::setMTResponseTime ( const ACS::TimeInterval &  _monitorThreadResponseTime  ) 
void baci::BACIComponent::setMTSleepTime ( const ACS::TimeInterval &  _monitorThreadSleepTime  ) 
void baci::BACIComponent::setRTResponseTime ( const ACS::TimeInterval &  _actionThreadResponseTime  ) 
void baci::BACIComponent::setRTSleepTime ( const ACS::TimeInterval &  _actionThreadSleepTime  ) 
void baci::BACIComponent::startActionThread (  ) 

Creates and starts the Action thread. The thread which is used for executing asyhronous commmand. In case of an error it throws an exception:

Exceptions:
ACSErrTypeCommon::NullPointerExImpl if there is no thread manager
acsthreadErrType::CanNotCreateThreadExImpl if the thread can not be created
bool baci::BACIComponent::startAllThreads (  ) 
void baci::BACIComponent::startMonitoringThread (  ) 

Creates and starts the Monitoring thread. In case of an error it throws an exception:

Exceptions:
ACSErrTypeCommon::NullPointerExImpl if there is no thread manager
acsthreadErrType::CanNotCreateThreadExImpl if the thread can not be created
void baci::BACIComponent::stopActionThread (  ) 

Stops (suspends) the Action thread. If the thread is already suspended, or if it has not been created yet, it just returns.

void baci::BACIComponent::stopAllThreads (  ) 
void baci::BACIComponent::stopMonitoringThread (  ) 

Stops (suspends) the Monitoring thread If the thread is already suspended, or if it has not been created yet, it just returns.


Friends And Related Function Documentation

friend class BACIProperty [friend]

Member Data Documentation

ACS::TimeInterval baci::BACIComponent::actionThreadSleepTime_m [private]
const ACS::TimeInterval baci::BACIComponent::defaultMTResponseTime_m [static, protected]
const ACS::TimeInterval baci::BACIComponent::defaultRTResponseTime_m [static, protected]
const ACS::TimeInterval baci::BACIComponent::minMTSleepTime_m [static, protected]
const ACS::TimeInterval baci::BACIComponent::minRTSleepTime_m [static, protected]
ACS::TimeInterval baci::BACIComponent::monitorThreadSleepTime_m [private]
ACE_CString baci::BACIComponent::name_m [private]
ACE_CString baci::BACIComponent::type_m [private]

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