Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5645 in orxonox.OLD


Ignore:
Timestamp:
Nov 19, 2005, 9:48:38 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: first Element gets loaded through the new LoadParam procedure.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/lang/base_object.cc

    r5642 r5645  
    6262{
    6363  // name setup
    64   LoadParam<BaseObject>(root, "name", this, &BaseObject::setName)
    65       .describe("the name of the Object at hand");
     64  LoadParamBase(root, "name", this, ExecutorObjective<BaseObject>(&BaseObject::setName))
     65      .describe("the Name of the Object.");
     66//  LoadParam<BaseObject>(root, "name", this, &BaseObject::setName)
     67      //.describe("the name of the Object at hand");
    6668}
    6769
     
    8688  if (this->objectName)
    8789    delete[] this->objectName;
    88   if (objectName)
     90  if (objectName != NULL)
    8991  {
    9092    this->objectName = new char[strlen(objectName)+1];
  • trunk/src/util/loading/load_param.cc

    r5634 r5645  
    3535{
    3636  this->setClassID(CL_LOAD_PARAM, "LoadParam");
     37  this->executor = NULL;
    3738
    3839  this->loadString = NULL;
     
    106107}
    107108
     109LoadParamBase::LoadParamBase(const TiXmlElement* root, const char* paramName, BaseObject* object, const Executor& executor)
     110{
     111  this->loadString = grabParameter(root, paramName);
     112
     113  if (loadString != NULL && root != NULL)
     114  {
     115    this->executor = executor.clone();
     116    this->executor->execute(object, loadString);
     117  }
     118  else
     119  {
     120    this->executor = NULL;
     121  }
     122}
     123LoadParamBase::~LoadParamBase()
     124{
     125  if (likely(this->executor != NULL))
     126    delete this->executor;
     127
     128}
     129
     130
     131
    108132/**
    109133 * @param descriptionText The text to set as a description for this Parameter
  • trunk/src/util/loading/load_param.h

    r5644 r5645  
    2929#include "substring.h"
    3030#include "tinyxml.h"
     31#include "executor/executor.h"
    3132
    3233#include "helper_functions.h"
     
    4445class LoadParamBase : public BaseObject
    4546{
    46  public:
    47   LoadParamBase* describe(const char* descriptionText);
    48   LoadParamBase* defaultValues(unsigned int count, ...);
    49 
    50  protected:
    51   LoadParamBase(const TiXmlElement* root, BaseObject* object, const char* paramName, int paramCount, bool multi, const void* pointerToParam, ...);
    52 
    53  protected:
    54   LoadClassDescription*    classDesc;            //!< The LoadClassDescription of this LoadParameter
    55   LoadParamDescription*    paramDesc;            //!< The LoadParameterDescription of this LoadParameter
    56   const char*              loadString;           //!< The string loaded by this LoadParam
    57   const void*              pointerToParam;       //!< A Pointer to a Parameter.
    58 
    59   MultiType*               defaultValue;
     47  public:
     48    LoadParamBase(const TiXmlElement* root, const char* paramName, BaseObject* object, const Executor& exeutor);
     49    ~LoadParamBase();
     50
     51    LoadParamBase* describe(const char* descriptionText);
     52    LoadParamBase* defaultValues(unsigned int count, ...);
     53
     54  protected:
     55    LoadParamBase(const TiXmlElement* root, BaseObject* object, const char* paramName, int paramCount, bool multi, const void* pointerToParam, ...);
     56
     57  protected:
     58    Executor*                executor;
     59
     60    LoadClassDescription*    classDesc;            //!< The LoadClassDescription of this LoadParameter
     61    LoadParamDescription*    paramDesc;            //!< The LoadParameterDescription of this LoadParameter
     62    const char*              loadString;           //!< The string loaded by this LoadParam
     63    const void*              pointerToParam;       //!< A Pointer to a Parameter.
     64
     65    MultiType*               defaultValue;
    6066};
    6167
     
    7581 * called element, and that you must say true at the Fith parameter, or it will fail
    7682 * also you will have to close the Cycle again with LOAD_PARAM_END_CYCLE
     83 *
    7784 * @param ROOT The root XLM-element to search element under.
    7885 * @param ELEMENT the element to search
Note: See TracChangeset for help on using the changeset viewer.