Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9660 in orxonox.OLD for trunk/src/lib/lang/new_class_id.h


Ignore:
Timestamp:
Aug 20, 2006, 11:50:41 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: dynamic class ID is on its way

File:
1 edited

Legend:

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

    r9659 r9660  
    1212#include <string>
    1313
    14 #define DeclareClass(ClassName) \
    15    ClassIDDeclaration ClassID_##ClassName(ClassName)
    16 
    17 class ClassIDDeclaration
    18 {
    19   friend class NewClassID;
    20 public:
    21   ClassIDDeclaration(const std::string& name);
    22   ~ClassIDDeclaration();
    23 
    24   int id() const { return _id; };
    25   const std::string& name() const { return _name; };
    26 
    27 private:
    28   //! the copy constructor will be hidden.
    29   ClassIDDeclaration(const ClassIDDeclaration& definer) {};
    30 
    31 private:
    32   int                   _id;
    33   std::string           _name;
    34 };
    35 
    36 
    3714//! A class to dynamically allocate ClassID's and support a isA operator
    3815class NewClassID
     
    4219  ~NewClassID();
    4320
    44 
    45 
    46   static int classCount() { return _idCounter; };
    47   static void registerClass(ClassIDDeclaration* namer);
    48   static void unregisterClass(ClassIDDeclaration* namer);
    49 
    5021private:
    51   std::set<ClassIDDeclaration>  _types;
    5222  std::string                   _className;
    5323
    54   static int                    _idCounter;      //!< A counter, that gives all classes a Unique ClassID. Access to this Variable is to be Thread-Safe.
    5524};
    5625
Note: See TracChangeset for help on using the changeset viewer.