00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef OSDL_PERIODICAL_ACTIVE_OBJECT_H_
00028 #define OSDL_PERIODICAL_ACTIVE_OBJECT_H_
00029
00030
00031
00032 #include "OSDLActiveObject.h"
00033 #include "OSDLPeriodicSlot.h"
00034 #include "OSDLEngineCommon.h"
00035
00036
00037 #include <string>
00038
00039
00040
00041
00042 namespace OSDL
00043 {
00044
00045
00046
00047 namespace Engine
00048 {
00049
00050
00051
00052
00090 class OSDL_DLL PeriodicalActiveObject : public ActiveObject
00091 {
00092
00093
00094 public:
00095
00096
00097
00124 explicit PeriodicalActiveObject(
00125 Ceylan::System::Millisecond periodDuration,
00126 bool autoRegister = true,
00127 Ceylan::Maths::Percentage maxErrorPercentage = 5 ) ;
00128
00129
00130
00155 PeriodicalActiveObject(
00156 Events::Period period,
00157 bool autoRegister,
00158 ObjectSchedulingPolicy policy,
00159 Weight weight ) ;
00160
00161
00162
00170 virtual ~PeriodicalActiveObject() throw() ;
00171
00172
00173
00174
00175
00176
00177
00178
00186 virtual void registerToScheduler() ;
00187
00188
00189
00197 virtual void unregisterFromScheduler() ;
00198
00199
00200
00201
00202
00203
00204
00205
00210 virtual Events::Period getPeriod() const ;
00211
00212
00213
00225 virtual void setPeriod( Events::Period newPeriod ) ;
00226
00227
00228
00254 virtual Ceylan::Maths::Hertz setFrequency(
00255 Ceylan::Maths::Hertz newFrequency ) ;
00256
00257
00258
00271 virtual Events::Period getSubslotNumber() const ;
00272
00273
00274
00288 virtual void onRegistering( Events::Period subslot ) ;
00289
00290
00291
00303 virtual void setBirthTick(
00304 Events::SimulationTick currentSimulationTick ) ;
00305
00306
00307
00323 virtual Events::SimulationTick
00324 convertDurationToActivationCount(
00325 Ceylan::System::Millisecond duration ) const ;
00326
00327
00328
00341 virtual const std::string toString(
00342 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00343
00344
00345
00346
00347 protected:
00348
00349
00355 Events::Period _period ;
00356
00357
00358
00365 Events::Period _subslot ;
00366
00367
00368 } ;
00369
00370
00371 }
00372
00373 }
00374
00375
00376
00377 #endif // OSDL_PERIODICAL_ACTIVE_OBJECT_H_
00378