00001 #ifndef OSDL_ACTIVE_OBJECT_H_
00002 #define OSDL_ACTIVE_OBJECT_H_
00003
00004
00005
00006 #include "OSDLPeriodicSlot.h"
00007 #include "OSDLEngineCommon.h"
00008 #include "OSDLEvents.h"
00009
00010 #include "Ceylan.h"
00011
00012 #include <string>
00013 #include <list>
00014
00015
00016
00017 namespace OSDL
00018 {
00019
00020
00021 namespace Engine
00022 {
00023
00024
00080 class OSDL_DLL ActiveObject : public Ceylan::TextDisplayable
00081 {
00082
00083
00084 public:
00085
00086
00088 typedef std::list<Events::SimulationTick> SimulationTickList ;
00089
00090
00111 explicit ActiveObject( Events::Period period = 1,
00112 ObjectSchedulingPolicy policy = relaxed,
00113 Weight weight = 1 ) throw() ;
00114
00115
00141 explicit ActiveObject(
00142 const SimulationTickList & triggeringStates,
00143 bool absolutlyDefined = true,
00144 ObjectSchedulingPolicy policy = relaxed,
00145 Weight weight = 1 ) throw() ;
00146
00147
00174 explicit ActiveObject( Events::SimulationTick triggerTick,
00175 bool absolutlyDefined,
00176 ObjectSchedulingPolicy policy = relaxed,
00177 Weight weight = 1 ) throw() ;
00178
00179
00185 virtual ~ActiveObject() throw() ;
00186
00187
00192 virtual ObjectSchedulingPolicy getPolicy() const throw() ;
00193
00194
00203 virtual Weight getWeight() const throw() ;
00204
00205
00213 virtual Events::Period getPeriod() const throw() ;
00214
00215
00229 virtual void setPeriod( Events::Period newPeriod ) throw() ;
00230
00231
00257 virtual Events::Hertz setFrequency(
00258 Events::Hertz newFrequency ) throw( SchedulingException ) ;
00259
00260
00265 virtual bool hasProgrammedActivations() const throw() ;
00266
00267
00275 bool areProgrammedActivationsAbsolute() const throw() ;
00276
00277
00286 void absoluteProgrammedActivationsWanted( bool on ) throw() ;
00287
00288
00300 virtual const SimulationTickList & getProgrammedActivations()
00301 const throw( SchedulingException ) ;
00302
00303
00316 virtual void setProgrammedActivations(
00317 const SimulationTickList & newActivationsList ) throw() ;
00318
00319
00333 virtual void addProgrammedActivations(
00334 const SimulationTickList & additionalActivationsList )
00335 throw() ;
00336
00337
00349 virtual void setUniqueProgrammedTicks() throw() ;
00350
00351
00357 virtual Events::SimulationTick getBirthTime() const throw() ;
00358
00359
00368 virtual void setBirthTime(
00369 Events::SimulationTick birthSimulationTick ) throw() ;
00370
00371
00387 virtual void onActivation(
00388 Events::SimulationTick newTick ) throw() = 0 ;
00389
00390
00409 virtual void onSkip( Events::SimulationTick skippedStep )
00410 throw( SchedulingException ) ;
00411
00412
00429 virtual void onImpossibleActivation(
00430 Events::SimulationTick missedStep )
00431 throw( SchedulingException ) ;
00432
00433
00446 virtual const std::string toString(
00447 Ceylan::VerbosityLevels level = Ceylan::high )
00448 const throw() ;
00449
00450
00451
00452 protected:
00453
00454
00460 Events::SimulationTick getLocalTime() const throw() ;
00461
00462
00463
00468 ObjectSchedulingPolicy _policy ;
00469
00470
00478 Weight _weight ;
00479
00480
00488 Events::Period _period ;
00489
00490
00498 SimulationTickList * _programmedTriggerTicks ;
00499
00500
00510 bool _absoluteTriggers ;
00511
00512
00524 Events::SimulationTick _birthTime ;
00525
00526
00527 } ;
00528
00529 }
00530
00531 }
00532
00533
00534 #endif // OSDL_ACTIVE_OBJECT_H_