#include <OSDLModel.h>
Inheritance diagram for OSDL::MVC::Model:
It allows the models to be scheduled, periodically and/or programmatically, during simulation ticks.
Definition at line 35 of file OSDLModel.h.
Public Types | |
typedef std::list< Events::SimulationTick > | SimulationTickList |
Types for lists of simulation ticks. | |
Public Member Functions | |
Model (bool autoRegister=true, Events::Period period=1, Engine::ObjectSchedulingPolicy policy=Engine::relaxed, Engine::Weight weight=1) throw ( Engine::SchedulingException ) | |
Constructor of an OSDL MVC model which is to be periodically scheduled. | |
Model (bool autoRegister, const SimulationTickList &triggeringStates, bool absolutelyDefined=true, Engine::ObjectSchedulingPolicy policy=Engine::relaxed, Engine::Weight weight=1) throw ( Engine::SchedulingException ) | |
Constructor of an OSDL MVC model activated only on specifically programmed simulation steps. | |
Model (bool autoRegister, Events::SimulationTick triggerTick, bool absolutelyDefined=true, Engine::ObjectSchedulingPolicy policy=Engine::relaxed, Engine::Weight weight=1) throw ( Engine::SchedulingException ) | |
Constructor of an OSDL MVC Model activated only on a specific simulation step. | |
virtual | ~Model () throw () |
Virtual destructor, which performs automatic unsubscribing of this model from the scheduler. | |
virtual const std::string | toString (Ceylan::VerbosityLevels level=Ceylan::high) const throw () |
Returns an user-friendly description of the state of this object. | |
virtual ObjectSchedulingPolicy | getPolicy () const throw () |
Returns the scheduling policy for this active object. | |
virtual Weight | getWeight () const throw () |
Returns the average processing need for each activation of this object. | |
virtual Events::Period | getPeriod () const throw () |
Returns the period for this active object. | |
virtual void | setPeriod (Events::Period newPeriod) throw () |
Sets a period for this object, which will be periodically scheduled accordingly. | |
virtual Events::Hertz | setFrequency (Events::Hertz newFrequency) throw ( SchedulingException ) |
Sets the period of this object so that it gets activated on specified frequency, making this object periodically activated if it was not, or changing its already defined period otherwise. | |
virtual bool | hasProgrammedActivations () const throw () |
Tells whether this object has programmed activations set. | |
bool | areProgrammedActivationsAbsolute () const throw () |
Tells whether programmed activations are defined absolutely (from the origin of simulation times, i.e. | |
void | absoluteProgrammedActivationsWanted (bool on) throw () |
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 throw ( SchedulingException ) |
Returns a reference to the internal list of programmed activations of this object. | |
virtual void | setProgrammedActivations (const SimulationTickList &newActivationsList) throw () |
Sets the list of programmed activations for this object to specified value. | |
virtual void | addProgrammedActivations (const SimulationTickList &additionalActivationsList) throw () |
Adds the specified list of simulation ticks to the list of activation ticks for this object. | |
virtual void | setUniqueProgrammedTicks () throw () |
Ensures that the programmed ticks for this object are unique, which means that, after this method call, this object will not be scheduled multiple times for any given simulation tick. | |
virtual Events::SimulationTick | getBirthTime () const throw () |
Returns the birth time, expressed in simulation ticks, of this active object. | |
virtual void | setBirthTime (Events::SimulationTick birthSimulationTick) throw () |
Sets the birth time, expressed in simulation ticks, of this active object. | |
virtual void | onActivation (Events::SimulationTick newTick)=0 throw () |
Pure virtual method, which is called when this active object gets activated on behalf of the scheduler. | |
virtual void | onSkip (Events::SimulationTick skippedStep) throw ( SchedulingException ) |
Called whenever the scheduler had to skip a period of activation for this object. | |
virtual void | onImpossibleActivation (Events::SimulationTick missedStep) throw ( SchedulingException ) |
Called whenever the scheduler was unable to activate this object. | |
Protected Member Functions | |
Events::SimulationTick | getLocalTime () const throw () |
Returns this object local time, as if the origin of time was this object creation. | |
Protected Attributes | |
ObjectSchedulingPolicy | _policy |
Determines the scheduling policy of this object. | |
Weight | _weight |
Describe the average processing need for each activation of this object. | |
Events::Period | _period |
Tells what is the requested scheduling period for this object. | |
SimulationTickList * | _programmedTriggerTicks |
Records the list of programmed simulation ticks that will be used by the scheduler to activate this object. | |
bool | _absoluteTriggers |
Tells whether the programmed trigger ticks should be understood as absolute (i.e. | |
Events::SimulationTick | _birthTime |
The date of birth of this object, expressed in simulation time. |
typedef std::list<Events::SimulationTick> OSDL::Engine::ActiveObject::SimulationTickList [inherited] |
Model::Model | ( | bool | autoRegister = true , |
|
Events::Period | period = 1 , |
|||
Engine::ObjectSchedulingPolicy | policy = Engine::relaxed , |
|||
Engine::Weight | weight = 1 | |||
) | throw ( Engine::SchedulingException ) [explicit] |
Constructor of an OSDL MVC model which is to be periodically scheduled.
autoRegister | tells whether this new Model is to automatically register itself to the scheduler. It requires the scheduler to exist already. | |
period | tells how many simulation steps are to be waited by the scheduler until the model is activated again. The period must not be null. | |
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. |
Definition at line 22 of file OSDLModel.cc.
OSDL::MVC::Model::Model | ( | bool | autoRegister, | |
const SimulationTickList & | triggeringStates, | |||
bool | absolutelyDefined = true , |
|||
Engine::ObjectSchedulingPolicy | policy = Engine::relaxed , |
|||
Engine::Weight | weight = 1 | |||
) | throw ( Engine::SchedulingException ) [explicit] |
Constructor of an OSDL MVC model activated only on specifically programmed simulation steps.
autoRegister | tells whether this new Model is to automatically register itself to the scheduler. It requires the scheduler to exist already. | |
triggeringStates | is the list of simulation ticks when the activation should occur. The model does not take ownership of this list, it will make its own copy of it. | |
absolutelyDefined | tells if the specified steps are defined absolutely, or relatively to the current simulation step. | |
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. |
Model::Model | ( | bool | autoRegister, | |
Events::SimulationTick | triggerTick, | |||
bool | absolutelyDefined = true , |
|||
Engine::ObjectSchedulingPolicy | policy = Engine::relaxed , |
|||
Engine::Weight | weight = 1 | |||
) | throw ( Engine::SchedulingException ) [explicit] |
Constructor of an OSDL MVC Model activated only on a specific simulation step.
autoRegister | tells whether this new Model is to automatically register itself to the scheduler. It requires the scheduler to exist already. | |
triggerTick | is the simulation step when this model will be activated. | |
absolutelyDefined | tells if the specified step is defined absolutely, or relatively to the current simulation step. No default value can be given for that parameter, since there would be an ambiguity with first constructor on any call with only one argument. | |
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. |
Definition at line 46 of file OSDLModel.cc.
Model::~Model | ( | ) | throw () [virtual] |
Virtual destructor, which performs automatic unsubscribing of this model from the scheduler.
Definition at line 59 of file OSDLModel.cc.
const string Model::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const throw () [virtual] |
Returns an user-friendly description of the state of this object.
level | the requested verbosity level. |
Reimplemented from OSDL::Engine::ActiveObject.
Definition at line 65 of file OSDLModel.cc.
References OSDL::Video::Pixels::toString().
ObjectSchedulingPolicy ActiveObject::getPolicy | ( | ) | const throw () [virtual, inherited] |
Returns the scheduling policy for this active object.
Definition at line 70 of file OSDLActiveObject.cc.
References OSDL::Engine::ActiveObject::_policy.
Weight ActiveObject::getWeight | ( | ) | const throw () [virtual, inherited] |
Returns the average processing need for each activation of this object.
Definition at line 76 of file OSDLActiveObject.cc.
References OSDL::Engine::ActiveObject::_weight.
Period ActiveObject::getPeriod | ( | ) | const throw () [virtual, inherited] |
Returns the period for this active object.
Definition at line 82 of file OSDLActiveObject.cc.
References OSDL::Engine::ActiveObject::_period.
void ActiveObject::setPeriod | ( | Events::Period | newPeriod | ) | throw () [virtual, inherited] |
Sets a period for this object, which will be periodically scheduled accordingly.
newPeriod | the new period of activation for this object, expressed in simulation ticks. |
Definition at line 88 of file OSDLActiveObject.cc.
Hertz ActiveObject::setFrequency | ( | Events::Hertz | newFrequency | ) | throw ( SchedulingException ) [virtual, inherited] |
Sets the period of this object so that it gets activated on specified frequency, making this object periodically activated if it was not, or changing its already defined period otherwise.
newFrequency | the desired frequency, expressed in Hertz. |
SchedulingException | if there was no existing scheduler available. |
Definition at line 94 of file OSDLActiveObject.cc.
References OSDL::Engine::Scheduler::GetExistingScheduler(), OSDL::Engine::Scheduler::getSimulationTickCount(), and OSDL::Engine::Scheduler::getTimeSliceDuration().
bool ActiveObject::hasProgrammedActivations | ( | ) | const throw () [virtual, inherited] |
Tells whether this object has programmed activations set.
Definition at line 134 of file OSDLActiveObject.cc.
References OSDL::Engine::ActiveObject::_programmedTriggerTicks.
bool ActiveObject::areProgrammedActivationsAbsolute | ( | ) | const throw () [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 141 of file OSDLActiveObject.cc.
References OSDL::Engine::ActiveObject::_absoluteTriggers.
void ActiveObject::absoluteProgrammedActivationsWanted | ( | bool | on | ) | throw () [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.
Definition at line 147 of file OSDLActiveObject.cc.
const ActiveObject::SimulationTickList & ActiveObject::getProgrammedActivations | ( | ) | const throw ( SchedulingException ) [virtual, inherited] |
Returns a reference to the internal list of programmed activations of this object.
SchedulingException | if the object had no programmed activations. |
Definition at line 154 of file OSDLActiveObject.cc.
References OSDL::Engine::ActiveObject::_programmedTriggerTicks.
void ActiveObject::setProgrammedActivations | ( | const SimulationTickList & | newActivationsList | ) | throw () [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. |
Definition at line 167 of file OSDLActiveObject.cc.
void ActiveObject::addProgrammedActivations | ( | const SimulationTickList & | additionalActivationsList | ) | throw () [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 which will activate the object too. |
Definition at line 179 of file OSDLActiveObject.cc.
void ActiveObject::setUniqueProgrammedTicks | ( | ) | throw () [virtual, inherited] |
Ensures that the programmed ticks for this object are unique, which means that, after this method call, this object will not be scheduled multiple times for any given simulation tick.
Definition at line 197 of file OSDLActiveObject.cc.
References OSDL::Engine::ActiveObject::_programmedTriggerTicks.
SimulationTick ActiveObject::getBirthTime | ( | ) | const throw () [virtual, inherited] |
Returns the birth time, expressed in simulation ticks, of this active object.
Definition at line 204 of file OSDLActiveObject.cc.
References OSDL::Engine::ActiveObject::_birthTime.
void ActiveObject::setBirthTime | ( | Events::SimulationTick | birthSimulationTick | ) | throw () [virtual, inherited] |
Sets the birth time, expressed in simulation ticks, of this active object.
Definition at line 210 of file OSDLActiveObject.cc.
virtual void OSDL::Engine::ActiveObject::onActivation | ( | Events::SimulationTick | newTick | ) | throw () [pure virtual, inherited] |
Pure virtual method, which is called when this active object gets activated on behalf of the scheduler.
If, for any reason, there is a simulation skip, this method may not be called for some objects. Refer to the onSkip method, which would be called instead (and, sadly, later).
void ActiveObject::onSkip | ( | Events::SimulationTick | skippedStep | ) | throw ( SchedulingException ) [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.
skippedStep | tells which step was skipped. |
SchedulingException | if this active object cannot stand skipped stimulation steps. |
Definition at line 216 of file OSDLActiveObject.cc.
References OSDL::Video::Pixels::toString().
void ActiveObject::onImpossibleActivation | ( | Events::SimulationTick | missedStep | ) | throw ( SchedulingException ) [virtual, inherited] |
Called whenever the scheduler was unable to activate this object.
This can happen for example when an absolute simulation step is specified whereas the current time is already in its future.
Default behaviour for this method is : throw a SchedulingException.
missedStep | tells which step is out of range. |
SchedulingException | if this active object should not stand activation failures. |
Definition at line 228 of file OSDLActiveObject.cc.
References OSDL::Video::Pixels::toString().
Events::SimulationTick OSDL::Engine::ActiveObject::getLocalTime | ( | ) | const throw () [protected, inherited] |
Returns this object local time, as if the origin of time was this object creation.
ObjectSchedulingPolicy OSDL::Engine::ActiveObject::_policy [protected, inherited] |
Determines the scheduling policy of this object.
Definition at line 468 of file OSDLActiveObject.h.
Referenced by OSDL::Engine::ActiveObject::getPolicy().
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 478 of file OSDLActiveObject.h.
Referenced by OSDL::Engine::ActiveObject::getWeight().
Events::Period OSDL::Engine::ActiveObject::_period [protected, inherited] |
Tells what is the requested scheduling period for this object.
Definition at line 488 of file OSDLActiveObject.h.
Referenced by OSDL::Engine::ActiveObject::getPeriod().
SimulationTickList* OSDL::Engine::ActiveObject::_programmedTriggerTicks [protected, inherited] |
Records the list of programmed simulation ticks that will be used by the scheduler to activate this object.
Definition at line 498 of file OSDLActiveObject.h.
Referenced by OSDL::Engine::ActiveObject::getProgrammedActivations(), OSDL::Engine::ActiveObject::hasProgrammedActivations(), OSDL::Engine::ActiveObject::setUniqueProgrammedTicks(), and OSDL::Engine::ActiveObject::~ActiveObject().
bool OSDL::Engine::ActiveObject::_absoluteTriggers [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 the moment the object is registered).
Is true by default.
Definition at line 510 of file OSDLActiveObject.h.
Referenced by OSDL::Engine::ActiveObject::areProgrammedActivationsAbsolute().
Events::SimulationTick OSDL::Engine::ActiveObject::_birthTime [protected, inherited] |
The date of birth of this object, expressed in simulation time.
Definition at line 524 of file OSDLActiveObject.h.
Referenced by OSDL::Engine::ActiveObject::getBirthTime().