// $Revision: 1.10 $ //------------------------------------------------------------------------------ // // Copyright (C) 1994 Taligent, Inc. All rights reserved. // // Project: ConcurrentActors // File: MovementSubsystem.h // Build/Version: 1.0.0 // // Description: The Movement subsystem maintains a thread that tracks // movable objects and decides when to move them. // //------------------------------------------------------------------------------ #ifndef TaligentSamples_MOVEMENTSUBSYSTEM #define TaligentSamples_MOVEMENTSUBSYSTEM class MMoving; class TMoverThread; #ifndef Taligent_COLLECTIONS #include #endif #ifndef Taligent_SYNCHRONIZATION #include #endif #ifndef Taligent_CLOCK #include #endif #ifndef TaligentSamples_LOCALUTILITIES #include "LocalUtilities.h" #endif //============================================================================== // MMoving class MMoving { public: MMoving(); virtual ~MMoving(); virtual void PreMove(const TTime& interval); virtual void Move(const TTime& interval) = 0; virtual void PostMove(const TTime& interval); }; //============================================================================== // TMoverThread class TMoverThread : public TPeriodicThread { public: static const TTime& kDefaultMoveInterval; TMoverThread(const TTime& moveInterval = kDefaultMoveInterval); virtual ~TMoverThread(); virtual void Add(MMoving* object); virtual MMoving* Remove(MMoving& object); virtual void RemoveAll(); protected: virtual void HandleIntervalPassed(const TTime& interval); virtual void GetDelayInterval(TTime& interval) const; private: TSeconds fInterval; TDequeOf fObjects; }; #endif