Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Aug 22, 2006, 2:36:54 PM (18 years ago)
Author:
bensch
Message:

new_class_id: many more classes done

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

Legend:

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

    r9684 r9686  
    9595}
    9696
     97
     98/**
     99 * @brief Seeks in the Inheritance if it matches objectList.
     100 * @param objectList The ObjectList this should be a member of (by Pointer-comparison).
     101 * @return True if found, false if not.
     102 */
     103bool BaseObject::isA(const NewClassID& classID) const
     104{
     105  ClassList::const_iterator it;
     106  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
     107    if (*(*it)._objectList == classID)
     108      return true;
     109  return false;
     110}
     111
    97112/**
    98113 * @brief Seeks in the Inheritance if it matches objectList.
  • branches/new_class_id/src/lib/lang/base_object.h

    r9684 r9686  
    5252
    5353  bool isA(const NewObjectListBase& objectList) const;
     54  bool isA(const NewClassID& classID) const;
    5455  bool isA(int classID) const;
    5556  bool isA(const std::string& className) const;
  • branches/new_class_id/src/lib/lang/new_object_list.h

    r9685 r9686  
    1515
    1616
     17
     18/**
     19 * @brief Use this macro to easily declare a Class to store its own ObjectListDeclaration
     20 * @param ClassName the Name of the Class.
     21 * @note: Using this inside of a Class means, that you loose the member: _objectList, while defining
     22 * two new functions objectList() and classID().
     23 */
    1724#define NewObjectListDeclaration(ClassName) \
    1825  public: \
    19    static const NewObjectList<ClassName>& objectList() { return ClassName::_objectList; }; \
     26   static inline const NewObjectList<ClassName>& objectList() { return ClassName::_objectList; }; \
     27   static inline const NewClassID classID() { return ClassName::_objectList.identity(); }; \
    2028  private: \
    2129   static NewObjectList<ClassName> _objectList
     
    4048
    4149public:
     50  inline const NewClassID& identity() const { return _identity; };
    4251  inline int id() const { return _identity.id(); };
    4352  inline const std::string& name() const { return _identity.name(); };
    4453  bool operator==(int id) const { return _identity == id; };
     54  bool operator==(const NewClassID& id) const { return _identity == id; };
    4555  bool operator==(const std::string& name) const { return _identity == name; };
    4656
Note: See TracChangeset for help on using the changeset viewer.