Changeset 4936 in orxonox.OLD for orxonox/trunk/src/util/object_manager.h
- Timestamp:
- Jul 22, 2005, 7:30:49 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/object_manager.h
r4935 r4936 56 56 void kill(ClassID classID, BaseObject* object); 57 57 58 virtual void fabricate() = NULL; 58 59 // retrival functions for fast Ineraction 59 60 //FastFactory* getFastFactory(ClassID classID); 61 62 static void flushAll(bool hardFLUSH = false); 63 void flush(bool hardFLUSH = false); 60 64 61 65 /** @returns the first FastFactory */ … … 102 106 103 107 T* resurect(); 104 void kill(T* object);105 106 108 private: 107 109 tFastFactory(ClassID classID, const char* fastFactoryName); 108 110 109 T*fabricate();111 virtual void fabricate(); 110 112 111 113 private: … … 142 144 143 145 template<class T> 144 T*tFastFactory<T>::fabricate()146 void tFastFactory<T>::fabricate() 145 147 { 146 148 FastObjectMember* tmpFirstDead = new FastObjectMember; 147 T* fabricatedT = new T(); 148 tmpFirstDead->objectPointer = fabricatedT; 149 tmpFirstDead->objectPointer = new T(); 149 150 tmpFirstDead->next = this->deadList; 150 151 ++this->storedDeadObjects; 151 152 152 153 this->deadList = tmpFirstDead; 153 return fabricatedT;154 154 } 155 155 … … 175 175 PRINTF(2)("The deadList of Class %s is empty, this may be either because it has not been filled yet, or the cache is to small.\n" \ 176 176 "Fabricating a new %s", this->getName(), this->getName()); 177 return this->fabricate(); 177 this->fabricate(); 178 return resurect(); 178 179 } 179 180 else … … 187 188 return dynamic_cast<T*>(tmpC->objectPointer); 188 189 } 189 }190 191 template<class T>192 void tFastFactory<T>::kill(T* object)193 {194 FastObjectMember* tmpC;195 if (unlikely(this->unusedContainers == NULL))196 {197 tmpC = new FastObjectMember;198 }199 else200 {201 tmpC = this->unusedContainers;202 this->unusedContainers = this->unusedContainers->next;203 }204 205 tmpC->next = this->deadList;206 tmpC->objectPointer = object;207 190 } 208 191
Note: See TracChangeset
for help on using the changeset viewer.