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_ACTIVE_OBJECT_H_
00028 #define OSDL_ACTIVE_OBJECT_H_
00029
00030
00031
00032 #include "OSDLEngineCommon.h"
00033
00034 #include "Ceylan.h"
00035
00036 #include <string>
00037
00038
00039
00040
00041 namespace OSDL
00042 {
00043
00044
00045
00046 namespace Engine
00047 {
00048
00049
00050
00051
00115 class OSDL_DLL ActiveObject : public Ceylan::TextDisplayable
00116 {
00117
00118
00119
00120 public:
00121
00122
00123
00136 explicit ActiveObject( ObjectSchedulingPolicy policy = relaxed,
00137 Weight weight = 1 ) ;
00138
00139
00140
00149 virtual ~ActiveObject() throw() ;
00150
00151
00152
00153
00154
00155
00156
00157
00165 virtual void registerToScheduler() = 0 ;
00166
00167
00168
00176 virtual void unregisterFromScheduler() = 0 ;
00177
00178
00179
00180
00181
00182
00183
00184
00185
00190 virtual ObjectSchedulingPolicy getPolicy() const ;
00191
00192
00193
00202 virtual Weight getWeight() const ;
00203
00204
00205
00211 virtual Events::SimulationTick getBirthTick() const ;
00212
00213
00214
00225 virtual void setBirthTick(
00226 Events::SimulationTick currentSimulationTick ) ;
00227
00228
00229
00245 virtual void onActivation(
00246 Events::SimulationTick newTick ) = 0 ;
00247
00248
00249
00268 virtual void onSkip( Events::SimulationTick skippedTick ) ;
00269
00270
00271
00289 virtual void onImpossibleActivation(
00290 Events::SimulationTick missedTick ) ;
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00315 virtual const std::string toString(
00316 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00317
00318
00319
00320
00321 protected:
00322
00323
00324
00330 Events::SimulationTick getLocalTime() const ;
00331
00332
00333
00338 ObjectSchedulingPolicy _policy ;
00339
00340
00341
00349 Weight _weight ;
00350
00351
00352
00358 bool _registered ;
00359
00360
00361
00373 Events::SimulationTick _birthTick ;
00374
00375
00376
00377 } ;
00378
00379
00380 }
00381
00382 }
00383
00384
00385
00386 #endif // OSDL_ACTIVE_OBJECT_H_
00387