Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: some build-efficiency-issues

File size: 1.4 KB
Line 
1/*!
2 * @file garbage_collector.h
3 */
4
5#ifndef _GARBAGE_COLLECTOR_H
6#define _GARBAGE_COLLECTOR_H
7
8#include "base_object.h"
9
10// FORWARD DECLARATION
11class FastObjectMember;
12
13//! this class maintains the garbage collection.
14/**
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
18*/
19class GarbageCollector : public BaseObject {
20
21 public:
22  virtual ~GarbageCollector();
23  /** @returns a Pointer to the only object of this Class */
24  inline static GarbageCollector* getInstance() { if (!singletonRef) singletonRef = new GarbageCollector();  return singletonRef; };
25
26  void setCollectionDelay(float delay);
27
28  void forceCollection();
29
30  void collect(BaseObject* object);
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
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.
44  float                       time;                   //!< the current time
45
46};
47
48#endif /* _GARBAGE_COLLECTOR_H */
Note: See TracBrowser for help on using the repository browser.