| 
                Last change
                  on this file since 4717 was
                  4519,
                  checked in by bensch, 20 years ago
           | 
        
        
          | 
               
orxonox/trunk: changed all getInstances into inline functions to save some (minor) time 
 
           | 
        
        | 
            File size:
            1.4 KB
           | 
      
      
        
  | Line |   | 
|---|
| 1 | /*!  | 
|---|
| 2 |     \file garbage_collector.h | 
|---|
| 3 |     \brief Definition of the proto class template, used quickly start work | 
|---|
| 4 |     \todo Example: this shows how to use simply add a Marker that here has to be done something. | 
|---|
| 5 |  | 
|---|
| 6 |     The Protoclass exists, to help you quikly getting the run for how to develop in orxonox. | 
|---|
| 7 |     It is an example for the CODING-CONVENTION, and a starting-point for every class. | 
|---|
| 8 | */ | 
|---|
| 9 |  | 
|---|
| 10 | #ifndef _GARBAGE_COLLECTOR_H | 
|---|
| 11 | #define _GARBAGE_COLLECTOR_H | 
|---|
| 12 |  | 
|---|
| 13 | #include "base_object.h" | 
|---|
| 14 |  | 
|---|
| 15 |  | 
|---|
| 16 | //! this class maintains the garbage collection. | 
|---|
| 17 | /** | 
|---|
| 18 |    the class is been ticked by the world.cc and goes through the  | 
|---|
| 19 |    world_entity list to clean out all unused entities. | 
|---|
| 20 | */ | 
|---|
| 21 | class GarbageCollector : public BaseObject { | 
|---|
| 22 |  | 
|---|
| 23 |  public: | 
|---|
| 24 |   virtual ~GarbageCollector(); | 
|---|
| 25 |   /** \returns a Pointer to the only object of this Class */ | 
|---|
| 26 |   inline static GarbageCollector* getInstance(void) { if (!singletonRef) singletonRef = new GarbageCollector();  return singletonRef; }; | 
|---|
| 27 |  | 
|---|
| 28 |   void setCollectionDelay(float delay); | 
|---|
| 29 |  | 
|---|
| 30 |   void forceCollection(); | 
|---|
| 31 |  | 
|---|
| 32 |   void tick(float time); | 
|---|
| 33 |   void update(); | 
|---|
| 34 |  | 
|---|
| 35 |  private: | 
|---|
| 36 |   GarbageCollector(); | 
|---|
| 37 |  | 
|---|
| 38 |  private: | 
|---|
| 39 |   static GarbageCollector*    singletonRef;           //!< The reference to this class (singleton) | 
|---|
| 40 |   float                       delay;                  //!< this is the delay to wait until collection | 
|---|
| 41 |   float                       time;                   //!< the current time | 
|---|
| 42 |  | 
|---|
| 43 | }; | 
|---|
| 44 |  | 
|---|
| 45 | #endif /* _GARBAGE_COLLECTOR_H */ | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.