Changeset 10361 for code/branches/core7/src/libraries/core
- Timestamp:
- Apr 12, 2015, 11:05:10 PM (10 years ago)
- Location:
- code/branches/core7/src/libraries/core/class
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/libraries/core/class/Identifier.h
r9667 r10361 223 223 XMLPortObjectContainer* getXMLPortObjectContainer(const std::string& sectionname); 224 224 225 virtual bool canDynamicCastObjectToIdentifierClass(Identifiable* object) = 0; 225 226 226 227 protected: … … 288 289 virtual const std::string& getTypeidName() 289 290 { return this->typeidName_; } 291 292 virtual bool canDynamicCastObjectToIdentifierClass(Identifiable* object) 293 { return dynamic_cast<T*>(object) != 0; } 290 294 291 295 private: -
code/branches/core7/src/libraries/core/class/IdentifierManager.cc
r9667 r10361 146 146 } 147 147 148 this->verifyClassHierarchy(); 149 148 150 this->stopCreatingHierarchy(); 149 151 orxout(internal_status) << "Finished class-hierarchy creation" << endl; 152 } 153 154 /** 155 * Verifies if the class hierarchy is consistent with the RTTI. 156 */ 157 void IdentifierManager::verifyClassHierarchy() 158 { 159 Context temporaryContext(NULL); 160 for (std::map<std::string, Identifier*>::const_iterator it1 = this->identifierByTypeidName_.begin(); it1 != this->identifierByTypeidName_.end(); ++it1) 161 { 162 if (!it1->second->hasFactory()) 163 continue; 164 165 Identifiable* temp = it1->second->fabricate(&temporaryContext); 166 167 for (std::map<std::string, Identifier*>::const_iterator it2 = this->identifierByTypeidName_.begin(); it2 != this->identifierByTypeidName_.end(); ++it2) 168 { 169 bool isA_AccordingToRtti = it2->second->canDynamicCastObjectToIdentifierClass(temp); 170 bool isA_AccordingToClassHierarchy = temp->isA(it2->second); 171 172 if (isA_AccordingToRtti != isA_AccordingToClassHierarchy) 173 { 174 orxout(internal_error) << "Class hierarchy does not match RTTI: Class hierarchy claims that " << it1->second->getName() << 175 (isA_AccordingToClassHierarchy ? " is a " : " is not a ") << it2->second->getName() << " but RTTI says the opposite." << endl; 176 } 177 } 178 179 delete temp; 180 } 181 182 size_t numberOfObjects = temporaryContext.getObjectList<Listable>()->size(); 183 if (numberOfObjects > 0) 184 orxout(internal_warning) << "There are still " << numberOfObjects << " listables left after creating the class hierarchy" << endl; 150 185 } 151 186 -
code/branches/core7/src/libraries/core/class/IdentifierManager.h
r9667 r10361 59 59 ///////////////////////////// 60 60 void createClassHierarchy(); 61 void verifyClassHierarchy(); 61 62 void destroyAllIdentifiers(); 62 63
Note: See TracChangeset
for help on using the changeset viewer.