Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/garbage_collector.cc @ 3649

Last change on this file since 3649 was 3647, checked in by patrick, 20 years ago

orxonox/trunk: definlty a problem with the list, now stable again

File size: 2.2 KB
Line 
1
2
3/*
4   orxonox - the future of 3D-vertical-scrollers
5
6   Copyright (C) 2004 orx
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2, or (at your option)
11   any later version.
12
13   ### File Specific:
14   main-programmer: Patrick Boenzli
15   co-programmer: ...
16*/
17
18#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
19
20#include "garbage_collector.h"
21
22#include "world.h"
23#include "world_entity.h"
24#include "null_parent.h"
25
26#include "list.h"
27
28using namespace std;
29
30
31GarbageCollector* GarbageCollector::singletonRef = 0;
32
33/**
34   \brief standard constructor
35   \todo this constructor is not jet implemented - do it
36*/
37GarbageCollector::GarbageCollector () 
38{
39   this->setClassName ("GarbageCollection");
40   this->time = 0;
41   this->delay = 3.0f; /* clean up all 5.0 seconds */
42}
43
44
45/**
46   \brief standard deconstructor
47
48*/
49GarbageCollector::~GarbageCollector () 
50{
51  // delete what has to be deleted here
52}
53
54
55/**
56   \brief this returns the singleton reference this this class
57   \returns singleton reference
58*/
59GarbageCollector* GarbageCollector::getInstance()
60{
61  if( singletonRef == NULL)
62    singletonRef = new GarbageCollector();
63  return singletonRef;
64}
65
66
67void GarbageCollector::setCollectionDelay(float delay)
68{}
69
70
71void GarbageCollector::forceCollection()
72{
73 
74}
75
76void GarbageCollector::tick(float time)
77{
78  this->time += time;
79}
80
81
82void GarbageCollector::update()
83{
84  if( this->time < this->delay)
85    return;
86  /* garbage collect */
87  PRINTF(3)("GarbageCollection is been done\n");
88  WorldInterface* wi = WorldInterface::getInstance();
89  tList<WorldEntity>* list = wi->getEntityList();
90  //WorldEntity* entity = list->enumerate();
91 // while( entity != NULL)
92  //  {
93  //  if( entity->isFinalized())
94  //{
95  //  PRINTF(3)("Finalizing object in list - not yet done realy\n");
96          /* first remove out of entity list */
97          //list->remove(entity);
98          /* second remove out of pnode tree */
99          //NullParent* np = NullParent::getInstance();
100          //np->removeChild(np);
101         
102  //}
103  //   entity = list->nextElement();
104  //}
105 
106  /* reset time to count again up to this->delay */
107  this->time = 0;
108}
Note: See TracBrowser for help on using the repository browser.