Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 25, 2006, 11:20:21 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: new safer concept for NewClassID

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/lang/new_class_id.h

    r9698 r9701  
    1010#include <string>
    1111
     12class NewObjectListBase;
     13
    1214//! A class to dynamically allocate ClassID's and support a isA operator
    1315class NewClassID
     
    1517public:
    1618  NewClassID();
    17   NewClassID(int id, const std::string& name) : _id(id), _name(name) { };
     19  NewClassID(const NewObjectListBase* id);
    1820  // the copy constructor is also defined.
    19   const int& id() const { return _id; };
    20   const std::string& name() const { return _name; };
     21  const int& id() const { return *_id; };
     22  const std::string& name() const { return *_name; };
    2123
    22   bool operator==(NewClassID id) const { return _id == id._id || _name == id._name; };
    23   bool operator==(int id) const { return _id == id; };
    24   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; };
     24  bool operator==(const NewClassID& id) const { return *_id == *id._id /* || _name == id._name */; };
     25  bool operator==(int id) const { return *_id == id; };
     26  bool operator==(const std::string& name) const { return *_name == name; };
     27  bool operator!=(const NewClassID& id) const { return *_id != *id._id /* && _name != id._name*/; };
     28  bool operator!=(int id) const { return *_id != id; };
     29  bool operator!=(const std::string& name) const { return *_name != name; };
    2830
    2931private:
    30   int                _id;
    31   std::string        _name;
     32  const int*                _id;
     33  const std::string*        _name;
    3234};
    3335
Note: See TracChangeset for help on using the changeset viewer.