fesa::RTScheduler Class Reference

The scheduler class contains the real time behavior of the class. It waits for events and then executes the real time action related to them. More...

#include <RTScheduler.h>

Inheritance diagram for fesa::RTScheduler:
fesa::Thread

List of all members.

Public Member Functions

 RTScheduler (const std::string &name, int32_t eventQueueSize)
void post (boost::shared_ptr< RTEvent > &pEv)
void addRTAction (const std::string &eventName, AbstractRTAction *rtAction)
const std::string & getName ()
virtual ~RTScheduler ()
void printState (FesaStream *fesaStream, double elapsedTime)
void printConfig (FesaStream *fesaStream)
void cancel ()

Private Member Functions

void run ()
void schedule (RTEvent *event)
void logDiagnostics (RTEvent *&pEvent)
 creates a log entry for the diagnostics tool

Private Attributes

std::map< const std::string,
std::vector< AbstractRTAction * > > 
schedulingMap_
 list of the actions which have to be executed per event
std::deque< boost::shared_ptr
< RTEvent > > 
eventQueue_
 this member contains the queue for real time events
std::string name_
 name of the layer specified by the FESA developer
int32_t queueSize_
 queue size
Mutex mutexQueue_
 mutex for the queue
ConditionalVariable conditionalVariableQueue_
 variable for the queue
DiagnosticUtils::DiagStateCounter postEventCount_
DiagnosticUtils::DiagStateCounter scheduledEventCount_
DiagnosticUtils::DiagStateCounter accumulatedEventCount_
uint32_t lostEventCount_

Detailed Description

The scheduler class contains the real time behavior of the class. It waits for events and then executes the real time action related to them.

Definition at line 30 of file RTScheduler.h.


Constructor & Destructor Documentation

fesa::RTScheduler::RTScheduler ( const std::string &  name,
int32_t  eventQueueSize 
)
fesa::RTScheduler::~RTScheduler (  )  [virtual]

Destructor

Definition at line 60 of file RTScheduler.cpp.

References schedulingMap_.


Member Function Documentation

void fesa::RTScheduler::addRTAction ( const std::string &  eventName,
AbstractRTAction rtAction 
)

This method links the RT action and the event passed by arguments

Parameters:
eventName name of the event which fires the action
rtAction to be executed when the event arrives

Definition at line 300 of file RTScheduler.cpp.

References schedulingMap_.

Referenced by fesa::RTController::createAction().

void fesa::RTScheduler::cancel (  ) 

This call provokes the stop of the scheduler and an exit on the current thread

Definition at line 278 of file RTScheduler.cpp.

References conditionalVariableQueue_, fesa::Thread::hasFinished_, fesa::Thread::isRunning_, fesa::MAX_ATTEMPTS_STOP_THREAD, name_, fesa::ConditionalVariable::signal(), and fesa::Thread::stop().

const std::string & fesa::RTScheduler::getName (  )  [inline]

Definition at line 144 of file RTScheduler.h.

References name_.

Referenced by fesa::AbstractEventSource::addRTScheduler(), and fesa::RTController::createAction().

void fesa::RTScheduler::logDiagnostics ( RTEvent *&  pEvent  )  [private]
void fesa::RTScheduler::post ( boost::shared_ptr< RTEvent > &  pEv  ) 
void fesa::RTScheduler::printConfig ( FesaStream fesaStream  ) 
Parameters:
fesaStream 

Definition at line 221 of file RTScheduler.cpp.

References fesa::Thread::getPriority(), name_, and schedulingMap_.

void fesa::RTScheduler::printState ( FesaStream fesaStream,
double  elapsedTime 
)
void fesa::RTScheduler::run (  )  [private, virtual]

This method is executed in an independent thread if the process is split.

Implements fesa::Thread.

Definition at line 110 of file RTScheduler.cpp.

References conditionalVariableQueue_, eventQueue_, fesa::Thread::hasFinished_, fesa::Thread::isRunning_, mutexQueue_, name_, schedule(), and fesa::ConditionalVariable::wait().

void fesa::RTScheduler::schedule ( RTEvent event  )  [private]

This method is in charge of scheduling the event to the proper RTActions

Definition at line 166 of file RTScheduler.cpp.

References fesa::DiagnosticUtils::DiagStateCounter::current_, fesa::FesaException::getMessage(), fesa::RTEvent::getName(), logDiagnostics(), name_, scheduledEventCount_, and schedulingMap_.

Referenced by run().


Member Data Documentation

Definition at line 138 of file RTScheduler.h.

Referenced by post(), printState(), and RTScheduler().

variable for the queue

Definition at line 118 of file RTScheduler.h.

Referenced by cancel(), post(), and run().

this member contains the queue for real time events

Definition at line 94 of file RTScheduler.h.

Referenced by post(), and run().

Definition at line 139 of file RTScheduler.h.

Referenced by printState().

mutex for the queue

Definition at line 112 of file RTScheduler.h.

Referenced by post(), and run().

name of the layer specified by the FESA developer

Reimplemented from fesa::Thread.

Definition at line 100 of file RTScheduler.h.

Referenced by cancel(), getName(), post(), printConfig(), printState(), RTScheduler(), run(), and schedule().

Definition at line 136 of file RTScheduler.h.

Referenced by post(), printState(), and RTScheduler().

queue size

Definition at line 106 of file RTScheduler.h.

Referenced by post(), and printState().

Definition at line 137 of file RTScheduler.h.

Referenced by printState(), RTScheduler(), and schedule().

list of the actions which have to be executed per event

Definition at line 88 of file RTScheduler.h.

Referenced by addRTAction(), printConfig(), printState(), schedule(), and ~RTScheduler().


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

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1