Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 14, 2006, 5:24:31 PM (18 years ago)
Author:
bensch
Message:

orxonox/new_class_id: new Executor construct, that is much more typesafe, faster, and easier to extend…

Also changed the LoadParam process, and adapted ScriptEngine calls

Then at the end, some missing headers appeared, and appended them to all the cc-files again.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/util/loading/load_param.h

    r8048 r9727  
    2525
    2626#include "executor/executor.h"
    27 #include "executor/executor_xml.h"
     27#include "parser/tinyxml/tinyxml.h"
    2828
    2929// Forward Declaration //
    3030class LoadClassDescription;
    3131class LoadParamDescription;
    32 class MultiType;
    33 
    3432
    3533/**
     
    4745#define LoadParam_CYCLE(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
    4846         CLoadParam(ROOT, PARAMETER_NAME, OBJECT, createExecutor<CLASS>(&CLASS::FUNCTION), true)
    49 
    50 #define LoadParamXML(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
    51          CLoadParam(ROOT, PARAMETER_NAME, OBJECT, new ExecutorXML<CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), false)
    52 
    53 #define LoadParamXML_CYCLE(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
    54          CLoadParam(ROOT, PARAMETER_NAME, OBJECT, new ExecutorXML<CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), true)
    55 
    5647
    5748/**
     
    7869}
    7970
     71
    8072/**************************
    8173**** REAL DECLARATIONS ****
    8274**************************/
    83 //! abstract Base class for a Loadable parameter
    84 class CLoadParam : public BaseObject
     75class LoadParamBase : public BaseObject
    8576{
    86   public:
    87     CLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, Executor* executor, bool inLoadCycle = false);
    88     virtual ~CLoadParam();
     77protected:
     78  LoadParamBase(const TiXmlElement* root, const std::string& paramName, BaseObject* object, bool inLoadCycle = false);
    8979
    90     CLoadParam& describe(const std::string& descriptionText);
    91     CLoadParam& defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
    92                               const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL,
    93                               const MultiType& value4 = MT_NULL);
    94     CLoadParam& attribute(const std::string& attributeName, const Executor& executor);
     80protected:
     81  void describe(const std::string& descriptionText);
     82
     83protected:
     84  BaseObject*              object;
     85  const std::string        paramName;
     86  bool                     inLoadCycle;
     87
     88  LoadClassDescription*    classDesc;            //!< The LoadClassDescription of this CLoadParameter
     89  LoadParamDescription*    paramDesc;            //!< The LoadParameterDescription of this LoadParameter
     90  const TiXmlElement*      loadElem;             //!< The Element to load.
     91};
    9592
    9693
    97   private:
    98     bool                     inLoadCycle;
    99     Executor*                executor;
    100     BaseObject*              object;
    101     const std::string        paramName;
     94//! abstract Base class for a Loadable parameter
     95class CLoadParam : public LoadParamBase
     96{
     97public:
     98  CLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, Executor<const SubString>* executor, bool inLoadCycle = false);
     99  virtual ~CLoadParam();
    102100
    103     LoadClassDescription*    classDesc;            //!< The LoadClassDescription of this CLoadParameter
    104     LoadParamDescription*    paramDesc;            //!< The LoadParameterDescription of this LoadParameter
    105     const TiXmlElement*      loadElem;             //!< The Element to load.
    106     const void*              pointerToParam;       //!< A Pointer to a Parameter.
     101  CLoadParam& defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
     102                            const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL,
     103                            const MultiType& value4 = MT_NULL);
     104  CLoadParam& describe(const std::string& descriptionText) { LoadParamBase::describe(descriptionText); return *this; };
     105  //     CLoadParam& attribute(const std::string& attributeName, const Executor<SubString>& executor);
    107106
    108     MultiType*               defaultValue;
     107
     108private:
     109  Executor<const SubString>*         executor;
    109110};
    110111
Note: See TracChangeset for help on using the changeset viewer.