Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9691 in orxonox.OLD for branches/new_class_id/src/lib/lang


Ignore:
Timestamp:
Aug 22, 2006, 11:45:21 PM (18 years ago)
Author:
bensch
Message:

new_class_id: adapted Network

Location:
branches/new_class_id/src/lib/lang
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/lang/base_object.cc

    r9686 r9691  
    2121#include "util/loading/load_param.h"
    2222
     23NewObjectListDefinition(BaseObject);
     24
    2325/**
    2426 * @brief sets the name from a LoadXML-Element
     
    2628 */
    2729BaseObject::BaseObject(const std::string& objectName)
     30  : _leafClassID(&BaseObject::classID())
    2831{
    2932  this->className = "BaseObject";
  • branches/new_class_id/src/lib/lang/base_object.h

    r9686 r9691  
    2626class BaseObject : public sigslot::has_slots<>
    2727{
    28 
     28  NewObjectListDeclaration(BaseObject);
    2929public:
    3030  BaseObject (const std::string& objectName = "");
     
    4949
    5050  /** @returns the ID of the Topmost object of the ClassStack */
    51   inline int getLeafClassID() const { return _classes.front()._objectList->id(); }
     51  inline const int& getLeafClassID() const { return _leafClassID->id(); }
    5252
    5353  bool isA(const NewObjectListBase& objectList) const;
     
    8888  std::string                         className;    //!< the name of the class
    8989  ClassList                           _classes;     //!< All Classes this object is part of.
    90 
     90  const NewClassID*                       _leafClassID;  //!< Topmost ClassID.
    9191};
    9292
     
    104104inline void BaseObject::registerObject(T* object, NewObjectList<T>& objectList)
    105105{
     106  this->_leafClassID = &objectList.identity();
    106107  this->_classes.push_front(ClassEntry(&objectList, objectList.registerObject(object)));
    107108}
  • branches/new_class_id/src/lib/lang/new_class_id.h

    r9685 r9691  
    1717  NewClassID(int id, const std::string& name) : _id(id), _name(name) { };
    1818  // the copy constructor is also defined.
    19   int id() const { return _id; };
     19  const int& id() const { return _id; };
    2020  const std::string& name() const { return _name; };
    2121
     
    2323  bool operator==(int id) const { return _id == id; };
    2424  bool operator==(const std::string& name) const { return _name == name; };
     25  bool operator!=(NewClassID id) const { return _id != id._id && _name != id._name; };
     26  bool operator!=(int id) const { return _id != id; };
     27  bool operator!=(const std::string& name) const { return _name != name; };
    2528
    2629private:
  • branches/new_class_id/src/lib/lang/new_object_list.h

    r9686 r9691  
    2525  public: \
    2626   static inline const NewObjectList<ClassName>& objectList() { return ClassName::_objectList; }; \
    27    static inline const NewClassID classID() { return ClassName::_objectList.identity(); }; \
     27   static inline const NewClassID& classID() { return ClassName::_objectList.identity(); }; \
    2828  private: \
    2929   static NewObjectList<ClassName> _objectList
Note: See TracChangeset for help on using the changeset viewer.