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.cc

    r9406 r9727  
    1818#include "util/loading/load_param.h"
    1919#include "load_param_description.h"
    20 
    21 #include <stdarg.h>
    22 
     20#include "compiler.h"
     21#include "debug.h"
    2322/**
    2423 * Constructs a new LoadParameter
     
    2827 * @param executor the Executor, that executes the loading procedure.
    2928 */
    30 CLoadParam::CLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, Executor* executor, bool inLoadCycle)
    31   :  object(object), paramName(paramName)
    32 {
    33   this->inLoadCycle = inLoadCycle;
    34 
     29LoadParamBase::LoadParamBase(const TiXmlElement* root, const std::string& paramName, BaseObject* object, bool inLoadCycle)
     30    :  object(object), paramName(paramName), inLoadCycle(inLoadCycle)
     31{
    3532  // determin the LoadString.
    3633  if (likely(!inLoadCycle))
     
    4037  else
    4138    this->loadElem = NULL;
    42 
     39}
     40
     41
     42/**
     43 * @param descriptionText The text to set as a description for this Parameter
     44 * @returns a pointer to itself.
     45 */
     46void LoadParamBase::describe(const std::string& descriptionText)
     47{
     48  if (LoadClassDescription::parametersDescription && this->paramDesc && this->paramDesc->getDescription().empty())
     49  {
     50    this->paramDesc->setDescription(descriptionText);
     51  }
     52}
     53
     54
     55
     56
     57CLoadParam::CLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, Executor<const SubString>* executor, bool inLoadCycle)
     58    : LoadParamBase(root, paramName, object, inLoadCycle)
     59{
     60  assert (executor != NULL);
    4361  // set the Executor.
    4462  this->executor = executor;
    45 
    4663  //if (this->executor)
    4764  //  this->executor->setName(paramName);
     
    5673CLoadParam::~CLoadParam()
    5774{
    58   if (likely(this->executor != NULL))
    59   {
    60     std::string loadString = "";
    61     if (this->loadElem != NULL &&  this->loadElem->ToText())
    62       loadString = this->loadElem->Value();
    63     if (likely(this->object != NULL) &&
    64         ( !loadString.empty() ||
    65           ((this->executor->getType() & Executor_NoLoadString) == Executor_NoLoadString)))
     75  assert(this->object != NULL);
     76
     77  std::string loadString;
     78  if (this->loadElem != NULL &&  this->loadElem->ToText())
     79  {
     80    loadString = this->loadElem->Value();
     81    if (!loadString.empty())
    6682    {
    67       PRINTF(4)("Loading value '%s' with Parameters '%s' onto: %s::%s\n", this->paramName.c_str(), loadString.c_str(), this->object->getClassCName(), this->object->getCName());
     83      PRINTF(0)("Loading value '%s' with Parameters '%s' onto: %s::%s\n",
     84                this->paramName.c_str(), loadString.c_str(), this->object->getClassCName(), this->object->getCName());
    6885      (*this->executor)(this->object, SubString(loadString, ",", SubString::WhiteSpaces, false, '\\'));
    6986    }
    70     delete this->executor;
    71   }
     87  }
     88  delete this->executor;
    7289}
    7390
     
    90107}
    91108
    92 
    93 
    94 /**
    95  * @param descriptionText The text to set as a description for this Parameter
    96  * @returns a pointer to itself.
    97 */
    98 CLoadParam& CLoadParam::describe(const std::string& descriptionText)
    99 {
    100   if (LoadClassDescription::parametersDescription && this->paramDesc && this->paramDesc->getDescription().empty())
    101   {
    102     this->paramDesc->setDescription(descriptionText);
    103   }
    104   return *this;
    105 }
    106109
    107110// const LoadParamDescription* LoadParamDescription::getClass(const char* className)
Note: See TracChangeset for help on using the changeset viewer.