Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 17, 2008, 1:33:00 AM (16 years ago)
Author:
landauf
Message:
  • added new XMLPortParam template to specify the template arguments / to specify the functor
  • implemented the Namespace object and
  • added a NamespaceNode class that helps keeping track of the existing namespaces in a level

this is not yet tested nor fully included in the loader nor usefull (as we have no scripts at the moment), but i think it's a good start.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core2/src/orxonox/core/XMLPort.h

    r879 r895  
    4242
    4343#define XMLPortParam(classname, paramname, loadfunction, savefunction, xmlelement, loading) \
    44     orxonox::XMLPortClassParamContainer<classname>* xmlcontainer##loadfunction##savefunction = (orxonox::XMLPortClassParamContainer<classname>*)(this->getIdentifier()->getXMLPortParamContainer(paramname)); \
    45     if (!xmlcontainer##loadfunction##savefunction) \
     44    XMLPortParamGeneric(classname, paramname, xmlcontainer##loadfunction##savefunction, createFunctor(&classname::loadfunction), createFunctor(&classname::savefunction), xmlelement, loading)
     45#define XMLPortParam_Template(classname, paramname, loadtemplate, loadfunction, savetemplate, savefunction, xmlelement, loading) \
     46    XMLPortParamGeneric(classname, paramname, xmlcontainer##loadfunction##savefunction, createFunctor loadtemplate (&classname::loadfunction), createFunctor savetemplate (&classname::savefunction), xmlelement, loading)
     47
     48
     49#define XMLPortParamLoadOnly(classname, paramname, loadfunction, xmlelement, loading) \
     50    XMLPortParamGeneric(classname, paramname, xmlcontainer##loadfunction##0, createFunctor(&classname::loadfunction), 0, xmlelement, loading)
     51#define XMLPortParamLoadOnly_Template(classname, paramname, loadtemplate, loadfunction, xmlelement, loading) \
     52    XMLPortParamGeneric(classname, paramname, xmlcontainer##loadfunction##0, createFunctor loadtemplate (&classname::loadfunction), 0, xmlelement, loading)
     53
     54
     55#define XMLPortParamGeneric(classname, paramname, containername, loadfunctor, savefunctor, xmlelement, loading) \
     56    orxonox::XMLPortClassParamContainer<classname>* containername = (orxonox::XMLPortClassParamContainer<classname>*)(this->getIdentifier()->getXMLPortParamContainer(paramname)); \
     57    if (!containername) \
    4658    { \
    47         xmlcontainer##loadfunction##savefunction = new orxonox::XMLPortClassParamContainer<classname>(this->getIdentifier()->getName(), std::string(paramname), createFunctor(&classname::loadfunction), createFunctor(&classname::savefunction)); \
    48         this->getIdentifier()->addXMLPortParamContainer(paramname, xmlcontainer##loadfunction##savefunction); \
     59        containername = new orxonox::XMLPortClassParamContainer<classname>(this->getIdentifier()->getName(), std::string(paramname), loadfunctor, savefunctor); \
     60        this->getIdentifier()->addXMLPortParamContainer(paramname, containername); \
    4961    } \
    50     xmlcontainer##loadfunction##savefunction->port(this, xmlelement, loading)
    51 
    52 #define XMLPortParamLoadOnly(classname, paramname, loadfunction, xmlelement, loading) \
    53     orxonox::XMLPortClassParamContainer<classname>* xmlcontainer##loadfunction##savefunction = (orxonox::XMLPortClassParamContainer<classname>*)(this->getIdentifier()->getXMLPortParamContainer(paramname)); \
    54     if (!xmlcontainer##loadfunction##savefunction) \
    55     { \
    56         xmlcontainer##loadfunction##savefunction = new orxonox::XMLPortClassParamContainer<classname>(this->getIdentifier()->getName(), std::string(paramname), createFunctor(&classname::loadfunction), 0); \
    57         this->getIdentifier()->addXMLPortParamContainer(paramname, xmlcontainer##loadfunction##savefunction); \
    58     } \
    59     xmlcontainer##loadfunction##savefunction->port(this, xmlelement, loading)
     62    containername->port(this, xmlelement, loading)
     63
    6064
    6165#define XMLPortObject(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, loading, bApplyLoaderMask, bLoadBefore) \
Note: See TracChangeset for help on using the changeset viewer.