AceSmartSoft API Documentation
|
Component management class. More...
#include <smartComponent.hh>
Public Member Functions | |
SmartComponent (const std::string &serverName, int argc, char **argv, SmartACE::ReactorTask *reactor=NULL, const ACE_Sched_Params &sched_params=ACE_Sched_Params(ACE_SCHED_OTHER, ACE_THR_PRI_OTHER_DEF), const char *compileDate=__DATE__, const char *compileTime=__TIME__) | |
Initializes the component. More... | |
virtual | ~SmartComponent () |
Destructor. More... | |
virtual Smart::StatusCode | run (void) |
Runs the SmartSoft framework within a component which includes handling intercomponent communication etc. More... | |
virtual void | signal_shutdown (void) |
virtual Smart::ITimerManager * | getTimerManager () |
get timer-manager for registering timer-handlers More... | |
Smart::StatusCode | blocking (const bool b) |
Allow or abort and reject blocking calls in communication patterns of this component. More... | |
void | setStateSlave (StateSlave *state) |
StateSlave * | getStateSlave () const |
SmartACE::ReactorTask * | getReactorTask () |
Smart::StatusCode | addCV (SmartCVwithMemory *cond) |
Smart::StatusCode | removeCV (SmartCVwithMemory *cond) |
Smart::StatusCode | addCV (SmartCVwithoutMemory *cond) |
Smart::StatusCode | removeCV (SmartCVwithoutMemory *cond) |
Smart::StatusCode | addSmartMonitor (SmartMonitor *monitor) |
Smart::StatusCode | removeSmartMonitor (SmartMonitor *monitor) |
Smart::StatusCode | waitForCond (SmartCondClass &cond) |
Smart::StatusCode | waitForCond (SmartCntCondClass &cond) |
void | enqueue (void *, void(*internalServInitDisc)(void *, int), int cid) |
void | sign_on (void *ptr) |
void | sign_off (void *ptr) |
Protected Member Functions | |
void | waitOnRuntimeCondVar () |
virtual int | handle_signal (int signum, siginfo_t *, ucontext_t *) |
Signal handler method for SIGINT. More... | |
virtual void | signalSmartTasksToStop (const Smart::Duration &watchdogTime=std::chrono::seconds(2)) |
virtual void | cleanUpInternalResources () |
virtual void | setTimedModeForAllSmartMonitors (const Smart::Duration &timeout) |
Protected Attributes | |
SIDhandler | srvInitDiscHandler |
ShutdownTimer | shutdownWatchdog |
StateSlave * | state |
bool | componentIsRunning |
bool | firstCallOfCleanupMethod |
bool | first_call_of_handle_signal |
TimerManagerThread | timerThread |
bool | ownReactor |
SmartACE::ReactorTask * | reactorTask |
Component management class.
Every component needs exactly one component management class which wraps basic services of the SmartSoft framework. This infrastructure is for example needed by the communication patterns.
The main thread of a component is used by this class to run the SmartSoft framework. Therefore all user activities must be started before in separate threads. Further details can be found in the examples.
SmartACE::SmartComponent::SmartComponent | ( | const std::string & | serverName, |
int | argc, | ||
char ** | argv, | ||
SmartACE::ReactorTask * | reactor = NULL , |
||
const ACE_Sched_Params & | sched_params = ACE_Sched_Params(ACE_SCHED_OTHER, ACE_THR_PRI_OTHER_DEF) , |
||
const char * | compileDate = __DATE__ , |
||
const char * | compileTime = __TIME__ |
||
) |
Initializes the component.
serverName | unique name of the whole component, which is used by the clients to address this server |
argc | # of command line arguments |
argv | array of command line arguments |
reactor | optionally a customized implementation of the Reactor can be used (otherwise component automatically initializes an own reactor) |
sched_params | optional scheduling parameters used for the related internal reactor thread |
compileDate | compile date, just for debugging, don't touch |
compileTime | compile time, just for debugging, don't touch |
|
virtual |
Destructor.
Smart::StatusCode SmartACE::SmartComponent::addCV | ( | SmartCVwithMemory * | cond | ) |
Returns the pointer of the shutdown task.
called by the communication patterns to add their condition variable to the component. Used to set the cancelled state for all communication patterns of a component by a single call to the blocking() member function of this class. This is for example used by the state pattern.
Smart::StatusCode SmartACE::SmartComponent::addCV | ( | SmartCVwithoutMemory * | cond | ) |
see above
Smart::StatusCode SmartACE::SmartComponent::addSmartMonitor | ( | SmartMonitor * | monitor | ) |
see above
Smart::StatusCode SmartACE::SmartComponent::blocking | ( | const bool | b | ) |
Allow or abort and reject blocking calls in communication patterns of this component.
if blocking is set to false all blocking calls of all communication patterns of this component return with SMART_CANCELLED. This can be used to abort blocking calls of ALL communication patterns inside a component.
b | (blocking) true/false |
|
protectedvirtual |
void SmartACE::SmartComponent::enqueue | ( | void * | , |
void(*)(void *, int) | internalServInitDisc, | ||
int | cid | ||
) |
see thesis from Schlegel on page 195!
|
inline |
Returns the reactor that is responsible for handling all Events of this component and its communication patterns
StateSlave* SmartACE::SmartComponent::getStateSlave | ( | ) | const |
Returns the reference for the StateSlave if one is started otherwise NULL is returned.
|
inlinevirtual |
get timer-manager for registering timer-handlers
An instance of an ITimerManager is instantiated by an IComponent. An ITimerManager allows activation of ITimerHandler instances that are triggered (once or repeatedly) after a given time period.
|
protectedvirtual |
Signal handler method for SIGINT.
The Default constructor registers this method to SIGINT.
This method calls exit(0) on SIGINT, resulting in a uncontrolled shutdown, no destructors will be called etc.
Overriding this method in a subclass is recommended to enable a clean shutdown after a Ctrl-C.
Smart::StatusCode SmartACE::SmartComponent::removeCV | ( | SmartCVwithMemory * | cond | ) |
see above
Smart::StatusCode SmartACE::SmartComponent::removeCV | ( | SmartCVwithoutMemory * | cond | ) |
see above
Smart::StatusCode SmartACE::SmartComponent::removeSmartMonitor | ( | SmartMonitor * | monitor | ) |
see above
|
virtual |
Runs the SmartSoft framework within a component which includes handling intercomponent communication etc.
This method is called in the main()-routine of a component after all initializations including activation of user threads are finished.
void SmartACE::SmartComponent::setStateSlave | ( | StateSlave * | state | ) |
Returns the reference for the StateSlave if one is started otherwise NULL is returned.
|
protectedvirtual |
void SmartACE::SmartComponent::sign_off | ( | void * | ptr | ) |
see thesis from Schlegel on page 195!
void SmartACE::SmartComponent::sign_on | ( | void * | ptr | ) |
see thesis from Schlegel on page 195!
|
virtual |
|
protectedvirtual |
Smart::StatusCode SmartACE::SmartComponent::waitForCond | ( | SmartCondClass & | cond | ) |
provide interruptable wait on condition variable.
Smart::StatusCode SmartACE::SmartComponent::waitForCond | ( | SmartCntCondClass & | cond | ) |
provide interruptable wait on condition variable.
|
protected |
|
protected |
|
protected |
variable is used to detect the first call of SIGINT handler and to ignore all further calls
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |