Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 871


Ignore:
Timestamp:
Mar 9, 2008, 4:44:36 PM (17 years ago)
Author:
landauf
Message:

merged core branch to trunk

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<!--
    142 <audio>
    153                <ambient>
     
    219                </ambient>
    2210  </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" />
    2911-->
    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" />
    5241
    5342    <Model position="-16779,42,11043" scale="95" mesh="ast2.mesh" rotationAxis="0.281711,0.152518,0" rotationRate="27" />
     
    278267    <Model position="-6787,1792,287" scale="71" mesh="ast6.mesh" rotationAxis="0.161019,0.130015,0" rotationRate="36" />
    279268    <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  
    66ADD_SUBDIRECTORY(audio)
    77ADD_SUBDIRECTORY(network)
    8 ADD_SUBDIRECTORY(loader)
     8#ADD_SUBDIRECTORY(loader)
    99ADD_SUBDIRECTORY(orxonox)
  • code/trunk/src/network/GameStateClient.cc

    r790 r871  
    8282        // bad luck ;)
    8383        // 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){
    8585          removeObject(it);
    8686        }
  • code/trunk/src/network/GameStateManager.cc

    r790 r871  
    109109    int offset=0;
    110110    // go through all Synchronisables
    111     for(it = orxonox::ObjectList<Synchronisable>::start(); it != 0; ++it){
     111    for(it = orxonox::ObjectList<Synchronisable>::start(); it; ++it){
    112112      //std::cout << "gamestatemanager: in for loop" << std::endl;
    113113      //get size of the synchronisable
  • code/trunk/src/network/Synchronisable.cc

    r790 r871  
    1414
    1515#include "Synchronisable.h"
     16#include "core/CoreIncludes.h"
    1617
    1718namespace network
  • code/trunk/src/network/Synchronisable.h

    r790 r871  
    22// C++ Interface: synchronisable
    33//
    4 // Description: 
     4// Description:
    55//
    66//
     
    1616
    1717#include "NetworkPrereqs.h"
    18 #include "core/CoreIncludes.h"
     18#include "core/OrxonoxClass.h"
    1919
    2020namespace network
     
    4747  public:
    4848
    49     virtual ~Synchronisable();
     49      virtual ~Synchronisable();
    5050    int objectID;
    5151    int classID;
     
    6666    int datasize;
    6767  };
    68 
    69 }
    70 
    71 namespace orxonox
    72 {
    73   template class _NetworkExport ClassIdentifier<network::Synchronisable>;
    74   template class _NetworkExport ObjectList<network::Synchronisable>;
    7568}
    7669
  • code/trunk/src/orxonox/CMakeLists.txt

    r790 r871  
    33  Main.cc
    44  Orxonox.cc
     5  objects/Tickable.cc
    56  SpaceshipSteering.cc
    67  hud/HUD.cc
     
    910  tools/Light.cc
    1011  tools/Mesh.cc
     12  tools/Timer.cc
    1113  objects/Ambient.cc
    1214  objects/Camera.cc
     
    1820  objects/Skybox.cc
    1921  objects/SpaceShip.cc
    20 # objects/SpaceshipSteeringObject.cc
    21 # objects/test1.cc
    22 # objects/test2.cc
    23 # objects/test3.cc
     22#  objects/SpaceshipSteeringObject.cc
     23#  objects/test1.cc
     24#  objects/test2.cc
     25#  objects/test3.cc
    2426  objects/WorldEntity.cc
    2527  objects/weapon/AmmunitionDump.cc
     
    4244  audio
    4345  network
    44   loader
     46#  loader
    4547)
    4648
  • code/trunk/src/orxonox/Orxonox.cc

    r790 r871  
    5757
    5858// loader and audio
    59 #include "loader/LevelLoader.h"
     59//#include "loader/LevelLoader.h"
    6060#include "audio/AudioManager.h"
    6161
     
    7272#include "core/Factory.h"
    7373#include "core/Debug.h"
     74#include "core/Loader.h"
    7475#include "hud/HUD.h"
    7576#include "objects/weapon/BulletManager.h"
     
    131132    this->ogre_ = new GraphicsEngine();
    132133    this->dataPath_ = "";
    133     this->loader_ = 0;
     134//    this->loader_ = 0;
    134135    this->auMan_ = 0;
    135136    this->singletonRef_ = 0;
     
    379380
    380381    // 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);
    383386
    384387    Ogre::Overlay* hudOverlay = Ogre::OverlayManager::getSingleton().getByName("Orxonox/HUD1.2");
  • code/trunk/src/orxonox/Orxonox.h

    r790 r871  
    1414
    1515#include "OrxonoxPrereqs.h"
    16 #include "loader/LoaderPrereqs.h"
     16//#include "loader/LoaderPrereqs.h"
    1717#include "audio/AudioPrereqs.h"
    1818
     
    6969      GraphicsEngine*       ogre_;          //!< our dearest graphics engine <3
    7070      std::string           dataPath_;      //!< path to data
    71       loader::LevelLoader*  loader_;        //!< level loader builds the scene
     71//      loader::LevelLoader*  loader_;        //!< level loader builds the scene
    7272      audio::AudioManager*  auMan_;         //!< audio manager
    7373      BulletManager*        bulletMgr_;     //!< Keeps track of the thrown bullets
  • code/trunk/src/orxonox/OrxonoxStableHeaders.h

    r790 r871  
    7373//#include "audio/AudioManager.h"
    7474
    75 #include "core/CoreIncludes.h"
     75//#include "core/CoreIncludes.h"
    7676#include "core/BaseObject.h"
    7777//#include "core/ArgReader.h"
  • code/trunk/src/orxonox/core/BaseObject.cc

    r790 r871  
    2020 *
    2121 *   Author:
    22  *      ...
     22 *      Fabian 'x3n' Landau
    2323 *   Co-authors:
    2424 *      ...
     
    2626 */
    2727
    28 /*!
     28/**
    2929    @file BaseObject.cc
    3030    @brief Implementation of the BaseObject class.
     
    3333#include "util/tinyxml/tinyxml.h"
    3434
     35#include "core/CoreIncludes.h"
    3536#include "BaseObject.h"
     37#include "XMLPort.h"
     38#include "Level.h"
    3639
    3740namespace orxonox
     
    4548    {
    4649        RegisterRootObject(BaseObject);
     50
     51        this->bActive_ = true;
     52        this->bVisible_ = true;
     53        this->level_ = 0;
    4754    }
    4855
     
    6471        }
    6572    }
     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    }
    6693}
  • 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/**
    229    @file BaseObject.h
    330    @brief Definition of the BaseObject class.
     
    1037
    1138#include "CorePrereqs.h"
    12 #include "util/tinyxml/TinyXMLPrereqs.h"
     39#include "util/XMLIncludes.h"
    1340
    14 #include "CoreIncludes.h"
     41#include "OrxonoxClass.h"
    1542
    1643namespace orxonox
     
    2350            virtual ~BaseObject();
    2451            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
    2592    };
    26     ExportClass(BaseObject, Core);
    2793}
    2894
  • code/trunk/src/orxonox/core/CMakeLists.txt

    r790 r871  
    11SET( CORE_SRC_FILES
     2  OrxonoxClass.cc
    23  BaseObject.cc
    34  Factory.cc
    4   IdentifierList.cc
    55  Identifier.cc
     6  IdentifierDistributor.cc
    67  MetaObjectList.cc
    7   OrxonoxClass.cc
    88  ConfigValueContainer.cc
    99  Error.cc
     
    1313  OutputHandler.cc
    1414  Language.cc
     15  ClassTreeMask.cc
     16  Loader.cc
     17  Executor.cc
     18  XMLPort.cc
    1519)
    1620
  • code/trunk/src/orxonox/core/ClassFactory.h

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929    @file ClassFactory.h
    3030    @brief Definition and implementation of the ClassFactory class
     
    7272    bool ClassFactory<T>::create(const std::string& name)
    7373    {
    74         COUT(4) << "*** Create entry for " << name << " in Factory." << std::endl;
    75         ClassIdentifier<T>::getIdentifier()->addFactory(new ClassFactory<T>);
    76         Factory::add(name, ClassIdentifier<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());
    7777
    7878        return true;
  • code/trunk/src/orxonox/core/ConfigValueContainer.cc

    r790 r871  
    2626 */
    2727
     28/**
     29    @file ConfigValueContainer.cc
     30    @brief Implementation of the ConfigValueContainer class.
     31*/
     32
    2833#include <fstream>
    2934
     35#include "ConfigValueContainer.h"
    3036#include "util/Tokenizer.h"
    3137#include "util/Convert.h"
    32 #include "ConfigValueContainer.h"
     38#include "Language.h"
    3339
    3440#define CONFIGFILEPATH "orxonox.ini"
     
    4349        @param defvalue The default-value
    4450    */
    45     ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, int defvalue)
     51    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, MultiTypeMath defvalue)
    4652    {
    4753        this->bAddedDescription_ = false;
    4854        this->classname_ = classname;
    4955        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
    5358        this->searchConfigFileLine();                                               // Search the entry in the config-file
    5459
    55         std::string valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
    56         if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
     60        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
    5762            this->resetConfigFileEntry();                                           // The conversion failed
    5863    }
    5964
    6065    /**
    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;
    339176    }
    340177
     
    344181        @return True if the string was successfully parsed
    345182    */
    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());
    374225
    375226        return false;
     
    382233        @return True if the string was successfully parsed
    383234    */
    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;
    387241    }
    388242
     
    393247        @return True if the string was successfully parsed
    394248    */
    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;
    398255    }
    399256
     
    404261        @return True if the string was successfully parsed
    405262    */
    406     bool ConfigValueContainer::parseSting(const std::string& input, char defvalue)
     263    bool ConfigValueContainer::parseString(const std::string& input, char defvalue)
    407264    {
    408265        // 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;
    410270    }
    411271
     
    416276        @return True if the string was successfully parsed
    417277    */
    418     bool ConfigValueContainer::parseSting(const std::string& input, unsigned char defvalue)
     278    bool ConfigValueContainer::parseString(const std::string& input, unsigned char defvalue)
    419279    {
    420280        // 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;
    422341    }
    423342
     
    428347        @return True if the string was successfully parsed
    429348    */
    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;
    433355    }
    434356
     
    439361        @return True if the string was successfully parsed
    440362    */
    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;
    444369    }
    445370
     
    450375        @return True if the string was successfully parsed
    451376    */
    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;
    455383    }
    456384
     
    461389        @return True if the string was successfully parsed
    462390    */
    463     bool ConfigValueContainer::parseSting(const std::string& input, bool defvalue)
     391    bool ConfigValueContainer::parseString(const std::string& input, bool defvalue)
    464392    {
    465393        // Try to parse the value-string - is it a word?
     
    468396         || input.find("yes") < input.size()
    469397         || input.find("Yes") < input.size())
    470             this->value_.value_bool_ = true;
     398            this->value_.setValue(true);
    471399        else if (input.find("false") < input.size()
    472400              || input.find("False") < input.size()
    473401              || input.find("no") < input.size()
    474402              || input.find("No") < input.size())
    475             this->value_.value_bool_ = false;
     403            this->value_.setValue(false);
    476404        else
    477405        {
    478406            // 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;
    480411        }
    481412
     
    489420        @return True if the string was successfully parsed
    490421    */
    491     bool ConfigValueContainer::parseSting(const std::string& input, const std::string& defvalue)
     422    bool ConfigValueContainer::parseString(const std::string& input, const std::string& defvalue)
    492423    {
    493424        // Strip the quotes
     
    499430        {
    500431            // 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));
    502433            return true;
    503434        }
    504435
    505436        // 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);
    507438        return false;
    508439    }
     
    514445        @return True if the string was successfully parsed
    515446    */
    516     bool ConfigValueContainer::parseSting(const std::string& input, const char* defvalue)
     447    bool ConfigValueContainer::parseString(const std::string& input, const char* defvalue)
    517448    {
    518449        // Strip the quotes
     
    524455        {
    525456            // 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));
    527458            return true;
    528459        }
    529460
    530461        // 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);
    532463        return false;
    533464    }
     
    539470        @return True if the string was successfully parsed
    540471    */
    541     bool ConfigValueContainer::parseSting(const std::string& input, const Vector2& defvalue)
     472    bool ConfigValueContainer::parseString(const std::string& input, const Vector2& defvalue)
    542473    {
    543474        // Strip the value-string
     
    549480        {
    550481            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);
    559490                return false;
    560491            }
     
    563494        }
    564495
    565         this->value_vector2_ = defvalue;
     496        this->value_.setValue(defvalue);
    566497        return false;
    567498    }
     
    573504        @return True if the string was successfully parsed
    574505    */
    575     bool ConfigValueContainer::parseSting(const std::string& input, const Vector3& defvalue)
     506    bool ConfigValueContainer::parseString(const std::string& input, const Vector3& defvalue)
    576507    {
    577508        // Strip the value-string
     
    583514        {
    584515            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);
    598529                return false;
    599530            }
     
    602533        }
    603534
    604         this->value_vector3_ = defvalue;
     535        this->value_.setValue(defvalue);
    605536        return false;
    606537    }
     
    612543        @return True if the string was successfully parsed
    613544    */
    614     bool ConfigValueContainer::parseSting(const std::string& input, const ColourValue& defvalue)
     545    bool ConfigValueContainer::parseString(const std::string& input, const ColourValue& defvalue)
    615546    {
    616547        // Strip the value-string
     
    622553        {
    623554            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);
    642573                return false;
    643574            }
     
    646577        }
    647578
    648         this->value_colourvalue_ = defvalue;
     579        this->value_.setValue(defvalue);
    649580        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);
    650647    }
    651648
     
    664661    void ConfigValueContainer::resetConfigValue()
    665662    {
    666         this->parseSting(this->defvalueString_);
     663        this->parseString(this->defvalueString_, this->value_);
    667664        this->resetConfigFileEntry();
    668665    }
     
    837834
    838835    /**
    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
    840838    */
    841839    std::list<std::string>& ConfigValueContainer::getConfigFileLines()
     
    879877        if (!file.is_open())
    880878        {
     879            COUT(1) << "An error occurred in ConfigValueContainer.cc:" << std::endl;
    881880            COUT(1) << "Error: Couldn't open config-file " << filename << " to read the config values!" << std::endl;
    882881            return;
     
    925924        if (!file.is_open())
    926925        {
     926            COUT(1) << "An error occurred in ConfigValueContainer.cc:" << std::endl;
    927927            COUT(1) << "Error: Couldn't open config-file " << filename << " to write the config values!" << std::endl;
    928928            return;
     
    948948        {
    949949            this->description_ = std::string("ConfigValueDescription::" + this->classname_ + "::" + this->varname_);
    950             Language::getLanguage().addEntry(this->description_, description);
     950            AddLanguageEntry(this->description_, description);
    951951            this->bAddedDescription_ = true;
    952952        }
    953953    }
     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    }
    954963}
  • code/trunk/src/orxonox/core/ConfigValueContainer.h

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929    @file ConfigValueContainer.h
    3030    @brief Definition of the ConfigValueContainer class.
     
    4949
    5050#include "util/Math.h"
    51 #include "Language.h"
     51#include "util/MultiTypeMath.h"
    5252
    5353namespace orxonox
     
    7272    {
    7373        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);
    9075
    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; }
    131100
    132101            void description(const std::string& description);
     102            const std::string& getDescription() const;
    133103
    134             bool parseSting(const std::string& input);
     104            bool parseString(const std::string& input, MultiTypeMath& defvalue);
     105            bool valueToString(std::string* output, MultiTypeMath& input);
    135106            void resetConfigFileEntry();
    136107            void resetConfigValue();
     
    141112
    142113        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);
    156134
    157135            static std::list<std::string>& getConfigFileLines();
     
    167145            std::string         defvalueString_;                //!< The string of the default-variable
    168146
    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
    185148
    186149            std::list<std::string>::iterator configFileLine_;   //!< An iterator, pointing to the entry of the variable in the config-file
    187150
    188             VariableType type_;                                 //!< The type of the variable
    189151            bool bAddedDescription_;                            //!< True if a description was added
    190             LanguageEntryName description_;                     //!< The description
     152            LanguageEntryLabel description_;                    //!< The description
    191153    };
    192154}
  • code/trunk/src/orxonox/core/CoreIncludes.h

    r790 r871  
    4444// All needed header-files
    4545#include "Identifier.h"
     46#include "ClassManager.h"
    4647#include "Factory.h"
    4748#include "ClassFactory.h"
     
    5152#include "Debug.h"
    5253
     54
     55// All needed macros
    5356/**
    5457    @brief Intern macro, containing the common parts of RegisterObject and RegisterRootObject.
     
    5760*/
    5861#define InternRegisterObject(ClassName, bRootClass) \
    59     this->setIdentifier(orxonox::ClassIdentifier<ClassName>::registerClass(this->getParents(), #ClassName, bRootClass)); \
     62    this->setIdentifier(orxonox::ClassManager<ClassName>::getIdentifier()->registerClass(this->getParents(), #ClassName, bRootClass)); \
    6063    if (orxonox::Identifier::isCreatingHierarchy() && this->getParents()) \
    61         this->getParents()->add(this->getIdentifier()); \
    62     orxonox::ClassIdentifier<ClassName>::addObject(this)
     64        this->getParents()->insert(this->getParents()->end(), this->getIdentifier()); \
     65    orxonox::ClassManager<ClassName>::getIdentifier()->addObject(this)
    6366
    6467/**
     
    6871#define InternRegisterRootObject(ClassName) \
    6972    if (orxonox::Identifier::isCreatingHierarchy() && !this->getParents()) \
    70         this->setParents(new orxonox::IdentifierList()); \
     73        this->createParents(); \
    7174    InternRegisterObject(ClassName, true)
    7275
     
    7679*/
    7780#define RegisterObject(ClassName) \
    78     COUT(4) << "*** Register Object: " << #ClassName << std::endl; \
     81    COUT(5) << "*** Register Object: " << #ClassName << std::endl; \
    7982    InternRegisterObject(ClassName, false)
    8083
     
    8487*/
    8588#define RegisterRootObject(ClassName) \
    86     COUT(4) << "*** Register Root-Object: " << #ClassName << std::endl; \
     89    COUT(5) << "*** Register Root-Object: " << #ClassName << std::endl; \
    8790    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 Class
    92     @param LibraryName The name of the Library
    93 */
    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 Class
    102     @param LibraryName The name of the Library
    103 */
    104 #define ExportAbstractClass(ClassName, LibraryName) \
    105     template class _##LibraryName##Export orxonox::ClassIdentifier<ClassName>; \
    106     template class _##LibraryName##Export orxonox::ObjectList<ClassName>
    10791
    10892/**
     
    11195*/
    11296#define Class(ClassName) \
    113     ClassIdentifier<ClassName>::getIdentifier()
     97    ClassManager<ClassName>::getIdentifier()
    11498
    11599/**
     
    137121    { \
    138122        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); \
    140124    } \
    141     container##varname->getValue(varname)
     125    container##varname->getValue(&varname)
    142126
    143127/**
     
    150134    { \
    151135        container##varname##reset->resetConfigValue(); \
    152         container##varname##reset->getValue(varname); \
     136        container##varname##reset->getValue(&varname); \
    153137    } \
    154138    else \
  • code/trunk/src/orxonox/core/CorePrereqs.h

    r790 r871  
    2727
    2828/**
    29  @file  OrxonoxPrereq.h
    30  @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*/
    3232
    3333#ifndef _CorePrereqs_H__
    3434#define _CorePrereqs_H__
     35
     36#include <string>
    3537
    3638#include "orxonox/OrxonoxPlatform.h"
     
    6365namespace orxonox
    6466{
     67  typedef std::string LanguageEntryLabel;
     68
    6569  class ArgReader;
    6670  class BaseFactory;
     
    7074  template <class T>
    7175  class ClassIdentifier;
     76  template <class T>
     77  class ClassManager;
     78  class ClassTreeMask;
     79  class ClassTreeMaskIterator;
     80  class ClassTreeMaskNode;
    7281  class ConfigValueContainer;
    7382  class DebugLevel;
    7483  class Error;
     84  class Executor;
    7585  class Factory;
    7686  class Identifier;
    77   class IdentifierList;
    78   class IdentifierListElement;
     87  class IdentifierDistributor;
    7988  template <class T>
    8089  class Iterator;
    8190  class Language;
    8291  class LanguageEntry;
     92  class Level;
    8393  class Loader;
    8494  class MetaObjectList;
     
    93103  template <class T>
    94104  class SubclassIdentifier;
     105  template <class T, class O>
     106  class XMLPortClassObjectContainer;
     107  template <class T>
     108  class XMLPortClassParamContainer;
     109  class XMLPortObjectContainer;
     110  class XMLPortParamContainer;
    95111}
    96112
  • code/trunk/src/orxonox/core/Debug.h

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929 * @file Debug.h
    3030 * @brief Handles the output for different verbose-modes.
     
    5555#define ORX_PRINT_DEBUG_OUTPUT 1 // <-- fix that! should be a configurable setting
    5656
    57 #define ORX_HARD_DEBUG_LEVEL ORX_DEBUG
     57#define ORX_HARD_DEBUG_LEVEL ORX_vDEBUG
    5858//#define ORX_SOFT_DEBUG_LEVEL ORX_WARNING // <-- fix that! should be a configurable setting
    5959
  • code/trunk/src/orxonox/core/DebugLevel.cc

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929    @file DebugLevel.cc
    3030    @brief Implementation of the DebugLevel class.
     
    3232
    3333#include "DebugLevel.h"
     34#include "CoreIncludes.h"
    3435
    3536namespace orxonox
     
    99100
    100101/**
    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
    102104*/
    103105int getSoftDebugLevel()
  • code/trunk/src/orxonox/core/DebugLevel.h

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929    @file DebugLevel.h
    3030    @brief Definition of the DebugLevel class.
     
    4141#include "OrxonoxClass.h"
    4242#include "OutputHandler.h"
    43 #include "CoreIncludes.h"
    4443
    4544namespace orxonox
     
    6665            ConfigValueContainer* softDebugLevelContainer_; //!< The config value container for the debug level
    6766    };
    68     ExportAbstractClass(DebugLevel, Core);
    6967}
    7068
  • code/trunk/src/orxonox/core/Error.cc

    r790 r871  
    2525 *
    2626 */
     27
     28/**
     29    @file Error.cc
     30    @brief Implementation of the Error class.
     31*/
    2732
    2833#include "Debug.h"
  • code/trunk/src/orxonox/core/Error.h

    r790 r871  
    2626 */
    2727
     28/**
     29    @file Error.h
     30    @brief Definition of the Error class.
     31*/
     32
    2833#ifndef _Error_H__
    2934#define _Error_H__
  • code/trunk/src/orxonox/core/Factory.cc

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929    @file Factory.cc
    3030    @brief Implementation of the Factory class.
     
    3939{
    4040    /**
    41         @returns the Identifier with a given name.
     41        @brief Returns the Identifier with a given name.
    4242        @param name The name of the wanted Identifier
     43        @return The Identifier
    4344    */
    4445    Identifier* Factory::getIdentifier(const std::string& name)
     
    4849
    4950    /**
    50         @returns the Identifier with a given network ID.
     51        @brief Returns the Identifier with a given network ID.
    5152        @param id The network ID of the wanted Identifier
     53        @return The Identifier
    5254    */
    5355    Identifier* Factory::getIdentifier(const unsigned int id)
     
    8486    void Factory::createClassHierarchy()
    8587    {
    86         COUT(3) << "*** Factory -> Create class-hierarchy" << std::endl;
     88        COUT(3) << "*** Factory: Create class-hierarchy" << std::endl;
    8789        std::map<std::string, Identifier*>::iterator it;
    8890        it = getFactoryPointer()->identifierStringMap_.begin();
     
    9597        }
    9698        (*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;
    98100    }
    99101
     
    107109      return &theOneAndOnlyFactoryInstance;
    108110    }
     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    }
    109129}
  • code/trunk/src/orxonox/core/Factory.h

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929    @file Factory.h
    3030    @brief Definition of the Factory and the BaseFactory class.
     
    6767
    6868            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();
    6971
    7072        private:
  • code/trunk/src/orxonox/core/Identifier.cc

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929    @file Identifier.cc
    3030    @brief Implementation of the Identifier class.
    3131*/
     32
     33#include <ostream>
    3234
    3335#include "Identifier.h"
     
    4951        this->factory_ = 0;
    5052
    51         this->children_ = new IdentifierList;
     53        this->children_ = new std::list<const Identifier*>();
     54        this->directChildren_ = new std::list<const Identifier*>();
    5255
    5356        // Use a static variable because the classID gets created before main() and that's why we should avoid static member variables
     
    5760
    5861    /**
    59         @brief Destructor: Deletes the IdentifierList containing the children.
     62        @brief Destructor: Deletes the list containing the children.
    6063    */
    6164    Identifier::~Identifier()
    6265    {
    6366        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;
    7377        this->bCreatedOneObject_ = true;
    7478
    7579        if (parents)
    7680        {
    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)
    7986            {
    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);
    84111            }
    85112        }
     
    98125        else
    99126        {
    100             // Abstract classes don't have a factory and therefore can't create new objects
    101             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;
    102129            COUT(1) << "Aborting..." << std::endl;
    103130            abort();
     
    117144
    118145    /**
    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.
    129147        @param identifier The identifier to compare with
    130148    */
    131149    bool Identifier::isA(const Identifier* identifier) const
    132150    {
    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::isDirectlyA(const Identifier* identifier) const
     151        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
    141159    {
    142160        return (identifier == this);
     
    144162
    145163    /**
    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.
    147165        @param identifier The identifier to compare with
    148166    */
    149167    bool Identifier::isChildOf(const Identifier* identifier) const
    150168    {
    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.
    156183        @param identifier The identifier to compare with
    157184    */
    158185    bool Identifier::isParentOf(const Identifier* identifier) const
    159186    {
    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;
    161244    }
    162245}
  • code/trunk/src/orxonox/core/Identifier.h

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929    @file Identifier.h
    3030    @brief Definition of the Identifier, ClassIdentifier and SubclassIdentifier classes, implementation of the ClassIdentifier and SubclassIdentifier classes.
     
    3939
    4040    Every object has a pointer to the Identifier of its class. This allows the use isA(...),
    41     isDirectlyA(...), isChildOf(...) and isParentOf(...).
     41    isExactlyA(...), isChildOf(...) and isParentOf(...).
    4242
    4343    To create the class-hierarchy, the Identifier has some intern functions and variables.
     
    5252#define _Identifier_H__
    5353
     54#include <list>
    5455#include <map>
    5556#include <string>
     
    5960
    6061#include "ObjectList.h"
    61 #include "IdentifierList.h"
    6262#include "Debug.h"
    6363#include "Iterator.h"
     
    8282
    8383        Every object has a pointer to the Identifier of its class. This allows the use isA(...),
    84         isDirectlyA(...), isChildOf(...) and isParentOf(...).
     84        isExactlyA(...), isChildOf(...) and isParentOf(...).
    8585
    8686        You can't directly create an Identifier, it's just the base-class for ClassIdentifier.
     
    8989    {
    9090        template <class T>
    91         friend class ClassIdentifier; // Forward declaration
     91        friend class ClassIdentifier;
    9292
    9393        template <class T>
    94         friend class SubclassIdentifier; // Forward declaration
    95 
    96         friend class Factory; // Forward declaration
     94        friend class SubclassIdentifier;
     95
     96        friend class Factory;
    9797
    9898        public:
     
    102102            BaseObject* fabricate();
    103103            bool isA(const Identifier* identifier) const;
    104             bool isDirectlyA(const Identifier* identifier) const;
     104            bool isExactlyA(const Identifier* identifier) const;
    105105            bool isChildOf(const Identifier* identifier) const;
     106            bool isDirectChildOf(const Identifier* identifier) const;
    106107            bool isParentOf(const Identifier* identifier) const;
    107 
    108             static std::map<std::string, Identifier*>& getIdentifierMap();
     108            bool isDirectParentOf(const Identifier* identifier) const;
    109109
    110110            /** @brief Removes all objects of the corresponding class. */
    111111            virtual void removeObjects() const = 0;
    112112
    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 */
    114114            inline const std::string& getName() const { return this->name_; }
    115115
    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 */
    123145            inline static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); }
    124146
    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 */
    126148            inline const unsigned int getNetworkID() const { return this->classID_; }
    127149
     
    129151            void setNetworkID(unsigned int id);
    130152
    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);
    138163
    139164        private:
     
    141166            Identifier(const Identifier& identifier) {} // don't copy
    142167            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_); }
    144174
    145175            /**
     
    149179            {
    150180                hierarchyCreatingCounter_s++;
    151                 COUT(4) << "*** Increased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << std::endl;
     181                COUT(4) << "*** Identifier: Increased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << std::endl;
    152182            }
    153183
     
    158188            {
    159189                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
    165198
    166199            std::string name_;                                          //!< The name of the class the Identifier belongs to
     
    173206    };
    174207
     208    std::ostream& operator<<(std::ostream& out, const std::list<const Identifier*>& list);
     209
    175210
    176211    // ###############################
     
    182217        This makes it possible to store informations about a class, sharing them with all
    183218        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.
    184225    */
    185226    template <class T>
    186227    class ClassIdentifier : public Identifier
    187228    {
     229        template <class TT>
     230        friend class ClassManager;
     231
    188232        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);
    192235            void removeObjects() const;
    193236            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);
    194244
    195245        private:
     
    200250            ObjectList<T>* objects_;    //!< The ObjectList, containing all objects of type T
    201251            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_;
    202254    };
    203255
     
    208260    ClassIdentifier<T>::ClassIdentifier()
    209261    {
    210         this->objects_ = ObjectList<T>::getList();
     262//        this->objects_ = ObjectList<T>::getList();
     263        this->objects_ = new ObjectList<T>();
    211264        this->bSetName_ = false;
    212265    }
     
    214267    /**
    215268        @brief Registers a class, which means that the name and the parents get stored.
    216         @param parents An IdentifierList, containing the Identifiers of all parents of the class
     269        @param parents A list, containing the Identifiers of all parents of the class
    217270        @param name A string, containing exactly the name of the class
    218271        @param bRootClass True if the class is either an Interface or the BaseObject itself
     
    220273    */
    221274    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;
    225278
    226279        // Check if at least one object of the given type was created
    227         if (!getIdentifier()->bCreatedOneObject_)
     280        if (!this->bCreatedOneObject_)
    228281        {
    229282            // 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;
    233286            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.
    235288            else
    236                 getIdentifier()->initialize(parents);
     289                this->initialize(parents);
    237290        }
    238291
    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;
    259293    }
    260294
     
    266300    void ClassIdentifier<T>::setName(const std::string& name)
    267301    {
    268         // Make sure we didn't already set the name, to avoid duplicate entries in the Identifier map
    269302        if (!this->bSetName_)
    270303        {
    271304            this->name_ = name;
    272             this->getIdentifierMap().insert(std::pair<std::string, Identifier*>(name, this));
    273305            this->bSetName_ = true;
    274306        }
     
    282314    void ClassIdentifier<T>::addObject(T* object)
    283315    {
    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));
    286318    }
    287319
     
    292324    void ClassIdentifier<T>::removeObjects() const
    293325    {
    294         for (Iterator<T> it = ObjectList<T>::start(); it;)
     326        for (Iterator<T> it = this->objects_->start(); it;)
    295327            delete *(it++);
    296328    }
     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
    297362
    298363    // ###############################
     
    314379            SubclassIdentifier()
    315380            {
    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;
    317391            }
    318392
     
    324398            SubclassIdentifier<T>& operator=(Identifier* identifier)
    325399            {
    326                 if (!identifier->isA(ClassIdentifier<T>::getIdentifier()))
     400                if (!identifier->isA(ClassManager<T>::getIdentifier()))
    327401                {
    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;
    330405                    COUT(1) << "Aborting..." << std::endl;
    331406                    abort();
     
    372447                    if (this->identifier_)
    373448                    {
    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;
    375451                        COUT(1) << "Error: Couldn't fabricate a new Object." << std::endl;
    376452                        COUT(1) << "Aborting..." << std::endl;
     
    378454                    else
    379455                    {
     456                        COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl;
    380457                        COUT(1) << "Error: Couldn't fabricate a new Object - Identifier is undefined." << std::endl;
    381458                        COUT(1) << "Aborting..." << std::endl;
     
    386463            }
    387464
    388             /** @returns the assigned identifier. */
     465            /** @brief Returns the assigned identifier. @return The identifier */
    389466            inline const Identifier* getIdentifier() const
    390467                { return this->identifier_; }
    391468
    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 */
    393470            inline bool isA(const Identifier* identifier) const
    394471                { return this->identifier_->isA(identifier); }
    395472
    396             /** @returns true, if the assigned identifier is exactly of the given type. @param identifier The identifier to compare with */
    397             inline bool isDirectlyA(const Identifier* identifier) const
    398                 { return this->identifier_->isDirectlyA(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 */
    401478            inline bool isChildOf(const Identifier* identifier) const
    402479                { return this->identifier_->isChildOf(identifier); }
    403480
    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 */
    405486            inline bool isParentOf(const Identifier* identifier) const
    406487                { return this->identifier_->isParentOf(identifier); }
    407488
     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
    408493        private:
    409             Identifier* identifier_;        //!< The assigned identifier
     494            Identifier* identifier_;            //!< The assigned identifier
    410495    };
    411496}
  • code/trunk/src/orxonox/core/Iterator.h

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929    @file Iterator.h
    3030    @brief Definition and implementation of the Iterator class.
     
    7171            */
    7272            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)
    7382            {
    7483                this->element_ = element;
     
    150159                @return True if the iterator points to an existing object.
    151160            */
    152             bool operator!=(int compare)
     161            bool operator!=(ObjectListElement<T>* compare)
    153162            {
    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);
    159164            }
    160165
  • code/trunk/src/orxonox/core/Language.cc

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929    @file Language.cc
    3030    @brief Implementation of the Language and the LanguageEntry class.
     
    5050
    5151        this->fallbackEntry_ = fallbackEntry;
    52         this->translatedEntry_ = fallbackEntry; // Set the translation to the fallback entry, for the case that no translation gets assigned
    53         this->bTranslationSet_ = false;
    54     }
    55 
    56     /**
    57         @brief Sets the translation of the entry.
    58         @param translation The translation
    59     */
    60     void LanguageEntry::setTranslation(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)
    6161    {
    6262        // Check if the translation is more than just an empty string
    63         if (translation.compare("") != 0)
    64         {
    65             this->translatedEntry_ = translation;
    66             this->bTranslationSet_ = true;
     63        if (localisation.compare("") != 0)
     64        {
     65            this->localisedEntry_ = localisation;
     66            this->bLocalisationSet_ = true;
    6767        }
    6868        else
    69             this->translatedEntry_ = this->fallbackEntry_;
     69            this->localisedEntry_ = this->fallbackEntry_;
    7070    }
    7171
     
    7777    {
    7878        // If the default entry changes and the translation wasn't set yet, use the new default entry as translation
    79         if (!this->bTranslationSet_)
    80             this->translatedEntry_ = fallbackEntry;
     79        if (!this->bLocalisationSet_)
     80            this->localisedEntry_ = fallbackEntry;
    8181
    8282        this->fallbackEntry_ = fallbackEntry;
     
    9494
    9595        this->defaultLanguage_ = "default";
    96         this->defaultTranslation_ = "ERROR: LANGUAGE ENTRY DOESN'T EXIST!";
     96        this->defaultLocalisation_ = "ERROR: LANGUAGE ENTRY DOESN'T EXIST!";
    9797
    9898        // Read the default language file to create all known LanguageEntry objects
     
    132132
    133133    /**
    134         @brief Creates a new LanguageEntry with a given name and a given default entry.
    135         @param name The name of the entry
     134        @brief Creates a new LanguageEntry with a given label and a given default entry.
     135        @param label The label of the entry
    136136        @param entry The default entry
    137137        @return The created LanguageEntry object
    138138    */
    139     LanguageEntry* Language::createEntry(const LanguageEntryName& 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);
    142142
    143143        // Make sure we don't create a duplicate entry
     
    145145        {
    146146            LanguageEntry* newEntry = new LanguageEntry(entry);
    147             newEntry->setName(name);
    148             this->languageEntries_[name] = newEntry;
     147            newEntry->setLabel(label);
     148            this->languageEntries_[label] = newEntry;
    149149            return newEntry;
    150150        }
    151151
    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;
    153153        return it->second;
    154154    }
     
    156156    /**
    157157        @brief Adds a new LanguageEntry, if it's not already existing.
    158         @param name The name of the entry
     158        @param label The label of the entry
    159159        @param entry The default entry
    160160    */
    161     void Language::addEntry(const LanguageEntryName& 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);
    165165        if (it == this->languageEntries_.end())
    166166        {
    167167            // The entry isn't available yet, meaning it's new, so create it
    168             this->createEntry(name, entry);
     168            this->createEntry(label, entry);
    169169        }
    170170        else if (it->second->getDefault().compare(entry) == 0)
     
    185185
    186186    /**
    187         @brief Returns the translation of a given entry.
    188         @param name The name of the entry
    189         @return The translation
    190     */
    191     const std::string& Language::getTranslation(const LanguageEntryName& name) const
    192     {
    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);
    194194        if (it != this->languageEntries_.end())
    195             return it->second->getTranslation();
     195            return it->second->getLocalisation();
    196196        else
    197197        {
    198198            // 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->defaultTranslation_;
     199            COUT(2) << "Warning: Language entry \"" << label << "\" not found!" << std::endl;
     200            return this->defaultLocalisation_;
    201201        }
    202202    }
     
    230230        if (!file.is_open())
    231231        {
     232            COUT(1) << "An error occurred in Language.cc:" << std::endl;
    232233            COUT(1) << "Error: Couldn't open file " << getFileName(this->defaultLanguage_) << " to read the default language entries!" << std::endl;
    233234            return;
     
    259260
    260261    /**
    261         @brief Reads the language file of the configured language and assigns the translations to the corresponding LanguageEntry object.
     262        @brief Reads the language file of the configured language and assigns the localisation to the corresponding LanguageEntry object.
    262263    */
    263264    void Language::readTranslatedLanguageFile()
     
    271272        if (!file.is_open())
    272273        {
     274            COUT(1) << "An error occurred in Language.cc:" << std::endl;
    273275            COUT(1) << "Error: Couldn't open file " << getFileName(this->language_) << " to read the translated language entries!" << std::endl;
    274276            ResetConfigValue(language_);
     
    297299                    // Check if the entry exists
    298300                    if (it != this->languageEntries_.end())
    299                         it->second->setTranslation(lineString.substr(pos + 1));
     301                        it->second->setLocalisation(lineString.substr(pos + 1));
    300302                    else
    301                         this->createEntry(lineString.substr(0, pos), this->defaultTranslation_)->setTranslation(lineString.substr(pos + 1));
     303                        this->createEntry(lineString.substr(0, pos), this->defaultLocalisation_)->setLocalisation(lineString.substr(pos + 1));
    302304                }
    303305                else
     
    314316    void Language::writeDefaultLanguageFile() const
    315317    {
    316         COUT(4) << "Write default language file." << std::endl;
     318        COUT(4) << "Language: Write default language file." << std::endl;
    317319
    318320        // Open the file
     
    322324        if (!file.is_open())
    323325        {
     326            COUT(1) << "An error occurred in Language.cc:" << std::endl;
    324327            COUT(1) << "Error: Couldn't open file " << getFileName(this->defaultLanguage_) << " to write the default language entries!" << std::endl;
    325328            return;
     
    329332        for (Iterator<LanguageEntry> it = ObjectList<LanguageEntry>::start(); it; ++it)
    330333        {
    331             file << it->getName() << "=" << it->getDefault() << std::endl;
     334            file << it->getLabel() << "=" << it->getDefault() << std::endl;
    332335        }
    333336
  • code/trunk/src/orxonox/core/Language.h

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929    @file Language.h
    3030    @brief Definition of the Language and the LanguageEntry class.
    3131
    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 name of 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.
    3434    If the translation in the configured language isn't available, the default entry, defined in the code, is used.
    3535
    3636    Usage:
    3737     - Set the entry with the default string:
    38        Language::getLanguage()->addEntry("name of the entry", "the string to translate");
     38       Language::getLanguage()->addEntry("label of the entry", "the string to translate");
    3939
    40      - Get the translation of the entry in the configured language:
    41        std::cout << Language::getLanguage()->getTranslation("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;
    4242*/
    4343
     
    5151#include "OrxonoxClass.h"
    5252
     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
    5361namespace orxonox
    5462{
    55     typedef std::string LanguageEntryName;
    56 
     63    // ###############################
     64    // ###      LanguageEntry      ###
     65    // ###############################
    5766    //! The LanguageEntry class stores the default- and the translated string of a given entry in the language file.
    5867    class _CoreExport LanguageEntry : public OrxonoxClass
     
    6069        public:
    6170            explicit LanguageEntry(const std::string& fallbackEntry);
    62             void setTranslation(const std::string& translation);
     71            void setLocalisation(const std::string& localisation);
    6372            void setDefault(const std::string& fallbackEntry);
    6473
    6574            /**
    66               @brief Returns the translated entry in the configured language.
     75              @brief Returns the localised entry in the configured language.
    6776              @return The translated entry
    6877            */
    69             inline const std::string& getTranslation()
    70                 { return this->translatedEntry_; }
     78            inline const std::string& getLocalisation()
     79                { return this->localisedEntry_; }
    7180
    7281            /**
     
    7786                { return this->fallbackEntry_; }
    7887
     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
    79102        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
    83107    };
    84     template class _CoreExport orxonox::ClassIdentifier<LanguageEntry>;
    85     template class _CoreExport orxonox::ObjectList<LanguageEntry>;
    86108
     109
     110    // ###############################
     111    // ###         Language        ###
     112    // ###############################
    87113    //! The Language class manges the language files and entries and stores the LanguageEntry objects in a map.
    88114    class _CoreExport Language : public OrxonoxClass
     
    94120            static Language& getLanguage();
    95121            void setConfigValues();
    96             void addEntry(const LanguageEntryName& name, const std::string& entry);
    97             const std::string& getTranslation(const LanguageEntryName& name) const;
     122            void addEntry(const LanguageEntryLabel& label, const std::string& entry);
     123            const std::string& getLocalisation(const LanguageEntryLabel& label) const;
    98124
    99125        private:
     
    106132            void writeDefaultLanguageFile() const;
    107133            static const std::string getFileName(const std::string& language);
    108             LanguageEntry* createEntry(const LanguageEntryName& name, const std::string& entry);
     134            LanguageEntry* createEntry(const LanguageEntryLabel& label, const std::string& entry);
    109135
    110136            std::string language_;                                  //!< The configured language
    111137            std::string defaultLanguage_;                           //!< The default language
    112             std::string defaultTranslation_;                        //!< The returned string, if an entry unavailable entry is requested
    113             std::map<std::string, LanguageEntry*> languageEntries_; //!< A map to store all LanguageEntry objects and their name
     138            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
    114140    };
    115     template class _CoreExport orxonox::ClassIdentifier<Language>;
    116     template class _CoreExport orxonox::ObjectList<Language>;
    117141}
    118142
  • code/trunk/src/orxonox/core/MetaObjectList.cc

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929    @file MetaObjectList.cc
    3030    @brief Implementation of the MetaObjectList class.
  • code/trunk/src/orxonox/core/MetaObjectList.h

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929    @file MetaObjectList.h
    3030    @brief Definition of the MetaObjectList class.
     
    9999
    100100
    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;
    102102        delete this->element_;
    103103    }
  • code/trunk/src/orxonox/core/ObjectList.h

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929    @file ObjectList.h
    3030    @brief Definition and implementation of the ObjectList class.
     
    4040#include "CorePrereqs.h"
    4141#include "Iterator.h"
     42#include "ClassManager.h"
    4243
    4344namespace orxonox
     
    8384    {
    8485        public:
    85             static ObjectList<T>* getList();
     86            ObjectList();
     87            ~ObjectList();
    8688
    8789            ObjectListElement<T>* add(T* object);
    8890//            void remove(OrxonoxClass* object, bool bIterateForwards = true);
    8991
    90             /** @returns the first element in the list */
     92            /** @brief Returns the first element in the list. @return The first element */
    9193            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 */
    9597            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 */
    99101            inline static Iterator<T> end()
    100                 { return Iterator<T>(getList()->last_); }
     102                { return Iterator<T>(ClassManager<T>::getIdentifier()->getObjects()->last_); }
    101103
    102104            ObjectListElement<T>* first_;       //!< The first element in the list
    103105            ObjectListElement<T>* last_;        //!< The last element in the list
    104 
    105         private:
    106             ObjectList();
    107             ~ObjectList();
    108106    };
    109107
     
    131129            this->first_ = temp;
    132130        }
    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;
    143131    }
    144132
  • code/trunk/src/orxonox/core/OrxonoxClass.cc

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929    @file OrxonoxClass.cc
    3030    @brief Implementation of the OrxonoxClass Class.
     
    4242        this->identifier_ = 0;
    4343        this->parents_ = 0;
    44 
    45         this->bActive_ = true;
    46         this->bVisible_ = true;
    4744    }
    4845
  • code/trunk/src/orxonox/core/OrxonoxClass.h

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929    @file OrxonoxClass.h
    3030    @brief Definition of the OrxonoxClass Class.
     
    3737#define _OrxonoxClass_H__
    3838
     39#include <list>
    3940#include <string>
    4041
     
    4748    //! The class all objects and interfaces of the game-logic (not the engine) are derived from.
    4849    /**
    49         The BaseObject and Interaces are derived with 'virtual public OrxonoxClass' from OrxonoxClass.
     50        The BaseObject and Interfaces are derived with 'virtual public OrxonoxClass' from OrxonoxClass.
    5051        OrxonoxClass is needed to create the class-hierarchy at startup and to store the Identifier and the MetaObjectList.
    5152    */
     
    5960            void setConfigValues() {};
    6061
    61             /** @returns the Identifier of the object */
     62            /** @brief Returns the Identifier of the object. @return The Identifier */
    6263            inline Identifier* getIdentifier() const { return this->identifier_; }
    6364
     
    6566            inline void setIdentifier(Identifier* identifier) { this->identifier_ = identifier; }
    6667
    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_; }
    6970
    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*>(); }
    7273
    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 */
    7475            inline MetaObjectList& getMetaList() { return this->metaList_; }
    7576
    7677
    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. */
    7879            inline bool isA(const Identifier* identifier)
    7980                { return this->getIdentifier()->isA(identifier); }
    80             /** @returns true if the objects class is exactly of the given type. */
    81             inline bool isDirectlyA(const Identifier* identifier)
    82                 { return this->getIdentifier()->isDirectlyA(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. */
    8485            inline bool isChildOf(const Identifier* identifier)
    8586                { 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. */
    8791            inline bool isParentOf(const Identifier* identifier)
    8892                { 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); }
    8996
    9097
    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. */
    9299            inline bool isA(const SubclassIdentifier<class B>* identifier)
    93100                { return this->getIdentifier()->isA(identifier->getIdentifier()); }
    94             /** @returns true if the objects class is exactly of the given type. */
    95             inline bool isDirectlyA(const SubclassIdentifier<class B>* identifier)
    96                 { return this->getIdentifier()->isDirectlyA(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. */
    98105            inline bool isChildOf(const SubclassIdentifier<class B>* identifier)
    99106                { 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. */
    101111            inline bool isParentOf(const SubclassIdentifier<class B>* identifier)
    102112                { 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()); }
    103116
    104117
    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. */
    106119            inline bool isA(const SubclassIdentifier<class B> identifier)
    107120                { return this->getIdentifier()->isA(identifier.getIdentifier()); }
    108             /** @returns true if the objects class is exactly of the given type. */
    109             inline bool isDirectlyA(const SubclassIdentifier<class B> identifier)
    110                 { return this->getIdentifier()->isDirectlyA(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. */
    112125            inline bool isChildOf(const SubclassIdentifier<class B> identifier)
    113126                { 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. */
    115131            inline bool isParentOf(const SubclassIdentifier<class B> identifier)
    116132                { 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()); }
    117136
    118137
    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. */
    120139            inline bool isA(const OrxonoxClass* object)
    121140                { return this->getIdentifier()->isA(object->getIdentifier()); }
    122             /** @returns true if the objects class is exactly of the given type. */
    123             inline bool isDirectlyA(const OrxonoxClass* object)
    124                 { return this->getIdentifier()->isDirectlyA(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. */
    126145            inline bool isChildOf(const OrxonoxClass* object)
    127146                { 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. */
    129151            inline bool isParentOf(const OrxonoxClass* object)
    130152                { 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()); }
    150156
    151157        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
    159161    };
    160     template class _CoreExport orxonox::ClassIdentifier<OrxonoxClass>;
    161     template class _CoreExport orxonox::ObjectList<OrxonoxClass>;
    162162}
    163163
  • code/trunk/src/orxonox/core/OutputHandler.cc

    r790 r871  
    2525 *
    2626 */
     27
     28/**
     29    @file OutputHandler.cc
     30    @brief Implementation of the OutputHandler class.
     31*/
    2732
    2833#include "DebugLevel.h"
     
    5358
    5459    /**
    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
    5662    */
    5763    OutputHandler& OutputHandler::getOutStream()
  • code/trunk/src/orxonox/core/OutputHandler.h

    r790 r871  
    2626 */
    2727
    28 /*!
     28/**
    2929    @file OutputHandler.h
    3030    @brief Definition of the OutputHandler class.
     
    5959            static OutputHandler& getOutStream();
    6060
    61             /** @returns a reference to the logfile. */
     61            /** @brief Returns a reference to the logfile. @return The logfile */
    6262            inline std::ofstream& getLogfile()
    6363                { return this->logfile_; }
     
    6767                { this->outputLevel_ = level; return *this; }
    6868
    69             /** @returns the level of the incoming output. */
     69            /** @brief Returns the level of the incoming output. @return The level */
    7070            inline int getOutputLevel() const
    7171                { return this->outputLevel_; }
  • code/trunk/src/orxonox/core/SignalHandler.cc

    r790 r871  
    2525 *
    2626 */
     27
     28/**
     29    @file SignalHandler.cc
     30    @brief Implementation of the SignalHandler class.
     31*/
    2732
    2833#include <assert.h>
  • code/trunk/src/orxonox/core/SignalHandler.h

    r790 r871  
    2626 */
    2727
    28 /*!
    29  * @file SignalHandler.h
    30  */
     28/**
     29    @file SignalHandler.h
     30    @brief Definition of the SignalHandler class.
     31*/
    3132
    3233#ifndef _SignalHandler_H__
  • code/trunk/src/orxonox/objects/Ambient.cc

    r790 r871  
    4040#include "../core/CoreIncludes.h"
    4141#include "../Orxonox.h"
     42#include "core/XMLPort.h"
    4243
    4344#include "Ambient.h"
     
    4546namespace orxonox
    4647{
    47     // create a template instantiations
    48     //template class _OrxonoxExport ClassIdentifier<Ambient>;
    49 
    5048    CreateFactory(Ambient);
    5149
     
    6159    void Ambient::loadParams(TiXmlElement* xmlElem)
    6260    {
    63         Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager();
    64 
    6561        if (xmlElem->Attribute("colourvalue"))
    6662        {
     
    7268                String2Number<float>(b, colourvalues[2]);
    7369
    74                 mgr->setAmbientLight(ColourValue(r,g,b));
     70                this->setAmbientLight(ColourValue(r, g, b));
    7571
    7672                COUT(4) << "Loader: Set ambient light: "<<r<<" " << g << " " << b  << std::endl << std::endl;
    7773        }
    7874   }
     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    }
    7993}
  • code/trunk/src/orxonox/objects/Ambient.h

    r790 r871  
    1414            virtual ~Ambient();
    1515
    16            
    1716            void loadParams(TiXmlElement* xmlElem);
     17            virtual void XMLPort(Element& xmlelement, bool loading);
     18            void setAmbientLight(const ColourValue& colour);
    1819
    1920        private:
    20            
     21
    2122
    2223    };
    23     ExportClass(Ambient, Orxonox);
    2424}
    2525
  • code/trunk/src/orxonox/objects/Camera.h

    r790 r871  
    1414            virtual ~Camera();
    1515
    16            
     16
    1717            void loadParams(TiXmlElement* xmlElem);
    1818
    1919        private:
    20            
     20
    2121
    2222    };
    23     ExportClass(Camera, Orxonox);
    2423}
    2524
  • code/trunk/src/orxonox/objects/Explosion.h

    r790 r871  
    2121            ParticleInterface* particle_;
    2222    };
    23     ExportClass(Explosion, Orxonox);
    2423}
    2524
  • code/trunk/src/orxonox/objects/Fighter.h

    r790 r871  
    9090            int emitterRate_;
    9191    };
    92     ExportClass(Fighter, Orxonox);
    9392}
    9493
  • code/trunk/src/orxonox/objects/Model.cc

    r790 r871  
    3333#include "../core/CoreIncludes.h"
    3434#include "../Orxonox.h"
     35#include "core/XMLPort.h"
    3536
    3637#include "Model.h"
     
    6061    }
    6162
     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
    6283    bool Model::create(){
    6384      if(meshSrc_.compare("")!=0){
     
    7192
    7293    void Model::registerAllVariables(){
    73       registerVar(&meshSrc_, meshSrc_.length() + 1, network::STRING);
     94//      registerVar(&meshSrc_, meshSrc_.length() + 1, network::STRING);
    7495    }
    7596}
  • code/trunk/src/orxonox/objects/Model.h

    r790 r871  
    1818            virtual ~Model();
    1919            virtual void loadParams(TiXmlElement* xmlElem);
     20            virtual void XMLPort(Element& xmlelement, bool loading);
     21            void setMesh(const std::string& meshname);
    2022            bool create();
    2123
     
    2527            void registerAllVariables();
    2628    };
    27     ExportClass(Model, Orxonox);
    2829}
    2930
  • code/trunk/src/orxonox/objects/NPC.h

    r790 r871  
    4444      static int const NUMELEMENTS = 9;  //number of elements
    4545  };
    46   ExportClass(NPC, Orxonox);
    47 
    4846}
    4947#endif /* _NPC_H__ */
  • code/trunk/src/orxonox/objects/Projectile.h

    r790 r871  
    2828            Timer<Projectile> destroyTimer_;
    2929    };
    30     ExportClass(Projectile, Orxonox);
    3130}
    3231
  • code/trunk/src/orxonox/objects/Skybox.cc

    r790 r871  
    3838#include "../core/CoreIncludes.h"
    3939#include "../core/Debug.h"
     40#include "core/XMLPort.h"
    4041
    4142#include "Skybox.h"
     
    5657    void Skybox::loadParams(TiXmlElement* xmlElem)
    5758    {
    58         Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager();
    59 
    6059        if (xmlElem->Attribute("src"))
    6160        {
    6261                std::string skyboxSrc = xmlElem->Attribute("src");
    63                 mgr->setSkyBox(true, skyboxSrc);
     62                this->setSkybox(skyboxSrc);
    6463
    6564                COUT(4) << "Loader: Set skybox: "<< skyboxSrc << std::endl << std::endl;
    6665        }
    6766   }
     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    }
    6885}
  • code/trunk/src/orxonox/objects/Skybox.h

    r790 r871  
    1616            virtual ~Skybox();
    1717
    18            
    1918            void loadParams(TiXmlElement* xmlElem);
     19            virtual void XMLPort(Element& xmlelement, bool loading);
     20            void setSkybox(const std::string& skyboxname);
    2021
    2122        private:
    22            
     23
    2324
    2425    };
    25     ExportClass(Skybox, Orxonox);
    2626}
    2727
  • code/trunk/src/orxonox/objects/SpaceShip.cc

    r790 r871  
    4444#include "../particle/ParticleInterface.h"
    4545#include "Projectile.h"
     46#include "core/XMLPort.h"
    4647
    4748#include "SpaceShip.h"
     
    123124        this->brakeLoop(loop);
    124125*/
     126        this->init();
     127
    125128        COUT(3) << "Info: SpaceShip was loaded" << std::endl;
    126129    }
     
    132135    }
    133136
    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    {
    146139        // START CREATING THRUSTER
    147140        this->tt_ = new ParticleInterface(Orxonox::getSingleton()->getSceneManager(),"twinthruster" + this->getName(),"Orxonox/engineglow");
     
    197190
    198191        // 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);
    200204/*
    201205        if (xmlElem->Attribute("forward") && xmlElem->Attribute("rotateupdown") && xmlElem->Attribute("rotaterightleft") && xmlElem->Attribute("looprightleft"))
     
    242246        if (xmlElem->Attribute("camera"))
    243247        {
    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();
    260249        }
     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);
    261305    }
    262306
  • code/trunk/src/orxonox/objects/SpaceShip.h

    r790 r871  
    2121            SpaceShip();
    2222            ~SpaceShip();
     23            void init();
    2324            void setConfigValues();
    2425            virtual void loadParams(TiXmlElement* xmlElem);
     26            virtual void XMLPort(Element& xmlelement, bool loading);
    2527            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);
    2637
    2738            bool mouseMoved(const OIS::MouseEvent &e);
     
    7586            int emitterRate_;
    7687    };
    77     ExportClass(SpaceShip, Orxonox);
    7888}
    7989
  • code/trunk/src/orxonox/objects/SpaceshipSteeringObject.cc

    r790 r871  
    4040#include "util/Tokenizer.h"
    4141#include "util/String2Number.h"
    42 #include "../core/Debug.h"
    43 
     42#include "core/CoreIncludes.h"
    4443#include "SpaceshipSteeringObject.h"
    4544
  • code/trunk/src/orxonox/objects/Test.h

    r790 r871  
    3030
    3131#include "core/BaseObject.h"
    32 #include "../core/CoreIncludes.h"
    3332
    3433namespace orxonox
     
    7473        public:
    7574            A1B2() { RegisterObject(A1B2); }
     75//            virtual void test() = 0;
    7676    };
    7777
     
    116116        public:
    117117            A1B2C1() { RegisterObject(A1B2C1); }
     118//            void test() { std::cout << "test!\n"; }
    118119    };
    119120
  • code/trunk/src/orxonox/objects/Tickable.h

    r790 r871  
    4444
    4545#include "../OrxonoxPrereqs.h"
    46 
    47 #include "../core/CoreIncludes.h"
     46#include "core/OrxonoxClass.h"
    4847
    4948namespace orxonox
     
    6261
    6362        protected:
    64             /**
    65                 @brief Constructor: Registers the object in the Tickable-list
    66             */
    67             Tickable() { RegisterRootObject(Tickable); }
     63            Tickable();
    6864    };
    69     ExportAbstractClass(Tickable, Orxonox);
    7065
    7166    //! The TickFrameListener calls the tick(dt) function of all Tickables every frame.
  • code/trunk/src/orxonox/objects/WorldEntity.cc

    r790 r871  
    3737#include "../Orxonox.h"
    3838#include "WorldEntity.h"
     39#include "core/XMLPort.h"
    3940
    4041namespace orxonox
     
    8687    void WorldEntity::loadParams(TiXmlElement* xmlElem)
    8788    {
     89
    8890        BaseObject::loadParams(xmlElem);
    89 
     91/*
    9092        if (xmlElem->Attribute("position"))
    9193        {
     
    153155
    154156        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);
    156185    }
    157186
     
    163192    void WorldEntity::registerAllVariables()
    164193    {
    165       // register coordinates
     194/*      // register coordinates
    166195      registerVar( (void*) &(this->getPosition().x), sizeof(this->getPosition().x), network::DATA);
    167196      registerVar( (void*) &(this->getPosition().y), sizeof(this->getPosition().y), network::DATA);
     
    171200      registerVar( (void*) &(this->getOrientation().x), sizeof(this->getOrientation().x), network::DATA);
    172201      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);*/
    174203      // not needed at the moment, because we don't have prediction yet
    175204      /*// register velocity_
     
    183212      registerVar( (void*) &(this->getRotationAxis().z), sizeof(this->getRotationAxis().z), network::DATA);*/
    184213    }
     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    }
    185227}
  • code/trunk/src/orxonox/objects/WorldEntity.h

    r790 r871  
    88
    99#include "util/Math.h"
     10#include "util/XMLIncludes.h"
    1011#include "network/Synchronisable.h"
    11 #include "util/tinyxml/tinyxml.h"
    12 #include "../core/CoreIncludes.h"
     12//#include "util/tinyxml/tinyxml.h"
    1313#include "core/BaseObject.h"
    1414#include "Tickable.h"
     
    1717namespace orxonox
    1818{
    19   class _OrxonoxExport WorldEntity : public BaseObject, public Tickable, public network::Synchronisable
    20   {
    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();
    2424
    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();
    2829
    29       inline Ogre::SceneNode* getNode()
    30           { return this->node_; }
     30            void attachWorldEntity(WorldEntity* entity);
     31            const WorldEntity* getAttachedWorldEntity(unsigned int index);
    3132
    32       inline void setNode(Ogre::SceneNode* node)
    33           { this->node_ = node; }
     33            inline Ogre::SceneNode* getNode()
     34                { return this->node_; }
    3435
    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; }
    4138
    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(); }
    5049
    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); }
    5758
    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);
    7066
    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); }
    8573
    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); }
    9488
    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); }
    101105
    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(); }
    108114
    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() const
    114           { 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_; }
    115121
    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() const
    121           { 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_; }
    122128
    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_; }
    129137
    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_; }
    134144
    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_; }
    137151
    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_; }
    143156
    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    };
    150172}
    151173
  • code/trunk/src/orxonox/objects/test1.cc

    r790 r871  
    2929#include "test2.h"
    3030#include "test3.h"
    31 #include "util/tinyxml/tinyxml.h"
    32 #include "../Orxonox.h"
    33 #include <OgreSceneManager.h>
     31#include "core/CoreIncludes.h"
    3432
    3533namespace orxonox
  • code/trunk/src/orxonox/objects/test2.cc

    r790 r871  
    2929#include "test2.h"
    3030#include "test3.h"
     31#include "core/CoreIncludes.h"
    3132
    3233namespace orxonox
  • code/trunk/src/orxonox/objects/test3.cc

    r790 r871  
    2929#include "test2.h"
    3030#include "test3.h"
     31#include "core/CoreIncludes.h"
    3132
    3233namespace orxonox
     
    6364    void Test3::configOutput()
    6465    {
    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;
    7778    }
    7879
  • code/trunk/src/orxonox/objects/test3.h

    r790 r871  
    33
    44#include "core/BaseObject.h"
     5#include "util/Math.h"
    56
    67namespace orxonox
  • code/trunk/src/orxonox/objects/weapon/AmmunitionDump.cc

    r790 r871  
    3131#include "BulletManager.h"
    3232#include "util/tinyxml/tinyxml.h"
     33#include "core/CoreIncludes.h"
    3334
    3435#include "AmmunitionDump.h"
  • code/trunk/src/orxonox/objects/weapon/AmmunitionDump.h

    r790 r871  
    3737
    3838#include "network/Synchronisable.h"
    39 //#include "../core/CoreIncludes.h"
    4039#include "core/BaseObject.h"
    4140
     
    6665    int *capacity_;
    6766  };
    68   ExportClass(AmmunitionDump, Orxonox);
    6967}
    7068
  • code/trunk/src/orxonox/objects/weapon/BarrelGun.cc

    r790 r871  
    3838#include "AmmunitionDump.h"
    3939#include "BaseWeapon.h"
     40#include "core/CoreIncludes.h"
    4041
    4142#include "BarrelGun.h"
  • code/trunk/src/orxonox/objects/weapon/BarrelGun.h

    r790 r871  
    6060
    6161  };
    62   ExportClass(BarrelGun, Orxonox);
    6362}
    6463
  • code/trunk/src/orxonox/objects/weapon/BaseWeapon.cc

    r790 r871  
    3838#include "BulletManager.h"
    3939#include "AmmunitionDump.h"
     40#include "core/CoreIncludes.h"
    4041
    4142#include "BaseWeapon.h"
  • code/trunk/src/orxonox/objects/weapon/BaseWeapon.h

    r790 r871  
    122122
    123123  };
    124   ExportAbstractClass(BaseWeapon, Orxonox);
    125124}
    126125
  • code/trunk/src/orxonox/objects/weapon/Bullet.cc

    r790 r871  
    2727
    2828#include "OrxonoxStableHeaders.h"
     29#include "core/CoreIncludes.h"
    2930
    3031#include "Bullet.h"
  • code/trunk/src/orxonox/objects/weapon/Bullet.h

    r790 r871  
    4747    inline virtual void loadParams(TiXmlElement* xmlElem) { Model::loadParams(xmlElem); };
    4848 };
    49   ExportClass(Bullet, Orxonox);
    5049}
    5150
  • code/trunk/src/orxonox/objects/weapon/BulletManager.cc

    r790 r871  
    3030#include "BulletManager.h"
    3131#include "Bullet.h"
     32#include "core/CoreIncludes.h"
    3233
    3334
  • code/trunk/src/orxonox/objects/weapon/BulletManager.h

    r790 r871  
    3838#include "network/Synchronisable.h"
    3939#include "util/tinyxml/tinyxml.h"
    40 #include "../../core/CoreIncludes.h"
    4140#include "core/BaseObject.h"
    4241#include "../Tickable.h"
     
    6766          int bulletsIndex_;
    6867  };
    69   ExportClass(BulletManager, Orxonox);
    7068}
    7169
  • code/trunk/src/orxonox/tools/BillboardSet.h

    r790 r871  
    77
    88#include "../OrxonoxPrereqs.h"
    9 
    10 #include "../core/CoreIncludes.h"
    119#include "util/Math.h"
    1210
  • code/trunk/src/orxonox/tools/Timer.h

    r790 r871  
    5959
    6060#include <OgreFrameListener.h>
    61 
    6261#include "../OrxonoxPrereqs.h"
    63 
    64 #include "../core/CoreIncludes.h"
    6562
    6663namespace orxonox
     
    7269
    7370        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();
    8572
    8673            virtual void run() const = 0;
     
    9481            /** @brief Unpauses the Timer - continues with the given state. */
    9582            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 */
    9784            inline bool isActive() const { return this->bActive_; }
    9885
     
    10491            float time_;        //!< Internal variable, counting the time till the next function-call
    10592    };
    106     ExportAbstractClass(TimerBase, Orxonox);
    10793
    10894    //! The Timer is a callback-object, calling a given function after a given time-interval.
     
    158144            T* object_;
    159145    };
    160     ExportAbstractClass(Timer<BaseObject>, Orxonox);
    161146
    162147    //! The TimerFrameListener manages all Timers in the game.
  • code/trunk/src/util/CMakeLists.txt

    r790 r871  
    44
    55SET (UTIL_SRC_FILES
     6  Math.cc
     7  String.cc
     8  SubString.cc
     9  MultiTypePrimitive.cc
     10  MultiTypeString.cc
     11  MultiTypeMath.cc
    612  ${TINYXML_SRC_FILES}
    7   substring.cc
    813)
    914
    10 IF(WIN32)
    11   ADD_LIBRARY( util ${UTIL_SRC_FILES} )
    12 ELSE(WIN32)
    13   ADD_LIBRARY( util SHARED ${UTIL_SRC_FILES} )
    14 ENDIF(WIN32)
     15ADD_LIBRARY( util SHARED ${UTIL_SRC_FILES} )
    1516SET_TARGET_PROPERTIES( util PROPERTIES LINK_FLAGS "--no-undefined" )
    16 
    1717
    1818IF(TESTING_ENABLED)
    1919  ADD_SUBDIRECTORY(testing)
    2020ENDIF(TESTING_ENABLED)
     21
     22TARGET_LINK_LIBRARIES( util
     23  ${OGRE_LIBRARIES}
     24)
  • code/trunk/src/util/Convert.h

    r790 r871  
    3636#include <sstream>
    3737
     38#include "UtilPrereqs.h"
     39#include "Math.h"
     40#include "SubString.h"
     41#include "MultiTypeMath.h"
     42
    3843
    3944// DEFAULT CLASS
     
    4146class Converter
    4247{
    43  public:
    44   bool operator()(ToType* output, const FromType& input) const
    45   {
    46     return false;
    47   }
     48  public:
     49    bool operator()(ToType* output, const FromType& input) const
     50    {
     51      return false;
     52    }
    4853};
    4954
     
    5257class Converter<FromType, std::string>
    5358{
    54  public:
    55   bool operator()(std::string* output, const FromType& input) const
    56   {
    57     std::ostringstream oss;
    58     if (oss << input)
    59     {
    60       (*output) = oss.str();
    61       return true;
    62     }
    63     else
    64       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    }
    6671};
    6772
     
    7075class Converter<std::string, ToType>
    7176{
    72  public:
    73   bool operator()(ToType* output, const std::string& input) const
    74   {
    75     std::istringstream iss(input);
    76     if (iss >> (*output))
    77       return true;
    78     else
    79       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    }
    8186};
    8287
     
    101106}
    102107
     108// THE SAME LIKE BEFORE, BUT NEEDS NO POINTER TO THE OUTPUT
     109template<typename FromType, typename ToType>
     110static 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
     118template<typename FromType, typename ToType>
     119static 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
     131template<>
     132class 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
     147template<typename ToType>
     148class 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};
     181template<>
     182class 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
     217template<typename ToType>
     218class 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};
     231template<>
     232class 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
     247template<typename ToType>
     248class 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};
     269template<>
     270class 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
     298template <>
     299class 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
     316template <>
     317class 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
     334template <>
     335class 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
     352template <>
     353class 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
     370template <>
     371class 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
     393template <>
     394class 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
     419template <>
     420class 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
     447template <>
     448class 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
     477template <>
     478class 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
     507template <>
     508class 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
    103536#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
    135#include <OgreMath.h>
    236#include <OgreVector2.h>
     
    1852  typedef Ogre::ColourValue ColourValue;
    1953}
     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
     60template <typename T>
     61inline T sgn(T x)
     62{
     63    return (x >= 0) ? 1 : -1;
     64}
     65
     66template <typename T>
     67inline T min(T a, T b)
     68{
     69    return (a <= b) ? a : b;
     70}
     71
     72template <typename T>
     73inline T max(T a, T b)
     74{
     75    return (a >= b) ? a : b;
     76}
     77
     78template <typename T>
     79inline 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
     90template <typename T>
     91inline T square(T x)
     92{
     93    return x*x;
     94}
     95
     96template <typename T>
     97inline T cube(T x)
     98{
     99    return x*x*x;
     100}
     101
     102template <typename T>
     103inline int floor(T x)
     104{
     105    return (int)(x);
     106}
     107
     108template <typename T>
     109inline int ceil(T x)
     110{
     111    int temp = floor(x);
     112    return (temp != x) ? (temp + 1) : temp;
     113}
     114
     115template <typename T>
     116inline int round(T x)
     117{
     118    return (int)(x + 0.5);
     119}
     120
     121template <typename T>
     122T interpolate(float time, const T& start, const T& end)
     123{
     124    return time * (end - start) + start;
     125}
     126
     127template <typename T>
     128T 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
     133inline _UtilExport float rnd()
     134{
     135    return ((float)rand() / RAND_MAX);
     136}
     137
     138inline _UtilExport float rnd(float max)
     139{
     140    return rnd() * max;
     141}
     142
     143inline _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  
    77
    88#include "core/Debug.h"
     9#include "UtilPrereqs.h"
    910
    1011/**
  • code/trunk/src/util/tinyxml/TinyXMLPrereqs.h

    r790 r871  
    7373class TiXmlParsingData;
    7474
     75namespace 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
    7586#endif /* _TinyXMLPrereqs_H__ */
  • code/trunk/src/util/tinyxml/ticpp.cc

    r790 r871  
     1#define TIXML_USE_TICPP
     2
    13/*
    24http://code.google.com/p/ticpp/
  • code/trunk/src/util/tinyxml/ticpp.h

    r790 r871  
     1#define TIXML_USE_TICPP
     2
    13/*
    24http://code.google.com/p/ticpp/
  • code/trunk/src/util/tinyxml/ticpprc.h

    r790 r871  
     1#define TIXML_USE_TICPP
     2
    13/*
    24http://code.google.com/p/ticpp/
  • code/trunk/src/util/tinyxml/tinyxml.h

    r790 r871  
     1#define TIXML_USE_TICPP
     2
    13/*
    24www.sourceforge.net/projects/tinyxml
Note: See TracChangeset for help on using the changeset viewer.