OpenDaVINCI  4.15.3
odcontext::base::StandaloneRuntimeControl Class Referenceabstract

#include <StandaloneRuntimeControl.h>

Inheritance diagram for odcontext::base::StandaloneRuntimeControl:
Inheritance graph

Public Types

enum  VEHICLECONTEXTMODULES { SIMPLIFIEDBICYCLEMODEL }
 
enum  RUNTIMECONTROL { UNSPECIFIED, DONT_TAKE_CONTROL, TAKE_CONTROL }
 
enum  ERRORCODES {
  NO_ERROR_OCCURRED, APPLICATIONS_FINISHED, RUNTIME_TIMEOUT, RUNTIMECONTROL_FORCED_TO_QUIT,
  SETUP_NOT_CALLED, EXCEPTION_CAUGHT, STRING_EXCEPTION_CAUGHT, UNKNOWN_EXCEPTION_CAUGHT
}
 

Public Member Functions

 StandaloneRuntimeControl (const RuntimeControlInterface &sci)
 
virtual ~StandaloneRuntimeControl ()
 
virtual void sendToSystemsUnderTest (odcore::data::Container &c)
 
void setup (const enum RUNTIMECONTROL &takeControl)
 
enum ERRORCODES run ()
 
enum ERRORCODES run (RuntimeEnvironment &rte, const uint32_t &maxRunningTimeInSeconds)
 
void tearDown ()
 
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 vector< AbstractModule * > & getListOfModules ()
 

Protected Member Functions

virtual void configureRuntimeEnvironment ()=0
 
void add (SystemFeedbackComponent *sfc)
 
virtual void destroySystemFeedbackComponents ()
 
void setupSystemContextComponents (RuntimeEnvironment &rte)
 
void tearDownSystemContextComponents (RuntimeEnvironment &rte)
 
virtual void wait ()
 
virtual void calledGetModuleState ()
 

Detailed Description

This class is the abstract base class for all standalone simulation.

Member Enumeration Documentation

Enumerator
NO_ERROR_OCCURRED 
APPLICATIONS_FINISHED 
RUNTIME_TIMEOUT 
RUNTIMECONTROL_FORCED_TO_QUIT 
SETUP_NOT_CALLED 
EXCEPTION_CAUGHT 
STRING_EXCEPTION_CAUGHT 
UNKNOWN_EXCEPTION_CAUGHT 
Enumerator
UNSPECIFIED 
DONT_TAKE_CONTROL 
TAKE_CONTROL 

Constructor & Destructor Documentation

odcontext::base::StandaloneRuntimeControl::~StandaloneRuntimeControl ( )
virtual

Member Function Documentation

void odcontext::base::StandaloneRuntimeControl::add ( SystemFeedbackComponent sfc)
protected

This method is used to add a SystemFeedbackComponent to react on incoming Containers.

Parameters
sfcSystemFeedbackComponent to be added to the RuntimeEnvironment.

References odcontext::base::RuntimeEnvironment::add().

void odcore::base::module::AbstractModule::calledGetModuleState ( )
protectedvirtualinherited

This method can be used indicate to subclasses that getModuleStateAndWaitForRemainingTimeInTimeslice() was called. This is used by InterruptibleModule with private inheritance to not permit overriding getModuleStateAndWaitForRemainingTimeInTimeslice() in subclasses from InterruptibleModule.

References odcore::base::module::AbstractModule::wait().

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

virtual void odcontext::base::StandaloneRuntimeControl::configureRuntimeEnvironment ( )
protectedpure virtual

This method is called right before executing the actual system simulation to modify the RuntimeEnvironment to be used.

void odcontext::base::StandaloneRuntimeControl::destroySystemFeedbackComponents ( )
protectedvirtual

This method destroys all added SystemFeedbackComponents. If they are managed outside this class, simply override this method with no method body.

References OPENDAVINCI_CORE_DELETE_POINTER.

Referenced by ~StandaloneRuntimeControl().

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().

enum RuntimeControl::ERRORCODES odcontext::base::RuntimeControl::run ( )
inherited

This method actually runs the system's context.

Returns
Any errorcode.

References odcontext::base::RuntimeControl::runStandalone().

enum RuntimeControl::ERRORCODES odcontext::base::RuntimeControl::run ( RuntimeEnvironment rte,
const uint32_t &  maxRunningTimeInSeconds 
)
inherited

This method actually runs the system's context for the given application. Therefore, the system's context takes control over the ContainerConference, Time, and the ControlFlow of the application.

Parameters
rteRuntimeEnvironment.
maxRunningTimeInSecondsMaximum running time in seconds to avoid infinite runs. Hereby, seconds are in simulation time.
Returns
Any errorcode.

References odcontext::base::RuntimeControl::APPLICATIONS_FINISHED, odcontext::base::RuntimeEnvironment::beginExecution(), odcontext::base::RuntimeControl::EXCEPTION_CAUGHT, odcontext::base::RuntimeEnvironment::getGreatestTimeStep(), odcontext::base::RuntimeEnvironment::getListOfSystemFeedbackComponents(), odcore::base::module::AbstractModule::getModuleStateAndWaitForRemainingTimeInTimeslice(), odcontext::base::RuntimeEnvironment::isValid(), odcontext::base::Runner::needsExecution(), odcontext::base::RuntimeControl::NO_ERROR_OCCURRED, odcontext::base::RuntimeControl::RUNTIME_TIMEOUT, odcontext::base::RuntimeControl::RUNTIMECONTROL_FORCED_TO_QUIT, odcore::base::module::AbstractModule::setModuleState(), odcontext::base::ControlledTimeFactory::setTime(), odcontext::base::RuntimeControl::SETUP_NOT_CALLED, odcontext::base::SystemFeedbackComponent::step(), odcontext::base::RuntimeControl::STRING_EXCEPTION_CAUGHT, odcontext::base::RuntimeControl::TAKE_CONTROL, odcontext::base::RuntimeControl::tearDownSystemContextComponents(), odcore::exceptions::Exceptions::toString(), odcontext::base::RuntimeControl::UNKNOWN_EXCEPTION_CAUGHT, and odcontext::base::RuntimeControl::UNSPECIFIED.

void odcontext::base::StandaloneRuntimeControl::sendToSystemsUnderTest ( odcore::data::Container c)
virtual

This method sends a Container to all created ControlledContainerConferences and thus to all running systems under test.

Parameters
cContainer to send.

Implements odcontext::base::SendContainerToSystemsUnderTest.

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().

void odcontext::base::RuntimeControl::setup ( const enum RUNTIMECONTROL takeControl)
inherited
void odcontext::base::RuntimeControl::setupSystemContextComponents ( RuntimeEnvironment rte)
protectedinherited

This method calls the setup-method of all SystemContextComponents registered at the given RuntimeEnvironment.

Parameters
rteRuntimeEnvironment.

References odcontext::base::RuntimeEnvironment::getListOfSystemFeedbackComponents(), and odcontext::base::SystemContextComponent::setup().

void odcontext::base::RuntimeControl::tearDown ( )
inherited

This method must be called to tear down the system's context.

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

void odcore::base::module::AbstractModule::wait ( )
protectedvirtualinherited

This method is called to enforce a specific frequency.

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

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