Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1854


Ignore:
Timestamp:
Sep 28, 2008, 5:30:14 PM (16 years ago)
Author:
landauf
Message:
  • some cmake fixes for ceguilua and mingw
  • small change in XMLPort
Location:
code/trunk/src
Files:
2 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/CMakeLists.txt

    r1810 r1854  
    1313# it ourselves.
    1414# So first, find out what CEGUI version we have.
    15 IF (${CEGUI_VERSION} LESS 0.6.0)
    16     ADD_SUBDIRECTORY(ceguilua-0.5.0b)
    17     INCLUDE_DIRECTORIES(ceguilua-0.5.0b)
    18 ELSE (${CEGUI_VERSION} LESS 0.6.0)
    19     ADD_SUBDIRECTORY(ceguilua-0.6.1)
     15
     16IF (WIN32)
     17    ADD_SUBDIRECTORY(ceguilua-0.6.1/ceguilua)
    2018    INCLUDE_DIRECTORIES(ceguilua-0.6.1)
    21 ENDIF (${CEGUI_VERSION} LESS 0.6.0)
     19ELSE (WIN32)
     20    IF (${CEGUI_VERSION} LESS 0.6.0)
     21        ADD_SUBDIRECTORY(ceguilua-0.5.0b/ceguilua)
     22        INCLUDE_DIRECTORIES(ceguilua-0.5.0b)
     23    ELSE (${CEGUI_VERSION} LESS 0.6.0)
     24        ADD_SUBDIRECTORY(ceguilua-0.6.1/ceguilua)
     25        INCLUDE_DIRECTORIES(ceguilua-0.6.1)
     26    ENDIF (${CEGUI_VERSION} LESS 0.6.0)
     27ENDIF (WIN32)
    2228
    2329
  • code/trunk/src/ceguilua-0.5.0b/ceguilua/CMakeLists.txt

    r1810 r1854  
    1010ADD_LIBRARY( ceguilua_orxonox SHARED ${CEGUILUA_SRC_FILES} )
    1111
    12 TARGET_LINK_LIBRARIES( ceguilua_orxonox lua_orxonox )
     12TARGET_LINK_LIBRARIES(ceguilua_orxonox
     13  lua_orxonox
     14  tolualib_orxonox
     15  ${CEGUI_LIBRARIES}
     16)
  • code/trunk/src/ceguilua-0.6.1/ceguilua/CMakeLists.txt

    r1814 r1854  
    1010ADD_LIBRARY( ceguilua_orxonox SHARED ${CEGUILUA_SRC_FILES} )
    1111
    12 TARGET_LINK_LIBRARIES( ceguilua_orxonox lua_orxonox )
     12TARGET_LINK_LIBRARIES(ceguilua_orxonox
     13  lua_orxonox
     14  tolualib_orxonox
     15  ${CEGUI_LIBRARIES}
     16)
  • code/trunk/src/core/Iterator.h

    r1747 r1854  
    3535
    3636    Usage:
    37     for (Iterator<myClass> it = anyidentifier->getObjects().begin(); it != anyidentifier->getObjects().end(); ++it)
     37    for (Iterator<myClass> it = anyidentifier->getObjects()->begin(); it != anyidentifier->getObjects()->end(); ++it)
    3838    {
    3939        it->someFunction(...);
  • code/trunk/src/core/Namespace.cc

    r1747 r1854  
    101101        }
    102102
    103         XMLPortObject(Namespace, BaseObject, "", loadObjects, saveObjects, xmlelement, mode, true, false);
     103        XMLPortObjectExtended(Namespace, BaseObject, "", loadObjects, saveObjects, xmlelement, mode, true, false);
    104104    }
    105105
  • code/trunk/src/core/ObjectListBase.h

    r1747 r1854  
    7171    {
    7272        public:
    73             ObjectListElement(T* object) : ObjectListBaseElement(object), object_(object) {}
     73            ObjectListElement(T* object) : ObjectListBaseElement((OrxonoxClass*)object), object_(object) {}
    7474            T* object_;              //!< The object
    7575    };
  • code/trunk/src/core/XMLPort.h

    r1841 r1854  
    2626 *
    2727 */
     28
     29/**
     30    @file XMLPort.h
     31    @brief Declaration of the XMLPort helper classes and macros.
     32
     33    XMLPort is a virtual function of every BaseObject. Every object can change this function.
     34    The XMLPort function gets called with an XMLElement, containing all attributes and
     35    subclasses the object gets from the levelfile.
     36
     37    This file declares classes and macros to simplify XML-parsing.
     38*/
    2839
    2940#ifndef _XMLPort_H__
     
    4051#include "BaseObject.h"
    4152
    42 
     53// ------------
     54// XMLPortParam
     55
     56/**
     57    @brief Declares an XML attribute with a name, which will be set through load- and savefunctions.
     58    @param classname The name of the class owning this param
     59    @param paramname The name of the attribute
     60    @param loadfunction A function to set the param in the object with a given value (~a set-function)
     61    @param savefunction A function to get the value of the param from the object (~a get-function)
     62    @param xmlelement The XMLElement, you get this from the XMLPort function
     63    @param mode The mode (load or save), you get this from the XMLPort function
     64
     65    In the XML file, a param or attribute will be set like this:
     66    <classname paramname="value" />
     67
     68    The macro will then call loadfunction(value) to set the given value (or call savefunction() to
     69    write an existing value to an XML file).
     70*/
    4371#define XMLPortParam(classname, paramname, loadfunction, savefunction, xmlelement, mode) \
    4472    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, classname, this, paramname, orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode)
     73/**
     74    @brief This is the same as XMLPortParam, but you can set the template arguments needed to store the loadfunction.
     75
     76    Sometimes the name of the loadfunction is ambiguous (example: setPosition(Vector3) or
     77    setPosition(float, float, float)). In this case, you can choose the right function by
     78    telling the types of the functionparams. In our example, this would be either
     79    > XMLPortParamTemplate(classname, paramname, loadfunction, savefunction, xmlelement, mode, Vector3);
     80    or
     81    > XMLPortParamTemplate(classname, paramname, loadfunction, savefunction, xmlelement, mode, float, float, float);
     82    You don't have to use this, if there exist only one function with the given name.
     83*/
    4584#define XMLPortParamTemplate(classname, paramname, loadfunction, savefunction, xmlelement, mode, ...) \
    4685    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, classname, this, paramname, orxonox::createExecutor(orxonox::createFunctor< __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode)
    4786
     87// --------------------
     88// XMLPortParamLoadOnly
     89
     90/**
     91    @brief Declares an XML attribute with a name, which can be set through a loadfunction.
     92
     93    This is the same as XMLPortParam, but you don't need a savefunction (get-function). Therefore,
     94    this param won't be saved in an XML file, but you can add the attribute manually an it will be
     95    loaded.
     96
     97    This might be helpful in cases, when you have several options to set a value, for example the
     98    rotation. You can set the rotation with a quaternion, but you could also use three angles.
     99    When saving the object, only one of both options has to be saved; this is, where this macro helps.
     100*/
    48101#define XMLPortParamLoadOnly(classname, paramname, loadfunction, xmlelement, mode) \
    49102    XMLPortParamGeneric(xmlcontainer##loadfunction##0, classname, classname, this, paramname, orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), 0, xmlelement, mode)
     103/**
     104    @brief This is the same as XMLPortParamTemplate, but for load-only attributes (see XMLPortParamLoadOnly).
     105*/
    50106#define XMLPortParamLoadOnlyTemplate(classname, paramname, loadfunction, xmlelement, mode, ...) \
    51107    XMLPortParamGeneric(xmlcontainer##loadfunction##0, classname, classname, this, paramname, orxonox::createExecutor(orxonox::createFunctor< __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), 0, xmlelement, mode)
    52108
     109// ------------------
     110// XMLPortParamExtern
     111
     112/**
     113    @brief This is the same as XMLPortParam, but for attributes in an extern class.
     114    @param classname The name of the class owning the object owning the attribute
     115    @param externclass The name of the extern class (the objects class)
     116    @param object The name of the object of the extern class (a member of the main class)
     117    @param paramname The name of the attribute
     118    @param loadfunction The function to set the attribute inside of the member object.
     119    @param loadfunction The function to get the attribute from the member object
     120
     121    Sometimes you'll have a member object in your class, which has it's own load- and savefunctions.
     122    With this macro, you can simply use them instead of writing your own functions.
     123
     124    @example
     125    Your class is called SpaceShip and this class has an object (myPilot_) of class Pilot. Pilot has a name
     126    and two functions, setName(name) and getName(). Now you want an attribute "pilotname" in your
     127    SpaceShip class. Instead of writing wrapper functions, you can simply use the XMLPortParamExtern
     128    macro:
     129    > XMLPortParamExtern(SpaceShip, Pilot, myPilot_, "pilotname", setName, getName, xmlelement, mode);
     130*/
    53131#define XMLPortParamExtern(classname, externclass, object, paramname, loadfunction, savefunction, xmlelement, mode) \
    54132    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, externclass, object, paramname, orxonox::createExecutor(orxonox::createFunctor(&externclass::loadfunction), std::string( #externclass ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&externclass::savefunction), std::string( #externclass ) + "::" + #savefunction), xmlelement, mode);
     133/**
     134    @brief This is the same as XMLPortParamTemplate, but for extern attributes (see XMLPortParamExtern).
     135*/
    55136#define XMLPortParamExternTemplate(classname, externclass, object, paramname, loadfunction, savefunction, xmlelement, mode, ...) \
    56137    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, externclass, object, paramname, orxonox::createExecutor(orxonox::createFunctor< __VA_ARGS__ >(&externclass::loadfunction), std::string( #externclass ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&externclass::savefunction), std::string( #externclass ) + "::" + #savefunction), xmlelement, mode);
    57138
     139// -------------------
     140// XMLPortParamGeneric
     141
     142/**
     143    @brief This is the generic XMLPort param macro, which is used by all six specialized macros above.
     144*/
    58145#define XMLPortParamGeneric(containername, classname, objectclass, object, paramname, loadexecutor, saveexecutor, xmlelement, mode) \
    59146    orxonox::XMLPortClassParamContainer<objectclass>* containername = (orxonox::XMLPortClassParamContainer<objectclass>*)(ClassIdentifier<classname>::getIdentifier()->getXMLPortParamContainer(paramname)); \
     
    65152    containername->port((BaseObject*)this, object, xmlelement, mode)
    66153
    67 
    68 #define XMLPortObject(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, bApplyLoaderMask, bLoadBefore) \
     154// --------------------
     155// XMLPortObjectExtended
     156
     157/**
     158    @brief Declares a possible sub-object that can be added in the XML file.
     159    @param classname The name of the class that uses this macro
     160    @param objectclass The baseclass of objects that can be added
     161    @param sectionname The name of the subsection in the XML file that encloses the sub-objects ("" means no subsection)
     162    @param loadfunction The function to add a new object to the class
     163    @param loadfunction The function to get all added objects from the class
     164    @param xmlelement The XMLElement (recieved through the XMLPort function)
     165    @param mode The mode (load/save) (received through the XMLPort function)
     166    @param bApplyLoaderMask If this is true, an added sub-object only gets loaded if it's class is included in the Loaders ClassTreeMask (this is usually false)
     167    @param bLoadBefore If this is true, the sub-cobject gets loaded (through XMLPort) BEFORE it gets added to the main class (this is usually true)
     168
     169    bApplyLoaderMask is usually false for the following reason:
     170    If the loaders mask says, for example, "load only SpaceShips" and you added weapons to the
     171    SpaceShips, then the Weapons will still be loaded (which is most probably what you want).
     172    Of course, if there are "standalone" weapons in the level, they wont be loaded.
     173
     174    If bLoadBefore, an added object already has all attributes set (like it's name). This is most
     175    likely the best option, so this is usually true.
     176
     177    @note
     178    The load- and savefunctions have to follow an exactly defined protocol.
     179    Loadfunction:
     180      The loadfunction gets a pointer to the object.
     181      > void loadfunction(objectclass* pointer);
     182
     183    Savefunction:
     184      The savefunction gets an index, starting with 0. For every returnvalue != 0, the savefunction
     185      gets called again, but with index + 1. It's the functions responsibility to do something smart
     186      with the index and to return 0 if all objects were returned.
     187      > objectclass* savefunction(unsigned int index) const;
     188
     189      Possible implementation:
     190        objectclass* savefunction(unsigned int index) const
     191        {
     192          if (index < number_of_added_objects_)
     193            return my_added_objects[index];
     194          else
     195            return 0;
     196        }
     197
     198    @example
     199    Possible usage of the macro:
     200    > XMLPortObject(SpaceShip, Weapon, "weapons", addWeapon, getWeapon, xmlelement, mode, false, true);
     201
     202    Now you can add weapons through the XML file:
     203    <SpaceShip someattribute="..." ...>
     204      <weapons>
     205        <Weapon someattribute="..." ... />
     206        <Weapon someattribute="..." ... />
     207        <Weapon someattribute="..." ... />
     208      </weapons>
     209    </SpaceShip>
     210
     211    Note that "weapons" is the subsection. This allows you to add more types of sub-objects. In our example,
     212    you could add pilots, blinking lights or other stuff. If you don't want a subsection, just use "" (an
     213    empty string). The you can add sub-objects directly into the mainclass.
     214*/
     215#define XMLPortObjectExtended(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, bApplyLoaderMask, bLoadBefore) \
    69216    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode, bApplyLoaderMask, bLoadBefore)
    70 #define XMLPortObjectTemplate(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, bApplyLoaderMask, bLoadBefore, ...) \
     217/**
     218    @brief This is the same as XMLPortObjectExtended, but you can specify the loadfunction by adding the param types. See XMLPortParamTemplate for more details about the types.
     219*/
     220#define XMLPortObjectExtendedTemplate(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, bApplyLoaderMask, bLoadBefore, ...) \
    71221    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor< __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode, bApplyLoaderMask, bLoadBefore)
    72222
     223// -------------
     224// XMLPortObject
     225
     226/**
     227    @brief This is the same as XMLPortObjectExtended, but bApplyLoaderMask is false and bLoadBefore is true by default.
     228*/
     229#define XMLPortObject(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode) \
     230    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode, false, true)
     231/**
     232    @brief This is the same as XMLPortObject, but you can specify the loadfunction by adding the param types. See XMLPortParamTemplate for more details about the types.
     233*/
     234#define XMLPortObjectTemplate(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, ...) \
     235    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor< __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode, false, true)
     236
     237// --------------------
     238// XMLPortObjectGeneric
     239
     240/**
     241    @brief Generic XMLPortObject macro, that gets called by all other XMLPortObject macros above.
     242*/
    73243#define XMLPortObjectGeneric(containername, classname, objectclass, sectionname, loadexecutor, saveexecutor, xmlelement, mode, bApplyLoaderMask, bLoadBefore) \
    74244    orxonox::XMLPortClassObjectContainer<classname, objectclass>* containername = (orxonox::XMLPortClassObjectContainer<classname, objectclass>*)(ClassIdentifier<classname>::getIdentifier()->getXMLPortObjectContainer(sectionname)); \
  • code/trunk/src/orxonox/objects/WorldEntity.cc

    r1755 r1854  
    120120        XMLPortParam(WorldEntity, "rotationRate", setRotationRate, getRotationRate, xmlelement, mode);
    121121
    122         XMLPortObject(WorldEntity, WorldEntity, "attached", attachWorldEntity, getAttachedWorldEntity, xmlelement, mode, false, true);
     122        XMLPortObject(WorldEntity, WorldEntity, "attached", attachWorldEntity, getAttachedWorldEntity, xmlelement, mode);
    123123
    124124        WorldEntity::create();
  • code/trunk/src/orxonox/overlays/OverlayGroup.cc

    r1747 r1854  
    6868        XMLPortParam(OverlayGroup, "scroll", setScroll, getScroll, xmlElement, mode).defaultValues(Vector2(0.0, 0.0));
    6969        // loads all the child elements
    70         XMLPortObject(OverlayGroup, OrxonoxOverlay, "", addElement, getElement, xmlElement, mode, false, true);
     70        XMLPortObject(OverlayGroup, OrxonoxOverlay, "", addElement, getElement, xmlElement, mode);
    7171    }
    7272
  • code/trunk/src/orxonox/overlays/hud/HUDBar.cc

    r1747 r1854  
    100100        XMLPortParam(HUDBar, "rightToLeft",  setRightToLeft, getRightToLeft, xmlElement, mode).defaultValues(false);
    101101        XMLPortParam(HUDBar, "autoColour",   setAutoColour,  getAutoColour,  xmlElement, mode).defaultValues(true);
    102         XMLPortObject(HUDBar, BarColour, "", addColour, getColour, xmlElement, mode, false, true);
     102        XMLPortObject(HUDBar, BarColour, "", addColour, getColour, xmlElement, mode);
    103103    }
    104104
  • code/trunk/src/util/MultiType.h

    r1791 r1854  
    189189        virtual void toString(std::ostream& outstream) const = 0;
    190190
    191         MT_Type type_; //! The type of the current value
     191        MT_Type type_; //!< The type of the current value
    192192    };
    193193
     
    388388        template <typename T>        void createNewValueContainer(const T& value) { BOOST_STATIC_ASSERT(sizeof(T) == 0); }
    389389
    390         MT_ValueBase* value_; //! A pointer to the value container
     390        MT_ValueBase* value_; //!< A pointer to the value container
    391391};
    392392
  • code/trunk/src/util/MultiTypeValue.h

    r1791 r1854  
    110110    inline void toString(std::ostream& outstream) const { outstream << this->value_; }
    111111
    112     T value_; //! The stored value
     112    T value_; //!< The stored value
    113113};
    114114
  • code/trunk/src/util/OutputBuffer.h

    r1791 r1854  
    167167            void callListeners();
    168168
    169             std::stringstream stream_;                   //! The stringstream that stores the assigned text
    170             std::list<OutputBufferListener*> listeners_; //! A list of all listeners
     169            std::stringstream stream_;                   //!< The stringstream that stores the assigned text
     170            std::list<OutputBufferListener*> listeners_; //!< A list of all listeners
    171171    };
    172172}
Note: See TracChangeset for help on using the changeset viewer.