fesa::AbstractEventSource Class Reference

This class represents an event source on the system. Event sources are responsible for firing events and sending them to the right scheduler. More...

#include <AbstractEventSource.h>

Inheritance diagram for fesa::AbstractEventSource:
fesa::Thread fesa::OnDemandEventSource fesa::OnSubscriptionEventSource fesa::TimerEventSource

List of all members.

Classes

struct  SubscribedScheduler

Public Member Functions

virtual void enable ()
 enable the event-source activity (for all of the related events)

Exceptions:
FesaException 

virtual void disable ()
 disable the event-source activity (for all of the related events)

Exceptions:
FesaException 

virtual void enableEvent (const std::string &logicalEventName)
 enable one particular event of the event-source
virtual void disableEvent (const std::string &logicalEventName)
 disable one particular event on the event-source
void printConfig (FesaStream *fesaStream) const
 method to print the event source configuration
void printState (FesaStream *fesaStream, double elapsedTime)
 Internal method to print the event source configuration.
virtual ~AbstractEventSource ()
 destructor
const std::string & getName () const
EventSourceType getType () const
 Retrieve the type of the event source.
uint32_t getEvtSrcPriority () const
 returns the priority
uint32_t getEvtSrcID () const
 returns the process ID
bool isEventEnabled (const std::string &logicalEventName) const
 returns true if the event passed by argument is enabled

Protected Member Functions

 AbstractEventSource (const std::string eventSourceName, EventSourceType type_)
 Constructor of the class.
void run ()
 This method is executed by the thread to post the event in the schedulers.
virtual void addRTScheduler (boost::shared_ptr< fesa::EventElement > &element, RTScheduler *scheduler)
 this method adds a scheduler to the list of schedulers
virtual RTEventwait ()=0
 This method has to be overridden in order to provide the RTEvent

Exceptions:
FesaException Can be thrown on errors. (Also derived, lab specific errors can be caught, catching for that type).

virtual void connect (boost::shared_ptr< fesa::EventElement > &eventElement)=0
 Connects the new discrete event source. It is up to each derived event source to perform the right actions to connect the event.

Exceptions:
FesaException. 

Private Types

typedef std::string ConcreteEventName
typedef std::map
< ConcreteEventName,
std::vector
< SubscribedScheduler > > 
ConcreteEventMap

Private Member Functions

void postEventToSchedulers (boost::shared_ptr< RTEvent > &event)
 Posts an incoming RTEvent to all schedulers which are registered.
void waitTillSourceEnabled ()
 Waits that source gets woken up, if disabled.
void setLogicalEventEnableState (bool newState, const std::string &logicalEventName)
 Enables / Disables all logical events of the given name.

Private Attributes

ConcreteEventMap eventMap_
 List of events triggered by this event-source and specific info.
bool sourceIsEnabled_
 used to enable/disable event-firing of this source in general
ConditionalVariable waitIfDisabled_
 used to wait for the enable-signal, if source is disabled
Mutex mutex_waitIfDisabled_
std::string eventSourceName_
 name of the event source
EventSourceType type_
 concrete type of the source
DiagnosticUtils::DiagStateCounter firedEventCount_
 number of event fired by this event-source.

Friends

class RTEvent
class RTController
class AbstractEventSourceFactory

Detailed Description

This class represents an event source on the system. Event sources are responsible for firing events and sending them to the right scheduler.

Definition at line 33 of file AbstractEventSource.h.


Member Typedef Documentation

Definition at line 162 of file AbstractEventSource.h.

typedef std::string fesa::AbstractEventSource::ConcreteEventName [private]

Definition at line 161 of file AbstractEventSource.h.


Constructor & Destructor Documentation

fesa::AbstractEventSource::~AbstractEventSource (  )  [virtual]

destructor

Definition at line 53 of file AbstractEventSource.cpp.

References eventSourceName_.

fesa::AbstractEventSource::AbstractEventSource ( const std::string  eventSourceName,
EventSourceType  type_ 
) [protected]

Member Function Documentation

void fesa::AbstractEventSource::addRTScheduler ( boost::shared_ptr< fesa::EventElement > &  element,
RTScheduler scheduler 
) [protected, virtual]

this method adds a scheduler to the list of schedulers

Parameters:
eventName contains the information about the event that will be passed to the scheduler
scheduler the object that is added to the list of schedulers
Exceptions:
FesaException Can be thrown on errors. (Also derived, lab specific errors can be caught, catching for that type) the scheduler cannot be null

Definition at line 135 of file AbstractEventSource.cpp.

References connect(), eventMap_, fesa::RTScheduler::getName(), fesa::AbstractEventSource::SubscribedScheduler::isEnabled_, fesa::AbstractEventSource::SubscribedScheduler::logicalEventName_, and fesa::AbstractEventSource::SubscribedScheduler::scheduler_.

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

virtual void fesa::AbstractEventSource::connect ( boost::shared_ptr< fesa::EventElement > &  eventElement  )  [protected, pure virtual]

Connects the new discrete event source. It is up to each derived event source to perform the right actions to connect the event.

Exceptions:
FesaException. 

Implemented in fesa::OnDemandEventSource, fesa::OnSubscriptionEventSource, and fesa::TimerEventSource.

Referenced by addRTScheduler().

void fesa::AbstractEventSource::disable (  )  [virtual]
void fesa::AbstractEventSource::disableEvent ( const std::string &  logicalEventName  )  [virtual]

disable one particular event on the event-source

Parameters:
logicalEventName logical name of the event that will be disable
Exceptions:
FesaException 

Definition at line 249 of file AbstractEventSource.cpp.

References eventSourceName_, and setLogicalEventEnableState().

Referenced by fesa::ServiceLocatorRealtimeSplitImplementation::disableRTEvent(), and fesa::ServiceLocatorUnsplitImplementation::disableRTEvent().

void fesa::AbstractEventSource::enable (  )  [virtual]
void fesa::AbstractEventSource::enableEvent ( const std::string &  logicalEventName  )  [virtual]

enable one particular event of the event-source

Parameters:
logicalEventName logical name of the event that will be enabled
Exceptions:
FesaException 

Definition at line 241 of file AbstractEventSource.cpp.

References eventSourceName_, and setLogicalEventEnableState().

Referenced by fesa::ServiceLocatorRealtimeSplitImplementation::enableRTEvent(), and fesa::ServiceLocatorUnsplitImplementation::enableRTEvent().

uint32_t fesa::AbstractEventSource::getEvtSrcID (  )  const

returns the process ID

Returns:
the ID

Definition at line 216 of file AbstractEventSource.cpp.

References fesa::Thread::getID().

uint32_t fesa::AbstractEventSource::getEvtSrcPriority (  )  const

returns the priority

Returns:
the current priority

Definition at line 211 of file AbstractEventSource.cpp.

References fesa::Thread::getPriority().

Referenced by printState().

const std::string & fesa::AbstractEventSource::getName (  )  const
Returns:
the name of the event source

Definition at line 201 of file AbstractEventSource.cpp.

References eventSourceName_.

Referenced by postEventToSchedulers(), and fesa::OnDemandEventSource::wait().

EventSourceType fesa::AbstractEventSource::getType (  )  const

Retrieve the type of the event source.

Returns:
type of event source

Definition at line 206 of file AbstractEventSource.cpp.

References type_.

bool fesa::AbstractEventSource::isEventEnabled ( const std::string &  logicalEventName  )  const

returns true if the event passed by argument is enabled

Parameters:
logicalEventName logical name of the event from which the enabled property is retrieved

Definition at line 257 of file AbstractEventSource.cpp.

References eventMap_, and FesaErrorEventNotFound.

Referenced by fesa::ServiceLocatorRealtimeSplitImplementation::isEventEnabled(), and fesa::ServiceLocatorUnsplitImplementation::isEventEnabled().

void fesa::AbstractEventSource::postEventToSchedulers ( boost::shared_ptr< RTEvent > &  event  )  [private]

Posts an incoming RTEvent to all schedulers which are registered.

Definition at line 102 of file AbstractEventSource.cpp.

References eventMap_, and getName().

Referenced by run().

void fesa::AbstractEventSource::printConfig ( FesaStream fesaStream  )  const

method to print the event source configuration

Parameters:
fesaStream in which the configuration will be shown

Definition at line 180 of file AbstractEventSource.cpp.

References eventMap_, and eventSourceName_.

void fesa::AbstractEventSource::printState ( FesaStream fesaStream,
double  elapsedTime 
)

Internal method to print the event source configuration.

Parameters:
fesaStream in which the configuration will be shown

Definition at line 191 of file AbstractEventSource.cpp.

References fesa::DiagnosticUtils::DiagStateCounter::current_, eventSourceName_, firedEventCount_, getEvtSrcPriority(), fesa::Thread::getID(), and fesa::DiagnosticUtils::DiagStateCounter::last_.

void fesa::AbstractEventSource::run (  )  [protected, virtual]
void fesa::AbstractEventSource::setLogicalEventEnableState ( bool  newState,
const std::string &  logicalEventName 
) [private]

Enables / Disables all logical events of the given name.

Definition at line 277 of file AbstractEventSource.cpp.

References eventMap_, and FesaErrorEventNotFound.

Referenced by disableEvent(), and enableEvent().

virtual RTEvent* fesa::AbstractEventSource::wait (  )  [protected, pure virtual]

This method has to be overridden in order to provide the RTEvent

Exceptions:
FesaException Can be thrown on errors. (Also derived, lab specific errors can be caught, catching for that type).

Implemented in fesa::OnDemandEventSource, fesa::OnSubscriptionEventSource, and fesa::TimerEventSource.

Referenced by run().

void fesa::AbstractEventSource::waitTillSourceEnabled (  )  [private]

Waits that source gets woken up, if disabled.

Definition at line 171 of file AbstractEventSource.cpp.

References mutex_waitIfDisabled_, sourceIsEnabled_, fesa::ConditionalVariable::wait(), and waitIfDisabled_.

Referenced by run().


Friends And Related Function Documentation

friend class AbstractEventSourceFactory [friend]

Reimplemented in fesa::OnSubscriptionEventSource, and fesa::TimerEventSource.

Definition at line 115 of file AbstractEventSource.h.

friend class RTController [friend]

Definition at line 114 of file AbstractEventSource.h.

friend class RTEvent [friend]

Member Data Documentation

List of events triggered by this event-source and specific info.

Definition at line 167 of file AbstractEventSource.h.

Referenced by addRTScheduler(), isEventEnabled(), postEventToSchedulers(), printConfig(), and setLogicalEventEnableState().

number of event fired by this event-source.

Definition at line 193 of file AbstractEventSource.h.

Referenced by AbstractEventSource(), printState(), and run().

Definition at line 178 of file AbstractEventSource.h.

Referenced by enable(), and waitTillSourceEnabled().

used to enable/disable event-firing of this source in general

Definition at line 172 of file AbstractEventSource.h.

Referenced by disable(), enable(), and waitTillSourceEnabled().

concrete type of the source

Definition at line 188 of file AbstractEventSource.h.

Referenced by getType().

used to wait for the enable-signal, if source is disabled

Definition at line 177 of file AbstractEventSource.h.

Referenced by enable(), and waitTillSourceEnabled().


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

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1