OSDL::MVC::Model Class Reference

#include <OSDLModel.h>

Inheritance diagram for OSDL::MVC::Model:

[legend]
Collaboration diagram for OSDL::MVC::Model:
[legend]
List of all members.

Detailed Description

These specialized MVC models comply with the scheduler framework, since they are active objects.

It allows the models to be scheduled, periodically and/or programmatically, during simulation ticks.

See also:
OSDL::Engine::Scheduler

Definition at line 35 of file OSDLModel.h.

Public Types

typedef std::list< Events::SimulationTickSimulationTickList
 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 SimulationTickListgetProgrammedActivations () 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.


Member Typedef Documentation

typedef std::list<Events::SimulationTick> OSDL::Engine::ActiveObject::SimulationTickList [inherited]

Types for lists of simulation ticks.

Definition at line 88 of file OSDLActiveObject.h.


Constructor & Destructor Documentation

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.

Parameters:
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.
Note:
Do not mix up this constructor with the one for programmed models, since their arguments are almost the same.

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.

Parameters:
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.
Note:
Do not mix up this constructor with the one for periodic models, since their arguments are almost the same.

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.

Parameters:
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.
Note:
Do not mix up this constructor with the one for programmed models, since their arguments are almost the same.

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.


Member Function Documentation

const string Model::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const throw () [virtual]

Returns an user-friendly description of the state of this object.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
Ceylan::TextDisplayable

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.

Note:
The greater the weight is, the heavier processing should be.

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.

Note:
A null (0) value denotes a pure programmed 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.

Parameters:
newPeriod the new period of activation for this object, expressed in simulation ticks.
Note:
An object will be considered as a periodically-activated one iff its period is non-zero. Zero means not activated on a regular basis thanks to periodic slots.

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.

Parameters:
newFrequency the desired frequency, expressed in Hertz.
Returns:
The actual chosen frequency, which may differ a bit from specified one since it depends on the simulation tick granularity. Notably, the obtained frequency cannot exceed the specified simulation frequency for the scheduler. The actual frequency is nevertheless chosen as the nearest possible frequency.
Note:
To be able to compute the actual period, expressed in simulation ticks, from the specified frequency, the scheduler that will be later used for this object is needed.
Exceptions:
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.

Exceptions:
SchedulingException if the object had no programmed activations.
See also:
hasProgrammedActivations to check for programmed activations before.

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.

Parameters:
newActivationsList the list of simulation ticks which will be copied internally.
Note:
Any previously defined activations are lost.
See also:
addProgrammedActivations

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.

Parameters:
additionalActivationsList the list of additional simulation ticks which will activate the object too.
Note:
The method will not ensure that each tick is present at most one time in the object activation list : one object can by programmed multiple times in a single simulation tick.

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.

Note:
One can wish an object is scheduled multiple times for a given simulation tick, so having unique elements in programmed lists is an option.

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.

Note:
Called by the schedule, when registering 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.

Note:
This is where the objects are to live actually : their time slice is spent here.

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

See also:
onSkip

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.

Parameters:
skippedStep tells which step was skipped.
Exceptions:
SchedulingException if this active object cannot stand skipped stimulation steps.
Note:
Some objects may call the onActivation method for the skipped tick, to emulate the behaviour they could have if they had been scheduled at the right time.

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.

Parameters:
missedStep tells which step is out of range.
Exceptions:
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.


Member Data Documentation

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.

Note:
A null (0) value denotes a programmed active 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.

Note:
No particular order is to be enforced.

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.

Note:
the date of birth is neither the creation time of this active object (since it could be created even before the scheduler exists), nor the time where this object is scheduled for the first time, but the time it was registered to the scheduler.

Definition at line 524 of file OSDLActiveObject.h.

Referenced by OSDL::Engine::ActiveObject::getBirthTime().


The documentation for this class was generated from the following files:
Generated on Fri Mar 30 14:47:29 2007 for OSDL by  doxygen 1.5.1