OpenDaVINCI  4.16.0
odcore::base::module::TimeTriggeredConferenceClientModule Class Referenceabstract

#include <TimeTriggeredConferenceClientModule.h>

Inheritance diagram for odcore::base::module::TimeTriggeredConferenceClientModule:
Inheritance graph

Public Member Functions

 TimeTriggeredConferenceClientModule (const int32_t &argc, char **argv, const string &name) throw (odcore::exceptions::InvalidArgumentException, odcore::exceptions::NoDatabaseAvailableException)
 
virtual ~TimeTriggeredConferenceClientModule ()
 
odcore::io::conference::ContainerConferencegetConference ()
 
void toLogger (const odcore::data::LogMessage::LogLevel &logLevel, const string &msg)
 
const odcore::data::TimeStamp getStartOfCurrentCycle () const
 
const odcore::data::TimeStamp getStartOfLastCycle () const
 
virtual
odcore::data::dmcp::ModuleExitCodeMessage::ModuleExitCode 
runModule ()
 
const string getName () const
 
virtual float getFrequency () const
 
uint32_t getIdentifier () const
 
const string getMultiCastGroup () const
 
uint32_t getCID () const
 
bool isProfiling () const
 
bool isRealtime () const
 
uint32_t getRealtimePriority () const
 
virtual void waitForNextFullSecond (const uint32_t &secondsIncrement)
 
void setBreakpoint (Breakpoint *bp)
 
void setModuleState (const odcore::data::dmcp::ModuleStateMessage::ModuleState &s)
 
odcore::data::dmcp::ModuleStateMessage::ModuleState getModuleState ()
 
odcore::data::dmcp::ModuleStateMessage::ModuleState getModuleStateAndWaitForRemainingTimeInTimeslice ()
 

Static Public Member Functions

static bool isVerbose ()
 
static int32_t getVerbosity ()
 
static vector< AbstractModule * > & getListOfModules ()
 

Protected Member Functions

virtual void setUp ()=0
 
virtual void tearDown ()=0
 
virtual
odcore::data::dmcp::ModuleExitCodeMessage::ModuleExitCode 
body ()=0
 
virtual void nextContainer (odcore::data::Container &c)
 
virtual void addDataStoreFor (odcore::base::AbstractDataStore &dataStore)
 
virtual void addDataStoreFor (const int32_t &datatype, odcore::base::AbstractDataStore &dataStore)
 
virtual
odcore::base::KeyValueDataStore
getKeyValueDataStore ()
 
virtual
odcore::data::dmcp::ModuleExitCodeMessage::ModuleExitCode 
runModuleImplementation ()
 
virtual void reached ()
 
void setContainerConference (std::shared_ptr< odcore::io::conference::ContainerConference > c)
 
std::shared_ptr
< odcore::io::conference::ContainerConference
getContainerConference ()
 
const
odcore::base::KeyValueConfiguration 
getKeyValueConfiguration () const
 
std::shared_ptr
< odcore::dmcp::connection::Client > & 
getDMCPClient ()
 
virtual void handleConnectionLost ()
 
const
odcore::data::dmcp::ServerInformation 
getServerInformation () const
 

Detailed Description

This class is the base for every client module that shall realize functionality in a time-triggered way. It participates automatically in a UDP multicast container conference. All received data is written into a key/value-map using Container::DATATYPE as key. Thus, it is possible to get the newest data using the map. Furthermore, it is possible to request a thread-safe FIFO- or LIFO-style queue for a specific Container::DATATYPE. It can be used as follows:

class MyModule: public TimeTriggeredConferenceClientModule
{
public:
MyModule(const int32_t argc, char **argv) :
TimeTriggeredConferenceClientModule(argc, argv, "MyName")
{}
virtual void setUp()
{}
virtual void tearDown()
{}
virtual odcore::data::dmcp::ModuleExitCodeMessage::ModuleExitCode body() {
FIFOQueue fifo;
addDataStoreFor(Container::TIMESTAMP, fifo);
while (getModuleStateAndWaitForRemainingTimeInTimeslice() == odcore::data::dmcp::ModuleStateMessage::RUNNING) {
Container c = fifo.leave();
TimeStamp ts = c.getData<TimeStamp>();
// Do something...
Container c2(Container::TIMESTAMP, TimeStamp());
}
return odcore::data::dmcp::ModuleExitCodeMessage::OKAY;
}
};
// Regular main method.
int32_t main(int32_t argc, char **argv) {
MyModule myModule(argc, argv);
return myModule.runModule();
}

Constructor & Destructor Documentation

odcore::base::module::TimeTriggeredConferenceClientModule::TimeTriggeredConferenceClientModule ( const int32_t &  argc,
char **  argv,
const string &  name 
)
throw (odcore::exceptions::InvalidArgumentException,
odcore::exceptions::NoDatabaseAvailableException
)

Constructor.

Parameters
argcNumber of command line arguments.
argvCommand line arguments.
nameName of this module. This parameter is necessary for identifying the corresponding parts in the configuration.
Exceptions
InvalidArgumentExceptionif the signal handler could not be registered.
NoDatabaseAvailableExceptionif the database could not be created.

References odcore::wrapper::KeyValueDatabaseFactory::createKeyValueDatabase().

odcore::base::module::TimeTriggeredConferenceClientModule::~TimeTriggeredConferenceClientModule ( )
virtual

Member Function Documentation

void odcore::base::module::TimeTriggeredConferenceClientModule::addDataStoreFor ( odcore::base::AbstractDataStore dataStore)
protectedvirtual

This method adds a data store for a all data types.

Parameters
dataStoreData store to be added.

Implements odcore::base::DataStoreManager.

void odcore::base::module::TimeTriggeredConferenceClientModule::addDataStoreFor ( const int32_t &  datatype,
odcore::base::AbstractDataStore dataStore 
)
protectedvirtual

This method adds a data store for a given data type.

Parameters
datatypeDatatype for which a datastore should be added.
dataStoreData store to be added.

Implements odcore::base::DataStoreManager.

virtual odcore::data::dmcp::ModuleExitCodeMessage::ModuleExitCode odcore::base::module::TimeTriggeredConferenceClientModule::body ( )
protectedpure virtual

This method contains the real module body.

Returns
The exit code of the real body.

Implements odcore::base::module::AbstractConferenceClientModule.

uint32_t odcore::base::module::AbstractCIDModule::getCID ( ) const
inherited

This method returns the CID.

Returns
CID.
ContainerConference & odcore::base::module::AbstractConferenceClientModule::getConference ( )
inherited

This method returns the conference.

Returns
Conference.
std::shared_ptr< odcore::io::conference::ContainerConference > odcore::base::module::ManagedClientModule::getContainerConference ( )
protectedinherited

This method returns the ContainerConference to be used. In the case that we are executed as managed level == ML_SIMULATION or ML_SIMULATION_RT we replace the UDP-based one with a local ContainerConference.

Returns
Pointer to the ContainerConference to be used.
std::shared_ptr< odcore::dmcp::connection::Client > & odcore::base::module::ClientModule::getDMCPClient ( )
protectedinherited

This method returns the std::shared_ptr for the DMCP connection.

Returns
std::shared_ptr for DMCP connection.
float odcore::base::module::AbstractCIDModule::getFrequency ( ) const
virtualinherited

This method returns the runtime frequency.

Returns
Runtime frequency.

Implements odcore::base::module::Periodic.

uint32_t odcore::base::module::AbstractCIDModule::getIdentifier ( ) const
inherited

This method returns this module's identifier as specified in the command line.

Returns
This module's identifier.
const KeyValueConfiguration odcore::base::module::ClientModule::getKeyValueConfiguration ( ) const
protectedinherited

This method returns the key/value-configuration for this client module.

Returns
Key/value-configuration.
KeyValueDataStore & odcore::base::module::TimeTriggeredConferenceClientModule::getKeyValueDataStore ( )
protectedvirtual

This method returns a key/value-datastore for all captured data.

Returns
Key/Value-data store containing all received data.

Implements odcore::base::DataStoreManager.

vector< AbstractModule * > & odcore::base::module::AbstractModule::getListOfModules ( )
staticinherited

This method returns the list of created modules for this class. This method can be used to broadcast signals to all instances.

Referenced by odcore::base::module::finalize(), odcore::base::module::signalHandler(), and odcore::base::module::AbstractModule::~AbstractModule().

odcore::data::dmcp::ModuleStateMessage::ModuleState odcore::base::module::AbstractModule::getModuleState ( )
inherited

This method returns the module MODULE_STATE.

Returns
Module MODULE_STATE.

Referenced by odcore::base::module::AbstractModule::getModuleStateAndWaitForRemainingTimeInTimeslice().

odcore::data::dmcp::ModuleStateMessage::ModuleState odcore::base::module::AbstractModule::getModuleStateAndWaitForRemainingTimeInTimeslice ( )
inherited

This method returns the module MODULE_STATE and suspends the execution of the calling thread for the rest of the current time slice.

Returns
Module MODULE_STATE.

References odcore::base::module::AbstractModule::calledGetModuleState(), and odcore::base::module::AbstractModule::getModuleState().

Referenced by odcontext::base::RuntimeControl::run().

const string odcore::base::module::AbstractCIDModule::getMultiCastGroup ( ) const
inherited

This method returns the module's multicast group as specified in the command line

const string odcore::base::module::ClientModule::getName ( ) const
inherited

This method returns the module's name.

Returns
name of the module.

Referenced by odcontext::base::TimeTriggeredConferenceClientModuleRunner::step().

uint32_t odcore::base::module::AbstractCIDModule::getRealtimePriority ( ) const
inherited

This method returns the priority, if –realtime is enabled.

Returns
Scheduling priority.
const odcore::data::dmcp::ServerInformation odcore::base::module::ClientModule::getServerInformation ( ) const
protectedinherited

This method returns the ServerInformation object describing the supercomponent.

Returns
ServerInformation
const TimeStamp odcore::base::module::ManagedClientModule::getStartOfCurrentCycle ( ) const
inherited
Returns
Start time of the current execution cycle.
const TimeStamp odcore::base::module::ManagedClientModule::getStartOfLastCycle ( ) const
inherited
Returns
End time of the last execution cycle.
int32_t odcore::base::module::AbstractCIDModule::getVerbosity ( )
staticinherited

This method returns the level of verbosity.

Returns
Level of verbosity.
void odcore::base::module::ClientModule::handleConnectionLost ( )
protectedvirtualinherited
bool odcore::base::module::AbstractCIDModule::isProfiling ( ) const
inlineinherited

This method returns true, if –profiling is enabled.

Returns
true if profiling is enabled.
bool odcore::base::module::AbstractCIDModule::isRealtime ( ) const
inlineinherited

This method returns true, if –realtime is enabled.

Returns
true if realtime is enabled.
bool odcore::base::module::AbstractCIDModule::isVerbose ( )
staticinherited

This method returns true, if –verbose is enabled.

Returns
true if verbose.
void odcore::base::module::TimeTriggeredConferenceClientModule::nextContainer ( odcore::data::Container c)
protectedvirtual

This method is called whenever a new container occurs.

Parameters
cContainer that has been occured.

Implements odcore::base::module::ManagedClientModule.

References odcore::base::AbstractDataStore::add(), and odcore::data::Container::getDataType().

void odcore::base::module::ManagedClientModule::reached ( )
protectedvirtualinherited

This method is called, whenever this breakpoint is reached.

Implements odcore::base::module::Breakpoint.

References OPENDAVINCI_CORE_THROW_EXCEPTION.

odcore::data::dmcp::ModuleExitCodeMessage::ModuleExitCode odcore::base::module::ClientModule::runModule ( )
virtualinherited

This method executes the application body.

Implements odcore::base::module::InterruptibleModule.

References CLOG1.

Referenced by odcontext::base::TimeTriggeredConferenceClientModuleRunner::run().

odcore::data::dmcp::ModuleExitCodeMessage::ModuleExitCode odcore::base::module::ManagedClientModule::runModuleImplementation ( )
protectedvirtualinherited

This method calls the implementation logic setUp - body - tearDown.

Returns
return status.

Implements odcore::base::module::ClientModule.

References OPENDAVINCI_CORE_THROW_EXCEPTION.

void odcore::base::module::InterruptibleModule::setBreakpoint ( Breakpoint bp)
inherited
void odcore::base::module::ManagedClientModule::setContainerConference ( std::shared_ptr< odcore::io::conference::ContainerConference c)
protectedinherited

This method sets the ContainerConference to be used. In the case that we are not executed as managed level == ML_SIMULATION or ML_SIMULATION_RT, the deriving class ConferenceClientModule sets the UDP-based ContainerConference here.

In the case the we are executed as managed level = ML_SIMULATION or ML_SIMULATION_RT, the UDP-based container conference will be replaced by a pure software implementation one.

Parameters
cPointer to the ContainerConference to be used.
void odcore::base::module::AbstractModule::setModuleState ( const odcore::data::dmcp::ModuleStateMessage::ModuleState &  s)
inherited

This method sets the module MODULE_STATE.

Parameters
sMODULE_STATE of the module.

Referenced by odcontext::base::TimeTriggeredConferenceClientModuleRunner::beforeStop(), odcontext::base::RuntimeControl::run(), and odcore::base::module::signalHandler().

virtual void odcore::base::module::TimeTriggeredConferenceClientModule::setUp ( )
protectedpure virtual

This method is called right before the body is executed.

Implements odcore::base::module::AbstractConferenceClientModule.

virtual void odcore::base::module::TimeTriggeredConferenceClientModule::tearDown ( )
protectedpure virtual

This method is called after returning from body.

Implements odcore::base::module::AbstractConferenceClientModule.

void odcore::base::module::AbstractConferenceClientModule::toLogger ( const odcore::data::LogMessage::LogLevel &  logLevel,
const string &  msg 
)
inherited

This method propagates the message msg to the central logger.

Parameters
logLevelLevel for the message.
msgMessage to be logged.
void odcore::base::module::AbstractCIDModule::waitForNextFullSecond ( const uint32_t &  secondsIncrement)
virtualinherited

This method suspends the execution of this thread to the next full second.

Parameters
secondsIncrementFrom the current point in time, for how many full seconds shall we wait?

Implements odcore::base::module::AbstractModule.

References odcore::base::Thread::usleepUntil().