Event-based model, to be activated on specified ticks by the scheduler. More...
#include <OSDLModel.h>
Public Member Functions | |
ProgrammedModel (const Engine::SimulationTickList &activationTicks, bool absolutelyDefined=true, bool autoRegister=true, Engine::ObjectSchedulingPolicy policy=Engine::relaxed, Engine::Weight weight=1) | |
Constructor of an OSDL MVC model which is to be scheduled on programmed ticks. | |
ProgrammedModel (Events::SimulationTick activationTick, bool absolutelyDefined=true, bool autoRegister=true, Engine::ObjectSchedulingPolicy policy=Engine::relaxed, Engine::Weight weight=1) | |
Constructor of an OSDL MVC model which is to be scheduled on a specific programmed tick. | |
virtual | ~ProgrammedModel () throw () |
Virtual destructor. | |
virtual const std::string | toString (Ceylan::VerbosityLevels level=Ceylan::high) const |
Returns an user-friendly description of the state of this object. | |
virtual void | registerToScheduler () |
Registers this active object to the supposedly already existing scheduler. | |
virtual void | unregisterFromScheduler () |
Unregisters this active object from the existing scheduler to whom it was supposedly registered. | |
bool | areProgrammedActivationsAbsolute () const |
Tells whether programmed activations are defined absolutely (from the origin of simulation times, i.e. | |
void | absoluteProgrammedActivationsWanted (bool on) |
Defines whether the programmed activations for this object are to be defined absolutely (from the origin of simulation times, i.e. | |
virtual const SimulationTickList & | getProgrammedActivations () const |
Returns a reference to the internal list of programmed activations of this object. | |
virtual void | setProgrammedActivations (const SimulationTickList &newActivationsList) |
Sets the list of programmed activations for this object to specified value. | |
virtual void | addProgrammedActivations (const SimulationTickList &additionalActivationsList) |
Adds the specified list of simulation ticks to the list of activation ticks for this object. | |
virtual void | onRegistering () |
Automatically called by the scheduler at registration time. | |
virtual ObjectSchedulingPolicy | getPolicy () const |
Returns the scheduling policy for this active object. | |
virtual Weight | getWeight () const |
Returns the average processing need for each activation of this object. | |
virtual Events::SimulationTick | getBirthTick () const |
Returns the birth time, expressed in simulation ticks, of this active object. | |
virtual void | setBirthTick (Events::SimulationTick currentSimulationTick) |
Sets the birth time, expressed in simulation ticks, of this active object. | |
virtual void | onActivation (Events::SimulationTick newTick)=0 |
Pure virtual method, which is called when this active object gets activated on behalf of the scheduler. | |
virtual void | onSkip (Events::SimulationTick skippedTick) |
Called whenever the scheduler had to skip a period of activation for this object. | |
virtual void | onImpossibleActivation (Events::SimulationTick missedTick) |
Called whenever the scheduler was unable to activate this object. | |
Protected Member Functions | |
Events::SimulationTick | getLocalTime () const |
Returns this object local time, as if the origin of time was this object creation. | |
Protected Attributes | |
SimulationTickList | _programmedTicks |
Records the list of programmed simulation ticks that will be used by the scheduler to activate this object. | |
bool | _absoluteTicks |
Tells whether the programmed trigger ticks should be understood as absolute (i.e. | |
ObjectSchedulingPolicy | _policy |
Determines the scheduling policy of this object. | |
Weight | _weight |
Describe the average processing need for each activation of this object. | |
bool | _registered |
Tells whether this active object has already been registered to a scheduler. | |
Events::SimulationTick | _birthTick |
The date of birth of this object, expressed in simulation time. |
Event-based model, to be activated on specified ticks by the scheduler.
Definition at line 152 of file OSDLModel.h.
OSDL::MVC::ProgrammedModel::ProgrammedModel | ( | const Engine::SimulationTickList & | activationTicks, | |
bool | absolutelyDefined = true , |
|||
bool | autoRegister = true , |
|||
Engine::ObjectSchedulingPolicy | policy = Engine::relaxed , |
|||
Engine::Weight | weight = 1 | |||
) | [explicit] |
Constructor of an OSDL MVC model which is to be scheduled on programmed ticks.
activationTicks | is the list of simulation ticks when this model should be activated. This model does not take ownership of this list, it will make a copy of it. | |
autoRegister | tells whether this new Model is to automatically register itself to the scheduler. It requires the scheduler to exist already. | |
policy | allows to choose a scheduling policy, according to the quality of service this model requires. | |
weight | evaluates how much processing power an activation of this model is to cost on average. This helps the scheduler doing its job balance. |
Engine::SchedulingException | if the construction failed. |
OSDL::MVC::ProgrammedModel::ProgrammedModel | ( | Events::SimulationTick | activationTick, | |
bool | absolutelyDefined = true , |
|||
bool | autoRegister = true , |
|||
Engine::ObjectSchedulingPolicy | policy = Engine::relaxed , |
|||
Engine::Weight | weight = 1 | |||
) | [explicit] |
Constructor of an OSDL MVC model which is to be scheduled on a specific programmed tick.
activationTick | is the simulation tick when this model should be activated. | |
autoRegister | tells whether this new Model is to automatically register itself to the scheduler. It requires the scheduler to exist already. | |
policy | allows to choose a scheduling policy, according to the quality of service this model requires. | |
weight | evaluates how much processing power an activation of this model is to cost on average. This helps the scheduler doing its job balance. |
Engine::SchedulingException | if the construction failed. |
ProgrammedModel::~ProgrammedModel | ( | ) | throw () [virtual] |
Virtual destructor.
Definition at line 122 of file OSDLModel.cc.
void ProgrammedActiveObject::absoluteProgrammedActivationsWanted | ( | bool | on | ) | [inherited] |
Defines whether the programmed activations for this object are to be defined absolutely (from the origin of simulation times, i.e.
the scheduler start) or relatively to the simulation tick of the object registering to the scheduler.
SchedulingException | if the operation failed. |
Definition at line 181 of file OSDLProgrammedActiveObject.cc.
References OSDL::Engine::ProgrammedActiveObject::_absoluteTicks, and OSDL::Engine::ActiveObject::_registered.
void ProgrammedActiveObject::addProgrammedActivations | ( | const SimulationTickList & | additionalActivationsList | ) | [virtual, inherited] |
Adds the specified list of simulation ticks to the list of activation ticks for this object.
additionalActivationsList | the list of additional simulation ticks on which this object will be activated too. |
SchedulingException | if the operation failed. |
Definition at line 220 of file OSDLProgrammedActiveObject.cc.
References OSDL::Engine::ProgrammedActiveObject::_programmedTicks, and OSDL::Engine::ActiveObject::_registered.
bool ProgrammedActiveObject::areProgrammedActivationsAbsolute | ( | ) | const [inherited] |
Tells whether programmed activations are defined absolutely (from the origin of simulation times, i.e.
the scheduler start) or relatively to the simulation tick of the object registering to the scheduler.
Definition at line 172 of file OSDLProgrammedActiveObject.cc.
References OSDL::Engine::ProgrammedActiveObject::_absoluteTicks.
Referenced by OSDL::Engine::Scheduler::registerProgrammedObject(), and OSDL::Engine::Scheduler::unregisterProgrammedObject().
SimulationTick ActiveObject::getBirthTick | ( | ) | const [virtual, inherited] |
Returns the birth time, expressed in simulation ticks, of this active object.
Definition at line 107 of file OSDLActiveObject.cc.
References OSDL::Engine::ActiveObject::_birthTick.
Referenced by OSDL::Engine::Scheduler::unregisterProgrammedObject().
Events::SimulationTick OSDL::Engine::ActiveObject::getLocalTime | ( | ) | const [protected, inherited] |
Returns this object local time, as if the origin of time was this object creation.
ObjectSchedulingPolicy ActiveObject::getPolicy | ( | ) | const [virtual, inherited] |
Returns the scheduling policy for this active object.
Definition at line 80 of file OSDLActiveObject.cc.
References OSDL::Engine::ActiveObject::_policy.
Referenced by OSDL::Engine::PeriodicSlot::add().
const SimulationTickList & ProgrammedActiveObject::getProgrammedActivations | ( | ) | const [virtual, inherited] |
Returns a reference to the internal list of programmed activations of this object.
These are the activations as they were specified: if they were relative ticks, they are still offsets, not absolute times.
Definition at line 195 of file OSDLProgrammedActiveObject.cc.
References OSDL::Engine::ProgrammedActiveObject::_programmedTicks.
Referenced by OSDL::Engine::Scheduler::registerProgrammedObject(), and OSDL::Engine::Scheduler::unregisterProgrammedObject().
Weight ActiveObject::getWeight | ( | ) | const [virtual, inherited] |
Returns the average processing need for each activation of this object.
Definition at line 89 of file OSDLActiveObject.cc.
References OSDL::Engine::ActiveObject::_weight.
virtual void OSDL::Engine::ActiveObject::onActivation | ( | Events::SimulationTick | newTick | ) | [pure virtual, inherited] |
Pure virtual method, which is called when this active object gets activated on behalf of the scheduler.
virtual void OSDL::Engine::ActiveObject::onImpossibleActivation | ( | Events::SimulationTick | missedTick | ) | [virtual, inherited] |
Called whenever the scheduler was unable to activate this object.
This can happen for example when an absolute simulation tick is specified whereas the current time is already in its future.
Default behaviour for this method is: throw a SchedulingException.
missedTick | tells which tick is out of range. |
SchedulingException | if this active object should not stand activation failures. |
void ProgrammedActiveObject::onRegistering | ( | ) | [virtual, inherited] |
Automatically called by the scheduler at registration time.
SchedulingException | if the operation failed. |
Definition at line 245 of file OSDLProgrammedActiveObject.cc.
References OSDL::Engine::ActiveObject::_registered.
Referenced by OSDL::Engine::Scheduler::registerProgrammedObject().
virtual void OSDL::Engine::ActiveObject::onSkip | ( | Events::SimulationTick | skippedTick | ) | [virtual, inherited] |
Called whenever the scheduler had to skip a period of activation for this object.
Default behaviour for this method is: do nothing except complain in the warning channel.
skippedTick | tells which tick was skipped. |
SchedulingException | if this active object cannot stand skipped stimulation ticks. |
void ProgrammedActiveObject::registerToScheduler | ( | ) | [virtual, inherited] |
Registers this active object to the supposedly already existing scheduler.
SchedulingException | if the operation failed. |
Implements OSDL::Engine::ActiveObject.
Definition at line 121 of file OSDLProgrammedActiveObject.cc.
References OSDL::Engine::ActiveObject::_registered, OSDL::Engine::Scheduler::GetExistingScheduler(), and OSDL::Engine::Scheduler::registerProgrammedObject().
Referenced by OSDL::Engine::ProgrammedActiveObject::ProgrammedActiveObject().
virtual void OSDL::Engine::ActiveObject::setBirthTick | ( | Events::SimulationTick | currentSimulationTick | ) | [virtual, inherited] |
Sets the birth time, expressed in simulation ticks, of this active object.
SchedulingException | if the operation failed. |
Reimplemented in OSDL::Engine::PeriodicalActiveObject.
Referenced by OSDL::Engine::Scheduler::registerProgrammedObject().
void ProgrammedActiveObject::setProgrammedActivations | ( | const SimulationTickList & | newActivationsList | ) | [virtual, inherited] |
Sets the list of programmed activations for this object to specified value.
newActivationsList | the list of simulation ticks which will be copied internally. |
SchedulingException | if the operation failed. |
Definition at line 205 of file OSDLProgrammedActiveObject.cc.
References OSDL::Engine::ProgrammedActiveObject::_programmedTicks, and OSDL::Engine::ActiveObject::_registered.
const string ProgrammedModel::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const [virtual] |
Returns an user-friendly description of the state of this object.
level | the requested verbosity level. |
Reimplemented from OSDL::Engine::ProgrammedActiveObject.
Definition at line 129 of file OSDLModel.cc.
void ProgrammedActiveObject::unregisterFromScheduler | ( | ) | [virtual, inherited] |
Unregisters this active object from the existing scheduler to whom it was supposedly registered.
SchedulingException | if the operation failed. |
Implements OSDL::Engine::ActiveObject.
Definition at line 146 of file OSDLProgrammedActiveObject.cc.
References OSDL::Engine::ActiveObject::_registered, OSDL::Engine::Scheduler::GetExistingScheduler(), and OSDL::Engine::Scheduler::unregisterProgrammedObject().
Referenced by OSDL::Engine::ProgrammedActiveObject::~ProgrammedActiveObject().
bool OSDL::Engine::ProgrammedActiveObject::_absoluteTicks [protected, inherited] |
Tells whether the programmed trigger ticks should be understood as absolute (i.e.
if their simulation ticks should be taken litteraly), or as relative (defined as an offset from this object birth time).
Is true by default.
Definition at line 347 of file OSDLProgrammedActiveObject.h.
Referenced by OSDL::Engine::ProgrammedActiveObject::absoluteProgrammedActivationsWanted(), OSDL::Engine::ProgrammedActiveObject::areProgrammedActivationsAbsolute(), and OSDL::Engine::ProgrammedActiveObject::toString().
Events::SimulationTick OSDL::Engine::ActiveObject::_birthTick [protected, inherited] |
The date of birth of this object, expressed in simulation time.
Definition at line 373 of file OSDLActiveObject.h.
Referenced by OSDL::Engine::ActiveObject::getBirthTick(), OSDL::Engine::PeriodicalActiveObject::setBirthTick(), and OSDL::Engine::ActiveObject::toString().
ObjectSchedulingPolicy OSDL::Engine::ActiveObject::_policy [protected, inherited] |
Determines the scheduling policy of this object.
Definition at line 338 of file OSDLActiveObject.h.
Referenced by OSDL::Engine::ActiveObject::getPolicy(), and OSDL::Engine::ActiveObject::toString().
SimulationTickList OSDL::Engine::ProgrammedActiveObject::_programmedTicks [protected, inherited] |
Records the list of programmed simulation ticks that will be used by the scheduler to activate this object.
Definition at line 332 of file OSDLProgrammedActiveObject.h.
Referenced by OSDL::Engine::ProgrammedActiveObject::addProgrammedActivations(), OSDL::Engine::ProgrammedActiveObject::getProgrammedActivations(), OSDL::Engine::ProgrammedActiveObject::ProgrammedActiveObject(), OSDL::Engine::ProgrammedActiveObject::setProgrammedActivations(), and OSDL::Engine::ProgrammedActiveObject::toString().
bool OSDL::Engine::ActiveObject::_registered [protected, inherited] |
Tells whether this active object has already been registered to a scheduler.
Definition at line 358 of file OSDLActiveObject.h.
Referenced by OSDL::Engine::ProgrammedActiveObject::absoluteProgrammedActivationsWanted(), OSDL::Engine::ProgrammedActiveObject::addProgrammedActivations(), OSDL::Engine::ProgrammedActiveObject::onRegistering(), OSDL::Engine::PeriodicalActiveObject::onRegistering(), OSDL::Engine::ProgrammedActiveObject::registerToScheduler(), OSDL::Engine::PeriodicalActiveObject::registerToScheduler(), OSDL::Engine::ProgrammedActiveObject::setProgrammedActivations(), OSDL::Engine::ActiveObject::toString(), OSDL::Engine::ProgrammedActiveObject::unregisterFromScheduler(), OSDL::Engine::PeriodicalActiveObject::unregisterFromScheduler(), OSDL::Engine::ActiveObject::~ActiveObject(), OSDL::Engine::PeriodicalActiveObject::~PeriodicalActiveObject(), and OSDL::Engine::ProgrammedActiveObject::~ProgrammedActiveObject().
Weight OSDL::Engine::ActiveObject::_weight [protected, inherited] |
Describe the average processing need for each activation of this object.
The greater the weight is, the heavier processing should be.
Definition at line 349 of file OSDLActiveObject.h.
Referenced by OSDL::Engine::ActiveObject::getWeight(), and OSDL::Engine::ActiveObject::toString().