Changeset 871
- Timestamp:
- Mar 9, 2008, 4:44:36 PM (17 years ago)
- Location:
- code/trunk
- Files:
-
- 4 deleted
- 82 edited
- 29 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/bin/levels/sample.oxw
r863 r871 1 <?xml version="1.0"?> 2 <orxonoxworld name="Orxonox sample level" image="textures/menu/moonstation_512x512.jpg"> 3 <description> 4 This is an orxonox sample level. 5 </description> 6 7 <loading> 8 <background color="000000" image="textures/load_screens/ambush.png" /> 9 <bar top="200" left="50" width="300" height="20" image="textures/load_screens/ambush-loadbar.png" /> 10 </loading> 11 12 13 1 <!-- 14 2 <audio> 15 3 <ambient> … … 21 9 </ambient> 22 10 </audio> 23 24 <!-- Keep a minimum distance of >100 to the object, otherwise the camara thinks it's in the object -->25 <!-- the value has to negative, as we want the camara behind the object -->26 <!--27 <Camera name="Camera" pos="0,50,-150" lookat="0,20,0" node="2OgreHeadNode" />28 <SpaceShip camera="true" position="0,0,0" scale="10" yaw="-90" pitch="-90" mesh="assf3.mesh" forward="250" rotateupdown="100" rotaterightleft="100" looprightleft="100" />29 11 --> 30 <world> 31 <Ambient colourvalue="1,1,1" /> 32 <Skybox src="Orxonox/StarSkyBox" /> 33 34 <!--Fighter camera="true" position="0,0,0" scale="10" yaw="-90" pitch="-90" mesh="assf3.mesh" forward="500" rotateupdown="200" rotaterightleft="200" looprightleft="200" /--> 35 <SpaceShip camera="true" position="0,0,0" scale="10" yaw="-90" pitch="-90" mesh="assf3.mesh" maxSpeed="500" maxSideAndBackSpeed="50" maxRotation="1.0" transAcc="200" rotAcc="3.0" transDamp="75" rotDamp="1.0" /> 36 37 <NPC position="0,100,400" scale="1" mesh="razor.mesh"/> 38 <NPC position="0,100,400" scale="1" mesh="razor.mesh"/> 39 <NPC position="0,-100,500" scale="1" mesh="razor.mesh"/> 40 <NPC position="0,-200,450" scale="1" mesh="razor.mesh"/> 41 <NPC position="100,0,400" scale="1" mesh="razor.mesh"/> 42 <!-- 43 <Model position="200,0,500" scale="10" mesh="starship.mesh" yaw="-90" pitch="-90" /> 44 <Model position="-200,0,500" scale="10" mesh="drone.mesh" yaw="-90" pitch="-90" /> 45 --> 46 <Model position="-200,1000,500" scale="10" mesh="hoover_body.mesh" yaw="-90" pitch="-90" /> 47 <Model position="-200,1000,500" scale="10" mesh="hoover_gear0.mesh" yaw="-90" pitch="-90" /> 48 <Model position="-200,1000,500" scale="10" mesh="hoover_gear1.mesh" yaw="-90" pitch="-90" /> 49 <Model position="-200,1000,500" scale="10" mesh="hoover_gear2.mesh" yaw="-90" pitch="-90" /> 50 <Model position="-200,1000,500" scale="10" mesh="hoover_turbine.mesh" yaw="-90" pitch="-90" /> 51 12 13 <Ambient colourvalue="1,1,1" /> 14 <Skybox src="Orxonox/StarSkyBox" /> 15 16 <!--Fighter camera="true" position="0,0,0" scale="10" yawpitchroll="-90,-90,0" mesh="assf3.mesh" forward="500" rotateupdown="200" rotaterightleft="200" looprightleft="200" /--> 17 <SpaceShip camera="true" position="0,0,0" scale="10" yawpitchroll="-90,-90,0" mesh="assf5.mesh" maxSpeed="500" maxSideAndBackSpeed="50" maxRotation="1.0" transAcc="200" rotAcc="3.0" transDamp="75" rotDamp="1.0" /> 18 19 <NPC position="0,100,400" scale="1" mesh="razor.mesh"/> 20 <NPC position="0,100,400" scale="1" mesh="razor.mesh"/> 21 <NPC position="0,-100,500" scale="1" mesh="razor.mesh"/> 22 <NPC position="0,-200,450" scale="1" mesh="razor.mesh"/> 23 <NPC position="100,0,400" scale="1" mesh="razor.mesh"/> 24 25 <Model name="starship" position="200,0,500" scale="10" mesh="starship.mesh" yawpitchroll="-90,-90,0" /> 26 <Model name="drone" position="-200,0,500" scale="10" mesh="drone.mesh" yawpitchroll="-90,-90,0"> 27 <attached> 28 <Model name="drone2" position="200,-100,-500" scale="10" mesh="drone.mesh" yawpitchroll="-90,-90,0"> 29 <attached> 30 <Model name="starship2" position="500,200,-500" scale="10" mesh="starship.mesh" yawpitchroll="-90,-90,0" /> 31 </attached> 32 </Model> 33 </attached> 34 </Model> 35 36 <Model position="-200,1000,500" scale="10" mesh="hoover_body.mesh" yawpitchroll="-90,-90,0" /> 37 <Model position="-200,1000,500" scale="10" mesh="hoover_gear0.mesh" yawpitchroll="-90,-90,0" /> 38 <Model position="-200,1000,500" scale="10" mesh="hoover_gear1.mesh" yawpitchroll="-90,-90,0" /> 39 <Model position="-200,1000,500" scale="10" mesh="hoover_gear2.mesh" yawpitchroll="-90,-90,0" /> 40 <Model position="-200,1000,500" scale="10" mesh="hoover_turbine.mesh" yawpitchroll="-90,-90,0" /> 52 41 53 42 <Model position="-16779,42,11043" scale="95" mesh="ast2.mesh" rotationAxis="0.281711,0.152518,0" rotationRate="27" /> … … 278 267 <Model position="-6787,1792,287" scale="71" mesh="ast6.mesh" rotationAxis="0.161019,0.130015,0" rotationRate="36" /> 279 268 <Model position="-7223,-13574,-11873" scale="24" mesh="ast4.mesh" rotationAxis="0.792203,0,0.177188" rotationRate="38" /> 280 281 282 </world>283 284 <!-- Unused at the moment -->285 <!-- <SpaceshipSteeringObject node="OgreHeadNode" forward="500" rotateupdown="200" rotaterightleft="200" looprightleft="200" /> -->286 287 <scripts>288 <script file="intro.lua" />289 </scripts>290 </orxonoxworld> -
code/trunk/src/CMakeLists.txt
r790 r871 6 6 ADD_SUBDIRECTORY(audio) 7 7 ADD_SUBDIRECTORY(network) 8 ADD_SUBDIRECTORY(loader)8 #ADD_SUBDIRECTORY(loader) 9 9 ADD_SUBDIRECTORY(orxonox) -
code/trunk/src/network/GameStateClient.cc
r790 r871 82 82 // bad luck ;) 83 83 // delete the synchronisable (obviously seems to be deleted on the server) 84 while(it != 0&& it->objectID!=sync.objectID){84 while(it && it->objectID!=sync.objectID){ 85 85 removeObject(it); 86 86 } -
code/trunk/src/network/GameStateManager.cc
r790 r871 109 109 int offset=0; 110 110 // go through all Synchronisables 111 for(it = orxonox::ObjectList<Synchronisable>::start(); it != 0; ++it){111 for(it = orxonox::ObjectList<Synchronisable>::start(); it; ++it){ 112 112 //std::cout << "gamestatemanager: in for loop" << std::endl; 113 113 //get size of the synchronisable -
code/trunk/src/network/Synchronisable.cc
r790 r871 14 14 15 15 #include "Synchronisable.h" 16 #include "core/CoreIncludes.h" 16 17 17 18 namespace network -
code/trunk/src/network/Synchronisable.h
r790 r871 2 2 // C++ Interface: synchronisable 3 3 // 4 // Description: 4 // Description: 5 5 // 6 6 // … … 16 16 17 17 #include "NetworkPrereqs.h" 18 #include "core/ CoreIncludes.h"18 #include "core/OrxonoxClass.h" 19 19 20 20 namespace network … … 47 47 public: 48 48 49 virtual ~Synchronisable();49 virtual ~Synchronisable(); 50 50 int objectID; 51 51 int classID; … … 66 66 int datasize; 67 67 }; 68 69 }70 71 namespace orxonox72 {73 template class _NetworkExport ClassIdentifier<network::Synchronisable>;74 template class _NetworkExport ObjectList<network::Synchronisable>;75 68 } 76 69 -
code/trunk/src/orxonox/CMakeLists.txt
r790 r871 3 3 Main.cc 4 4 Orxonox.cc 5 objects/Tickable.cc 5 6 SpaceshipSteering.cc 6 7 hud/HUD.cc … … 9 10 tools/Light.cc 10 11 tools/Mesh.cc 12 tools/Timer.cc 11 13 objects/Ambient.cc 12 14 objects/Camera.cc … … 18 20 objects/Skybox.cc 19 21 objects/SpaceShip.cc 20 # objects/SpaceshipSteeringObject.cc21 # objects/test1.cc22 # objects/test2.cc23 # objects/test3.cc22 # objects/SpaceshipSteeringObject.cc 23 # objects/test1.cc 24 # objects/test2.cc 25 # objects/test3.cc 24 26 objects/WorldEntity.cc 25 27 objects/weapon/AmmunitionDump.cc … … 42 44 audio 43 45 network 44 loader46 # loader 45 47 ) 46 48 -
code/trunk/src/orxonox/Orxonox.cc
r790 r871 57 57 58 58 // loader and audio 59 #include "loader/LevelLoader.h"59 //#include "loader/LevelLoader.h" 60 60 #include "audio/AudioManager.h" 61 61 … … 72 72 #include "core/Factory.h" 73 73 #include "core/Debug.h" 74 #include "core/Loader.h" 74 75 #include "hud/HUD.h" 75 76 #include "objects/weapon/BulletManager.h" … … 131 132 this->ogre_ = new GraphicsEngine(); 132 133 this->dataPath_ = ""; 133 this->loader_ = 0;134 // this->loader_ = 0; 134 135 this->auMan_ = 0; 135 136 this->singletonRef_ = 0; … … 379 380 380 381 // load this file from config 381 loader_ = new loader::LevelLoader("sample.oxw"); 382 loader_->loadLevel(); 382 // loader_ = new loader::LevelLoader("sample.oxw"); 383 // loader_->loadLevel(); 384 Level* startlevel = new Level("levels/sample.oxw"); 385 Loader::open(startlevel); 383 386 384 387 Ogre::Overlay* hudOverlay = Ogre::OverlayManager::getSingleton().getByName("Orxonox/HUD1.2"); -
code/trunk/src/orxonox/Orxonox.h
r790 r871 14 14 15 15 #include "OrxonoxPrereqs.h" 16 #include "loader/LoaderPrereqs.h"16 //#include "loader/LoaderPrereqs.h" 17 17 #include "audio/AudioPrereqs.h" 18 18 … … 69 69 GraphicsEngine* ogre_; //!< our dearest graphics engine <3 70 70 std::string dataPath_; //!< path to data 71 loader::LevelLoader* loader_; //!< level loader builds the scene71 // loader::LevelLoader* loader_; //!< level loader builds the scene 72 72 audio::AudioManager* auMan_; //!< audio manager 73 73 BulletManager* bulletMgr_; //!< Keeps track of the thrown bullets -
code/trunk/src/orxonox/OrxonoxStableHeaders.h
r790 r871 73 73 //#include "audio/AudioManager.h" 74 74 75 #include "core/CoreIncludes.h"75 //#include "core/CoreIncludes.h" 76 76 #include "core/BaseObject.h" 77 77 //#include "core/ArgReader.h" -
code/trunk/src/orxonox/core/BaseObject.cc
r790 r871 20 20 * 21 21 * Author: 22 * ...22 * Fabian 'x3n' Landau 23 23 * Co-authors: 24 24 * ... … … 26 26 */ 27 27 28 /* !28 /** 29 29 @file BaseObject.cc 30 30 @brief Implementation of the BaseObject class. … … 33 33 #include "util/tinyxml/tinyxml.h" 34 34 35 #include "core/CoreIncludes.h" 35 36 #include "BaseObject.h" 37 #include "XMLPort.h" 38 #include "Level.h" 36 39 37 40 namespace orxonox … … 45 48 { 46 49 RegisterRootObject(BaseObject); 50 51 this->bActive_ = true; 52 this->bVisible_ = true; 53 this->level_ = 0; 47 54 } 48 55 … … 64 71 } 65 72 } 73 74 /** 75 @brief XML loading and saving. 76 @param xmlelement The XML-element 77 @param loading Loading (true) or saving (false) 78 @return The XML-element 79 */ 80 void BaseObject::XMLPort(Element& xmlelement, bool loading) 81 { 82 XMLPortParam(BaseObject, "name", setName, getName, xmlelement, loading); 83 } 84 85 /** 86 @brief Returns the levelfile that loaded this object. 87 @return The levelfile 88 */ 89 const std::string& BaseObject::getLevelfile() const 90 { 91 return this->level_->getFile(); 92 } 66 93 } -
code/trunk/src/orxonox/core/BaseObject.h
r790 r871 1 /*! 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * 4 * 5 * License notice: 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * Author: 22 * Fabian 'x3n' Landau 23 * Co-authors: 24 * ... 25 * 26 */ 27 28 /** 2 29 @file BaseObject.h 3 30 @brief Definition of the BaseObject class. … … 10 37 11 38 #include "CorePrereqs.h" 12 #include "util/ tinyxml/TinyXMLPrereqs.h"39 #include "util/XMLIncludes.h" 13 40 14 #include " CoreIncludes.h"41 #include "OrxonoxClass.h" 15 42 16 43 namespace orxonox … … 23 50 virtual ~BaseObject(); 24 51 virtual void loadParams(TiXmlElement* xmlElem); 52 virtual void XMLPort(Element& xmlelement, bool loading); 53 54 /** @brief Sets the name of the object. @param name The name */ 55 inline void setName(const std::string& name) { this->name_ = name; this->changedName(); } 56 /** @brief Returns the name of the object. @return The name */ 57 inline const std::string& getName() const { return this->name_; } 58 /** @brief This function gets called if the name of the object changes. */ 59 virtual void changedName() {} 60 61 /** @brief Sets the state of the objects activity. @param bActive True = active */ 62 inline void setActivity(bool bActive) { this->bActive_ = bActive; this->changedActivity(); } 63 /** @brief Returns the state of the objects activity. @return The state of the activity */ 64 inline const bool isActive() const { return this->bActive_; } 65 /** @brief This function gets called if the activity of the object changes. */ 66 virtual void changedActivity() {} 67 68 /** @brief Sets the state of the objects visibility. @param bVisible True = visible */ 69 inline void setVisibility(bool bVisible) { this->bVisible_ = bVisible; this->changedVisibility(); } 70 /** @brief Returns the state of the objects visibility. @return The state of the visibility */ 71 inline const bool isVisible() const { return this->bVisible_; } 72 /** @brief This function gets called if the visibility of the object changes. */ 73 virtual void changedVisibility() {} 74 75 /** @brief Sets a pointer to the level that loaded this object. @param level The pointer to the level */ 76 inline void setLevel(const Level* level) { this->level_ = level; } 77 /** @brief Returns a pointer to the level that loaded this object. @return The level */ 78 inline const Level* getLevel() const { return this->level_; } 79 const std::string& getLevelfile() const; 80 81 /** @brief Sets the indentation of the debug output in the Loader. @param indentation The indentation */ 82 inline void setLoaderIndentation(const std::string& indentation) { this->loaderIndentation_ = indentation; } 83 /** @brief Returns the indentation of the debug output in the Loader. @return The indentation */ 84 inline const std::string& getLoaderIndentation() const { return this->loaderIndentation_; } 85 86 private: 87 std::string name_; //!< The name of the object 88 bool bActive_; //!< True = the object is active 89 bool bVisible_; //!< True = the object is visible 90 const Level* level_; //!< The level that loaded this object 91 std::string loaderIndentation_; //!< Indentation of the debug output in the Loader 25 92 }; 26 ExportClass(BaseObject, Core);27 93 } 28 94 -
code/trunk/src/orxonox/core/CMakeLists.txt
r790 r871 1 1 SET( CORE_SRC_FILES 2 OrxonoxClass.cc 2 3 BaseObject.cc 3 4 Factory.cc 4 IdentifierList.cc5 5 Identifier.cc 6 IdentifierDistributor.cc 6 7 MetaObjectList.cc 7 OrxonoxClass.cc8 8 ConfigValueContainer.cc 9 9 Error.cc … … 13 13 OutputHandler.cc 14 14 Language.cc 15 ClassTreeMask.cc 16 Loader.cc 17 Executor.cc 18 XMLPort.cc 15 19 ) 16 20 -
code/trunk/src/orxonox/core/ClassFactory.h
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 @file ClassFactory.h 30 30 @brief Definition and implementation of the ClassFactory class … … 72 72 bool ClassFactory<T>::create(const std::string& name) 73 73 { 74 COUT(4) << "*** C reate entry for " << name << " in Factory." << std::endl;75 Class Identifier<T>::getIdentifier()->addFactory(new ClassFactory<T>);76 Factory::add(name, Class Identifier<T>::getIdentifier());74 COUT(4) << "*** ClassFactory: Create entry for " << name << " in Factory." << std::endl; 75 ClassManager<T>::getIdentifier()->addFactory(new ClassFactory<T>); 76 Factory::add(name, ClassManager<T>::getIdentifier()); 77 77 78 78 return true; -
code/trunk/src/orxonox/core/ConfigValueContainer.cc
r790 r871 26 26 */ 27 27 28 /** 29 @file ConfigValueContainer.cc 30 @brief Implementation of the ConfigValueContainer class. 31 */ 32 28 33 #include <fstream> 29 34 35 #include "ConfigValueContainer.h" 30 36 #include "util/Tokenizer.h" 31 37 #include "util/Convert.h" 32 #include " ConfigValueContainer.h"38 #include "Language.h" 33 39 34 40 #define CONFIGFILEPATH "orxonox.ini" … … 43 49 @param defvalue The default-value 44 50 */ 45 ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, intdefvalue)51 ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, MultiTypeMath defvalue) 46 52 { 47 53 this->bAddedDescription_ = false; 48 54 this->classname_ = classname; 49 55 this->varname_ = varname; 50 this->type_ = VT_Int; 51 52 ConvertValue(&this->defvalueString_, defvalue, std::string("0")); // Try to convert the default-value to a string 56 57 this->valueToString(&this->defvalueString_, defvalue); // Try to convert the default-value to a string 53 58 this->searchConfigFileLine(); // Search the entry in the config-file 54 59 55 std::string valueString = this->parseValueString( );// Parses the value string from the config-file-entry56 if (!this->parseSt ing(valueString, defvalue))// Try to convert the string to a value60 std::string valueString = this->parseValueString(!(defvalue.isA(MT_string) || defvalue.isA(MT_constchar))); // Parses the value string from the config-file-entry 61 if (!this->parseString(valueString, defvalue)) // Try to convert the string to a value 57 62 this->resetConfigFileEntry(); // The conversion failed 58 63 } 59 64 60 65 /** 61 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable. 62 @param value This is only needed to determine the right type. 63 @param classname The name of the class the variable belongs to 64 @param varname The name of the variable 65 @param defvalue The default-value 66 */ 67 ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, unsigned int defvalue) 68 { 69 this->bAddedDescription_ = false; 70 this->classname_ = classname; 71 this->varname_ = varname; 72 this->type_ = VT_uInt; 73 74 ConvertValue(&this->defvalueString_, defvalue, std::string("0")); // Try to convert the default-value to a string 75 this->searchConfigFileLine(); // Search the entry in the config-file 76 77 std::string valueString = this->parseValueString(); // Parses the value string from the config-file-entry 78 if (!this->parseSting(valueString, defvalue)) // Try to convert the string to a value 79 this->resetConfigFileEntry(); // The conversion failed 80 } 81 82 /** 83 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable. 84 @param value This is only needed to determine the right type. 85 @param classname The name of the class the variable belongs to 86 @param varname The name of the variable 87 @param defvalue The default-value 88 */ 89 ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, char defvalue) 90 { 91 this->bAddedDescription_ = false; 92 this->classname_ = classname; 93 this->varname_ = varname; 94 this->type_ = VT_Char; 95 96 ConvertValue(&this->defvalueString_, (int)defvalue, std::string("0")); // Try to convert the default-value to a string 97 this->searchConfigFileLine(); // Search the entry in the config-file 98 99 std::string valueString = this->parseValueString(); // Parses the value string from the config-file-entry 100 if (!this->parseSting(valueString, defvalue)) // Try to convert the string to a value 101 this->resetConfigFileEntry(); // The conversion failed 102 } 103 104 /** 105 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable. 106 @param value This is only needed to determine the right type. 107 @param classname The name of the class the variable belongs to 108 @param varname The name of the variable 109 @param defvalue The default-value 110 */ 111 ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, unsigned char defvalue) 112 { 113 this->bAddedDescription_ = false; 114 this->classname_ = classname; 115 this->varname_ = varname; 116 this->type_ = VT_uChar; 117 118 ConvertValue(&this->defvalueString_, (unsigned int)defvalue, std::string("0")); // Try to convert the default-value to a string 119 this->searchConfigFileLine(); // Search the entry in the config-file 120 121 std::string valueString = this->parseValueString(); // Parses the value string from the config-file-entry 122 if (!this->parseSting(valueString, defvalue)) // Try to convert the string to a value 123 this->resetConfigFileEntry(); // The conversion failed 124 } 125 126 /** 127 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable. 128 @param value This is only needed to determine the right type. 129 @param classname The name of the class the variable belongs to 130 @param varname The name of the variable 131 @param defvalue The default-value 132 */ 133 ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, float defvalue) 134 { 135 this->bAddedDescription_ = false; 136 this->classname_ = classname; 137 this->varname_ = varname; 138 this->type_ = VT_Float; 139 140 ConvertValue(&this->defvalueString_, defvalue, std::string("0.000000")); // Try to convert the default-value to a string 141 this->searchConfigFileLine(); // Search the entry in the config-file 142 143 std::string valueString = this->parseValueString(); // Parses the value string from the config-file-entry 144 if (!this->parseSting(valueString, defvalue)) // Try to convert the string to a value 145 this->resetConfigFileEntry(); // The conversion failed 146 } 147 148 /** 149 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable. 150 @param value This is only needed to determine the right type. 151 @param classname The name of the class the variable belongs to 152 @param varname The name of the variable 153 @param defvalue The default-value 154 */ 155 ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, double defvalue) 156 { 157 this->bAddedDescription_ = false; 158 this->classname_ = classname; 159 this->varname_ = varname; 160 this->type_ = VT_Double; 161 162 ConvertValue(&this->defvalueString_, defvalue, std::string("0.000000")); // Try to convert the default-value to a string 163 this->searchConfigFileLine(); // Search the entry in the config-file 164 165 std::string valueString = this->parseValueString(); // Parses the value string from the config-file-entry 166 if (!this->parseSting(valueString, defvalue)) // Try to convert the string to a value 167 this->resetConfigFileEntry(); // The conversion failed 168 } 169 170 /** 171 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable. 172 @param value This is only needed to determine the right type. 173 @param classname The name of the class the variable belongs to 174 @param varname The name of the variable 175 @param defvalue The default-value 176 */ 177 ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, long double defvalue) 178 { 179 this->bAddedDescription_ = false; 180 this->classname_ = classname; 181 this->varname_ = varname; 182 this->type_ = VT_LongDouble; 183 184 ConvertValue(&this->defvalueString_, defvalue, std::string("0.000000")); // Try to convert the default-value to a string 185 this->searchConfigFileLine(); // Search the entry in the config-file 186 187 std::string valueString = this->parseValueString(); // Parses the value string from the config-file-entry 188 if (!this->parseSting(valueString, defvalue)) // Try to convert the string to a value 189 this->resetConfigFileEntry(); // The conversion failed 190 } 191 192 /** 193 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable. 194 @param value This is only needed to determine the right type. 195 @param classname The name of the class the variable belongs to 196 @param varname The name of the variable 197 @param defvalue The default-value 198 */ 199 ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, bool defvalue) 200 { 201 this->bAddedDescription_ = false; 202 this->classname_ = classname; 203 this->varname_ = varname; 204 this->type_ = VT_Bool; 205 206 // Convert the default-value from bool to string 207 if (defvalue) 208 this->defvalueString_ = "true"; 209 else 210 this->defvalueString_ = "false"; 211 212 this->searchConfigFileLine(); // Search the entry in the config-file 213 std::string valueString = this->parseValueString(); // Parses the value string from the config-file-entry 214 if (!this->parseSting(valueString, defvalue)) // Try to convert the string to a value 215 this->resetConfigFileEntry(); // The conversion failed 216 } 217 218 /** 219 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable. 220 @param value This is only needed to determine the right type. 221 @param classname The name of the class the variable belongs to 222 @param varname The name of the variable 223 @param defvalue The default-value 224 */ 225 ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, const std::string& defvalue) 226 { 227 this->bAddedDescription_ = false; 228 this->classname_ = classname; 229 this->varname_ = varname; 230 this->type_ = VT_String; 231 232 this->defvalueString_ = "\"" + defvalue + "\""; // Convert the string to a "config-file-string" with quotes 233 this->searchConfigFileLine(); // Search the entry in the config-file 234 std::string valueString = this->parseValueString(false); // Parses the value string from the config-file-entry 235 if (!this->parseSting(valueString, defvalue)) // Try to convert the string to a value 236 this->resetConfigFileEntry(); // The conversion failed 237 } 238 239 /** 240 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable. 241 @param value This is only needed to determine the right type. 242 @param classname The name of the class the variable belongs to 243 @param varname The name of the variable 244 @param defvalue The default-value 245 */ 246 ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, const char* defvalue) 247 { 248 this->bAddedDescription_ = false; 249 this->classname_ = classname; 250 this->varname_ = varname; 251 this->type_ = VT_ConstChar; 252 253 this->defvalueString_ = "\"" + std::string(defvalue) + "\""; // Convert the string to a "config-file-string" with quotes 254 this->searchConfigFileLine(); // Search the entry in the config-file 255 std::string valueString = this->parseValueString(false); // Parses the value string from the config-file-entry 256 if (!this->parseSting(valueString, defvalue)) // Try to convert the string to a value 257 this->resetConfigFileEntry(); // The conversion failed 258 } 259 260 /** 261 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable. 262 @param value This is only needed to determine the right type. 263 @param classname The name of the class the variable belongs to 264 @param varname The name of the variable 265 @param defvalue The default-value 266 */ 267 ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, Vector2 defvalue) 268 { 269 this->bAddedDescription_ = false; 270 this->classname_ = classname; 271 this->varname_ = varname; 272 this->type_ = VT_Vector2; 273 274 // Try to convert the default-value from Vector2 to string 275 std::ostringstream ostream; 276 if (ostream << "(" << defvalue.x << "," << defvalue.y << ")") 277 this->defvalueString_ = ostream.str(); 278 else 279 this->defvalueString_ = "(0,0)"; 280 281 this->searchConfigFileLine(); // Search the entry in the config-file 282 std::string valueString = this->parseValueString(); // Parses the value string from the config-file-entry 283 if (!this->parseSting(valueString, defvalue)) // Try to convert the string to a value 284 this->resetConfigFileEntry(); // The conversion failed 285 } 286 287 /** 288 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable. 289 @param value This is only needed to determine the right type. 290 @param classname The name of the class the variable belongs to 291 @param varname The name of the variable 292 @param defvalue The default-value 293 */ 294 ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, Vector3 defvalue) 295 { 296 this->bAddedDescription_ = false; 297 this->classname_ = classname; 298 this->varname_ = varname; 299 this->type_ = VT_Vector3; 300 301 // Try to convert the default-value from Vector3 to string 302 std::ostringstream ostream; 303 if (ostream << "(" << defvalue.x << "," << defvalue.y << "," << defvalue.z << ")") 304 this->defvalueString_ = ostream.str(); 305 else 306 this->defvalueString_ = "(0,0,0)"; 307 308 this->searchConfigFileLine(); // Search the entry in the config-file 309 std::string valueString = this->parseValueString(); // Parses the value string from the config-file-entry 310 if (!this->parseSting(valueString, defvalue)) // Try to convert the string to a value 311 this->resetConfigFileEntry(); // The conversion failed 312 } 313 314 /** 315 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable. 316 @param value This is only needed to determine the right type. 317 @param classname The name of the class the variable belongs to 318 @param varname The name of the variable 319 @param defvalue The default-value 320 */ 321 ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, ColourValue defvalue) 322 { 323 this->bAddedDescription_ = false; 324 this->classname_ = classname; 325 this->varname_ = varname; 326 this->type_ = VT_ColourValue; 327 328 // Try to convert the default-value from ColourValue to string 329 std::ostringstream ostream; 330 if (ostream << "(" << defvalue.r << "," << defvalue.g << "," << defvalue.b << "," << defvalue.a << ")") 331 this->defvalueString_ = ostream.str(); 332 else 333 this->defvalueString_ = "(0,0,0,0)"; 334 335 this->searchConfigFileLine(); // Search the entry in the config-file 336 std::string valueString = this->parseValueString(); // Parses the value string from the config-file-entry 337 if (!this->parseSting(valueString, defvalue)) // Try to convert the string to a value 338 this->resetConfigFileEntry(); // The conversion failed 66 @brief Converts a value to a string. 67 @param output The string to write to 68 @param input The value to convert 69 @return True if the converson was successful 70 */ 71 bool ConfigValueContainer::valueToString(std::string* output, MultiTypeMath& input) 72 { 73 if (input.getType() == MT_int) 74 return ConvertValue(output, input.getInt(), std::string("0")); 75 else if (input.getType() == MT_uint) 76 return ConvertValue(output, input.getUnsignedInt(), std::string("0")); 77 else if (input.getType() == MT_char) 78 return ConvertValue(output, (int)input.getChar(), std::string("0")); 79 else if (input.getType() == MT_uchar) 80 return ConvertValue(output, (unsigned int)input.getUnsignedChar(), std::string("0")); 81 else if (input.getType() == MT_short) 82 return ConvertValue(output, input.getShort(), std::string("0")); 83 else if (input.getType() == MT_ushort) 84 return ConvertValue(output, input.getUnsignedShort(), std::string("0")); 85 else if (input.getType() == MT_long) 86 return ConvertValue(output, input.getLong(), std::string("0")); 87 else if (input.getType() == MT_ulong) 88 return ConvertValue(output, input.getUnsignedLong(), std::string("0")); 89 else if (input.getType() == MT_float) 90 return ConvertValue(output, input.getFloat(), std::string("0.000000")); 91 else if (input.getType() == MT_double) 92 return ConvertValue(output, input.getDouble(), std::string("0.000000")); 93 else if (input.getType() == MT_longdouble) 94 return ConvertValue(output, input.getChar(), std::string("0.000000")); 95 else if (input.getType() == MT_bool) 96 { 97 if (input.getBool()) 98 (*output) = "true"; 99 else 100 (*output) = "false"; 101 102 return true; 103 } 104 else if (input.getType() == MT_constchar) 105 { 106 (*output) = "\"" + input.getString() + "\""; 107 return true; 108 } 109 else if (input.getType() == MT_string) 110 { 111 (*output) = "\"" + input.getString() + "\""; 112 return true; 113 } 114 else if (input.getType() == MT_vector2) 115 { 116 std::ostringstream ostream; 117 if (ostream << "(" << input.getVector2().x << "," << input.getVector2().y << ")") 118 { 119 (*output) = ostream.str(); 120 return true; 121 } 122 else 123 { 124 (*output) = "(0,0)"; 125 return false; 126 } 127 } 128 else if (input.getType() == MT_vector3) 129 { 130 std::ostringstream ostream; 131 if (ostream << "(" << input.getVector3().x << "," << input.getVector3().y << "," << input.getVector3().z << ")") 132 { 133 (*output) = ostream.str(); 134 return true; 135 } 136 else 137 { 138 (*output) = "(0,0,0)"; 139 return false; 140 } 141 } 142 else if (input.getType() == MT_colourvalue) 143 { 144 std::ostringstream ostream; 145 if (ostream << "(" << input.getColourValue().r << "," << input.getColourValue().g << "," << input.getColourValue().b << "," << input.getColourValue().a << ")") 146 { 147 (*output) = ostream.str(); 148 return true; 149 } 150 else 151 { 152 (*output) = "(0,0,0,0)"; 153 return false; 154 } 155 } 156 else if (input.getType() == MT_quaternion) 157 { 158 std::ostringstream ostream; 159 if (ostream << "(" << input.getQuaternion().w << "," << input.getQuaternion().x << "," << input.getQuaternion().y << "," << input.getQuaternion().z << ")") 160 { 161 (*output) = ostream.str(); 162 return true; 163 } 164 else 165 { 166 (*output) = "(0,0,0,0)"; 167 return false; 168 } 169 } 170 else if (input.getType() == MT_radian) 171 return ConvertValue(output, input.getRadian(), std::string("0.000000")); 172 else if (input.getType() == MT_degree) 173 return ConvertValue(output, input.getDegree(), std::string("0.000000")); 174 175 return false; 339 176 } 340 177 … … 344 181 @return True if the string was successfully parsed 345 182 */ 346 bool ConfigValueContainer::parseSting(const std::string& input) 347 { 348 if (this->type_ == ConfigValueContainer::VT_Int) 349 return this->parseSting(input, this->value_.value_int_); 350 else if (this->type_ == ConfigValueContainer::VT_uInt) 351 return this->parseSting(input, this->value_.value_uint_); 352 else if (this->type_ == ConfigValueContainer::VT_Char) 353 return this->parseSting(input, this->value_.value_char_); 354 else if (this->type_ == ConfigValueContainer::VT_uChar) 355 return this->parseSting(input, this->value_.value_uchar_); 356 else if (this->type_ == ConfigValueContainer::VT_Float) 357 return this->parseSting(input, this->value_.value_float_); 358 else if (this->type_ == ConfigValueContainer::VT_Double) 359 return this->parseSting(input, this->value_.value_double_); 360 else if (this->type_ == ConfigValueContainer::VT_LongDouble) 361 return this->parseSting(input, this->value_.value_long_double_); 362 else if (this->type_ == ConfigValueContainer::VT_Bool) 363 return this->parseSting(input, this->value_.value_bool_); 364 else if (this->type_ == ConfigValueContainer::VT_String) 365 return this->parseSting(input, this->value_string_); 366 else if (this->type_ == ConfigValueContainer::VT_ConstChar) 367 return this->parseSting(input, this->value_string_); 368 else if (this->type_ == ConfigValueContainer::VT_Vector2) 369 return this->parseSting(input, this->value_vector2_); 370 else if (this->type_ == ConfigValueContainer::VT_Vector3) 371 return this->parseSting(input, this->value_vector3_); 372 else if (this->type_ == ConfigValueContainer::VT_ColourValue) 373 return this->parseSting(input, this->value_colourvalue_); 183 bool ConfigValueContainer::parseString(const std::string& input, MultiTypeMath& defvalue) 184 { 185 if (defvalue.getType() == MT_int) 186 return this->parseString(input, defvalue.getInt()); 187 else if (defvalue.getType() == MT_uint) 188 return this->parseString(input, defvalue.getUnsignedInt()); 189 else if (defvalue.getType() == MT_char) 190 return this->parseString(input, defvalue.getChar()); 191 else if (defvalue.getType() == MT_uchar) 192 return this->parseString(input, defvalue.getUnsignedChar()); 193 else if (defvalue.getType() == MT_short) 194 return this->parseString(input, defvalue.getShort()); 195 else if (defvalue.getType() == MT_ushort) 196 return this->parseString(input, defvalue.getUnsignedShort()); 197 else if (defvalue.getType() == MT_long) 198 return this->parseString(input, defvalue.getLong()); 199 else if (defvalue.getType() == MT_ulong) 200 return this->parseString(input, defvalue.getUnsignedLong()); 201 else if (defvalue.getType() == MT_float) 202 return this->parseString(input, defvalue.getFloat()); 203 else if (defvalue.getType() == MT_double) 204 return this->parseString(input, defvalue.getDouble()); 205 else if (defvalue.getType() == MT_longdouble) 206 return this->parseString(input, defvalue.getLongDouble()); 207 else if (defvalue.getType() == MT_bool) 208 return this->parseString(input, defvalue.getBool()); 209 else if (defvalue.getType() == MT_constchar) 210 return this->parseString(input, defvalue.getString()); 211 else if (defvalue.getType() == MT_string) 212 return this->parseString(input, defvalue.getString()); 213 else if (defvalue.getType() == MT_vector2) 214 return this->parseString(input, defvalue.getVector2()); 215 else if (defvalue.getType() == MT_vector3) 216 return this->parseString(input, defvalue.getVector3()); 217 else if (defvalue.getType() == MT_colourvalue) 218 return this->parseString(input, defvalue.getColourValue()); 219 else if (defvalue.getType() == MT_quaternion) 220 return this->parseString(input, defvalue.getQuaternion()); 221 else if (defvalue.getType() == MT_radian) 222 return this->parseString(input, defvalue.getRadian()); 223 else if (defvalue.getType() == MT_degree) 224 return this->parseString(input, defvalue.getDegree()); 374 225 375 226 return false; … … 382 233 @return True if the string was successfully parsed 383 234 */ 384 bool ConfigValueContainer::parseSting(const std::string& input, int defvalue) 385 { 386 return ConvertValue(&this->value_.value_int_, input, defvalue); 235 bool ConfigValueContainer::parseString(const std::string& input, int defvalue) 236 { 237 int temp; 238 bool success = ConvertValue(&temp, input, defvalue); 239 this->value_.setValue(temp); 240 return success; 387 241 } 388 242 … … 393 247 @return True if the string was successfully parsed 394 248 */ 395 bool ConfigValueContainer::parseSting(const std::string& input, unsigned int defvalue) 396 { 397 return ConvertValue(&this->value_.value_uint_, input, defvalue); 249 bool ConfigValueContainer::parseString(const std::string& input, unsigned int defvalue) 250 { 251 unsigned int temp; 252 bool success = ConvertValue(&temp, input, defvalue); 253 this->value_.setValue(temp); 254 return success; 398 255 } 399 256 … … 404 261 @return True if the string was successfully parsed 405 262 */ 406 bool ConfigValueContainer::parseSt ing(const std::string& input, char defvalue)263 bool ConfigValueContainer::parseString(const std::string& input, char defvalue) 407 264 { 408 265 // I used value_int_ instead of value_char_ to avoid number <-> char confusion in the config-file 409 return ConvertValue(&this->value_.value_int_, input, (int)defvalue); 266 int temp; 267 bool success = ConvertValue(&temp, input, (int)defvalue); 268 this->value_.setValue((char)temp); 269 return success; 410 270 } 411 271 … … 416 276 @return True if the string was successfully parsed 417 277 */ 418 bool ConfigValueContainer::parseSt ing(const std::string& input, unsigned char defvalue)278 bool ConfigValueContainer::parseString(const std::string& input, unsigned char defvalue) 419 279 { 420 280 // I used value_uint_ instead of value_uchar_ to avoid number <-> char confusion in the config-file 421 return ConvertValue(&this->value_.value_uint_, input, (unsigned int)defvalue); 281 unsigned int temp; 282 bool success = ConvertValue(&temp, input, (unsigned int)defvalue); 283 this->value_.setValue((unsigned char)temp); 284 return success; 285 } 286 287 /** 288 @brief Parses a given std::string into a value of the type short and assigns it to the right variable. If the conversion failed, the default-value gets assigned. 289 @param input The string to convert 290 @param defvalue The default-value 291 @return True if the string was successfully parsed 292 */ 293 bool ConfigValueContainer::parseString(const std::string& input, short defvalue) 294 { 295 short temp; 296 bool success = ConvertValue(&temp, input, defvalue); 297 this->value_.setValue(temp); 298 return success; 299 } 300 301 /** 302 @brief Parses a given std::string into a value of the type unsigned short and assigns it to the right variable. If the conversion failed, the default-value gets assigned. 303 @param input The string to convert 304 @param defvalue The default-value 305 @return True if the string was successfully parsed 306 */ 307 bool ConfigValueContainer::parseString(const std::string& input, unsigned short defvalue) 308 { 309 unsigned short temp; 310 bool success = ConvertValue(&temp, input, defvalue); 311 this->value_.setValue(temp); 312 return success; 313 } 314 315 /** 316 @brief Parses a given std::string into a value of the type long and assigns it to the right variable. If the conversion failed, the default-value gets assigned. 317 @param input The string to convert 318 @param defvalue The default-value 319 @return True if the string was successfully parsed 320 */ 321 bool ConfigValueContainer::parseString(const std::string& input, long defvalue) 322 { 323 long temp; 324 bool success = ConvertValue(&temp, input, defvalue); 325 this->value_.setValue(temp); 326 return success; 327 } 328 329 /** 330 @brief Parses a given std::string into a value of the type unsigned long and assigns it to the right variable. If the conversion failed, the default-value gets assigned. 331 @param input The string to convert 332 @param defvalue The default-value 333 @return True if the string was successfully parsed 334 */ 335 bool ConfigValueContainer::parseString(const std::string& input, unsigned long defvalue) 336 { 337 unsigned long temp; 338 bool success = ConvertValue(&temp, input, defvalue); 339 this->value_.setValue(temp); 340 return success; 422 341 } 423 342 … … 428 347 @return True if the string was successfully parsed 429 348 */ 430 bool ConfigValueContainer::parseSting(const std::string& input, float defvalue) 431 { 432 return ConvertValue(&this->value_.value_float_, input, defvalue); 349 bool ConfigValueContainer::parseString(const std::string& input, float defvalue) 350 { 351 float temp; 352 bool success = ConvertValue(&temp, input, defvalue); 353 this->value_.setValue(temp); 354 return success; 433 355 } 434 356 … … 439 361 @return True if the string was successfully parsed 440 362 */ 441 bool ConfigValueContainer::parseSting(const std::string& input, double defvalue) 442 { 443 return ConvertValue(&this->value_.value_double_, input, defvalue); 363 bool ConfigValueContainer::parseString(const std::string& input, double defvalue) 364 { 365 double temp; 366 bool success = ConvertValue(&temp, input, defvalue); 367 this->value_.setValue(temp); 368 return success; 444 369 } 445 370 … … 450 375 @return True if the string was successfully parsed 451 376 */ 452 bool ConfigValueContainer::parseSting(const std::string& input, long double defvalue) 453 { 454 return ConvertValue(&this->value_.value_long_double_, input, defvalue); 377 bool ConfigValueContainer::parseString(const std::string& input, long double defvalue) 378 { 379 long double temp; 380 bool success = ConvertValue(&temp, input, defvalue); 381 this->value_.setValue(temp); 382 return success; 455 383 } 456 384 … … 461 389 @return True if the string was successfully parsed 462 390 */ 463 bool ConfigValueContainer::parseSt ing(const std::string& input, bool defvalue)391 bool ConfigValueContainer::parseString(const std::string& input, bool defvalue) 464 392 { 465 393 // Try to parse the value-string - is it a word? … … 468 396 || input.find("yes") < input.size() 469 397 || input.find("Yes") < input.size()) 470 this->value_. value_bool_ = true;398 this->value_.setValue(true); 471 399 else if (input.find("false") < input.size() 472 400 || input.find("False") < input.size() 473 401 || input.find("no") < input.size() 474 402 || input.find("No") < input.size()) 475 this->value_. value_bool_ = false;403 this->value_.setValue(false); 476 404 else 477 405 { 478 406 // Its not a known word - is it a number? 479 return ConvertValue(&this->value_.value_bool_, input, defvalue); 407 bool temp; 408 bool success = ConvertValue(&temp, input, defvalue); 409 this->value_.setValue(temp); 410 return success; 480 411 } 481 412 … … 489 420 @return True if the string was successfully parsed 490 421 */ 491 bool ConfigValueContainer::parseSt ing(const std::string& input, const std::string& defvalue)422 bool ConfigValueContainer::parseString(const std::string& input, const std::string& defvalue) 492 423 { 493 424 // Strip the quotes … … 499 430 { 500 431 // It was - get the string between the quotes 501 this->value_ string_ = input.substr(pos1, pos2 - pos1);432 this->value_.setValue(input.substr(pos1, pos2 - pos1)); 502 433 return true; 503 434 } 504 435 505 436 // It wasn't - use the default-value and restore the entry in the config-file. 506 this->value_ string_ = defvalue;437 this->value_.setValue(defvalue); 507 438 return false; 508 439 } … … 514 445 @return True if the string was successfully parsed 515 446 */ 516 bool ConfigValueContainer::parseSt ing(const std::string& input, const char* defvalue)447 bool ConfigValueContainer::parseString(const std::string& input, const char* defvalue) 517 448 { 518 449 // Strip the quotes … … 524 455 { 525 456 // It was - get the string between the quotes 526 this->value_ string_ = input.substr(pos1, pos2 - pos1);457 this->value_.setValue(input.substr(pos1, pos2 - pos1)); 527 458 return true; 528 459 } 529 460 530 461 // It wasn't - use the default-value and restore the entry in the config-file. 531 this->value_ string_ = defvalue;462 this->value_.setValue(defvalue); 532 463 return false; 533 464 } … … 539 470 @return True if the string was successfully parsed 540 471 */ 541 bool ConfigValueContainer::parseSt ing(const std::string& input, const Vector2& defvalue)472 bool ConfigValueContainer::parseString(const std::string& input, const Vector2& defvalue) 542 473 { 543 474 // Strip the value-string … … 549 480 { 550 481 std::vector<std::string> tokens = tokenize(input.substr(pos1, pos2 - pos1), ","); 551 if (!ConvertValue(&this->value_ vector2_.x, tokens[0]))552 { 553 this->value_ vector2_ = defvalue;554 return false; 555 } 556 if (!ConvertValue(&this->value_ vector2_.y, tokens[1]))557 { 558 this->value_ vector2_ = defvalue;482 if (!ConvertValue(&this->value_.getVector2().x, tokens[0])) 483 { 484 this->value_.setValue(defvalue); 485 return false; 486 } 487 if (!ConvertValue(&this->value_.getVector2().y, tokens[1])) 488 { 489 this->value_.setValue(defvalue); 559 490 return false; 560 491 } … … 563 494 } 564 495 565 this->value_ vector2_ = defvalue;496 this->value_.setValue(defvalue); 566 497 return false; 567 498 } … … 573 504 @return True if the string was successfully parsed 574 505 */ 575 bool ConfigValueContainer::parseSt ing(const std::string& input, const Vector3& defvalue)506 bool ConfigValueContainer::parseString(const std::string& input, const Vector3& defvalue) 576 507 { 577 508 // Strip the value-string … … 583 514 { 584 515 std::vector<std::string> tokens = tokenize(input.substr(pos1, pos2 - pos1), ","); 585 if (!ConvertValue(&this->value_ vector3_.x, tokens[0]))586 { 587 this->value_ vector3_ = defvalue;588 return false; 589 } 590 if (!ConvertValue(&this->value_ vector3_.y, tokens[1]))591 { 592 this->value_ vector3_ = defvalue;593 return false; 594 } 595 if (!ConvertValue(&this->value_ vector3_.z, tokens[2]))596 { 597 this->value_ vector3_ = defvalue;516 if (!ConvertValue(&this->value_.getVector3().x, tokens[0])) 517 { 518 this->value_.setValue(defvalue); 519 return false; 520 } 521 if (!ConvertValue(&this->value_.getVector3().y, tokens[1])) 522 { 523 this->value_.setValue(defvalue); 524 return false; 525 } 526 if (!ConvertValue(&this->value_.getVector3().z, tokens[2])) 527 { 528 this->value_.setValue(defvalue); 598 529 return false; 599 530 } … … 602 533 } 603 534 604 this->value_ vector3_ = defvalue;535 this->value_.setValue(defvalue); 605 536 return false; 606 537 } … … 612 543 @return True if the string was successfully parsed 613 544 */ 614 bool ConfigValueContainer::parseSt ing(const std::string& input, const ColourValue& defvalue)545 bool ConfigValueContainer::parseString(const std::string& input, const ColourValue& defvalue) 615 546 { 616 547 // Strip the value-string … … 622 553 { 623 554 std::vector<std::string> tokens = tokenize(input.substr(pos1, pos2 - pos1), ","); 624 if (!ConvertValue(&this->value_ colourvalue_.r, tokens[0]))625 { 626 this->value_ colourvalue_ = defvalue;627 return false; 628 } 629 if (!ConvertValue(&this->value_ colourvalue_.g, tokens[1]))630 { 631 this->value_ colourvalue_ = defvalue;632 return false; 633 } 634 if (!ConvertValue(&this->value_ colourvalue_.b, tokens[2]))635 { 636 this->value_ colourvalue_ = defvalue;637 return false; 638 } 639 if (!ConvertValue(&this->value_ colourvalue_.a, tokens[3]))640 { 641 this->value_ colourvalue_ = defvalue;555 if (!ConvertValue(&this->value_.getColourValue().r, tokens[0])) 556 { 557 this->value_.setValue(defvalue); 558 return false; 559 } 560 if (!ConvertValue(&this->value_.getColourValue().g, tokens[1])) 561 { 562 this->value_.setValue(defvalue); 563 return false; 564 } 565 if (!ConvertValue(&this->value_.getColourValue().b, tokens[2])) 566 { 567 this->value_.setValue(defvalue); 568 return false; 569 } 570 if (!ConvertValue(&this->value_.getColourValue().a, tokens[3])) 571 { 572 this->value_.setValue(defvalue); 642 573 return false; 643 574 } … … 646 577 } 647 578 648 this->value_ colourvalue_ = defvalue;579 this->value_.setValue(defvalue); 649 580 return false; 581 } 582 583 /** 584 @brief Parses a given std::string into a value of the type Quaternion and assigns it to the right variable. If the conversion failed, the default-value gets assigned. 585 @param input The string to convert 586 @param defvalue The default-value 587 @return True if the string was successfully parsed 588 */ 589 bool ConfigValueContainer::parseString(const std::string& input, const Quaternion& defvalue) 590 { 591 // Strip the value-string 592 unsigned int pos1 = input.find("(") + 1; 593 unsigned int pos2 = input.find(")", pos1); 594 595 // Try to convert the stripped value-string to Vector3 596 if (pos1 < input.length() && pos2 < input.length() && pos1 < pos2) 597 { 598 std::vector<std::string> tokens = tokenize(input.substr(pos1, pos2 - pos1), ","); 599 if (!ConvertValue(&this->value_.getQuaternion().w, tokens[0])) 600 { 601 this->value_.setValue(defvalue); 602 return false; 603 } 604 if (!ConvertValue(&this->value_.getQuaternion().x, tokens[1])) 605 { 606 this->value_.setValue(defvalue); 607 return false; 608 } 609 if (!ConvertValue(&this->value_.getQuaternion().y, tokens[2])) 610 { 611 this->value_.setValue(defvalue); 612 return false; 613 } 614 if (!ConvertValue(&this->value_.getQuaternion().z, tokens[3])) 615 { 616 this->value_.setValue(defvalue); 617 return false; 618 } 619 620 return true; 621 } 622 623 this->value_.setValue(defvalue); 624 return false; 625 } 626 627 /** 628 @brief Parses a given std::string into a value of the type long double and assigns it to the right variable. If the conversion failed, the default-value gets assigned. 629 @param input The string to convert 630 @param defvalue The default-value 631 @return True if the string was successfully parsed 632 */ 633 bool ConfigValueContainer::parseString(const std::string& input, const Radian& defvalue) 634 { 635 return ConvertValue(&this->value_.getRadian(), input, defvalue); 636 } 637 638 /** 639 @brief Parses a given std::string into a value of the type long double and assigns it to the right variable. If the conversion failed, the default-value gets assigned. 640 @param input The string to convert 641 @param defvalue The default-value 642 @return True if the string was successfully parsed 643 */ 644 bool ConfigValueContainer::parseString(const std::string& input, const Degree& defvalue) 645 { 646 return ConvertValue(&this->value_.getDegree(), input, defvalue); 650 647 } 651 648 … … 664 661 void ConfigValueContainer::resetConfigValue() 665 662 { 666 this->parseSt ing(this->defvalueString_);663 this->parseString(this->defvalueString_, this->value_); 667 664 this->resetConfigFileEntry(); 668 665 } … … 837 834 838 835 /** 839 @returns a list, containing all entrys in the config-file. 836 @brief Rreturns a list, containing all entrys in the config-file. 837 @return The list 840 838 */ 841 839 std::list<std::string>& ConfigValueContainer::getConfigFileLines() … … 879 877 if (!file.is_open()) 880 878 { 879 COUT(1) << "An error occurred in ConfigValueContainer.cc:" << std::endl; 881 880 COUT(1) << "Error: Couldn't open config-file " << filename << " to read the config values!" << std::endl; 882 881 return; … … 925 924 if (!file.is_open()) 926 925 { 926 COUT(1) << "An error occurred in ConfigValueContainer.cc:" << std::endl; 927 927 COUT(1) << "Error: Couldn't open config-file " << filename << " to write the config values!" << std::endl; 928 928 return; … … 948 948 { 949 949 this->description_ = std::string("ConfigValueDescription::" + this->classname_ + "::" + this->varname_); 950 Language::getLanguage().addEntry(this->description_, description);950 AddLanguageEntry(this->description_, description); 951 951 this->bAddedDescription_ = true; 952 952 } 953 953 } 954 955 /** 956 @brief Returns the description of the config-value. 957 @return The description 958 */ 959 const std::string& ConfigValueContainer::getDescription() const 960 { 961 return GetLocalisation(this->description_); 962 } 954 963 } -
code/trunk/src/orxonox/core/ConfigValueContainer.h
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 @file ConfigValueContainer.h 30 30 @brief Definition of the ConfigValueContainer class. … … 49 49 50 50 #include "util/Math.h" 51 #include " Language.h"51 #include "util/MultiTypeMath.h" 52 52 53 53 namespace orxonox … … 72 72 { 73 73 public: 74 enum VariableType 75 { 76 VT_Int, 77 VT_uInt, 78 VT_Char, 79 VT_uChar, 80 VT_Float, 81 VT_Double, 82 VT_LongDouble, 83 VT_Bool, 84 VT_ConstChar, 85 VT_String, 86 VT_Vector2, 87 VT_Vector3, 88 VT_ColourValue 89 }; 74 ConfigValueContainer(const std::string& classname, const std::string& varname, MultiTypeMath defvalue); 90 75 91 ConfigValueContainer(const std::string& classname, const std::string& varname, int defvalue); 92 ConfigValueContainer(const std::string& classname, const std::string& varname, unsigned int defvalue); 93 ConfigValueContainer(const std::string& classname, const std::string& varname, char defvalue); 94 ConfigValueContainer(const std::string& classname, const std::string& varname, unsigned char defvalue); 95 ConfigValueContainer(const std::string& classname, const std::string& varname, float defvalue); 96 ConfigValueContainer(const std::string& classname, const std::string& varname, double defvalue); 97 ConfigValueContainer(const std::string& classname, const std::string& varname, long double defvalue); 98 ConfigValueContainer(const std::string& classname, const std::string& varname, bool defvalue); 99 ConfigValueContainer(const std::string& classname, const std::string& varname, const std::string& defvalue); 100 ConfigValueContainer(const std::string& classname, const std::string& varname, const char* defvalue); 101 ConfigValueContainer(const std::string& classname, const std::string& varname, Vector2 defvalue); 102 ConfigValueContainer(const std::string& classname, const std::string& varname, Vector3 defvalue); 103 ConfigValueContainer(const std::string& classname, const std::string& varname, ColourValue defvalue); 104 105 /** @returns the value. @param value This is only needed to determine the right type. */ 106 inline ConfigValueContainer& getValue(int& value) { value = this->value_.value_int_; return *this; } 107 /** @returns the value. @param value This is only needed to determine the right type. */ 108 inline ConfigValueContainer& getValue(unsigned int& value) { value = this->value_.value_uint_; return *this; } 109 /** @returns the value. @param value This is only needed to determine the right type. */ 110 inline ConfigValueContainer& getValue(char& value) { value = this->value_.value_char_; return *this; } 111 /** @returns the value. @param value This is only needed to determine the right type. */ 112 inline ConfigValueContainer& getValue(unsigned char& value) { value = this->value_.value_uchar_; return *this; } 113 /** @returns the value. @param value This is only needed to determine the right type. */ 114 inline ConfigValueContainer& getValue(float& value) { value = this->value_.value_float_; return *this; } 115 /** @returns the value. @param value This is only needed to determine the right type. */ 116 inline ConfigValueContainer& getValue(double& value) { value = this->value_.value_double_; return *this; } 117 /** @returns the value. @param value This is only needed to determine the right type. */ 118 inline ConfigValueContainer& getValue(long double& value) { value = this->value_.value_long_double_; return *this; } 119 /** @returns the value. @param value This is only needed to determine the right type. */ 120 inline ConfigValueContainer& getValue(bool& value) { value = this->value_.value_bool_; return *this; } 121 /** @returns the value. @param value This is only needed to determine the right type. */ 122 inline ConfigValueContainer& getValue(std::string& value) { value = this->value_string_; return *this; } 123 /** @returns the value. @param value This is only needed to determine the right type. */ 124 inline ConfigValueContainer& getValue(const char* value) { value = this->value_string_.c_str(); return *this; } 125 /** @returns the value. @param value This is only needed to determine the right type. */ 126 inline ConfigValueContainer& getValue(Vector2& value) { value = this->value_vector2_; return *this; } 127 /** @returns the value. @param value This is only needed to determine the right type. */ 128 inline ConfigValueContainer& getValue(Vector3& value) { value = this->value_vector3_; return *this; } 129 /** @returns the value. @param value This is only needed to determine the right type. */ 130 inline ConfigValueContainer& getValue(ColourValue& value) { value = this->value_colourvalue_; return *this; } 76 /** @brief Returns the configured value. @param value This is only needed to determine the right type. @return The value */ 77 /* template <typename T> 78 inline ConfigValueContainer& getValue(T& value) { this->value_.getValue(value); return *this; } 79 */ 80 inline ConfigValueContainer& getValue(int* value) { this->value_.getValue(value); return *this; } 81 inline ConfigValueContainer& getValue(unsigned int* value) { this->value_.getValue(value); return *this; } 82 inline ConfigValueContainer& getValue(char* value) { this->value_.getValue(value); return *this; } 83 inline ConfigValueContainer& getValue(unsigned char* value) { this->value_.getValue(value); return *this; } 84 inline ConfigValueContainer& getValue(short* value) { this->value_.getValue(value); return *this; } 85 inline ConfigValueContainer& getValue(unsigned short* value) { this->value_.getValue(value); return *this; } 86 inline ConfigValueContainer& getValue(long* value) { this->value_.getValue(value); return *this; } 87 inline ConfigValueContainer& getValue(unsigned long* value) { this->value_.getValue(value); return *this; } 88 inline ConfigValueContainer& getValue(float* value) { this->value_.getValue(value); return *this; } 89 inline ConfigValueContainer& getValue(double* value) { this->value_.getValue(value); return *this; } 90 inline ConfigValueContainer& getValue(long double* value) { this->value_.getValue(value); return *this; } 91 inline ConfigValueContainer& getValue(bool* value) { this->value_.getValue(value); return *this; } 92 inline ConfigValueContainer& getValue(std::string* value) { this->value_.getValue(value); return *this; } 93 inline ConfigValueContainer& getValue(const char** value) { this->value_.getValue(value); return *this; } 94 inline ConfigValueContainer& getValue(Vector2* value) { this->value_.getValue(value); return *this; } 95 inline ConfigValueContainer& getValue(Vector3* value) { this->value_.getValue(value); return *this; } 96 inline ConfigValueContainer& getValue(ColourValue* value) { this->value_.getValue(value); return *this; } 97 inline ConfigValueContainer& getValue(Quaternion* value) { this->value_.getValue(value); return *this; } 98 inline ConfigValueContainer& getValue(Radian* value) { this->value_.getValue(value); return *this; } 99 inline ConfigValueContainer& getValue(Degree* value) { this->value_.getValue(value); return *this; } 131 100 132 101 void description(const std::string& description); 102 const std::string& getDescription() const; 133 103 134 bool parseSting(const std::string& input); 104 bool parseString(const std::string& input, MultiTypeMath& defvalue); 105 bool valueToString(std::string* output, MultiTypeMath& input); 135 106 void resetConfigFileEntry(); 136 107 void resetConfigValue(); … … 141 112 142 113 private: 143 bool parseSting(const std::string& input, int defvalue); 144 bool parseSting(const std::string& input, unsigned int defvalue); 145 bool parseSting(const std::string& input, char defvalue); 146 bool parseSting(const std::string& input, unsigned char defvalue); 147 bool parseSting(const std::string& input, float defvalue); 148 bool parseSting(const std::string& input, double defvalue); 149 bool parseSting(const std::string& input, long double defvalue); 150 bool parseSting(const std::string& input, bool defvalue); 151 bool parseSting(const std::string& input, const std::string& defvalue); 152 bool parseSting(const std::string& input, const char* defvalue); 153 bool parseSting(const std::string& input, const Vector2& defvalue); 154 bool parseSting(const std::string& input, const Vector3& defvalue); 155 bool parseSting(const std::string& input, const ColourValue& defvalue); 114 bool parseString(const std::string& input, int defvalue); 115 bool parseString(const std::string& input, unsigned int defvalue); 116 bool parseString(const std::string& input, char defvalue); 117 bool parseString(const std::string& input, unsigned char defvalue); 118 bool parseString(const std::string& input, short defvalue); 119 bool parseString(const std::string& input, unsigned short defvalue); 120 bool parseString(const std::string& input, long defvalue); 121 bool parseString(const std::string& input, unsigned long defvalue); 122 bool parseString(const std::string& input, float defvalue); 123 bool parseString(const std::string& input, double defvalue); 124 bool parseString(const std::string& input, long double defvalue); 125 bool parseString(const std::string& input, bool defvalue); 126 bool parseString(const std::string& input, const std::string& defvalue); 127 bool parseString(const std::string& input, const char* defvalue); 128 bool parseString(const std::string& input, const Vector2& defvalue); 129 bool parseString(const std::string& input, const Vector3& defvalue); 130 bool parseString(const std::string& input, const ColourValue& defvalue); 131 bool parseString(const std::string& input, const Quaternion& defvalue); 132 bool parseString(const std::string& input, const Radian& defvalue); 133 bool parseString(const std::string& input, const Degree& defvalue); 156 134 157 135 static std::list<std::string>& getConfigFileLines(); … … 167 145 std::string defvalueString_; //!< The string of the default-variable 168 146 169 union MultiType 170 { 171 int value_int_; //!< The value, if the variable is of the type int 172 unsigned int value_uint_; //!< The value, if the variable is of the type unsigned int 173 char value_char_; //!< The value, if the variable is of the type char 174 unsigned char value_uchar_; //!< The value, if the variable is of the type unsigned char 175 float value_float_; //!< The value, if the variable is of the type float 176 double value_double_; //!< The value, if the variable is of the type double 177 long double value_long_double_; //!< The value, if the variable is of the type long double 178 bool value_bool_; //!< The value, if the variable is of the type bool 179 } value_; //!< The value of the variable 180 181 std::string value_string_; //!< The value, if the variable is of the type string 182 Vector2 value_vector2_; //!< The value, if the variable is of the type Vector2 183 Vector3 value_vector3_; //!< The value, if the variable is of the type Vector3 184 ColourValue value_colourvalue_; //!< The value, if the variable is of the type ColourValue 147 MultiTypeMath value_; //!< The value 185 148 186 149 std::list<std::string>::iterator configFileLine_; //!< An iterator, pointing to the entry of the variable in the config-file 187 150 188 VariableType type_; //!< The type of the variable189 151 bool bAddedDescription_; //!< True if a description was added 190 LanguageEntry Name description_;//!< The description152 LanguageEntryLabel description_; //!< The description 191 153 }; 192 154 } -
code/trunk/src/orxonox/core/CoreIncludes.h
r790 r871 44 44 // All needed header-files 45 45 #include "Identifier.h" 46 #include "ClassManager.h" 46 47 #include "Factory.h" 47 48 #include "ClassFactory.h" … … 51 52 #include "Debug.h" 52 53 54 55 // All needed macros 53 56 /** 54 57 @brief Intern macro, containing the common parts of RegisterObject and RegisterRootObject. … … 57 60 */ 58 61 #define InternRegisterObject(ClassName, bRootClass) \ 59 this->setIdentifier(orxonox::Class Identifier<ClassName>::registerClass(this->getParents(), #ClassName, bRootClass)); \62 this->setIdentifier(orxonox::ClassManager<ClassName>::getIdentifier()->registerClass(this->getParents(), #ClassName, bRootClass)); \ 60 63 if (orxonox::Identifier::isCreatingHierarchy() && this->getParents()) \ 61 this->getParents()-> add(this->getIdentifier()); \62 orxonox::Class Identifier<ClassName>::addObject(this)64 this->getParents()->insert(this->getParents()->end(), this->getIdentifier()); \ 65 orxonox::ClassManager<ClassName>::getIdentifier()->addObject(this) 63 66 64 67 /** … … 68 71 #define InternRegisterRootObject(ClassName) \ 69 72 if (orxonox::Identifier::isCreatingHierarchy() && !this->getParents()) \ 70 this-> setParents(new orxonox::IdentifierList()); \73 this->createParents(); \ 71 74 InternRegisterObject(ClassName, true) 72 75 … … 76 79 */ 77 80 #define RegisterObject(ClassName) \ 78 COUT( 4) << "*** Register Object: " << #ClassName << std::endl; \81 COUT(5) << "*** Register Object: " << #ClassName << std::endl; \ 79 82 InternRegisterObject(ClassName, false) 80 83 … … 84 87 */ 85 88 #define RegisterRootObject(ClassName) \ 86 COUT( 4) << "*** Register Root-Object: " << #ClassName << std::endl; \89 COUT(5) << "*** Register Root-Object: " << #ClassName << std::endl; \ 87 90 InternRegisterRootObject(ClassName) 88 89 /**90 @brief Exports the necessary templates in order to make them available to all libraries.91 @param ClassName The name of the Class92 @param LibraryName The name of the Library93 */94 #define ExportClass(ClassName, LibraryName) \95 template class _##LibraryName##Export orxonox::ClassIdentifier<ClassName>; \96 template class _##LibraryName##Export orxonox::ObjectList<ClassName>; \97 template class _##LibraryName##Export orxonox::ClassFactory<ClassName>98 99 /**100 @brief Exports the necessary templates in order to make them available to all libraries.101 @param ClassName The name of the Class102 @param LibraryName The name of the Library103 */104 #define ExportAbstractClass(ClassName, LibraryName) \105 template class _##LibraryName##Export orxonox::ClassIdentifier<ClassName>; \106 template class _##LibraryName##Export orxonox::ObjectList<ClassName>107 91 108 92 /** … … 111 95 */ 112 96 #define Class(ClassName) \ 113 Class Identifier<ClassName>::getIdentifier()97 ClassManager<ClassName>::getIdentifier() 114 98 115 99 /** … … 137 121 { \ 138 122 container##varname = new orxonox::ConfigValueContainer(this->getIdentifier()->getName(), #varname, varname = defvalue); \ 139 this->getIdentifier()-> setConfigValueContainer(#varname, container##varname); \123 this->getIdentifier()->addConfigValueContainer(#varname, container##varname); \ 140 124 } \ 141 container##varname->getValue( varname)125 container##varname->getValue(&varname) 142 126 143 127 /** … … 150 134 { \ 151 135 container##varname##reset->resetConfigValue(); \ 152 container##varname##reset->getValue( varname); \136 container##varname##reset->getValue(&varname); \ 153 137 } \ 154 138 else \ -
code/trunk/src/orxonox/core/CorePrereqs.h
r790 r871 27 27 28 28 /** 29 @file OrxonoxPrereq.h30 @brief Contains all the necessary forward declarations for all classes, structs and enums.31 29 @file CorePrereq.h 30 @brief Contains all the necessary forward declarations for all classes, structs and enums. 31 */ 32 32 33 33 #ifndef _CorePrereqs_H__ 34 34 #define _CorePrereqs_H__ 35 36 #include <string> 35 37 36 38 #include "orxonox/OrxonoxPlatform.h" … … 63 65 namespace orxonox 64 66 { 67 typedef std::string LanguageEntryLabel; 68 65 69 class ArgReader; 66 70 class BaseFactory; … … 70 74 template <class T> 71 75 class ClassIdentifier; 76 template <class T> 77 class ClassManager; 78 class ClassTreeMask; 79 class ClassTreeMaskIterator; 80 class ClassTreeMaskNode; 72 81 class ConfigValueContainer; 73 82 class DebugLevel; 74 83 class Error; 84 class Executor; 75 85 class Factory; 76 86 class Identifier; 77 class IdentifierList; 78 class IdentifierListElement; 87 class IdentifierDistributor; 79 88 template <class T> 80 89 class Iterator; 81 90 class Language; 82 91 class LanguageEntry; 92 class Level; 83 93 class Loader; 84 94 class MetaObjectList; … … 93 103 template <class T> 94 104 class SubclassIdentifier; 105 template <class T, class O> 106 class XMLPortClassObjectContainer; 107 template <class T> 108 class XMLPortClassParamContainer; 109 class XMLPortObjectContainer; 110 class XMLPortParamContainer; 95 111 } 96 112 -
code/trunk/src/orxonox/core/Debug.h
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 * @file Debug.h 30 30 * @brief Handles the output for different verbose-modes. … … 55 55 #define ORX_PRINT_DEBUG_OUTPUT 1 // <-- fix that! should be a configurable setting 56 56 57 #define ORX_HARD_DEBUG_LEVEL ORX_ DEBUG57 #define ORX_HARD_DEBUG_LEVEL ORX_vDEBUG 58 58 //#define ORX_SOFT_DEBUG_LEVEL ORX_WARNING // <-- fix that! should be a configurable setting 59 59 -
code/trunk/src/orxonox/core/DebugLevel.cc
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 @file DebugLevel.cc 30 30 @brief Implementation of the DebugLevel class. … … 32 32 33 33 #include "DebugLevel.h" 34 #include "CoreIncludes.h" 34 35 35 36 namespace orxonox … … 99 100 100 101 /** 101 @returns the soft debug level, stored in the only existing instance of the DebugLevel class, configured in the config-file. 102 @brief Returns the soft debug level, stored in the only existing instance of the DebugLevel class, configured in the config-file. 103 @return The soft debug level 102 104 */ 103 105 int getSoftDebugLevel() -
code/trunk/src/orxonox/core/DebugLevel.h
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 @file DebugLevel.h 30 30 @brief Definition of the DebugLevel class. … … 41 41 #include "OrxonoxClass.h" 42 42 #include "OutputHandler.h" 43 #include "CoreIncludes.h"44 43 45 44 namespace orxonox … … 66 65 ConfigValueContainer* softDebugLevelContainer_; //!< The config value container for the debug level 67 66 }; 68 ExportAbstractClass(DebugLevel, Core);69 67 } 70 68 -
code/trunk/src/orxonox/core/Error.cc
r790 r871 25 25 * 26 26 */ 27 28 /** 29 @file Error.cc 30 @brief Implementation of the Error class. 31 */ 27 32 28 33 #include "Debug.h" -
code/trunk/src/orxonox/core/Error.h
r790 r871 26 26 */ 27 27 28 /** 29 @file Error.h 30 @brief Definition of the Error class. 31 */ 32 28 33 #ifndef _Error_H__ 29 34 #define _Error_H__ -
code/trunk/src/orxonox/core/Factory.cc
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 @file Factory.cc 30 30 @brief Implementation of the Factory class. … … 39 39 { 40 40 /** 41 @ returns the Identifier with a given name.41 @brief Returns the Identifier with a given name. 42 42 @param name The name of the wanted Identifier 43 @return The Identifier 43 44 */ 44 45 Identifier* Factory::getIdentifier(const std::string& name) … … 48 49 49 50 /** 50 @ returns the Identifier with a given network ID.51 @brief Returns the Identifier with a given network ID. 51 52 @param id The network ID of the wanted Identifier 53 @return The Identifier 52 54 */ 53 55 Identifier* Factory::getIdentifier(const unsigned int id) … … 84 86 void Factory::createClassHierarchy() 85 87 { 86 COUT(3) << "*** Factory ->Create class-hierarchy" << std::endl;88 COUT(3) << "*** Factory: Create class-hierarchy" << std::endl; 87 89 std::map<std::string, Identifier*>::iterator it; 88 90 it = getFactoryPointer()->identifierStringMap_.begin(); … … 95 97 } 96 98 (*getFactoryPointer()->identifierStringMap_.begin()).second->stopCreatingHierarchy(); 97 COUT(3) << "*** Factory ->Finished class-hierarchy creation" << std::endl;99 COUT(3) << "*** Factory: Finished class-hierarchy creation" << std::endl; 98 100 } 99 101 … … 107 109 return &theOneAndOnlyFactoryInstance; 108 110 } 111 112 /** 113 @brief Returns the begin-iterator of the factory-map. 114 @return The begin-iterator 115 */ 116 std::map<std::string, Identifier*>::const_iterator Factory::getFactoryBegin() 117 { 118 return Factory::getFactoryPointer()->identifierStringMap_.begin(); 119 } 120 121 /** 122 @brief Returns the end-iterator of the factory-map. 123 @return The end-iterator 124 */ 125 std::map<std::string, Identifier*>::const_iterator Factory::getFactoryEnd() 126 { 127 return Factory::getFactoryPointer()->identifierStringMap_.end(); 128 } 109 129 } -
code/trunk/src/orxonox/core/Factory.h
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 @file Factory.h 30 30 @brief Definition of the Factory and the BaseFactory class. … … 67 67 68 68 static Factory* getFactoryPointer(); // avoid overriding order problem in the static intialisation process 69 static std::map<std::string, Identifier*>::const_iterator getFactoryBegin(); 70 static std::map<std::string, Identifier*>::const_iterator getFactoryEnd(); 69 71 70 72 private: -
code/trunk/src/orxonox/core/Identifier.cc
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 @file Identifier.cc 30 30 @brief Implementation of the Identifier class. 31 31 */ 32 33 #include <ostream> 32 34 33 35 #include "Identifier.h" … … 49 51 this->factory_ = 0; 50 52 51 this->children_ = new IdentifierList; 53 this->children_ = new std::list<const Identifier*>(); 54 this->directChildren_ = new std::list<const Identifier*>(); 52 55 53 56 // Use a static variable because the classID gets created before main() and that's why we should avoid static member variables … … 57 60 58 61 /** 59 @brief Destructor: Deletes the IdentifierList containing the children.62 @brief Destructor: Deletes the list containing the children. 60 63 */ 61 64 Identifier::~Identifier() 62 65 { 63 66 delete this->children_; 64 } 65 66 /** 67 @brief Initializes the Identifier with an IdentifierList containing all parents of the class the Identifier belongs to. 68 @param parents The IdentifierList containing all parents 69 */ 70 void Identifier::initialize(const IdentifierList* parents) 71 { 72 COUT(4) << "*** Initialize " << this->name_ << "-Singleton." << std::endl; 67 delete this->directChildren_; 68 } 69 70 /** 71 @brief Initializes the Identifier with a list containing all parents of the class the Identifier belongs to. 72 @param parents A list containing all parents 73 */ 74 void Identifier::initialize(std::list<const Identifier*>* parents) 75 { 76 COUT(4) << "*** Identifier: Initialize " << this->name_ << "-Singleton." << std::endl; 73 77 this->bCreatedOneObject_ = true; 74 78 75 79 if (parents) 76 80 { 77 IdentifierListElement* temp1 = parents->first_; 78 while (temp1) 81 this->parents_ = (*parents); 82 this->directParents_ = (*parents); 83 84 // Iterate through all parents 85 for (std::list<const Identifier*>::iterator it = parents->begin(); it != parents->end(); ++it) 79 86 { 80 this->parents_.add(temp1->identifier_); 81 temp1->identifier_->getChildren().add(this); // We're a child of our parents 82 83 temp1 = temp1->next_; 87 // Tell the parent we're one of it's children 88 (*it)->getChildrenIntern().insert((*it)->getChildrenIntern().end(), this); 89 90 // Erase all parents of our parent from our direct-parent-list 91 for (std::list<const Identifier*>::const_iterator it1 = (*it)->getParents().begin(); it1 != (*it)->getParents().end(); ++it1) 92 { 93 // Search for the parent's parent in our direct-parent-list 94 for (std::list<const Identifier*>::iterator it2 = this->directParents_.begin(); it2 != this->directParents_.end(); ++it2) 95 { 96 if ((*it1) == (*it2)) 97 { 98 // We've found a non-direct parent in our list: Erase it 99 this->directParents_.erase(it2); 100 break; 101 } 102 } 103 } 104 } 105 106 // Now iterate through all direct parents 107 for (std::list<const Identifier*>::iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it) 108 { 109 // Tell the parent we're one of it's direct children 110 (*it)->getDirectChildrenIntern().insert((*it)->getDirectChildrenIntern().end(), this); 84 111 } 85 112 } … … 98 125 else 99 126 { 100 // Abstract classes don't have a factory and therefore can't create new objects101 COUT(1) << "Error: Cannot create an object of type '" << this->name_ << "'. Class is abstract." << std::endl;127 COUT(1) << "An error occurred in Identifier.cc:" << std::endl; 128 COUT(1) << "Error: Cannot fabricate an object of type '" << this->name_ << "'. Class has no factory." << std::endl; 102 129 COUT(1) << "Aborting..." << std::endl; 103 130 abort(); … … 117 144 118 145 /** 119 @returns a reference to the Identifier map, containing all Identifiers. 120 */ 121 std::map<std::string, Identifier*>& Identifier::getIdentifierMap() 122 { 123 static std::map<std::string, Identifier*> identifierMapStaticReference = std::map<std::string, Identifier*>(); 124 return identifierMapStaticReference; 125 } 126 127 /** 128 @returns true, if the Identifier is at least of the given type. 146 @brief Returns true, if the Identifier is at least of the given type. 129 147 @param identifier The identifier to compare with 130 148 */ 131 149 bool Identifier::isA(const Identifier* identifier) const 132 150 { 133 return (identifier == this || this-> parents_.isInList(identifier));134 } 135 136 /** 137 @ returns true, if the Identifier is exactly of the given type.138 @param identifier The identifier to compare with 139 */ 140 bool Identifier::is DirectlyA(const Identifier* identifier) const151 return (identifier == this || this->identifierIsInList(identifier, this->parents_)); 152 } 153 154 /** 155 @brief Returns true, if the Identifier is exactly of the given type. 156 @param identifier The identifier to compare with 157 */ 158 bool Identifier::isExactlyA(const Identifier* identifier) const 141 159 { 142 160 return (identifier == this); … … 144 162 145 163 /** 146 @ returns true, if the assigned identifier is a child of the given identifier.164 @brief Returns true, if the assigned identifier is a child of the given identifier. 147 165 @param identifier The identifier to compare with 148 166 */ 149 167 bool Identifier::isChildOf(const Identifier* identifier) const 150 168 { 151 return this->parents_.isInList(identifier); 152 } 153 154 /** 155 @returns true, if the assigned identifier is a parent of the given identifier. 169 return this->identifierIsInList(identifier, this->parents_); 170 } 171 172 /** 173 @brief Returns true, if the assigned identifier is a direct child of the given identifier. 174 @param identifier The identifier to compare with 175 */ 176 bool Identifier::isDirectChildOf(const Identifier* identifier) const 177 { 178 return this->identifierIsInList(identifier, this->directParents_); 179 } 180 181 /** 182 @brief Returns true, if the assigned identifier is a parent of the given identifier. 156 183 @param identifier The identifier to compare with 157 184 */ 158 185 bool Identifier::isParentOf(const Identifier* identifier) const 159 186 { 160 return this->children_->isInList(identifier); 187 return this->identifierIsInList(identifier, *this->children_); 188 } 189 190 /** 191 @brief Returns true, if the assigned identifier is a direct parent of the given identifier. 192 @param identifier The identifier to compare with 193 */ 194 bool Identifier::isDirectParentOf(const Identifier* identifier) const 195 { 196 return this->identifierIsInList(identifier, *this->directChildren_); 197 } 198 199 /** 200 @brief Returns the ConfigValueContainer of a variable, given by the string of its name. 201 @param varname The name of the variable 202 @return The ConfigValueContainer 203 */ 204 ConfigValueContainer* Identifier::getConfigValueContainer(const std::string& varname) 205 { 206 std::map<std::string, ConfigValueContainer*>::const_iterator it = configValues_.find(varname); 207 if (it != configValues_.end()) 208 return ((*it).second); 209 else 210 return 0; 211 } 212 213 /** 214 @brief Adds the ConfigValueContainer of a variable, given by the string of its name. 215 @param varname The name of the variablee 216 @param container The container 217 */ 218 void Identifier::addConfigValueContainer(const std::string& varname, ConfigValueContainer* container) 219 { 220 this->configValues_[varname] = container; 221 } 222 223 /** 224 @brief Searches for a given identifier in a list and returns whether the identifier is in the list or not. 225 @param identifier The identifier to look for 226 @param list The list 227 @return True = the identifier is in the list 228 */ 229 bool Identifier::identifierIsInList(const Identifier* identifier, const std::list<const Identifier*>& list) 230 { 231 for (std::list<const Identifier*>::const_iterator it = list.begin(); it != list.end(); ++it) 232 if (identifier == (*it)) 233 return true; 234 235 return false; 236 } 237 238 std::ostream& operator<<(std::ostream& out, const std::list<const Identifier*>& list) 239 { 240 for (std::list<const Identifier*>::const_iterator it = list.begin(); it != list.end(); ++it) 241 out << (*it)->getName() << " "; 242 243 return out; 161 244 } 162 245 } -
code/trunk/src/orxonox/core/Identifier.h
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 @file Identifier.h 30 30 @brief Definition of the Identifier, ClassIdentifier and SubclassIdentifier classes, implementation of the ClassIdentifier and SubclassIdentifier classes. … … 39 39 40 40 Every object has a pointer to the Identifier of its class. This allows the use isA(...), 41 is DirectlyA(...), isChildOf(...) and isParentOf(...).41 isExactlyA(...), isChildOf(...) and isParentOf(...). 42 42 43 43 To create the class-hierarchy, the Identifier has some intern functions and variables. … … 52 52 #define _Identifier_H__ 53 53 54 #include <list> 54 55 #include <map> 55 56 #include <string> … … 59 60 60 61 #include "ObjectList.h" 61 #include "IdentifierList.h"62 62 #include "Debug.h" 63 63 #include "Iterator.h" … … 82 82 83 83 Every object has a pointer to the Identifier of its class. This allows the use isA(...), 84 is DirectlyA(...), isChildOf(...) and isParentOf(...).84 isExactlyA(...), isChildOf(...) and isParentOf(...). 85 85 86 86 You can't directly create an Identifier, it's just the base-class for ClassIdentifier. … … 89 89 { 90 90 template <class T> 91 friend class ClassIdentifier; // Forward declaration91 friend class ClassIdentifier; 92 92 93 93 template <class T> 94 friend class SubclassIdentifier; // Forward declaration95 96 friend class Factory; // Forward declaration94 friend class SubclassIdentifier; 95 96 friend class Factory; 97 97 98 98 public: … … 102 102 BaseObject* fabricate(); 103 103 bool isA(const Identifier* identifier) const; 104 bool is DirectlyA(const Identifier* identifier) const;104 bool isExactlyA(const Identifier* identifier) const; 105 105 bool isChildOf(const Identifier* identifier) const; 106 bool isDirectChildOf(const Identifier* identifier) const; 106 107 bool isParentOf(const Identifier* identifier) const; 107 108 static std::map<std::string, Identifier*>& getIdentifierMap(); 108 bool isDirectParentOf(const Identifier* identifier) const; 109 109 110 110 /** @brief Removes all objects of the corresponding class. */ 111 111 virtual void removeObjects() const = 0; 112 112 113 /** @ returns the name of the class the Identifier belongs to.*/113 /** @brief Returns the name of the class the Identifier belongs to. @return The name */ 114 114 inline const std::string& getName() const { return this->name_; } 115 115 116 /** @returns the parents of the class the Identifier belongs to. */ 117 inline const IdentifierList& getParents() const { return this->parents_; } 118 119 /** @returns the children of the class the Identifier belongs to. */ 120 inline IdentifierList& getChildren() const { return *this->children_; } 121 122 /** @returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents. */ 116 /** @brief Returns the parents of the class the Identifier belongs to. @return The list of all parents */ 117 inline const std::list<const Identifier*>& getParents() const { return this->parents_; } 118 /** @brief Returns the begin-iterator of the parents-list. @return The begin-iterator */ 119 inline std::list<const Identifier*>::const_iterator getParentsBegin() const { return this->parents_.begin(); } 120 /** @brief Returns the end-iterator of the parents-list. @return The end-iterator */ 121 inline std::list<const Identifier*>::const_iterator getParentsEnd() const { return this->parents_.end(); } 122 123 /** @brief Returns the children of the class the Identifier belongs to. @return The list of all children */ 124 inline const std::list<const Identifier*>& getChildren() const { return (*this->children_); } 125 /** @brief Returns the begin-iterator of the children-list. @return The begin-iterator */ 126 inline std::list<const Identifier*>::const_iterator getChildrenBegin() const { return this->children_->begin(); } 127 /** @brief Returns the end-iterator of the children-list. @return The end-iterator */ 128 inline std::list<const Identifier*>::const_iterator getChildrenEnd() const { return this->children_->end(); } 129 130 /** @brief Returns the direct parents of the class the Identifier belongs to. @return The list of all direct parents */ 131 inline const std::list<const Identifier*>& getDirectParents() const { return this->directParents_; } 132 /** @brief Returns the begin-iterator of the direct-parents-list. @return The begin-iterator */ 133 inline std::list<const Identifier*>::const_iterator getDirectParentsBegin() const { return this->directParents_.begin(); } 134 /** @brief Returns the end-iterator of the direct-parents-list. @return The end-iterator */ 135 inline std::list<const Identifier*>::const_iterator getDirectParentsEnd() const { return this->directParents_.end(); } 136 137 /** @brief Returns the direct children the class the Identifier belongs to. @return The list of all direct children */ 138 inline const std::list<const Identifier*>& getDirectChildren() const { return (*this->directChildren_); } 139 /** @brief Returns the begin-iterator of the direct-children-list. @return The begin-iterator */ 140 inline std::list<const Identifier*>::const_iterator getDirectChildrenBegin() const { return this->directChildren_->begin(); } 141 /** @brief Returns the end-iterator of the direct-children-list. @return The end-iterator */ 142 inline std::list<const Identifier*>::const_iterator getDirectChildrenEnd() const { return this->directChildren_->end(); } 143 144 /** @brief Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents. @return The status of the class-hierarchy creation */ 123 145 inline static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); } 124 146 125 /** @ returns the network ID to identify a class through the network.*/147 /** @brief Returns the network ID to identify a class through the network. @return the network ID */ 126 148 inline const unsigned int getNetworkID() const { return this->classID_; } 127 149 … … 129 151 void setNetworkID(unsigned int id); 130 152 131 /** @returns the ConfigValueContainer of a variable, given by the string of its name. @param varname The name of the variable */ 132 inline ConfigValueContainer* getConfigValueContainer(const std::string& varname) 133 { return this->configValues_[varname]; } 134 135 /** @brief Sets the ConfigValueContainer of a variable, given by the string of its name. @param varname The name of the variablee @param container The container */ 136 inline void setConfigValueContainer(const std::string& varname, ConfigValueContainer* container) 137 { this->configValues_[varname] = container; } 153 ConfigValueContainer* getConfigValueContainer(const std::string& varname); 154 void addConfigValueContainer(const std::string& varname, ConfigValueContainer* container); 155 156 virtual XMLPortParamContainer* getXMLPortParamContainer(const std::string& paramname) = 0; 157 virtual void addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container) = 0; 158 159 virtual XMLPortObjectContainer* getXMLPortObjectContainer(const std::string& sectionname) = 0; 160 virtual void addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container) = 0; 161 162 static bool identifierIsInList(const Identifier* identifier, const std::list<const Identifier*>& list); 138 163 139 164 private: … … 141 166 Identifier(const Identifier& identifier) {} // don't copy 142 167 virtual ~Identifier(); 143 void initialize(const IdentifierList* parents); 168 void initialize(std::list<const Identifier*>* parents); 169 170 /** @brief Returns the children of the class the Identifier belongs to. @return The list of all children */ 171 inline std::list<const Identifier*>& getChildrenIntern() const { return (*this->children_); } 172 /** @brief Returns the direct children of the class the Identifier belongs to. @return The list of all direct children */ 173 inline std::list<const Identifier*>& getDirectChildrenIntern() const { return (*this->directChildren_); } 144 174 145 175 /** … … 149 179 { 150 180 hierarchyCreatingCounter_s++; 151 COUT(4) << "*** I ncreased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << std::endl;181 COUT(4) << "*** Identifier: Increased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << std::endl; 152 182 } 153 183 … … 158 188 { 159 189 hierarchyCreatingCounter_s--; 160 COUT(4) << "*** Decreased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << std::endl; 161 } 162 163 IdentifierList parents_; //!< The Parents of the class the Identifier belongs to 164 IdentifierList* children_; //!< The Children of the class the Identifier belongs to 190 COUT(4) << "*** Identifier: Decreased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << std::endl; 191 } 192 193 std::list<const Identifier*> parents_; //!< The parents of the class the Identifier belongs to 194 std::list<const Identifier*>* children_; //!< The children of the class the Identifier belongs to 195 196 std::list<const Identifier*> directParents_; //!< The direct parents of the class the Identifier belongs to 197 std::list<const Identifier*>* directChildren_; //!< The direct children of the class the Identifier belongs to 165 198 166 199 std::string name_; //!< The name of the class the Identifier belongs to … … 173 206 }; 174 207 208 std::ostream& operator<<(std::ostream& out, const std::list<const Identifier*>& list); 209 175 210 176 211 // ############################### … … 182 217 This makes it possible to store informations about a class, sharing them with all 183 218 objects of that class without defining static variables in every class. 219 220 To be really sure that not more than exactly one object exists (even with libraries), 221 ClassIdentifiers are only created by IdentifierDistributor. 222 223 You can access the ClassIdentifiers created by IdentifierDistributor through the 224 ClassManager singletons. 184 225 */ 185 226 template <class T> 186 227 class ClassIdentifier : public Identifier 187 228 { 229 template <class TT> 230 friend class ClassManager; 231 188 232 public: 189 static ClassIdentifier<T>* registerClass(const IdentifierList* parents, const std::string& name, bool bRootClass); 190 static void addObject(T* object); 191 static ClassIdentifier<T>* getIdentifier(); 233 ClassIdentifier<T>* registerClass(std::list<const Identifier*>* parents, const std::string& name, bool bRootClass); 234 void addObject(T* object); 192 235 void removeObjects() const; 193 236 void setName(const std::string& name); 237 inline const ObjectList<T>* getObjects() const { return this->objects_; } 238 239 XMLPortParamContainer* getXMLPortParamContainer(const std::string& paramname); 240 void addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container); 241 242 XMLPortObjectContainer* getXMLPortObjectContainer(const std::string& sectionname); 243 void addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container); 194 244 195 245 private: … … 200 250 ObjectList<T>* objects_; //!< The ObjectList, containing all objects of type T 201 251 bool bSetName_; //!< True if the name is set 252 std::map<std::string, XMLPortClassParamContainer<T>*> xmlportParamContainers_; 253 std::map<std::string, XMLPortClassObjectContainer<T, class O>*> xmlportObjectContainers_; 202 254 }; 203 255 … … 208 260 ClassIdentifier<T>::ClassIdentifier() 209 261 { 210 this->objects_ = ObjectList<T>::getList(); 262 // this->objects_ = ObjectList<T>::getList(); 263 this->objects_ = new ObjectList<T>(); 211 264 this->bSetName_ = false; 212 265 } … … 214 267 /** 215 268 @brief Registers a class, which means that the name and the parents get stored. 216 @param parents A n IdentifierList, containing the Identifiers of all parents of the class269 @param parents A list, containing the Identifiers of all parents of the class 217 270 @param name A string, containing exactly the name of the class 218 271 @param bRootClass True if the class is either an Interface or the BaseObject itself … … 220 273 */ 221 274 template <class T> 222 ClassIdentifier<T>* ClassIdentifier<T>::registerClass( const IdentifierList* parents, const std::string& name, bool bRootClass)223 { 224 COUT( 4) << "***Register Class in " << name << "-Singleton." << std::endl;275 ClassIdentifier<T>* ClassIdentifier<T>::registerClass(std::list<const Identifier*>* parents, const std::string& name, bool bRootClass) 276 { 277 COUT(5) << "*** ClassIdentifier: Register Class in " << name << "-Singleton." << std::endl; 225 278 226 279 // Check if at least one object of the given type was created 227 if (! getIdentifier()->bCreatedOneObject_)280 if (!this->bCreatedOneObject_) 228 281 { 229 282 // If no: We have to store the informations and initialize the Identifier 230 getIdentifier()->setName(name);231 232 COUT(4) << "*** Register Class in " << name << "-Singleton -> Initialize Singleton." << std::endl;283 this->setName(name); 284 285 COUT(4) << "*** ClassIdentifier: Register Class in " << name << "-Singleton -> Initialize Singleton." << std::endl; 233 286 if (bRootClass) 234 getIdentifier()->initialize(NULL); // If a class is derived from two interfaces, the second interface might think it's derived from the first because of the order of constructor-calls. Thats why we set parents to zero in that case.287 this->initialize(NULL); // If a class is derived from two interfaces, the second interface might think it's derived from the first because of the order of constructor-calls. Thats why we set parents to zero in that case. 235 288 else 236 getIdentifier()->initialize(parents);289 this->initialize(parents); 237 290 } 238 291 239 return getIdentifier(); 240 } 241 242 /** 243 @brief Creates the only instance of this class for the template class T. 244 @return The Identifier itself 245 */ 246 template <class T> 247 ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier() 248 { 249 static ClassIdentifier<T> theOneAndOnlyInstance = ClassIdentifier<T>(); 250 static bool bIdentifierCreated = false; 251 252 if (!bIdentifierCreated) 253 { 254 COUT(4) << "*** Create Identifier Singleton." << std::endl; 255 bIdentifierCreated = true; 256 } 257 258 return &theOneAndOnlyInstance; 292 return this; 259 293 } 260 294 … … 266 300 void ClassIdentifier<T>::setName(const std::string& name) 267 301 { 268 // Make sure we didn't already set the name, to avoid duplicate entries in the Identifier map269 302 if (!this->bSetName_) 270 303 { 271 304 this->name_ = name; 272 this->getIdentifierMap().insert(std::pair<std::string, Identifier*>(name, this));273 305 this->bSetName_ = true; 274 306 } … … 282 314 void ClassIdentifier<T>::addObject(T* object) 283 315 { 284 COUT( 4) << "*** Added object to " << ClassIdentifier<T>::getIdentifier()->getName() << "-list." << std::endl;285 object->getMetaList().add( ClassIdentifier<T>::getIdentifier()->objects_, ClassIdentifier<T>::getIdentifier()->objects_->add(object));316 COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl; 317 object->getMetaList().add(this->objects_, this->objects_->add(object)); 286 318 } 287 319 … … 292 324 void ClassIdentifier<T>::removeObjects() const 293 325 { 294 for (Iterator<T> it = ObjectList<T>::start(); it;)326 for (Iterator<T> it = this->objects_->start(); it;) 295 327 delete *(it++); 296 328 } 329 330 template <class T> 331 XMLPortParamContainer* ClassIdentifier<T>::getXMLPortParamContainer(const std::string& paramname) 332 { 333 typename std::map<std::string, XMLPortClassParamContainer<T>*>::const_iterator it = xmlportParamContainers_.find(paramname); 334 if (it != xmlportParamContainers_.end()) 335 return (XMLPortParamContainer*)((*it).second); 336 else 337 return 0; 338 } 339 340 template <class T> 341 void ClassIdentifier<T>::addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container) 342 { 343 this->xmlportParamContainers_[paramname] = (XMLPortClassParamContainer<T>*)container; 344 } 345 346 template <class T> 347 XMLPortObjectContainer* ClassIdentifier<T>::getXMLPortObjectContainer(const std::string& sectionname) 348 { 349 typename std::map<std::string, XMLPortClassObjectContainer<T, class O>*>::const_iterator it = xmlportObjectContainers_.find(sectionname); 350 if (it != xmlportObjectContainers_.end()) 351 return (XMLPortObjectContainer*)((*it).second); 352 else 353 return 0; 354 } 355 356 template <class T> 357 void ClassIdentifier<T>::addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container) 358 { 359 this->xmlportObjectContainers_[sectionname] = (XMLPortClassObjectContainer<T, class O>*)container; 360 } 361 297 362 298 363 // ############################### … … 314 379 SubclassIdentifier() 315 380 { 316 this->identifier_ = ClassIdentifier<T>::getIdentifier(); 381 this->identifier_ = ClassManager<T>::getIdentifier(); 382 } 383 384 /** 385 @brief Copyconstructor: Assigns the given Identifier. 386 @param identifier The Identifier 387 */ 388 SubclassIdentifier(Identifier* identifier) 389 { 390 this->identifier_ = identifier; 317 391 } 318 392 … … 324 398 SubclassIdentifier<T>& operator=(Identifier* identifier) 325 399 { 326 if (!identifier->isA(Class Identifier<T>::getIdentifier()))400 if (!identifier->isA(ClassManager<T>::getIdentifier())) 327 401 { 328 COUT(1) << "Error: Class " << identifier->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << "!" << std::endl; 329 COUT(1) << "Error: SubclassIdentifier<" << ClassIdentifier<T>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden." << std::endl; 402 COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl; 403 COUT(1) << "Error: Class " << identifier->getName() << " is not a " << ClassManager<T>::getIdentifier()->getName() << "!" << std::endl; 404 COUT(1) << "Error: SubclassIdentifier<" << ClassManager<T>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden." << std::endl; 330 405 COUT(1) << "Aborting..." << std::endl; 331 406 abort(); … … 372 447 if (this->identifier_) 373 448 { 374 COUT(1) << "Error: Class " << this->identifier_->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << "!" << std::endl; 449 COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl; 450 COUT(1) << "Error: Class " << this->identifier_->getName() << " is not a " << ClassManager<T>::getIdentifier()->getName() << "!" << std::endl; 375 451 COUT(1) << "Error: Couldn't fabricate a new Object." << std::endl; 376 452 COUT(1) << "Aborting..." << std::endl; … … 378 454 else 379 455 { 456 COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl; 380 457 COUT(1) << "Error: Couldn't fabricate a new Object - Identifier is undefined." << std::endl; 381 458 COUT(1) << "Aborting..." << std::endl; … … 386 463 } 387 464 388 /** @ returns the assigned identifier.*/465 /** @brief Returns the assigned identifier. @return The identifier */ 389 466 inline const Identifier* getIdentifier() const 390 467 { return this->identifier_; } 391 468 392 /** @ returns true, if the assigned identifier is at least of the given type. @param identifier The identifier to compare with */469 /** @brief Returns true, if the assigned identifier is at least of the given type. @param identifier The identifier to compare with */ 393 470 inline bool isA(const Identifier* identifier) const 394 471 { return this->identifier_->isA(identifier); } 395 472 396 /** @ returns true, if the assigned identifier is exactly of the given type. @param identifier The identifier to compare with */397 inline bool is DirectlyA(const Identifier* identifier) const398 { return this->identifier_->is DirectlyA(identifier); }399 400 /** @ returns true, if the assigned identifier is a child of the given identifier. @param identifier The identifier to compare with */473 /** @brief Returns true, if the assigned identifier is exactly of the given type. @param identifier The identifier to compare with */ 474 inline bool isExactlyA(const Identifier* identifier) const 475 { return this->identifier_->isExactlyA(identifier); } 476 477 /** @brief Returns true, if the assigned identifier is a child of the given identifier. @param identifier The identifier to compare with */ 401 478 inline bool isChildOf(const Identifier* identifier) const 402 479 { return this->identifier_->isChildOf(identifier); } 403 480 404 /** @returns true, if the assigned identifier is a parent of the given identifier. @param identifier The identifier to compare with */ 481 /** @brief Returns true, if the assigned identifier is a direct child of the given identifier. @param identifier The identifier to compare with */ 482 inline bool isDirectChildOf(const Identifier* identifier) const 483 { return this->identifier_->isDirectChildOf(identifier); } 484 485 /** @brief Returns true, if the assigned identifier is a parent of the given identifier. @param identifier The identifier to compare with */ 405 486 inline bool isParentOf(const Identifier* identifier) const 406 487 { return this->identifier_->isParentOf(identifier); } 407 488 489 /** @brief Returns true, if the assigned identifier is a direct parent of the given identifier. @param identifier The identifier to compare with */ 490 inline bool isDirectParentOf(const Identifier* identifier) const 491 { return this->identifier_->isDirectParentOf(identifier); } 492 408 493 private: 409 Identifier* identifier_; //!< The assigned identifier494 Identifier* identifier_; //!< The assigned identifier 410 495 }; 411 496 } -
code/trunk/src/orxonox/core/Iterator.h
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 @file Iterator.h 30 30 @brief Definition and implementation of the Iterator class. … … 71 71 */ 72 72 Iterator(ObjectListElement<T>* element) 73 { 74 this->element_ = element; 75 } 76 77 /** 78 @brief Assigns an element to the iterator. 79 @param element The element 80 */ 81 Iterator<T> operator=(ObjectListElement<T>* element) 73 82 { 74 83 this->element_ = element; … … 150 159 @return True if the iterator points to an existing object. 151 160 */ 152 bool operator!=( intcompare)161 bool operator!=(ObjectListElement<T>* compare) 153 162 { 154 // Comparing with anything except zero makes no sense 155 if (compare != 0) 156 COUT(2) << "Warning: Comparing the " << ClassIdentifier<T>::getIdentifier()->getName() << "-List-Iterator with " << compare << " has no effect. Only comparison with 0 works." << std::endl; 157 158 return (this->element_ != 0); 163 return (this->element_ != compare); 159 164 } 160 165 -
code/trunk/src/orxonox/core/Language.cc
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 @file Language.cc 30 30 @brief Implementation of the Language and the LanguageEntry class. … … 50 50 51 51 this->fallbackEntry_ = fallbackEntry; 52 this-> translatedEntry_ = fallbackEntry; // Set the translation to the fallback entry, for the case that no translation gets assigned53 this->b TranslationSet_ = false;54 } 55 56 /** 57 @brief Sets the translation of the entry.58 @param translation The translation59 */ 60 void LanguageEntry::set Translation(const std::string& translation)52 this->localisedEntry_ = fallbackEntry; // Set the localisation to the fallback entry, for the case that no translation gets assigned 53 this->bLocalisationSet_ = false; 54 } 55 56 /** 57 @brief Sets the localisation of the entry. 58 @param localisation The localisation 59 */ 60 void LanguageEntry::setLocalisation(const std::string& localisation) 61 61 { 62 62 // Check if the translation is more than just an empty string 63 if ( translation.compare("") != 0)64 { 65 this-> translatedEntry_ = translation;66 this->b TranslationSet_ = true;63 if (localisation.compare("") != 0) 64 { 65 this->localisedEntry_ = localisation; 66 this->bLocalisationSet_ = true; 67 67 } 68 68 else 69 this-> translatedEntry_ = this->fallbackEntry_;69 this->localisedEntry_ = this->fallbackEntry_; 70 70 } 71 71 … … 77 77 { 78 78 // If the default entry changes and the translation wasn't set yet, use the new default entry as translation 79 if (!this->b TranslationSet_)80 this-> translatedEntry_ = fallbackEntry;79 if (!this->bLocalisationSet_) 80 this->localisedEntry_ = fallbackEntry; 81 81 82 82 this->fallbackEntry_ = fallbackEntry; … … 94 94 95 95 this->defaultLanguage_ = "default"; 96 this->default Translation_ = "ERROR: LANGUAGE ENTRY DOESN'T EXIST!";96 this->defaultLocalisation_ = "ERROR: LANGUAGE ENTRY DOESN'T EXIST!"; 97 97 98 98 // Read the default language file to create all known LanguageEntry objects … … 132 132 133 133 /** 134 @brief Creates a new LanguageEntry with a given nameand a given default entry.135 @param name The nameof the entry134 @brief Creates a new LanguageEntry with a given label and a given default entry. 135 @param label The label of the entry 136 136 @param entry The default entry 137 137 @return The created LanguageEntry object 138 138 */ 139 LanguageEntry* Language::createEntry(const LanguageEntry Name& name, const std::string& entry)140 { 141 std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find( name);139 LanguageEntry* Language::createEntry(const LanguageEntryLabel& label, const std::string& entry) 140 { 141 std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(label); 142 142 143 143 // Make sure we don't create a duplicate entry … … 145 145 { 146 146 LanguageEntry* newEntry = new LanguageEntry(entry); 147 newEntry->set Name(name);148 this->languageEntries_[ name] = newEntry;147 newEntry->setLabel(label); 148 this->languageEntries_[label] = newEntry; 149 149 return newEntry; 150 150 } 151 151 152 COUT(2) << "Warning: Language entry " << name<< " is duplicate in " << getFileName(this->defaultLanguage_) << "!" << std::endl;152 COUT(2) << "Warning: Language entry " << label << " is duplicate in " << getFileName(this->defaultLanguage_) << "!" << std::endl; 153 153 return it->second; 154 154 } … … 156 156 /** 157 157 @brief Adds a new LanguageEntry, if it's not already existing. 158 @param name The nameof the entry158 @param label The label of the entry 159 159 @param entry The default entry 160 160 */ 161 void Language::addEntry(const LanguageEntry Name& name, const std::string& entry)162 { 163 COUT(5) << " Called addEntry with\n name: " << name<< "\n entry: " << entry << std::endl;164 std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find( name);161 void Language::addEntry(const LanguageEntryLabel& label, const std::string& entry) 162 { 163 COUT(5) << "Language: Called addEntry with\n label: " << label << "\n entry: " << entry << std::endl; 164 std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(label); 165 165 if (it == this->languageEntries_.end()) 166 166 { 167 167 // The entry isn't available yet, meaning it's new, so create it 168 this->createEntry( name, entry);168 this->createEntry(label, entry); 169 169 } 170 170 else if (it->second->getDefault().compare(entry) == 0) … … 185 185 186 186 /** 187 @brief Returns the translation of a given entry.188 @param name The nameof the entry189 @return The translation190 */ 191 const std::string& Language::get Translation(const LanguageEntryName& name) const192 { 193 std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find( name);187 @brief Returns the localisation of a given entry. 188 @param label The label of the entry 189 @return The localisation 190 */ 191 const std::string& Language::getLocalisation(const LanguageEntryLabel& label) const 192 { 193 std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(label); 194 194 if (it != this->languageEntries_.end()) 195 return it->second->get Translation();195 return it->second->getLocalisation(); 196 196 else 197 197 { 198 198 // Uh, oh, an undefined entry was requested: return the default string 199 COUT(2) << " Error: Language entry \"" << name<< "\" not found!" << std::endl;200 return this->default Translation_;199 COUT(2) << "Warning: Language entry \"" << label << "\" not found!" << std::endl; 200 return this->defaultLocalisation_; 201 201 } 202 202 } … … 230 230 if (!file.is_open()) 231 231 { 232 COUT(1) << "An error occurred in Language.cc:" << std::endl; 232 233 COUT(1) << "Error: Couldn't open file " << getFileName(this->defaultLanguage_) << " to read the default language entries!" << std::endl; 233 234 return; … … 259 260 260 261 /** 261 @brief Reads the language file of the configured language and assigns the translationsto the corresponding LanguageEntry object.262 @brief Reads the language file of the configured language and assigns the localisation to the corresponding LanguageEntry object. 262 263 */ 263 264 void Language::readTranslatedLanguageFile() … … 271 272 if (!file.is_open()) 272 273 { 274 COUT(1) << "An error occurred in Language.cc:" << std::endl; 273 275 COUT(1) << "Error: Couldn't open file " << getFileName(this->language_) << " to read the translated language entries!" << std::endl; 274 276 ResetConfigValue(language_); … … 297 299 // Check if the entry exists 298 300 if (it != this->languageEntries_.end()) 299 it->second->set Translation(lineString.substr(pos + 1));301 it->second->setLocalisation(lineString.substr(pos + 1)); 300 302 else 301 this->createEntry(lineString.substr(0, pos), this->default Translation_)->setTranslation(lineString.substr(pos + 1));303 this->createEntry(lineString.substr(0, pos), this->defaultLocalisation_)->setLocalisation(lineString.substr(pos + 1)); 302 304 } 303 305 else … … 314 316 void Language::writeDefaultLanguageFile() const 315 317 { 316 COUT(4) << " Write default language file." << std::endl;318 COUT(4) << "Language: Write default language file." << std::endl; 317 319 318 320 // Open the file … … 322 324 if (!file.is_open()) 323 325 { 326 COUT(1) << "An error occurred in Language.cc:" << std::endl; 324 327 COUT(1) << "Error: Couldn't open file " << getFileName(this->defaultLanguage_) << " to write the default language entries!" << std::endl; 325 328 return; … … 329 332 for (Iterator<LanguageEntry> it = ObjectList<LanguageEntry>::start(); it; ++it) 330 333 { 331 file << it->get Name() << "=" << it->getDefault() << std::endl;334 file << it->getLabel() << "=" << it->getDefault() << std::endl; 332 335 } 333 336 -
code/trunk/src/orxonox/core/Language.h
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 @file Language.h 30 30 @brief Definition of the Language and the LanguageEntry class. 31 31 32 The Language class is used, to get a translation of a string in the configured language.33 The string is identified by another string, the nameof the entry.32 The Language class is used, to get a localisation of a string in the configured language. 33 The string is identified by another string, the label of the entry. 34 34 If the translation in the configured language isn't available, the default entry, defined in the code, is used. 35 35 36 36 Usage: 37 37 - Set the entry with the default string: 38 Language::getLanguage()->addEntry(" nameof the entry", "the string to translate");38 Language::getLanguage()->addEntry("label of the entry", "the string to translate"); 39 39 40 - Get the translation of the entry in the configured language:41 std::cout << Language::getLanguage()->get Translation("name of the entry") << std::endl;40 - Get the localisation of the entry in the configured language: 41 std::cout << Language::getLanguage()->getLocalisation("name of the entry") << std::endl; 42 42 */ 43 43 … … 51 51 #include "OrxonoxClass.h" 52 52 53 54 #define AddLanguageEntry(label, fallbackstring) \ 55 orxonox::Language::getLanguage().addEntry(label, fallbackstring) 56 57 #define GetLocalisation(label) \ 58 orxonox::Language::getLanguage().getLocalisation(label) 59 60 53 61 namespace orxonox 54 62 { 55 typedef std::string LanguageEntryName; 56 63 // ############################### 64 // ### LanguageEntry ### 65 // ############################### 57 66 //! The LanguageEntry class stores the default- and the translated string of a given entry in the language file. 58 67 class _CoreExport LanguageEntry : public OrxonoxClass … … 60 69 public: 61 70 explicit LanguageEntry(const std::string& fallbackEntry); 62 void set Translation(const std::string& translation);71 void setLocalisation(const std::string& localisation); 63 72 void setDefault(const std::string& fallbackEntry); 64 73 65 74 /** 66 @brief Returns the translated entry in the configured language.75 @brief Returns the localised entry in the configured language. 67 76 @return The translated entry 68 77 */ 69 inline const std::string& get Translation()70 { return this-> translatedEntry_; }78 inline const std::string& getLocalisation() 79 { return this->localisedEntry_; } 71 80 72 81 /** … … 77 86 { return this->fallbackEntry_; } 78 87 88 /** 89 @brief Sets the label of this entry. 90 @param label The label 91 */ 92 inline void setLabel(const LanguageEntryLabel& label) 93 { this->label_ = label; } 94 95 /** 96 @brief Returns the label of this entry. 97 @return The label 98 */ 99 inline const LanguageEntryLabel& getLabel() const 100 { return this->label_; } 101 79 102 private: 80 std::string fallbackEntry_; //!< The default entry: Used, if no translation is available or no language configured 81 std::string translatedEntry_; //!< The translated entry in the configured language 82 bool bTranslationSet_; //!< True if the translation was set 103 LanguageEntryLabel label_; //!< The label of the entry 104 std::string fallbackEntry_; //!< The default entry: Used, if no translation is available or no language configured 105 std::string localisedEntry_; //!< The localised entry in the configured language 106 bool bLocalisationSet_; //!< True if the translation was set 83 107 }; 84 template class _CoreExport orxonox::ClassIdentifier<LanguageEntry>;85 template class _CoreExport orxonox::ObjectList<LanguageEntry>;86 108 109 110 // ############################### 111 // ### Language ### 112 // ############################### 87 113 //! The Language class manges the language files and entries and stores the LanguageEntry objects in a map. 88 114 class _CoreExport Language : public OrxonoxClass … … 94 120 static Language& getLanguage(); 95 121 void setConfigValues(); 96 void addEntry(const LanguageEntry Name& name, const std::string& entry);97 const std::string& get Translation(const LanguageEntryName& name) const;122 void addEntry(const LanguageEntryLabel& label, const std::string& entry); 123 const std::string& getLocalisation(const LanguageEntryLabel& label) const; 98 124 99 125 private: … … 106 132 void writeDefaultLanguageFile() const; 107 133 static const std::string getFileName(const std::string& language); 108 LanguageEntry* createEntry(const LanguageEntry Name& name, const std::string& entry);134 LanguageEntry* createEntry(const LanguageEntryLabel& label, const std::string& entry); 109 135 110 136 std::string language_; //!< The configured language 111 137 std::string defaultLanguage_; //!< The default language 112 std::string default Translation_;//!< The returned string, if an entry unavailable entry is requested113 std::map<std::string, LanguageEntry*> languageEntries_; //!< A map to store all LanguageEntry objects and their name138 std::string defaultLocalisation_; //!< The returned string, if an entry unavailable entry is requested 139 std::map<std::string, LanguageEntry*> languageEntries_; //!< A map to store all LanguageEntry objects and their labels 114 140 }; 115 template class _CoreExport orxonox::ClassIdentifier<Language>;116 template class _CoreExport orxonox::ObjectList<Language>;117 141 } 118 142 -
code/trunk/src/orxonox/core/MetaObjectList.cc
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 @file MetaObjectList.cc 30 30 @brief Implementation of the MetaObjectList class. -
code/trunk/src/orxonox/core/MetaObjectList.h
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 @file MetaObjectList.h 30 30 @brief Definition of the MetaObjectList class. … … 99 99 100 100 101 COUT( 4) << "*** Removing Object from " << ClassIdentifier<T>::getIdentifier()->getName() << "-list." << std::endl;101 COUT(5) << "*** MetaObjectList: Removing Object from " << this->element_->object_->getIdentifier()->getName() << "-list." << std::endl; 102 102 delete this->element_; 103 103 } -
code/trunk/src/orxonox/core/ObjectList.h
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 @file ObjectList.h 30 30 @brief Definition and implementation of the ObjectList class. … … 40 40 #include "CorePrereqs.h" 41 41 #include "Iterator.h" 42 #include "ClassManager.h" 42 43 43 44 namespace orxonox … … 83 84 { 84 85 public: 85 static ObjectList<T>* getList(); 86 ObjectList(); 87 ~ObjectList(); 86 88 87 89 ObjectListElement<T>* add(T* object); 88 90 // void remove(OrxonoxClass* object, bool bIterateForwards = true); 89 91 90 /** @ returns the first element in the list */92 /** @brief Returns the first element in the list. @return The first element */ 91 93 inline static Iterator<T> start() 92 { return Iterator<T>( getList()->first_); }93 94 /** @ returns the first element in the list */94 { return Iterator<T>(ClassManager<T>::getIdentifier()->getObjects()->first_); } 95 96 /** @brief Returns the first element in the list. @return The first element */ 95 97 inline static Iterator<T> begin() 96 { return Iterator<T>( getList()->first_); }97 98 /** @ returns the last element in the list */98 { return Iterator<T>(ClassManager<T>::getIdentifier()->getObjects()->first_); } 99 100 /** @brief Returns the last element in the list. @return The last element */ 99 101 inline static Iterator<T> end() 100 { return Iterator<T>( getList()->last_); }102 { return Iterator<T>(ClassManager<T>::getIdentifier()->getObjects()->last_); } 101 103 102 104 ObjectListElement<T>* first_; //!< The first element in the list 103 105 ObjectListElement<T>* last_; //!< The last element in the list 104 105 private:106 ObjectList();107 ~ObjectList();108 106 }; 109 107 … … 131 129 this->first_ = temp; 132 130 } 133 }134 135 /**136 @returns a pointer to the only existing instance for the given class T.137 */138 template <class T>139 ObjectList<T>* ObjectList<T>::getList()140 {141 static ObjectList<T> theOnlyObjectListObjectForClassT = ObjectList<T>();142 return &theOnlyObjectListObjectForClassT;143 131 } 144 132 -
code/trunk/src/orxonox/core/OrxonoxClass.cc
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 @file OrxonoxClass.cc 30 30 @brief Implementation of the OrxonoxClass Class. … … 42 42 this->identifier_ = 0; 43 43 this->parents_ = 0; 44 45 this->bActive_ = true;46 this->bVisible_ = true;47 44 } 48 45 -
code/trunk/src/orxonox/core/OrxonoxClass.h
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 @file OrxonoxClass.h 30 30 @brief Definition of the OrxonoxClass Class. … … 37 37 #define _OrxonoxClass_H__ 38 38 39 #include <list> 39 40 #include <string> 40 41 … … 47 48 //! The class all objects and interfaces of the game-logic (not the engine) are derived from. 48 49 /** 49 The BaseObject and Inter aces are derived with 'virtual public OrxonoxClass' from OrxonoxClass.50 The BaseObject and Interfaces are derived with 'virtual public OrxonoxClass' from OrxonoxClass. 50 51 OrxonoxClass is needed to create the class-hierarchy at startup and to store the Identifier and the MetaObjectList. 51 52 */ … … 59 60 void setConfigValues() {}; 60 61 61 /** @ returns the Identifier of the object*/62 /** @brief Returns the Identifier of the object. @return The Identifier */ 62 63 inline Identifier* getIdentifier() const { return this->identifier_; } 63 64 … … 65 66 inline void setIdentifier(Identifier* identifier) { this->identifier_ = identifier; } 66 67 67 /** @ returns the list of all parents of the object */68 inline IdentifierList* getParents() const { return this->parents_; }68 /** @brief Returns the list of all parents of the object. @return The list */ 69 inline std::list<const Identifier*>* getParents() const { return this->parents_; } 69 70 70 /** @brief Sets the Parents of the object. Used by the RegisterObject-macro. */71 inline void setParents(IdentifierList* parents) { this->parents_ = parents; }71 /** @brief Creates the parents-list. */ 72 inline void createParents() { this->parents_ = new std::list<const Identifier*>(); } 72 73 73 /** @ returns the MetaObjectList of the object, containing a link to all ObjectLists and ObjectListElements the object is registered in.*/74 /** @brief Returns the MetaObjectList of the object, containing a link to all ObjectLists and ObjectListElements the object is registered in. @return The list */ 74 75 inline MetaObjectList& getMetaList() { return this->metaList_; } 75 76 76 77 77 /** @ returns true if the objects class is of the given type or a derivative. */78 /** @brief Returns true if the objects class is of the given type or a derivative. */ 78 79 inline bool isA(const Identifier* identifier) 79 80 { return this->getIdentifier()->isA(identifier); } 80 /** @ returns true if the objects class is exactly of the given type. */81 inline bool is DirectlyA(const Identifier* identifier)82 { return this->getIdentifier()->is DirectlyA(identifier); }83 /** @ returns true if the objects class is a child of the given type. */81 /** @brief Returns true if the objects class is exactly of the given type. */ 82 inline bool isExactlyA(const Identifier* identifier) 83 { return this->getIdentifier()->isExactlyA(identifier); } 84 /** @brief Returns true if the objects class is a child of the given type. */ 84 85 inline bool isChildOf(const Identifier* identifier) 85 86 { return this->getIdentifier()->isChildOf(identifier); } 86 /** @returns true if the objects class is a parent of the given type. */ 87 /** @brief Returns true if the objects class is a direct child of the given type. */ 88 inline bool isDirectChildOf(const Identifier* identifier) 89 { return this->getIdentifier()->isDirectChildOf(identifier); } 90 /** @brief Returns true if the objects class is a parent of the given type. */ 87 91 inline bool isParentOf(const Identifier* identifier) 88 92 { return this->getIdentifier()->isParentOf(identifier); } 93 /** @brief Returns true if the objects class is a direct parent of the given type. */ 94 inline bool isDirectParentOf(const Identifier* identifier) 95 { return this->getIdentifier()->isDirectParentOf(identifier); } 89 96 90 97 91 /** @ returns true if the objects class is of the given type or a derivative. */98 /** @brief Returns true if the objects class is of the given type or a derivative. */ 92 99 inline bool isA(const SubclassIdentifier<class B>* identifier) 93 100 { return this->getIdentifier()->isA(identifier->getIdentifier()); } 94 /** @ returns true if the objects class is exactly of the given type. */95 inline bool is DirectlyA(const SubclassIdentifier<class B>* identifier)96 { return this->getIdentifier()->is DirectlyA(identifier->getIdentifier()); }97 /** @ returns true if the objects class is a child of the given type. */101 /** @brief Returns true if the objects class is exactly of the given type. */ 102 inline bool isExactlyA(const SubclassIdentifier<class B>* identifier) 103 { return this->getIdentifier()->isExactlyA(identifier->getIdentifier()); } 104 /** @brief Returns true if the objects class is a child of the given type. */ 98 105 inline bool isChildOf(const SubclassIdentifier<class B>* identifier) 99 106 { return this->getIdentifier()->isChildOf(identifier->getIdentifier()); } 100 /** @returns true if the objects class is a parent of the given type. */ 107 /** @brief Returns true if the objects class is a direct child of the given type. */ 108 inline bool isDirectChildOf(const SubclassIdentifier<class B>* identifier) 109 { return this->getIdentifier()->isDirectChildOf(identifier->getIdentifier()); } 110 /** @brief Returns true if the objects class is a parent of the given type. */ 101 111 inline bool isParentOf(const SubclassIdentifier<class B>* identifier) 102 112 { return this->getIdentifier()->isParentOf(identifier->getIdentifier()); } 113 /** @brief Returns true if the objects class is a direct parent of the given type. */ 114 inline bool isDirectParentOf(const SubclassIdentifier<class B>* identifier) 115 { return this->getIdentifier()->isDirectParentOf(identifier->getIdentifier()); } 103 116 104 117 105 /** @ returns true if the objects class is of the given type or a derivative. */118 /** @brief Returns true if the objects class is of the given type or a derivative. */ 106 119 inline bool isA(const SubclassIdentifier<class B> identifier) 107 120 { return this->getIdentifier()->isA(identifier.getIdentifier()); } 108 /** @ returns true if the objects class is exactly of the given type. */109 inline bool is DirectlyA(const SubclassIdentifier<class B> identifier)110 { return this->getIdentifier()->is DirectlyA(identifier.getIdentifier()); }111 /** @ returns true if the objects class is a child of the given type. */121 /** @brief Returns true if the objects class is exactly of the given type. */ 122 inline bool isExactlyA(const SubclassIdentifier<class B> identifier) 123 { return this->getIdentifier()->isExactlyA(identifier.getIdentifier()); } 124 /** @brief Returns true if the objects class is a child of the given type. */ 112 125 inline bool isChildOf(const SubclassIdentifier<class B> identifier) 113 126 { return this->getIdentifier()->isChildOf(identifier.getIdentifier()); } 114 /** @returns true if the objects class is a parent of the given type. */ 127 /** @brief Returns true if the objects class is a direct child of the given type. */ 128 inline bool isDirectChildOf(const SubclassIdentifier<class B> identifier) 129 { return this->getIdentifier()->isDirectChildOf(identifier.getIdentifier()); } 130 /** @brief Returns true if the objects class is a parent of the given type. */ 115 131 inline bool isParentOf(const SubclassIdentifier<class B> identifier) 116 132 { return this->getIdentifier()->isParentOf(identifier.getIdentifier()); } 133 /** @brief Returns true if the objects class is a direct parent of the given type. */ 134 inline bool isDirectParentOf(const SubclassIdentifier<class B> identifier) 135 { return this->getIdentifier()->isDirectParentOf(identifier.getIdentifier()); } 117 136 118 137 119 /** @ returns true if the objects class is of the given type or a derivative. */138 /** @brief Returns true if the objects class is of the given type or a derivative. */ 120 139 inline bool isA(const OrxonoxClass* object) 121 140 { return this->getIdentifier()->isA(object->getIdentifier()); } 122 /** @ returns true if the objects class is exactly of the given type. */123 inline bool is DirectlyA(const OrxonoxClass* object)124 { return this->getIdentifier()->is DirectlyA(object->getIdentifier()); }125 /** @ returns true if the objects class is a child of the given type. */141 /** @brief Returns true if the objects class is exactly of the given type. */ 142 inline bool isExactlyA(const OrxonoxClass* object) 143 { return this->getIdentifier()->isExactlyA(object->getIdentifier()); } 144 /** @brief Returns true if the objects class is a child of the given type. */ 126 145 inline bool isChildOf(const OrxonoxClass* object) 127 146 { return this->getIdentifier()->isChildOf(object->getIdentifier()); } 128 /** @returns true if the objects class is a parent of the given type. */ 147 /** @brief Returns true if the objects class is a direct child of the given type. */ 148 inline bool isDirectChildOf(const OrxonoxClass* object) 149 { return this->getIdentifier()->isDirectChildOf(object->getIdentifier()); } 150 /** @brief Returns true if the objects class is a parent of the given type. */ 129 151 inline bool isParentOf(const OrxonoxClass* object) 130 152 { return this->getIdentifier()->isParentOf(object->getIdentifier()); } 131 132 133 /** @brief Sets the name of the object. @param name The name */ 134 inline virtual void setName(const std::string& name) { this->name_ = name; } 135 136 /** @returns the name of the object. */ 137 inline const std::string& getName() const { return this->name_; } 138 139 /** @brief Sets the state of the objects activity. @param bActive True = active */ 140 inline virtual void setActive(bool bActive) { this->bActive_ = bActive; } 141 142 /** @returns the state of the objects activity. */ 143 inline const bool isActive() const { return this->bActive_; } 144 145 /** @brief Sets the state of the objects visibility. @param bVisible True = visible */ 146 inline virtual void setVisible(bool bVisible) { this->bVisible_ = bVisible; } 147 148 /** @returns the state of the objects visibility. */ 149 inline const bool isVisible() const { return this->bVisible_; } 153 /** @brief Returns true if the objects class is a direct child of the given type. */ 154 inline bool isDirectParentOf(const OrxonoxClass* object) 155 { return this->getIdentifier()->isDirectParentOf(object->getIdentifier()); } 150 156 151 157 private: 152 Identifier* identifier_; //!< The Identifier of the object 153 IdentifierList* parents_; //!< List of all parents of the object 154 MetaObjectList metaList_; //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in 155 156 std::string name_; //!< The name of the object 157 bool bActive_; //!< True = the object is active 158 bool bVisible_; //!< True = the object is visible 158 Identifier* identifier_; //!< The Identifier of the object 159 std::list<const Identifier*>* parents_; //!< List of all parents of the object 160 MetaObjectList metaList_; //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in 159 161 }; 160 template class _CoreExport orxonox::ClassIdentifier<OrxonoxClass>;161 template class _CoreExport orxonox::ObjectList<OrxonoxClass>;162 162 } 163 163 -
code/trunk/src/orxonox/core/OutputHandler.cc
r790 r871 25 25 * 26 26 */ 27 28 /** 29 @file OutputHandler.cc 30 @brief Implementation of the OutputHandler class. 31 */ 27 32 28 33 #include "DebugLevel.h" … … 53 58 54 59 /** 55 @returns a reference to the only existing instance of the OutputHandler class. 60 @brief Returns a reference to the only existing instance of the OutputHandler class. 61 @return The instance 56 62 */ 57 63 OutputHandler& OutputHandler::getOutStream() -
code/trunk/src/orxonox/core/OutputHandler.h
r790 r871 26 26 */ 27 27 28 /* !28 /** 29 29 @file OutputHandler.h 30 30 @brief Definition of the OutputHandler class. … … 59 59 static OutputHandler& getOutStream(); 60 60 61 /** @ returns a reference to the logfile.*/61 /** @brief Returns a reference to the logfile. @return The logfile */ 62 62 inline std::ofstream& getLogfile() 63 63 { return this->logfile_; } … … 67 67 { this->outputLevel_ = level; return *this; } 68 68 69 /** @ returns the level of the incoming output.*/69 /** @brief Returns the level of the incoming output. @return The level */ 70 70 inline int getOutputLevel() const 71 71 { return this->outputLevel_; } -
code/trunk/src/orxonox/core/SignalHandler.cc
r790 r871 25 25 * 26 26 */ 27 28 /** 29 @file SignalHandler.cc 30 @brief Implementation of the SignalHandler class. 31 */ 27 32 28 33 #include <assert.h> -
code/trunk/src/orxonox/core/SignalHandler.h
r790 r871 26 26 */ 27 27 28 /*! 29 * @file SignalHandler.h 30 */ 28 /** 29 @file SignalHandler.h 30 @brief Definition of the SignalHandler class. 31 */ 31 32 32 33 #ifndef _SignalHandler_H__ -
code/trunk/src/orxonox/objects/Ambient.cc
r790 r871 40 40 #include "../core/CoreIncludes.h" 41 41 #include "../Orxonox.h" 42 #include "core/XMLPort.h" 42 43 43 44 #include "Ambient.h" … … 45 46 namespace orxonox 46 47 { 47 // create a template instantiations48 //template class _OrxonoxExport ClassIdentifier<Ambient>;49 50 48 CreateFactory(Ambient); 51 49 … … 61 59 void Ambient::loadParams(TiXmlElement* xmlElem) 62 60 { 63 Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager();64 65 61 if (xmlElem->Attribute("colourvalue")) 66 62 { … … 72 68 String2Number<float>(b, colourvalues[2]); 73 69 74 mgr->setAmbientLight(ColourValue(r,g,b));70 this->setAmbientLight(ColourValue(r, g, b)); 75 71 76 72 COUT(4) << "Loader: Set ambient light: "<<r<<" " << g << " " << b << std::endl << std::endl; 77 73 } 78 74 } 75 76 void Ambient::setAmbientLight(const ColourValue& colour) 77 { 78 Orxonox::getSingleton()->getSceneManager()->setAmbientLight(colour); 79 } 80 81 /** 82 @brief XML loading and saving. 83 @param xmlelement The XML-element 84 @param loading Loading (true) or saving (false) 85 @return The XML-element 86 */ 87 void Ambient::XMLPort(Element& xmlelement, bool loading) 88 { 89 BaseObject::XMLPort(xmlelement, loading); 90 91 XMLPortParamLoadOnly(Ambient, "colourvalue", setAmbientLight, xmlelement, loading); 92 } 79 93 } -
code/trunk/src/orxonox/objects/Ambient.h
r790 r871 14 14 virtual ~Ambient(); 15 15 16 17 16 void loadParams(TiXmlElement* xmlElem); 17 virtual void XMLPort(Element& xmlelement, bool loading); 18 void setAmbientLight(const ColourValue& colour); 18 19 19 20 private: 20 21 21 22 22 23 }; 23 ExportClass(Ambient, Orxonox);24 24 } 25 25 -
code/trunk/src/orxonox/objects/Camera.h
r790 r871 14 14 virtual ~Camera(); 15 15 16 16 17 17 void loadParams(TiXmlElement* xmlElem); 18 18 19 19 private: 20 20 21 21 22 22 }; 23 ExportClass(Camera, Orxonox);24 23 } 25 24 -
code/trunk/src/orxonox/objects/Explosion.h
r790 r871 21 21 ParticleInterface* particle_; 22 22 }; 23 ExportClass(Explosion, Orxonox);24 23 } 25 24 -
code/trunk/src/orxonox/objects/Fighter.h
r790 r871 90 90 int emitterRate_; 91 91 }; 92 ExportClass(Fighter, Orxonox);93 92 } 94 93 -
code/trunk/src/orxonox/objects/Model.cc
r790 r871 33 33 #include "../core/CoreIncludes.h" 34 34 #include "../Orxonox.h" 35 #include "core/XMLPort.h" 35 36 36 37 #include "Model.h" … … 60 61 } 61 62 63 /** 64 @brief XML loading and saving. 65 @param xmlelement The XML-element 66 @param loading Loading (true) or saving (false) 67 @return The XML-element 68 */ 69 void Model::XMLPort(Element& xmlelement, bool loading) 70 { 71 WorldEntity::XMLPort(xmlelement, loading); 72 73 XMLPortParamLoadOnly(Model, "mesh", setMesh, xmlelement, loading); 74 75 create(); 76 } 77 78 void Model::setMesh(const std::string& meshname) 79 { 80 this->meshSrc_ = meshname; 81 } 82 62 83 bool Model::create(){ 63 84 if(meshSrc_.compare("")!=0){ … … 71 92 72 93 void Model::registerAllVariables(){ 73 registerVar(&meshSrc_, meshSrc_.length() + 1, network::STRING);94 // registerVar(&meshSrc_, meshSrc_.length() + 1, network::STRING); 74 95 } 75 96 } -
code/trunk/src/orxonox/objects/Model.h
r790 r871 18 18 virtual ~Model(); 19 19 virtual void loadParams(TiXmlElement* xmlElem); 20 virtual void XMLPort(Element& xmlelement, bool loading); 21 void setMesh(const std::string& meshname); 20 22 bool create(); 21 23 … … 25 27 void registerAllVariables(); 26 28 }; 27 ExportClass(Model, Orxonox);28 29 } 29 30 -
code/trunk/src/orxonox/objects/NPC.h
r790 r871 44 44 static int const NUMELEMENTS = 9; //number of elements 45 45 }; 46 ExportClass(NPC, Orxonox);47 48 46 } 49 47 #endif /* _NPC_H__ */ -
code/trunk/src/orxonox/objects/Projectile.h
r790 r871 28 28 Timer<Projectile> destroyTimer_; 29 29 }; 30 ExportClass(Projectile, Orxonox);31 30 } 32 31 -
code/trunk/src/orxonox/objects/Skybox.cc
r790 r871 38 38 #include "../core/CoreIncludes.h" 39 39 #include "../core/Debug.h" 40 #include "core/XMLPort.h" 40 41 41 42 #include "Skybox.h" … … 56 57 void Skybox::loadParams(TiXmlElement* xmlElem) 57 58 { 58 Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager();59 60 59 if (xmlElem->Attribute("src")) 61 60 { 62 61 std::string skyboxSrc = xmlElem->Attribute("src"); 63 mgr->setSkyBox(true,skyboxSrc);62 this->setSkybox(skyboxSrc); 64 63 65 64 COUT(4) << "Loader: Set skybox: "<< skyboxSrc << std::endl << std::endl; 66 65 } 67 66 } 67 68 void Skybox::setSkybox(const std::string& skyboxname) 69 { 70 Orxonox::getSingleton()->getSceneManager()->setSkyBox(true, skyboxname); 71 } 72 73 /** 74 @brief XML loading and saving. 75 @param xmlelement The XML-element 76 @param loading Loading (true) or saving (false) 77 @return The XML-element 78 */ 79 void Skybox::XMLPort(Element& xmlelement, bool loading) 80 { 81 BaseObject::XMLPort(xmlelement, loading); 82 83 XMLPortParamLoadOnly(Skybox, "src", setSkybox, xmlelement, loading); 84 } 68 85 } -
code/trunk/src/orxonox/objects/Skybox.h
r790 r871 16 16 virtual ~Skybox(); 17 17 18 19 18 void loadParams(TiXmlElement* xmlElem); 19 virtual void XMLPort(Element& xmlelement, bool loading); 20 void setSkybox(const std::string& skyboxname); 20 21 21 22 private: 22 23 23 24 24 25 }; 25 ExportClass(Skybox, Orxonox);26 26 } 27 27 -
code/trunk/src/orxonox/objects/SpaceShip.cc
r790 r871 44 44 #include "../particle/ParticleInterface.h" 45 45 #include "Projectile.h" 46 #include "core/XMLPort.h" 46 47 47 48 #include "SpaceShip.h" … … 123 124 this->brakeLoop(loop); 124 125 */ 126 this->init(); 127 125 128 COUT(3) << "Info: SpaceShip was loaded" << std::endl; 126 129 } … … 132 135 } 133 136 134 void SpaceShip::setConfigValues() 135 { 136 SetConfigValue(bInvertYAxis_, false).description("Set this to true for joystick-like mouse behaviour (mouse up = ship down)."); 137 SetConfigValue(reloadTime_, 0.125).description("The reload time of the weapon in seconds"); 138 SetConfigValue(testvector_, Vector3()).description("asdfblah"); 139 } 140 141 void SpaceShip::loadParams(TiXmlElement* xmlElem) 142 { 143 Model::loadParams(xmlElem); 144 145 137 void SpaceShip::init() 138 { 146 139 // START CREATING THRUSTER 147 140 this->tt_ = new ParticleInterface(Orxonox::getSingleton()->getSceneManager(),"twinthruster" + this->getName(),"Orxonox/engineglow"); … … 197 190 198 191 // END of testing crosshair 199 192 } 193 194 void SpaceShip::setConfigValues() 195 { 196 SetConfigValue(bInvertYAxis_, false).description("Set this to true for joystick-like mouse behaviour (mouse up = ship down)."); 197 SetConfigValue(reloadTime_, 0.125).description("The reload time of the weapon in seconds"); 198 SetConfigValue(testvector_, Vector3()).description("asdfblah"); 199 } 200 201 void SpaceShip::loadParams(TiXmlElement* xmlElem) 202 { 203 Model::loadParams(xmlElem); 200 204 /* 201 205 if (xmlElem->Attribute("forward") && xmlElem->Attribute("rotateupdown") && xmlElem->Attribute("rotaterightleft") && xmlElem->Attribute("looprightleft")) … … 242 246 if (xmlElem->Attribute("camera")) 243 247 { 244 Ogre::Camera *cam = Orxonox::getSingleton()->getSceneManager()->createCamera("ShipCam"); 245 this->camNode_ = this->getNode()->createChildSceneNode("CamNode"); 246 /* 247 // node->setInheritOrientation(false); 248 cam->setPosition(Vector3(0,50,-150)); 249 cam->lookAt(Vector3(0,20,0)); 250 cam->roll(Degree(0)); 251 */ 252 253 cam->setPosition(Vector3(-200,0,35)); 254 // cam->setPosition(Vector3(0,-350,0)); 255 cam->lookAt(Vector3(0,0,35)); 256 cam->roll(Degree(-90)); 257 258 this->camNode_->attachObject(cam); 259 Orxonox::getSingleton()->getOgrePointer()->getRoot()->getAutoCreatedWindow()->addViewport(cam); 248 this->setCamera(); 260 249 } 250 } 251 252 void SpaceShip::setCamera(const std::string& camera) 253 { 254 Ogre::Camera *cam = Orxonox::getSingleton()->getSceneManager()->createCamera("ShipCam"); 255 this->camNode_ = this->getNode()->createChildSceneNode("CamNode"); 256 /* 257 // node->setInheritOrientation(false); 258 cam->setPosition(Vector3(0,50,-150)); 259 cam->lookAt(Vector3(0,20,0)); 260 cam->roll(Degree(0)); 261 */ 262 263 cam->setPosition(Vector3(-200,0,35)); 264 // cam->setPosition(Vector3(0,-350,0)); 265 cam->lookAt(Vector3(0,0,35)); 266 cam->roll(Degree(-90)); 267 268 this->camNode_->attachObject(cam); 269 Orxonox::getSingleton()->getOgrePointer()->getRoot()->getAutoCreatedWindow()->addViewport(cam); 270 } 271 272 void SpaceShip::setMaxSpeed(float value) 273 { this->maxSpeed_ = value; } 274 void SpaceShip::setMaxSideAndBackSpeed(float value) 275 { this->maxSideAndBackSpeed_ = value; } 276 void SpaceShip::setMaxRotation(float value) 277 { this->maxRotation_ = value; this->maxRotationRadian_ = Radian(value); } 278 void SpaceShip::setTransAcc(float value) 279 { this->translationAcceleration_ = value; } 280 void SpaceShip::setRotAcc(float value) 281 { this->rotationAcceleration_ = value; this->rotationAccelerationRadian_ = Radian(value); } 282 void SpaceShip::setTransDamp(float value) 283 { this->translationDamping_ = value; } 284 void SpaceShip::setRotDamp(float value) 285 { this->rotationDamping_ = value; this->rotationDampingRadian_ = Radian(value); } 286 287 /** 288 @brief XML loading and saving. 289 @param xmlelement The XML-element 290 @param loading Loading (true) or saving (false) 291 @return The XML-element 292 */ 293 void SpaceShip::XMLPort(Element& xmlelement, bool loading) 294 { 295 Model::XMLPort(xmlelement, loading); 296 297 XMLPortParamLoadOnly(SpaceShip, "camera", setCamera, xmlelement, loading); 298 XMLPortParamLoadOnly(SpaceShip, "maxSpeed", setMaxSpeed, xmlelement, loading); 299 XMLPortParamLoadOnly(SpaceShip, "maxSideAndBackSpeed", setMaxSideAndBackSpeed, xmlelement, loading); 300 XMLPortParamLoadOnly(SpaceShip, "maxRotation", setMaxRotation, xmlelement, loading); 301 XMLPortParamLoadOnly(SpaceShip, "transAcc", setTransAcc, xmlelement, loading); 302 XMLPortParamLoadOnly(SpaceShip, "rotAcc", setRotAcc, xmlelement, loading); 303 XMLPortParamLoadOnly(SpaceShip, "transDamp", setTransDamp, xmlelement, loading); 304 XMLPortParamLoadOnly(SpaceShip, "rotDamp", setRotDamp, xmlelement, loading); 261 305 } 262 306 -
code/trunk/src/orxonox/objects/SpaceShip.h
r790 r871 21 21 SpaceShip(); 22 22 ~SpaceShip(); 23 void init(); 23 24 void setConfigValues(); 24 25 virtual void loadParams(TiXmlElement* xmlElem); 26 virtual void XMLPort(Element& xmlelement, bool loading); 25 27 virtual void tick(float dt); 28 29 void setCamera(const std::string& camera = ""); 30 void setMaxSpeed(float value); 31 void setMaxSideAndBackSpeed(float value); 32 void setMaxRotation(float value); 33 void setTransAcc(float value); 34 void setRotAcc(float value); 35 void setTransDamp(float value); 36 void setRotDamp(float value); 26 37 27 38 bool mouseMoved(const OIS::MouseEvent &e); … … 75 86 int emitterRate_; 76 87 }; 77 ExportClass(SpaceShip, Orxonox);78 88 } 79 89 -
code/trunk/src/orxonox/objects/SpaceshipSteeringObject.cc
r790 r871 40 40 #include "util/Tokenizer.h" 41 41 #include "util/String2Number.h" 42 #include "../core/Debug.h" 43 42 #include "core/CoreIncludes.h" 44 43 #include "SpaceshipSteeringObject.h" 45 44 -
code/trunk/src/orxonox/objects/Test.h
r790 r871 30 30 31 31 #include "core/BaseObject.h" 32 #include "../core/CoreIncludes.h"33 32 34 33 namespace orxonox … … 74 73 public: 75 74 A1B2() { RegisterObject(A1B2); } 75 // virtual void test() = 0; 76 76 }; 77 77 … … 116 116 public: 117 117 A1B2C1() { RegisterObject(A1B2C1); } 118 // void test() { std::cout << "test!\n"; } 118 119 }; 119 120 -
code/trunk/src/orxonox/objects/Tickable.h
r790 r871 44 44 45 45 #include "../OrxonoxPrereqs.h" 46 47 #include "../core/CoreIncludes.h" 46 #include "core/OrxonoxClass.h" 48 47 49 48 namespace orxonox … … 62 61 63 62 protected: 64 /** 65 @brief Constructor: Registers the object in the Tickable-list 66 */ 67 Tickable() { RegisterRootObject(Tickable); } 63 Tickable(); 68 64 }; 69 ExportAbstractClass(Tickable, Orxonox);70 65 71 66 //! The TickFrameListener calls the tick(dt) function of all Tickables every frame. -
code/trunk/src/orxonox/objects/WorldEntity.cc
r790 r871 37 37 #include "../Orxonox.h" 38 38 #include "WorldEntity.h" 39 #include "core/XMLPort.h" 39 40 40 41 namespace orxonox … … 86 87 void WorldEntity::loadParams(TiXmlElement* xmlElem) 87 88 { 89 88 90 BaseObject::loadParams(xmlElem); 89 91 /* 90 92 if (xmlElem->Attribute("position")) 91 93 { … … 153 155 154 156 create(); 155 157 */ 158 } 159 160 void WorldEntity::setYawPitchRoll(const Degree& yaw, const Degree& pitch, const Degree& roll) 161 { 162 this->yaw(yaw); 163 this->pitch(pitch); 164 this->roll(roll); 165 } 166 167 /** 168 @brief XML loading and saving. 169 @param xmlelement The XML-element 170 @param loading Loading (true) or saving (false) 171 @return The XML-element 172 */ 173 void WorldEntity::XMLPort(Element& xmlelement, bool loading) 174 { 175 BaseObject::XMLPort(xmlelement, loading); 176 177 XMLPortParam(WorldEntity, "position", setPositionLoader2, getPosition, xmlelement, loading); 178 XMLPortParamLoadOnly(WorldEntity, "direction", setDirectionLoader, xmlelement, loading); 179 XMLPortParamLoadOnly(WorldEntity, "yawpitchroll", setYawPitchRoll, xmlelement, loading); 180 XMLPortParam(WorldEntity, "scale", setTotalScale, getScale, xmlelement, loading); 181 XMLPortParam(WorldEntity, "rotationAxis", setRotationAxisLoader, getRotationAxis, xmlelement, loading); 182 XMLPortParam(WorldEntity, "rotationRate", setRotationRate, getRotationRate, xmlelement, loading); 183 184 XMLPortObject(WorldEntity, WorldEntity, "attached", attachWorldEntity, getAttachedWorldEntity, xmlelement, loading); 156 185 } 157 186 … … 163 192 void WorldEntity::registerAllVariables() 164 193 { 165 // register coordinates194 /* // register coordinates 166 195 registerVar( (void*) &(this->getPosition().x), sizeof(this->getPosition().x), network::DATA); 167 196 registerVar( (void*) &(this->getPosition().y), sizeof(this->getPosition().y), network::DATA); … … 171 200 registerVar( (void*) &(this->getOrientation().x), sizeof(this->getOrientation().x), network::DATA); 172 201 registerVar( (void*) &(this->getOrientation().y), sizeof(this->getOrientation().y), network::DATA); 173 registerVar( (void*) &(this->getOrientation().z), sizeof(this->getOrientation().z), network::DATA); 202 registerVar( (void*) &(this->getOrientation().z), sizeof(this->getOrientation().z), network::DATA);*/ 174 203 // not needed at the moment, because we don't have prediction yet 175 204 /*// register velocity_ … … 183 212 registerVar( (void*) &(this->getRotationAxis().z), sizeof(this->getRotationAxis().z), network::DATA);*/ 184 213 } 214 215 void WorldEntity::attachWorldEntity(WorldEntity* entity) 216 { 217 this->attachedWorldEntities_.push_back(entity); 218 } 219 220 const WorldEntity* WorldEntity::getAttachedWorldEntity(unsigned int index) 221 { 222 if (index < this->attachedWorldEntities_.size()) 223 return this->attachedWorldEntities_[index]; 224 else 225 return 0; 226 } 185 227 } -
code/trunk/src/orxonox/objects/WorldEntity.h
r790 r871 8 8 9 9 #include "util/Math.h" 10 #include "util/XMLIncludes.h" 10 11 #include "network/Synchronisable.h" 11 #include "util/tinyxml/tinyxml.h" 12 #include "../core/CoreIncludes.h" 12 //#include "util/tinyxml/tinyxml.h" 13 13 #include "core/BaseObject.h" 14 14 #include "Tickable.h" … … 17 17 namespace orxonox 18 18 { 19 class _OrxonoxExport WorldEntity : public BaseObject, public Tickable, public network::Synchronisable20 {21 public:22 WorldEntity();23 virtual ~WorldEntity();19 class _OrxonoxExport WorldEntity : public BaseObject, public Tickable//, public network::Synchronisable 20 { 21 public: 22 WorldEntity(); 23 virtual ~WorldEntity(); 24 24 25 virtual void tick(float dt); 26 virtual void loadParams(TiXmlElement* xmlElem); 27 bool create(); 25 virtual void tick(float dt); 26 virtual void loadParams(TiXmlElement* xmlElem); 27 virtual void XMLPort(Element& xmlelement, bool loading); 28 bool create(); 28 29 29 inline Ogre::SceneNode* getNode()30 { return this->node_; }30 void attachWorldEntity(WorldEntity* entity); 31 const WorldEntity* getAttachedWorldEntity(unsigned int index); 31 32 32 inline void setNode(Ogre::SceneNode* node)33 { this->node_ = node; }33 inline Ogre::SceneNode* getNode() 34 { return this->node_; } 34 35 35 inline void setPosition(const Vector3& pos) 36 { this->node_->setPosition(pos); } 37 inline void setPosition(Real x, Real y, Real z) 38 { this->node_->setPosition(x, y, z); } 39 inline const Vector3& getPosition() const 40 { return this->node_->getPosition(); } 36 inline void setNode(Ogre::SceneNode* node) 37 { this->node_ = node; } 41 38 42 inline void translate(const Vector3 &d, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT) 43 { this->node_->translate(d, relativeTo); } 44 inline void translate(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT) 45 { this->node_->translate(x, y, z, relativeTo); } 46 inline void translate(const Matrix3 &axes, const Vector3 &move, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT) 47 { this->node_->translate(axes, move, relativeTo); } 48 inline void translate(const Matrix3 &axes, Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT) 49 { this->node_->translate(axes, x, y, z, relativeTo); } 39 inline void setPosition(const Vector3& pos) 40 { this->node_->setPosition(pos); } 41 inline void setPositionLoader1(const Vector3& pos) 42 { this->node_->setPosition(pos); } 43 inline void setPositionLoader2(Real x, Real y, Real z) 44 { this->node_->setPosition(x, y, z); } 45 inline void setPosition(Real x, Real y, Real z) 46 { this->node_->setPosition(x, y, z); } 47 inline const Vector3& getPosition() const 48 { return this->node_->getPosition(); } 50 49 51 inline void yaw(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) 52 { this->node_->yaw(angle, relativeTo); } 53 inline void pitch(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) 54 { this->node_->pitch(angle, relativeTo); } 55 inline void roll(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) 56 { this->node_->roll(angle, relativeTo); } 50 inline void translate(const Vector3 &d, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT) 51 { this->node_->translate(d, relativeTo); } 52 inline void translate(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT) 53 { this->node_->translate(x, y, z, relativeTo); } 54 inline void translate(const Matrix3 &axes, const Vector3 &move, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT) 55 { this->node_->translate(axes, move, relativeTo); } 56 inline void translate(const Matrix3 &axes, Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT) 57 { this->node_->translate(axes, x, y, z, relativeTo); } 57 58 58 inline const Ogre::Quaternion& getOrientation() 59 { return this->node_->getOrientation(); } 60 inline void setOrientation(const Ogre::Quaternion& quat) 61 { this->node_->setOrientation(quat); } 62 inline void rotate(const Vector3 &axis, const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) 63 { this->node_->rotate(axis, angle, relativeTo); } 64 inline void setDirection(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) 65 { this->node_->setDirection(x, y, z, relativeTo, localDirectionVector); } 66 inline void setDirection(const Vector3 &vec, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) 67 { this->node_->setDirection(vec, relativeTo, localDirectionVector); } 68 inline void lookAt(const Vector3 &targetPoint, Ogre::Node::TransformSpace relativeTo, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) 69 { this->node_->lookAt(targetPoint, relativeTo, localDirectionVector); } 59 inline void yaw(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) 60 { this->node_->yaw(angle, relativeTo); } 61 inline void pitch(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) 62 { this->node_->pitch(angle, relativeTo); } 63 inline void roll(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) 64 { this->node_->roll(angle, relativeTo); } 65 void setYawPitchRoll(const Degree& yaw, const Degree& pitch, const Degree& roll); 70 66 71 inline void setScale(const Vector3 &scale) 72 { this->node_->setScale(scale); } 73 inline void setScale(Real x, Real y, Real z) 74 { this->node_->setScale(x, y, z); } 75 inline void setScale(Real scale) 76 { this->node_->setScale(scale, scale, scale); } 77 inline const Vector3& getScale(void) const 78 { return this->node_->getScale(); } 79 inline void scale(const Vector3 &scale) 80 { this->node_->scale(scale); } 81 inline void scale(Real x, Real y, Real z) 82 { this->node_->scale(x, y, z); } 83 inline void scale(Real scale) 84 { this->node_->scale(scale, scale, scale); } 67 inline void setYaw(const Degree &angle) 68 { this->node_->yaw(angle, Ogre::Node::TS_LOCAL); } 69 inline void setPitch(const Degree &angle) 70 { this->node_->pitch(angle, Ogre::Node::TS_LOCAL); } 71 inline void setRoll(const Degree &angle) 72 { this->node_->roll(angle, Ogre::Node::TS_LOCAL); } 85 73 86 inline void attachObject(Ogre::MovableObject *obj) 87 { this->node_->attachObject(obj); } 88 inline void attachObject(Mesh &mesh) 89 { this->node_->attachObject(mesh.getEntity()); } 90 inline void detachObject(Ogre::MovableObject *obj) 91 { this->node_->detachObject(obj); } 92 inline void detachAllObjects() 93 { this->node_->detachAllObjects(); } 74 inline const Ogre::Quaternion& getOrientation() 75 { return this->node_->getOrientation(); } 76 inline void setOrientation(const Ogre::Quaternion& quat) 77 { this->node_->setOrientation(quat); } 78 inline void rotate(const Vector3 &axis, const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) 79 { this->node_->rotate(axis, angle, relativeTo); } 80 inline void setDirectionLoader(Real x, Real y, Real z) 81 { this->setDirection(x, y, z); } 82 inline void setDirection(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) 83 { this->node_->setDirection(x, y, z, relativeTo, localDirectionVector); } 84 inline void setDirection(const Vector3 &vec, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) 85 { this->node_->setDirection(vec, relativeTo, localDirectionVector); } 86 inline void lookAt(const Vector3 &targetPoint, Ogre::Node::TransformSpace relativeTo, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) 87 { this->node_->lookAt(targetPoint, relativeTo, localDirectionVector); } 94 88 95 inline void setVelocity(const Vector3& velocity) 96 { this->velocity_ = velocity; } 97 inline void setVelocity(Real x, Real y, Real z) 98 { this->velocity_.x = x; this->velocity_.y = y; this->velocity_.z = z; } 99 inline const Vector3& getVelocity() const 100 { return this->velocity_; } 89 inline void setScale(const Vector3 &scale) 90 { this->node_->setScale(scale); } 91 inline void setScale(Real x, Real y, Real z) 92 { this->node_->setScale(x, y, z); } 93 inline void setScale(Real scale) 94 { this->node_->setScale(scale, scale, scale); } 95 inline void setTotalScale(Real scale) 96 { this->node_->setScale(scale, scale, scale); } 97 inline const Vector3& getScale(void) const 98 { return this->node_->getScale(); } 99 inline void scale(const Vector3 &scale) 100 { this->node_->scale(scale); } 101 inline void scale(Real x, Real y, Real z) 102 { this->node_->scale(x, y, z); } 103 inline void scale(Real scale) 104 { this->node_->scale(scale, scale, scale); } 101 105 102 inline void setAcceleration(const Vector3& acceleration) 103 { this->acceleration_ = acceleration; } 104 inline void setAcceleration(Real x, Real y, Real z) 105 { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; } 106 inline const Vector3& getAcceleration() const 107 { return this->acceleration_; } 106 inline void attachObject(Ogre::MovableObject *obj) 107 { this->node_->attachObject(obj); } 108 inline void attachObject(Mesh &mesh) 109 { this->node_->attachObject(mesh.getEntity()); } 110 inline void detachObject(Ogre::MovableObject *obj) 111 { this->node_->detachObject(obj); } 112 inline void detachAllObjects() 113 { this->node_->detachAllObjects(); } 108 114 109 inline void setRotationAxis(const Vector3& axis)110 { this->rotationAxis_ = axis; }111 inline void setRotationAxis(Real x, Real y, Real z)112 { this->rotationAxis_.x = x; this->rotationAxis_.y = y; this->rotationAxis_.z = z; }113 inline const Vector3& getRotationAxis() const114 { return this->rotationAxis_; }115 inline void setVelocity(const Vector3& velocity) 116 { this->velocity_ = velocity; } 117 inline void setVelocity(Real x, Real y, Real z) 118 { this->velocity_.x = x; this->velocity_.y = y; this->velocity_.z = z; } 119 inline const Vector3& getVelocity() const 120 { return this->velocity_; } 115 121 116 inline void setRotationRate(const Radian& angle)117 { this->rotationRate_ = angle; }118 inline void setRotationRate(const Degree& angle)119 { this->rotationRate_ = angle; }120 inline const Radian& getRotationRate() const121 { return this->rotationRate_; }122 inline void setAcceleration(const Vector3& acceleration) 123 { this->acceleration_ = acceleration; } 124 inline void setAcceleration(Real x, Real y, Real z) 125 { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; } 126 inline const Vector3& getAcceleration() const 127 { return this->acceleration_; } 122 128 123 inline void setMomentum(const Radian& angle) 124 { this->momentum_ = angle; } 125 inline void setMomentum(const Degree& angle) 126 { this->momentum_ = angle; } 127 inline const Radian& getMomentum() const 128 { return this->momentum_; } 129 inline void setRotationAxisLoader(const Vector3& axis) 130 { this->rotationAxis_ = axis; } 131 inline void setRotationAxis(const Vector3& axis) 132 { this->rotationAxis_ = axis; } 133 inline void setRotationAxis(Real x, Real y, Real z) 134 { this->rotationAxis_.x = x; this->rotationAxis_.y = y; this->rotationAxis_.z = z; } 135 inline const Vector3& getRotationAxis() const 136 { return this->rotationAxis_; } 129 137 130 inline void setStatic(bool bStatic) 131 { this->bStatic_ = bStatic; } 132 inline bool isStatic() 133 { return this->bStatic_; } 138 // inline void setRotationRate(const Radian& angle) 139 // { this->rotationRate_ = angle; } 140 inline void setRotationRate(const Degree& angle) 141 { this->rotationRate_ = angle; this->setStatic(angle == Degree(0)); } 142 inline const Radian& getRotationRate() const 143 { return this->rotationRate_; } 134 144 135 protected: 136 void registerAllVariables(); 145 inline void setMomentum(const Radian& angle) 146 { this->momentum_ = angle; } 147 inline void setMomentum(const Degree& angle) 148 { this->momentum_ = angle; } 149 inline const Radian& getMomentum() const 150 { return this->momentum_; } 137 151 138 Vector3 velocity_; 139 Vector3 acceleration_; 140 Vector3 rotationAxis_; 141 Radian rotationRate_; 142 Radian momentum_; 152 inline void setStatic(bool bStatic) 153 { this->bStatic_ = bStatic; } 154 inline bool isStatic() 155 { return this->bStatic_; } 143 156 144 private: 145 static unsigned int worldEntityCounter_s; 146 Ogre::SceneNode* node_; 147 bool bStatic_; 148 }; 149 ExportClass(WorldEntity, Orxonox); 157 protected: 158 void registerAllVariables(); 159 160 Vector3 velocity_; 161 Vector3 acceleration_; 162 Vector3 rotationAxis_; 163 Radian rotationRate_; 164 Radian momentum_; 165 166 private: 167 static unsigned int worldEntityCounter_s; 168 Ogre::SceneNode* node_; 169 bool bStatic_; 170 std::vector<WorldEntity*> attachedWorldEntities_; 171 }; 150 172 } 151 173 -
code/trunk/src/orxonox/objects/test1.cc
r790 r871 29 29 #include "test2.h" 30 30 #include "test3.h" 31 #include "util/tinyxml/tinyxml.h" 32 #include "../Orxonox.h" 33 #include <OgreSceneManager.h> 31 #include "core/CoreIncludes.h" 34 32 35 33 namespace orxonox -
code/trunk/src/orxonox/objects/test2.cc
r790 r871 29 29 #include "test2.h" 30 30 #include "test3.h" 31 #include "core/CoreIncludes.h" 31 32 32 33 namespace orxonox -
code/trunk/src/orxonox/objects/test3.cc
r790 r871 29 29 #include "test2.h" 30 30 #include "test3.h" 31 #include "core/CoreIncludes.h" 31 32 32 33 namespace orxonox … … 63 64 void Test3::configOutput() 64 65 { 65 std::cout << this->value_int_ << std::endl;66 std::cout << this->value_uint_ << std::endl;67 std::cout << (int)this->value_char_ << std::endl;68 std::cout << (int)this->value_uchar_ << std::endl;69 std::cout << this->value_float_ << std::endl;70 std::cout << this->value_double_ << std::endl;71 std::cout << this->value_bool_ << std::endl;72 std::cout << this->value_string_ << std::endl;73 std::cout << this->value_constchar_ << std::endl;74 std::cout << this->value_vector2_ << std::endl;75 std::cout << this->value_vector3_ << std::endl;76 std::cout << this->value_colourvalue_ << std::endl;66 std::cout << "int: " << this->value_int_ << std::endl; 67 std::cout << "uint: " << this->value_uint_ << std::endl; 68 std::cout << "char: " << (int)this->value_char_ << std::endl; 69 std::cout << "uchar: " << (int)this->value_uchar_ << std::endl; 70 std::cout << "float: " << this->value_float_ << std::endl; 71 std::cout << "double: " << this->value_double_ << std::endl; 72 std::cout << "bool: " << this->value_bool_ << std::endl; 73 std::cout << "string: " << this->value_string_ << std::endl; 74 std::cout << "constchar: " << this->value_constchar_ << std::endl; 75 std::cout << "vector2: " << this->value_vector2_ << std::endl; 76 std::cout << "vector3: " << this->value_vector3_ << std::endl; 77 std::cout << "colourvalue: " << this->value_colourvalue_ << std::endl; 77 78 } 78 79 -
code/trunk/src/orxonox/objects/test3.h
r790 r871 3 3 4 4 #include "core/BaseObject.h" 5 #include "util/Math.h" 5 6 6 7 namespace orxonox -
code/trunk/src/orxonox/objects/weapon/AmmunitionDump.cc
r790 r871 31 31 #include "BulletManager.h" 32 32 #include "util/tinyxml/tinyxml.h" 33 #include "core/CoreIncludes.h" 33 34 34 35 #include "AmmunitionDump.h" -
code/trunk/src/orxonox/objects/weapon/AmmunitionDump.h
r790 r871 37 37 38 38 #include "network/Synchronisable.h" 39 //#include "../core/CoreIncludes.h"40 39 #include "core/BaseObject.h" 41 40 … … 66 65 int *capacity_; 67 66 }; 68 ExportClass(AmmunitionDump, Orxonox);69 67 } 70 68 -
code/trunk/src/orxonox/objects/weapon/BarrelGun.cc
r790 r871 38 38 #include "AmmunitionDump.h" 39 39 #include "BaseWeapon.h" 40 #include "core/CoreIncludes.h" 40 41 41 42 #include "BarrelGun.h" -
code/trunk/src/orxonox/objects/weapon/BarrelGun.h
r790 r871 60 60 61 61 }; 62 ExportClass(BarrelGun, Orxonox);63 62 } 64 63 -
code/trunk/src/orxonox/objects/weapon/BaseWeapon.cc
r790 r871 38 38 #include "BulletManager.h" 39 39 #include "AmmunitionDump.h" 40 #include "core/CoreIncludes.h" 40 41 41 42 #include "BaseWeapon.h" -
code/trunk/src/orxonox/objects/weapon/BaseWeapon.h
r790 r871 122 122 123 123 }; 124 ExportAbstractClass(BaseWeapon, Orxonox);125 124 } 126 125 -
code/trunk/src/orxonox/objects/weapon/Bullet.cc
r790 r871 27 27 28 28 #include "OrxonoxStableHeaders.h" 29 #include "core/CoreIncludes.h" 29 30 30 31 #include "Bullet.h" -
code/trunk/src/orxonox/objects/weapon/Bullet.h
r790 r871 47 47 inline virtual void loadParams(TiXmlElement* xmlElem) { Model::loadParams(xmlElem); }; 48 48 }; 49 ExportClass(Bullet, Orxonox);50 49 } 51 50 -
code/trunk/src/orxonox/objects/weapon/BulletManager.cc
r790 r871 30 30 #include "BulletManager.h" 31 31 #include "Bullet.h" 32 #include "core/CoreIncludes.h" 32 33 33 34 -
code/trunk/src/orxonox/objects/weapon/BulletManager.h
r790 r871 38 38 #include "network/Synchronisable.h" 39 39 #include "util/tinyxml/tinyxml.h" 40 #include "../../core/CoreIncludes.h"41 40 #include "core/BaseObject.h" 42 41 #include "../Tickable.h" … … 67 66 int bulletsIndex_; 68 67 }; 69 ExportClass(BulletManager, Orxonox);70 68 } 71 69 -
code/trunk/src/orxonox/tools/BillboardSet.h
r790 r871 7 7 8 8 #include "../OrxonoxPrereqs.h" 9 10 #include "../core/CoreIncludes.h"11 9 #include "util/Math.h" 12 10 -
code/trunk/src/orxonox/tools/Timer.h
r790 r871 59 59 60 60 #include <OgreFrameListener.h> 61 62 61 #include "../OrxonoxPrereqs.h" 63 64 #include "../core/CoreIncludes.h"65 62 66 63 namespace orxonox … … 72 69 73 70 public: 74 /** @brief Constructor: Sets the default-values. */ 75 TimerBase() 76 { 77 RegisterRootObject(TimerBase); 78 79 this->interval_ = 0; 80 this->bLoop_ = false; 81 this->bActive_ = false; 82 83 this->time_ = 0; 84 } 71 TimerBase(); 85 72 86 73 virtual void run() const = 0; … … 94 81 /** @brief Unpauses the Timer - continues with the given state. */ 95 82 inline void unpauseTimer() { this->bActive_ = true; } 96 /** @ returns true if the Timer is active (= not stoped, not paused).*/83 /** @brief Returns true if the Timer is active (= not stoped, not paused). @return True = Time is active */ 97 84 inline bool isActive() const { return this->bActive_; } 98 85 … … 104 91 float time_; //!< Internal variable, counting the time till the next function-call 105 92 }; 106 ExportAbstractClass(TimerBase, Orxonox);107 93 108 94 //! The Timer is a callback-object, calling a given function after a given time-interval. … … 158 144 T* object_; 159 145 }; 160 ExportAbstractClass(Timer<BaseObject>, Orxonox);161 146 162 147 //! The TimerFrameListener manages all Timers in the game. -
code/trunk/src/util/CMakeLists.txt
r790 r871 4 4 5 5 SET (UTIL_SRC_FILES 6 Math.cc 7 String.cc 8 SubString.cc 9 MultiTypePrimitive.cc 10 MultiTypeString.cc 11 MultiTypeMath.cc 6 12 ${TINYXML_SRC_FILES} 7 substring.cc8 13 ) 9 14 10 IF(WIN32) 11 ADD_LIBRARY( util ${UTIL_SRC_FILES} ) 12 ELSE(WIN32) 13 ADD_LIBRARY( util SHARED ${UTIL_SRC_FILES} ) 14 ENDIF(WIN32) 15 ADD_LIBRARY( util SHARED ${UTIL_SRC_FILES} ) 15 16 SET_TARGET_PROPERTIES( util PROPERTIES LINK_FLAGS "--no-undefined" ) 16 17 17 18 18 IF(TESTING_ENABLED) 19 19 ADD_SUBDIRECTORY(testing) 20 20 ENDIF(TESTING_ENABLED) 21 22 TARGET_LINK_LIBRARIES( util 23 ${OGRE_LIBRARIES} 24 ) -
code/trunk/src/util/Convert.h
r790 r871 36 36 #include <sstream> 37 37 38 #include "UtilPrereqs.h" 39 #include "Math.h" 40 #include "SubString.h" 41 #include "MultiTypeMath.h" 42 38 43 39 44 // DEFAULT CLASS … … 41 46 class Converter 42 47 { 43 public:44 bool operator()(ToType* output, const FromType& input) const45 {46 return false;47 }48 public: 49 bool operator()(ToType* output, const FromType& input) const 50 { 51 return false; 52 } 48 53 }; 49 54 … … 52 57 class Converter<FromType, std::string> 53 58 { 54 public:55 bool operator()(std::string* output, const FromType& input) const56 {57 std::ostringstream oss;58 if (oss << input)59 {60 (*output) = oss.str();61 return true;62 }63 else64 return false;65 }59 public: 60 bool operator()(std::string* output, const FromType& input) const 61 { 62 std::ostringstream oss; 63 if (oss << input) 64 { 65 (*output) = oss.str(); 66 return true; 67 } 68 else 69 return false; 70 } 66 71 }; 67 72 … … 70 75 class Converter<std::string, ToType> 71 76 { 72 public:73 bool operator()(ToType* output, const std::string& input) const74 {75 std::istringstream iss(input);76 if (iss >> (*output))77 return true;78 else79 return false;80 }77 public: 78 bool operator()(ToType* output, const std::string& input) const 79 { 80 std::istringstream iss(input); 81 if (iss >> (*output)) 82 return true; 83 else 84 return false; 85 } 81 86 }; 82 87 … … 101 106 } 102 107 108 // THE SAME LIKE BEFORE, BUT NEEDS NO POINTER TO THE OUTPUT 109 template<typename FromType, typename ToType> 110 static ToType ConvertValueAndReturn(const FromType& input) 111 { 112 ToType output; 113 ConvertValue(&output, input); 114 return output; 115 } 116 117 // THE SAME, BUT WITH DEFAULT VALUE 118 template<typename FromType, typename ToType> 119 static ToType ConvertValueAndReturn(const FromType& input, const FromType& fallback) 120 { 121 ToType output; 122 ConvertValue(&output, input, fallback); 123 return output; 124 } 125 126 ////////////////////////// 127 // MORE SPECIALISATIONS // 128 ////////////////////////// 129 130 // STRING TO STRING 131 template<> 132 class Converter<std::string, std::string> 133 { 134 public: 135 bool operator()(std::string* output, const std::string& input) const 136 { 137 (*output) = std::string(input); 138 return true; 139 } 140 }; 141 142 //////////////// 143 // MULTITYPES // 144 //////////////// 145 146 // PARTIAL SPECIALIZATION TO CONVERT FROM MULTITYPEPRIMITIVE 147 template<typename ToType> 148 class Converter<MultiTypePrimitive, ToType> 149 { 150 public: 151 bool operator()(ToType* output, const MultiTypePrimitive& input) const 152 { 153 if (input.getType() == MT_int) 154 return ConvertValue(output, input.getInt()); 155 else if (input.getType() == MT_uint) 156 return ConvertValue(output, input.getUnsignedInt()); 157 else if (input.getType() == MT_char) 158 return ConvertValue(output, input.getChar()); 159 else if (input.getType() == MT_uchar) 160 return ConvertValue(output, input.getUnsignedChar()); 161 else if (input.getType() == MT_short) 162 return ConvertValue(output, input.getShort()); 163 else if (input.getType() == MT_ushort) 164 return ConvertValue(output, input.getUnsignedShort()); 165 else if (input.getType() == MT_long) 166 return ConvertValue(output, input.getLong()); 167 else if (input.getType() == MT_ulong) 168 return ConvertValue(output, input.getUnsignedLong()); 169 else if (input.getType() == MT_float) 170 return ConvertValue(output, input.getFloat()); 171 else if (input.getType() == MT_double) 172 return ConvertValue(output, input.getDouble()); 173 else if (input.getType() == MT_longdouble) 174 return ConvertValue(output, input.getLongDouble()); 175 else if (input.getType() == MT_bool) 176 return ConvertValue(output, input.getBool()); 177 else 178 return false; 179 } 180 }; 181 template<> 182 class Converter<MultiTypePrimitive, std::string> 183 { 184 public: 185 bool operator()(std::string* output, const MultiTypePrimitive& input) const 186 { 187 if (input.getType() == MT_int) 188 return ConvertValue(output, input.getInt()); 189 else if (input.getType() == MT_uint) 190 return ConvertValue(output, input.getUnsignedInt()); 191 else if (input.getType() == MT_char) 192 return ConvertValue(output, input.getChar()); 193 else if (input.getType() == MT_uchar) 194 return ConvertValue(output, input.getUnsignedChar()); 195 else if (input.getType() == MT_short) 196 return ConvertValue(output, input.getShort()); 197 else if (input.getType() == MT_ushort) 198 return ConvertValue(output, input.getUnsignedShort()); 199 else if (input.getType() == MT_long) 200 return ConvertValue(output, input.getLong()); 201 else if (input.getType() == MT_ulong) 202 return ConvertValue(output, input.getUnsignedLong()); 203 else if (input.getType() == MT_float) 204 return ConvertValue(output, input.getFloat()); 205 else if (input.getType() == MT_double) 206 return ConvertValue(output, input.getDouble()); 207 else if (input.getType() == MT_longdouble) 208 return ConvertValue(output, input.getLongDouble()); 209 else if (input.getType() == MT_bool) 210 return ConvertValue(output, input.getBool()); 211 else 212 return false; 213 } 214 }; 215 216 // PARTIAL SPECIALIZATION TO CONVERT FROM MULTITYPESTRING 217 template<typename ToType> 218 class Converter<MultiTypeString, ToType> 219 { 220 public: 221 bool operator()(ToType* output, const MultiTypeString& input) const 222 { 223 if (input.getType() == MT_constchar) 224 return ConvertValue(output, input.getConstChar()); 225 else if (input.getType() == MT_string) 226 return ConvertValue(output, input.getString()); 227 else 228 return ConvertValue(output, (MultiTypePrimitive)input); 229 } 230 }; 231 template<> 232 class Converter<MultiTypeString, std::string> 233 { 234 public: 235 bool operator()(std::string* output, const MultiTypeString& input) const 236 { 237 if (input.getType() == MT_constchar) 238 return ConvertValue(output, input.getConstChar()); 239 else if (input.getType() == MT_string) 240 return ConvertValue(output, input.getString()); 241 else 242 return ConvertValue(output, (MultiTypePrimitive)input); 243 } 244 }; 245 246 // PARTIAL SPECIALIZATION TO CONVERT FROM MULTITYPEMATH 247 template<typename ToType> 248 class Converter<MultiTypeMath, ToType> 249 { 250 public: 251 bool operator()(ToType* output, const MultiTypeMath& input) const 252 { 253 if (input.getType() == MT_vector2) 254 return ConvertValue(output, input.getVector2()); 255 else if (input.getType() == MT_vector3) 256 return ConvertValue(output, input.getVector3()); 257 else if (input.getType() == MT_quaternion) 258 return ConvertValue(output, input.getQuaternion()); 259 else if (input.getType() == MT_colourvalue) 260 return ConvertValue(output, input.getColourValue()); 261 else if (input.getType() == MT_radian) 262 return ConvertValue(output, input.getRadian()); 263 else if (input.getType() == MT_degree) 264 return ConvertValue(output, input.getDegree()); 265 else 266 return ConvertValue(output, (MultiTypeString)input); 267 } 268 }; 269 template<> 270 class Converter<MultiTypeMath, std::string> 271 { 272 public: 273 bool operator()(std::string* output, const MultiTypeMath& input) const 274 { 275 if (input.getType() == MT_vector2) 276 return ConvertValue(output, input.getVector2()); 277 else if (input.getType() == MT_vector3) 278 return ConvertValue(output, input.getVector3()); 279 else if (input.getType() == MT_quaternion) 280 return ConvertValue(output, input.getQuaternion()); 281 else if (input.getType() == MT_colourvalue) 282 return ConvertValue(output, input.getColourValue()); 283 else if (input.getType() == MT_radian) 284 return ConvertValue(output, input.getRadian()); 285 else if (input.getType() == MT_degree) 286 return ConvertValue(output, input.getDegree()); 287 else 288 return ConvertValue(output, (MultiTypeString)input); 289 } 290 }; 291 292 293 //////////////////// 294 // MATH TO STRING // 295 //////////////////// 296 297 // Vector2 to std::string 298 template <> 299 class Converter<orxonox::Vector2, std::string> 300 { 301 public: 302 bool operator()(std::string* output, const orxonox::Vector2& input) const 303 { 304 std::ostringstream ostream; 305 if (ostream << input.x << "," << input.y) 306 { 307 (*output) = ostream.str(); 308 return true; 309 } 310 311 return false; 312 } 313 }; 314 315 // Vector3 to std::string 316 template <> 317 class Converter<orxonox::Vector3, std::string> 318 { 319 public: 320 bool operator()(std::string* output, const orxonox::Vector3& input) const 321 { 322 std::ostringstream ostream; 323 if (ostream << input.x << "," << input.y << "," << input.z) 324 { 325 (*output) = ostream.str(); 326 return true; 327 } 328 329 return false; 330 } 331 }; 332 333 // Vector4 to std::string 334 template <> 335 class Converter<orxonox::Vector4, std::string> 336 { 337 public: 338 bool operator()(std::string* output, const orxonox::Vector4& input) const 339 { 340 std::ostringstream ostream; 341 if (ostream << input.x << "," << input.y << "," << input.z << "," << input.w) 342 { 343 (*output) = ostream.str(); 344 return true; 345 } 346 347 return false; 348 } 349 }; 350 351 // Quaternion to std::string 352 template <> 353 class Converter<orxonox::Quaternion, std::string> 354 { 355 public: 356 bool operator()(std::string* output, const orxonox::Quaternion& input) const 357 { 358 std::ostringstream ostream; 359 if (ostream << input.w << "," << input.x << "," << input.y << "," << input.z) 360 { 361 (*output) = ostream.str(); 362 return true; 363 } 364 365 return false; 366 } 367 }; 368 369 // ColourValue to std::string 370 template <> 371 class Converter<orxonox::ColourValue, std::string> 372 { 373 public: 374 bool operator()(std::string* output, const orxonox::ColourValue& input) const 375 { 376 std::ostringstream ostream; 377 if (ostream << input.r << "," << input.g << "," << input.b << "," << input.a) 378 { 379 (*output) = ostream.str(); 380 return true; 381 } 382 383 return false; 384 } 385 }; 386 387 388 //////////////////// 389 // STRING TO MATH // 390 //////////////////// 391 392 // std::string to Vector2 393 template <> 394 class Converter<std::string, orxonox::Vector2> 395 { 396 public: 397 bool operator()(orxonox::Vector2* output, const std::string& input) const 398 { 399 unsigned int opening_parenthesis, closing_parenthesis = input.find(')'); 400 if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; } 401 402 SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 403 404 if (tokens.size() >= 2) 405 { 406 if (!ConvertValue(&(output->x), tokens[0])) 407 return false; 408 if (!ConvertValue(&(output->y), tokens[1])) 409 return false; 410 411 return true; 412 } 413 414 return false; 415 } 416 }; 417 418 // std::string to Vector3 419 template <> 420 class Converter<std::string, orxonox::Vector3> 421 { 422 public: 423 bool operator()(orxonox::Vector3* output, const std::string& input) const 424 { 425 unsigned int opening_parenthesis, closing_parenthesis = input.find(')'); 426 if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; } 427 428 SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 429 430 if (tokens.size() >= 3) 431 { 432 if (!ConvertValue(&(output->x), tokens[0])) 433 return false; 434 if (!ConvertValue(&(output->y), tokens[1])) 435 return false; 436 if (!ConvertValue(&(output->z), tokens[2])) 437 return false; 438 439 return true; 440 } 441 442 return false; 443 } 444 }; 445 446 // std::string to Vector4 447 template <> 448 class Converter<std::string, orxonox::Vector4> 449 { 450 public: 451 bool operator()(orxonox::Vector4* output, const std::string& input) const 452 { 453 unsigned int opening_parenthesis, closing_parenthesis = input.find(')'); 454 if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; } 455 456 SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 457 458 if (tokens.size() >= 4) 459 { 460 if (!ConvertValue(&(output->x), tokens[0])) 461 return false; 462 if (!ConvertValue(&(output->y), tokens[1])) 463 return false; 464 if (!ConvertValue(&(output->z), tokens[2])) 465 return false; 466 if (!ConvertValue(&(output->w), tokens[3])) 467 return false; 468 469 return true; 470 } 471 472 return false; 473 } 474 }; 475 476 // std::string to Quaternion 477 template <> 478 class Converter<std::string, orxonox::Quaternion> 479 { 480 public: 481 bool operator()(orxonox::Quaternion* output, const std::string& input) const 482 { 483 unsigned int opening_parenthesis, closing_parenthesis = input.find(')'); 484 if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; } 485 486 SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 487 488 if (tokens.size() >= 4) 489 { 490 if (!ConvertValue(&(output->w), tokens[0])) 491 return false; 492 if (!ConvertValue(&(output->x), tokens[1])) 493 return false; 494 if (!ConvertValue(&(output->y), tokens[2])) 495 return false; 496 if (!ConvertValue(&(output->z), tokens[3])) 497 return false; 498 499 return true; 500 } 501 502 return false; 503 } 504 }; 505 506 // std::string to ColourValue 507 template <> 508 class Converter<std::string, orxonox::ColourValue> 509 { 510 public: 511 bool operator()(orxonox::ColourValue* output, const std::string& input) const 512 { 513 unsigned int opening_parenthesis, closing_parenthesis = input.find(')'); 514 if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; } 515 516 SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 517 518 if (tokens.size() >= 4) 519 { 520 if (!ConvertValue(&(output->r), tokens[0])) 521 return false; 522 if (!ConvertValue(&(output->g), tokens[1])) 523 return false; 524 if (!ConvertValue(&(output->b), tokens[2])) 525 return false; 526 if (!ConvertValue(&(output->a), tokens[3])) 527 return false; 528 529 return true; 530 } 531 532 return false; 533 } 534 }; 535 103 536 #endif /* _Convert_H__ */ -
code/trunk/src/util/Math.h
r790 r871 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * 4 * 5 * License notice: 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * Author: 22 * Fabian 'x3n' Landau 23 * Co-authors: 24 * ... 25 * 26 */ 27 28 #ifndef _Math_H__ 29 #define _Math_H__ 30 31 #include <ostream> 32 33 #include "UtilPrereqs.h" 34 1 35 #include <OgreMath.h> 2 36 #include <OgreVector2.h> … … 18 52 typedef Ogre::ColourValue ColourValue; 19 53 } 54 55 _UtilExport std::ostream& operator<<(std::ostream& out, const orxonox::Radian& radian); 56 _UtilExport std::istream& operator>>(std::istream& in, orxonox::Radian& radian); 57 _UtilExport std::ostream& operator<<(std::ostream& out, const orxonox::Degree& degree); 58 _UtilExport std::istream& operator>>(std::istream& in, orxonox::Degree& degree); 59 60 template <typename T> 61 inline T sgn(T x) 62 { 63 return (x >= 0) ? 1 : -1; 64 } 65 66 template <typename T> 67 inline T min(T a, T b) 68 { 69 return (a <= b) ? a : b; 70 } 71 72 template <typename T> 73 inline T max(T a, T b) 74 { 75 return (a >= b) ? a : b; 76 } 77 78 template <typename T> 79 inline T clamp(T x, T min, T max) 80 { 81 if (x < min) 82 return min; 83 84 if (x > max) 85 return max; 86 87 return x; 88 } 89 90 template <typename T> 91 inline T square(T x) 92 { 93 return x*x; 94 } 95 96 template <typename T> 97 inline T cube(T x) 98 { 99 return x*x*x; 100 } 101 102 template <typename T> 103 inline int floor(T x) 104 { 105 return (int)(x); 106 } 107 108 template <typename T> 109 inline int ceil(T x) 110 { 111 int temp = floor(x); 112 return (temp != x) ? (temp + 1) : temp; 113 } 114 115 template <typename T> 116 inline int round(T x) 117 { 118 return (int)(x + 0.5); 119 } 120 121 template <typename T> 122 T interpolate(float time, const T& start, const T& end) 123 { 124 return time * (end - start) + start; 125 } 126 127 template <typename T> 128 T interpolateSmooth(float time, const T& start, const T& end) 129 { 130 return (-2 * (end - start) * cube(time)) + (3 * (end - start) * square(time)) + start; 131 } 132 133 inline _UtilExport float rnd() 134 { 135 return ((float)rand() / RAND_MAX); 136 } 137 138 inline _UtilExport float rnd(float max) 139 { 140 return rnd() * max; 141 } 142 143 inline _UtilExport float rnd(float min, float max) 144 { 145 return rnd(max - min) + min; 146 } 147 148 #endif /* _Math_H__ */ -
code/trunk/src/util/String2Number.h
r790 r871 7 7 8 8 #include "core/Debug.h" 9 #include "UtilPrereqs.h" 9 10 10 11 /** -
code/trunk/src/util/tinyxml/TinyXMLPrereqs.h
r790 r871 73 73 class TiXmlParsingData; 74 74 75 namespace ticpp 76 { 77 class Document; 78 class Element; 79 class Declaration; 80 class StylesheetReference; 81 class Text; 82 class Comment; 83 class Attribute; 84 } 85 75 86 #endif /* _TinyXMLPrereqs_H__ */ -
code/trunk/src/util/tinyxml/ticpp.cc
r790 r871 1 #define TIXML_USE_TICPP 2 1 3 /* 2 4 http://code.google.com/p/ticpp/ -
code/trunk/src/util/tinyxml/ticpp.h
r790 r871 1 #define TIXML_USE_TICPP 2 1 3 /* 2 4 http://code.google.com/p/ticpp/ -
code/trunk/src/util/tinyxml/ticpprc.h
r790 r871 1 #define TIXML_USE_TICPP 2 1 3 /* 2 4 http://code.google.com/p/ticpp/ -
code/trunk/src/util/tinyxml/tinyxml.h
r790 r871 1 #define TIXML_USE_TICPP 2 1 3 /* 2 4 www.sourceforge.net/projects/tinyxml
Note: See TracChangeset
for help on using the changeset viewer.