Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/util/garbage_collector.h @ 5604

Last change on this file since 5604 was 5355, checked in by bensch, 19 years ago

orxonox/trunk: some build-efficiency-issues

File size: 1.4 KB
RevLine 
[4836]1/*!
[4941]2 * @file garbage_collector.h
3 */
[3647]4
5#ifndef _GARBAGE_COLLECTOR_H
6#define _GARBAGE_COLLECTOR_H
7
8#include "base_object.h"
9
[5355]10// FORWARD DECLARATION
11class FastObjectMember;
[3647]12
13//! this class maintains the garbage collection.
14/**
[4979]15 * you can pass everything to this class that you want to be collected
16 * just use GarbageCollector->collect(POINTER); to pass a collectable to the GarbageCollector
17 * it will then be handled acording to the class
[3647]18*/
19class GarbageCollector : public BaseObject {
20
21 public:
22  virtual ~GarbageCollector();
[4836]23  /** @returns a Pointer to the only object of this Class */
[4746]24  inline static GarbageCollector* getInstance() { if (!singletonRef) singletonRef = new GarbageCollector();  return singletonRef; };
[3647]25
26  void setCollectionDelay(float delay);
27
28  void forceCollection();
29
[4941]30  void collect(BaseObject* object);
31
[3647]32  void tick(float time);
33  void update();
34
35 private:
[4519]36  GarbageCollector();
37
38 private:
[4485]39  static GarbageCollector*    singletonRef;           //!< The reference to this class (singleton)
[4941]40
41  FastObjectMember*           collectedObjects;       //!< A list of recently collected Objects, that want to be deleted.
42  FastObjectMember*           unusedContainers;       //!< A list of unused containers.
43  float                       delay;                  //!< this is the delay to wait until collection.
[4485]44  float                       time;                   //!< the current time
[3647]45
46};
47
48#endif /* _GARBAGE_COLLECTOR_H */
Note: See TracBrowser for help on using the repository browser.