Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9406 in orxonox.OLD for trunk/src/lib/lang


Ignore:
Timestamp:
Jul 24, 2006, 11:09:47 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the proxy back

merged with commandsvn merge -r9346:HEAD https://svn.orxonox.net/orxonox/branches/proxy .

no conflicts

Location:
trunk/src/lib/lang
Files:
3 edited

Legend:

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

    r8145 r9406  
    2121#include "util/loading/load_param.h"
    2222#include "class_list.h"
    23 
    24 #include "synchronizeable.h"
    25 
    26 using namespace std;
    27 
    2823
    2924/**
     
    5045  ClassList::removeFromClassList(this);
    5146
    52   //  delete []this->className;
    5347  if (this->xmlElem != NULL)
    5448    delete this->xmlElem;
     
    6155void BaseObject::loadParams(const TiXmlElement* root)
    6256{
    63   // all loadParams should sometime arrive here.
     57  // all loadParams should arrive here, and be tested for (root != NULL)
    6458  assert (root != NULL);
    6559
     60  // copy the xml-element for to know how it was loaded.
    6661  if (this->xmlElem != NULL)
    6762    delete this->xmlElem;
    6863  this->xmlElem = root->Clone();
     64
    6965  // name setup
    7066  LoadParam(root, "name", this, BaseObject, setName)
     
    9288/**
    9389 * @brief set the name of the Object
     90 * @param objectName The new name of the Object.
    9491 */
    9592void BaseObject::setName (const std::string& objectName)
     
    164161 * @returns true on match, false otherwise.
    165162 */
    166 bool BaseObject::operator==(const std::string& objectName)
     163bool BaseObject::operator==(const std::string& objectName) const
    167164{
    168165  return (this->objectName == objectName);
    169166}
    170167
    171 
    172 /**
    173  * @brief displays everything this class is
    174  * @TODO REIMPLEMENT WITH SENSE.
    175  */
    176 void BaseObject::whatIs() const
    177 {
    178 
    179 }
  • trunk/src/lib/lang/base_object.h

    r8362 r9406  
    11/*!
    22 * @file base_object.h
    3   *  Definition of the base object class.
    4 
    5     This is a global handler for all classes.
    6 */
     3 * @brief Definition of the BaseObject class.
     4 *
     5 * This is a global handler for all classes Object and Class names
     6 *
     7 * BaseObject is the class, that handles object registration and
     8 * is the only write-access member of ClassList, where the Objects
     9 * References are stored.
     10 */
    711
    812
    9 #ifndef _BASE_OBJECT_H
    10 #define _BASE_OBJECT_H
     13#ifndef __BASE_OBJECT_H_
     14#define __BASE_OBJECT_H_
    1115
    1216#include "class_id.h"
     17#include "sigslot/slot.h"
     18
    1319#include <string>
    1420
     
    1824
    1925//! A class all other classes are derived from
    20 class BaseObject
     26class BaseObject : public sigslot::has_slots<>
    2127{
    2228
     
    2935  void setName (const std::string& newName);
    3036  /** returns the Name of this Object */
    31   inline const char* getName ()const { return this->objectName.c_str(); };
     37  inline const std::string& getName() const { return this->objectName; };
     38  /** returns the Name of this Object as a C-compliant string (const char*) */
     39  inline const char* getCName() const { return this->objectName.c_str(); };
    3240  /** @returns the XML-Element with whicht this Object was loaded */
    3341  inline TiXmlNode* getXmlElem() const { return this->xmlElem; };
    3442
    3543  /** @returns the className of the corresponding Object */
    36   inline const char* getClassName() const { return this->className.c_str(); };
     44  inline const std::string& getClassName() const { return this->className; }
     45  /** @returns the className of the corresponding Object as a C-compliant string (const char*) */
     46  inline const char* getClassCName() const { return this->className.c_str(); };
    3747  /** @returns the classID of the corresponding Object */
    3848  inline int getClassID() const { return this->classID; };
     
    4151  bool isA (ClassID classID) const;
    4252  bool isA (const std::string& className) const;
    43   void whatIs() const;
    4453
    45   bool operator==(const std::string& objectName);
    4654  /** @param classID comparer for a ClassID @returns true on match, false otherwise */
    47   bool operator==(ClassID classID) { return this->isA(classID); };
     55  bool operator==(ClassID classID) const  { return this->isA(classID); };
     56  bool operator==(const std::string& objectName) const;
    4857
    4958protected:
     
    5463
    5564private:
    56 
    5765  std::string        className;        //!< the name of the class
    5866  long               classID;          //!< this is the id from the class_id.h enumeration
     
    6472};
    6573
    66 #endif /* _BASE_OBJECT_H */
     74#endif /* __BASE_OBJECT_H_ */
  • trunk/src/lib/lang/class_list.cc

    r8783 r9406  
    2323#include <cmath>
    2424
    25 using namespace std;
     25
    2626
    2727/**
     
    6161{
    6262  if (unlikely(classList == NULL))
    63     ClassList::classList = new list<ClassList>();
     63    ClassList::classList = new std::list<ClassList>();
    6464
    6565  PRINTF(5)("subscribe a '%s'\n", className.c_str() );
     
    8585void ClassList::removeFromClassList(BaseObject* objectPointer)
    8686{
    87   list<ClassList>::iterator cl;
     87  std::list<ClassList>::iterator cl;
    8888  for(cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
    8989  {
     
    110110      ClassList::classNames.clear();
    111111
    112       list<ClassList>::const_iterator cl;
     112      std::list<ClassList>::const_iterator cl;
    113113      for (cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
    114114        ClassList::classNames.push_back((*cl).className);
     
    207207      std::list<BaseObject*>::iterator bo;
    208208      for (bo = cl->objectList.begin(); bo != cl->objectList.end(); bo++)
    209         if ((*bo)->getName() != NULL && objectName == (*bo)->getName())
     209        if (objectName == (*bo)->getName())
    210210          return (*bo);
    211211    }
     
    213213  else
    214214  {
    215     list<ClassList>::iterator cl;
     215    std::list<ClassList>::iterator cl;
    216216    for (cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
    217217    {
    218218      std::list<BaseObject*>::iterator bo;
    219219      for (bo = (*cl).objectList.begin(); bo != (*cl).objectList.end(); bo++)
    220         if ((*bo)->getName() != NULL && objectName == (*bo)->getName())
     220        if (objectName == (*bo)->getName())
    221221          return (*bo);
    222222    }
     
    241241    std::list<BaseObject*>::iterator bo;
    242242    for (bo = cl->objectList.begin(); bo != cl->objectList.end(); bo++)
    243       if ((*bo)->getName() != NULL && objectName == (*bo)->getName())
     243      if (objectName == (*bo)->getName())
    244244        return (*bo);
    245245  }
     
    268268  else
    269269  {
    270     list<ClassList>::iterator cl;
     270    std::list<ClassList>::iterator cl;
    271271    for (cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
    272272    {
     
    286286    std::list<BaseObject*>::iterator bo;
    287287    for (bo = cl->objectList.begin(); bo != cl->objectList.end(); bo++)
    288       if ((*bo)->getName() != NULL && objectName == (*bo)->getName())
     288      if (objectName == (*bo)->getName())
    289289        return true;
    290290  }
     
    299299void ClassList::whatIs(const BaseObject* object)
    300300{
    301   list<ClassList>::iterator cl;
     301  std::list<ClassList>::iterator cl;
    302302  for (cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
    303303    if (object->isA((*cl).classID))
     
    359359  int lenCount = 0;
    360360
    361   list<ClassList>::iterator cl;
     361  std::list<ClassList>::iterator cl;
    362362  for (cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
    363363  {
     
    377377      {
    378378        PRINT(0)("|  Listing Instances:\n");
    379         list<BaseObject*>::const_iterator bo;
     379        std::list<BaseObject*>::const_iterator bo;
    380380        for (bo = (*cl).objectList.begin(); bo != (*cl).objectList.end(); bo++)
    381381        {
    382           PRINT(0)("|   %s::%s::(0x%.8X->%p ", (*bo)->getClassName(), (*bo)->getName(), (*bo)->getClassID(), (*bo));
     382          PRINT(0)("|   %s::%s::(0x%.8X->%p ", (*bo)->getClassCName(), (*bo)->getCName(), (*bo)->getClassID(), (*bo));
    383383          if (debugLevel == 3)
    384384            ClassList::whatIs(*bo);
Note: See TracChangeset for help on using the changeset viewer.