semaine::components::Component Class Reference

#include <Component.h>

Inheritance diagram for semaine::components::Component:
semaine::cms::SEMAINEMessageAvailableListener semaine::components::control::ParticipantControl semaine::components::dummy::DummyAnalyser semaine::components::dummy::DummyFeatureExtractor semaine::components::dummy::DummyFML2BML semaine::components::dummy::GenericTestComponent

List of all members.

Public Member Functions

virtual ~Component ()
const std::string getName ()
virtual void messageAvailableFrom (Receiver *const source)
void run ()
void requestExit ()

Static Public Attributes

static const std::string STATE_STARTING = "starting"
static const std::string STATE_READY = "ready"
static const std::string STATE_STOPPED = "stopped"
static const std::string STATE_FAILURE = "failure"
static const std::string STATE_STALLED = "stalled"

Protected Member Functions

 Component (const std::string &componentName, bool isInput=false, bool isOutput=false) throw (CMSException)
 Component (const std::string &componentName, const std::string &cmsUrl, const std::string &cmsUser="", const std::string &cmsPassword="") throw (CMSException)
 Component (const std::string &componentName, bool isInput, bool isOutput, const std::string &cmsUrl, const std::string &cmsUser, const std::string &cmsPassword) throw (CMSException)
bool exitRequested ()
virtual void act () throw (std::exception)
virtual void react (SEMAINEMessage *message) throw (std::exception)
virtual void customStartIO () throw (std::exception)

Protected Attributes

std::list< Receiver * > receivers
std::list< Sender * > senders
std::queue< Receiver * > inputWaiting
CMSLoggerlog
bool _exitRequested
std::string state
MetaMessenger meta
int waitingTime
bool isInput
bool isOutput
decaf::util::concurrent::Mutex mutex

Detailed Description

The base class for all components. Subclasses need to:

Author:
marc

Constructor & Destructor Documentation

semaine::components::Component::~Component (  )  [virtual]
semaine::components::Component::Component ( const std::string &  componentName,
bool  isInput = false,
bool  isOutput = false 
) throw (CMSException) [protected]

Create a component with the given name. The component communicates with the default CMS server (see IOBase#IOBase()).

Parameters:
componentName the component name as it is to be used throughout the system.
isInput whether the component is an input component (optional, defaults to false)
isOutput whether the component is an output component (optional, defaults to false)
Exceptions:
JMSException if the connection to the middleware cannot be established
semaine::components::Component::Component ( const std::string &  componentName,
const std::string &  cmsUrl,
const std::string &  cmsUser = "",
const std::string &  cmsPassword = "" 
) throw (CMSException) [protected]

Create a component with the given name. The component is neither an input nor an output component, communicates with the CMS server given in the arguments.

Parameters:
componentName the component name as it is to be used throughout the system.
cmsUrl the url where to contact the CMS server.
cmsUser the username to use (optional)
cmsPassword the password to use (optional)
Exceptions:
JMSException if the connection to the middleware cannot be established
semaine::components::Component::Component ( const std::string &  componentName,
bool  isInput,
bool  isOutput,
const std::string &  cmsUrl,
const std::string &  cmsUser,
const std::string &  cmsPassword 
) throw (CMSException) [protected]

Create a component with the given name. The component communicates with the CMS server given in the arguments.

Parameters:
componentName the component name as it is to be used throughout the system.
isInput whether the component is an input component
isOutput whether the component is an output component
cmsUrl the url where to contact the CMS server.
cmsUser the username to use (can be the empty string)
cmsPassword the password to use (can be the empty string)
Exceptions:
JMSException if the connection to the middleware cannot be established

Member Function Documentation

virtual void semaine::components::Component::act (  )  throw (std::exception) [inline, protected, virtual]

Proactive actions. This method is called every waitingTime milliseconds if no messages arrive, and after every message processing.

This base implementation does nothing; subclasses should implement suitable behaviour here.

Exceptions:
CMSException if communication with the JMS server goes wrong.
std::exception if anything goes wrong in the internal processing of the component.

Reimplemented in semaine::components::dummy::DummyFeatureExtractor, and semaine::components::dummy::GenericTestComponent.

virtual void semaine::components::Component::customStartIO (  )  throw (std::exception) [inline, protected, virtual]

Subclasses can implement this method in order to run custom code needed at startup time.

Exceptions:
std::exception if anything goes wrong in the internal processing of the component.

Reimplemented in semaine::components::control::ParticipantControl, and semaine::components::dummy::DummyFeatureExtractor.

bool semaine::components::Component::exitRequested (  )  [protected]
const std::string semaine::components::Component::getName (  )  [inline]
virtual void semaine::components::Component::messageAvailableFrom ( Receiver *const   source  )  [virtual]

Method called from the corresponding receiver thread, to notify us that a message is available.

Implements semaine::cms::SEMAINEMessageAvailableListener.

virtual void semaine::components::Component::react ( SEMAINEMessage message  )  throw (std::exception) [inline, protected, virtual]

Reactions to messages.

This base implementation does nothing; subclasses should implement suitable behaviour here.

Exceptions:
CMSException if communication with the JMS server goes wrong.
std::exception if anything goes wrong in the internal processing of the component.

Reimplemented in semaine::components::control::ParticipantControl, semaine::components::dummy::DummyAnalyser, semaine::components::dummy::DummyFML2BML, and semaine::components::dummy::GenericTestComponent.

void semaine::components::Component::requestExit (  ) 
void semaine::components::Component::run (  ) 

The main method executed for this Thread.


Member Data Documentation

decaf::util::concurrent::Mutex semaine::components::Component::mutex [protected]
std::string semaine::components::Component::state [protected]
const std::string semaine::components::Component::STATE_FAILURE = "failure" [static]
const std::string semaine::components::Component::STATE_READY = "ready" [static]
const std::string semaine::components::Component::STATE_STALLED = "stalled" [static]
const std::string semaine::components::Component::STATE_STARTING = "starting" [static]
const std::string semaine::components::Component::STATE_STOPPED = "stopped" [static]

The documentation for this class was generated from the following files:
Generated on Tue Dec 14 17:13:18 2010 for SEMAINE by  doxygen 1.6.3