- Timestamp:
- Dec 27, 2009, 12:09:08 AM (15 years ago)
- Location:
- code/trunk/src/libraries/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/core/ConfigValueIncludes.h
r6417 r6423 63 63 inline ConfigValueContainer& setConfigValueGeneric(T* object, V* variable, ConfigFileType type, const std::string& sectionName, const std::string& entryName, const D& defaultValue) 64 64 { 65 ConfigValueContainer* container = object->getIdentifier()->getConfigValueContainer(entryName);65 ConfigValueContainer* container = ClassIdentifier<T>::getIdentifier()->getConfigValueContainer(entryName); 66 66 if (!container) 67 67 { 68 container = new ConfigValueContainer(type, object->getIdentifier(), sectionName, entryName, defaultValue, *variable);69 object->getIdentifier()->addConfigValueContainer(entryName, container);68 container = new ConfigValueContainer(type, ClassIdentifier<T>::getIdentifier(), sectionName, entryName, defaultValue, *variable); 69 ClassIdentifier<T>::getIdentifier()->addConfigValueContainer(entryName, container); 70 70 } 71 71 return container->getValue(variable, object); … … 113 113 inline void resetConfigValueGeneric(T* object, V* variable, const std::string& entryName) 114 114 { 115 ConfigValueContainer* container = object->getIdentifier()->getConfigValueContainer(entryName);115 ConfigValueContainer* container = ClassIdentifier<T>::getIdentifier()->getConfigValueContainer(entryName); 116 116 if (container) 117 117 { … … 122 122 { 123 123 COUT(2) << "Warning: Couldn't reset config-value '" << entryName << "' in class '" 124 << object->getIdentifier()->getName() << "', corresponding container doesn't exist." << std::endl;124 << ClassIdentifier<T>::getIdentifier()->getName() << "', corresponding container doesn't exist." << std::endl; 125 125 } 126 126 } … … 152 152 */ 153 153 #define ModifyConfigValueGeneric(object, variable, entryName, modifier, ...) \ 154 if (orxonox::ConfigValueContainer* container = object->getIdentifier()->getConfigValueContainer(entryName)) \154 if (orxonox::ConfigValueContainer* container = ClassByObjectType(object)->getConfigValueContainer(entryName)) \ 155 155 { \ 156 156 container->modifier(__VA_ARGS__); \ … … 160 160 { \ 161 161 COUT(2) << "Warning: Couln't modify config-value '" << entryName << "' in class '" \ 162 << object->getIdentifier()->getName() << "', corresponding container doesn't exist." << std::endl; \162 << ClassByObjectType(object)->getName() << "', corresponding container doesn't exist." << std::endl; \ 163 163 } 164 164 -
code/trunk/src/libraries/core/CoreIncludes.h
r5929 r6423 125 125 return Identifier::getIdentifierByID(id); 126 126 } 127 128 /** 129 @brief Returns the Identifier with a given 'this' pointer. 130 @note This of course only works with OrxonoxClasses. 131 The only use is in conjunction with macros that don't know the class type. 132 @param Pointer to an OrxonoxClass 133 */ 134 template <class T> 135 inline Identifier* ClassByObjectType(const T* object) 136 { 137 return ClassIdentifier<T>::getIdentifier(); 138 } 127 139 } 128 140
Note: See TracChangeset
for help on using the changeset viewer.