Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/lib/lang/new_class_id.h @ 9686

Last change on this file since 9686 was 9685, checked in by bensch, 18 years ago

adapted many classes to the new ClassID System, now comes the hard part… Scripting… then Network… wow this will be so bad :/

File size: 813 bytes
Line 
1/*!
2 * @file new_class_id.h
3 * @brief Definition of a dynamically allocating ClassID
4 *
5 */
6
7#ifndef _NEW_CLASS_ID_H
8#define _NEW_CLASS_ID_H
9
10#include <string>
11
12//! A class to dynamically allocate ClassID's and support a isA operator
13class NewClassID
14{
15public:
16  NewClassID() : _id(-1), _name("") { };
17  NewClassID(int id, const std::string& name) : _id(id), _name(name) { };
18  // the copy constructor is also defined.
19  int id() const { return _id; };
20  const std::string& name() const { return _name; };
21
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
26private:
27  int            _id;
28  std::string    _name;
29};
30#endif /* _NEW_CLASS_ID_H */
Note: See TracBrowser for help on using the repository browser.