Changeset 4934 in orxonox.OLD for orxonox/trunk/src/util
- Timestamp:
- Jul 22, 2005, 6:41:46 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/object_manager.h
r4933 r4934 63 63 64 64 protected: 65 FastFactory (ClassID classID, const char* fastFactoryName = NULL); 66 65 67 /** sets the Next factory in the list @param nextFactory the next factory */ 66 68 inline void setNext( FastFactory* nextFastFactory) { this->next = nextFastFactory; }; … … 68 70 FastFactory* getNext() const { return this->next; }; 69 71 70 virtual BaseObject* fabricate(ClassID classID) = NULL; 71 72 private: 73 FastFactory (ClassID classID, const char* fastFactoryName = NULL); 72 // virtual BaseObject* fabricate(ClassID classID) = NULL; 73 74 static FastFactory* searchFastFactory(ClassID classID, const char* fastFactoryName = NULL); 75 76 private: 74 77 static void registerFastFactory(FastFactory* fastFactory); 75 static FastFactory* searchFastFactory(ClassID classID, const char* fastFactoryName = NULL);76 78 77 79 protected: … … 92 94 { 93 95 public: 94 static FastFactory* getFastFactory(ClassID classID, const char* fastFactoryName = NULL);96 static tFastFactory<T>* getFastFactory(ClassID classID, const char* fastFactoryName = NULL); 95 97 96 98 void prepare(unsigned int count); … … 126 128 127 129 template<class T> 128 FastFactory* tFastFactory<T>::getFastFactory(ClassID classID, const char* fastFactoryName)130 tFastFactory<T>* tFastFactory<T>::getFastFactory(ClassID classID, const char* fastFactoryName) 129 131 { 130 132 tFastFactory<T>* tmpFac = NULL; 131 133 if (FastFactory::getFirst() != NULL) 132 tmpFac = FastFactory::getFirst()->searchFastFactory(classID, fastFactoryName);134 tmpFac = static_cast<tFastFactory<T>*>(FastFactory::getFirst()->searchFastFactory(classID, fastFactoryName)); 133 135 134 136 if (tmpFac != NULL) 135 137 return tmpFac; 136 138 else 137 return new tFastFactory<T> ;139 return new tFastFactory<T>(classID, fastFactoryName); 138 140 } 139 141 … … 142 144 T* tFastFactory<T>::fabricate() 143 145 { 144 FastObjectMember<T>* tmpFirstDead = this->deadList;146 FastObjectMember<T>* tmpFirstDead = new FastObjectMember<T>; 145 147 tmpFirstDead->objectPointer = new T(); 146 148 tmpFirstDead->next = this->deadList; … … 148 150 149 151 this->deadList = tmpFirstDead; 150 return t his->deadList;152 return tmpFirstDead->objectPointer; 151 153 } 152 154 … … 154 156 void tFastFactory<T>::prepare(unsigned int count) 155 157 { 156 if (this->storedDeadObjects + this->storedLivingObjects >= count)158 /* if (this->storedDeadObjects + this->storedLivingObjects >= count) 157 159 { 158 160 PRINTF(3)("not creating new Objects for class %s, because the requested count already exists\n", this->getClassName()); 159 } 160 for (int i = this->storedDeadObjects + this->storedLivingObjects; i < count; i++)161 }*/ 162 for (int i = this->storedDeadObjects; i < count; i++) 161 163 { 162 164 this->fabricate(); … … 167 169 T* tFastFactory<T>::resurect() 168 170 { 171 PRINTF(4)("Resurecting Object of type %s\n", this->getName()); 169 172 if (unlikely(this->deadList == NULL)) 170 173 { … … 179 182 180 183 tmpC->next = this->unusedContainers; 181 this->unusedContainers ->tmpC;182 183 return tmpC ;184 this->unusedContainers = tmpC; 185 186 return tmpC->objectPointer; 184 187 } 185 188 }
Note: See TracChangeset
for help on using the changeset viewer.