Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9659 in orxonox.OLD for trunk/src/lib/lang/new_class_id.cc


Ignore:
Timestamp:
Aug 15, 2006, 9:35:58 PM (18 years ago)
Author:
bensch
Message:

some thoughts

File:
1 copied

Legend:

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

    r9658 r9659  
    22   orxonox - the future of 3D-vertical-scrollers
    33
    4    Copyright (C) 2004 orx
     4   Copyright (C) 2006 orx
    55
    66   This program is free software; you can redistribute it and/or modify
     
    1010
    1111   ### File Specific:
    12    main-programmer: ...
     12   main-programmer: Benjamin Grauer
    1313   co-programmer: ...
    1414*/
     
    1616//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
    1717
    18 #include "proto_class.h"
     18#include "new_class_id.h"
     19#include <cassert>
     20
     21ClassIDDeclaration::ClassIDDeclaration(const std::string& name)
     22  : _id(-1), _name(name)
     23{
     24  NewClassID::registerClass(this);
     25}
     26
     27ClassIDDeclaration::~ClassIDDeclaration()
     28{
     29  NewClassID::unregisterClass(this);
     30}
    1931
    2032
    2133
    22 
     34///////////////////////////////////////////////////////////
     35//// CLASS ID definiton. //////////////////////////////////
     36///////////////////////////////////////////////////////////
    2337/**
    24  * standard constructor
    25  * @todo this constructor is not jet implemented - do it
    26 */
    27 ProtoClass::ProtoClass ()
     38 * @brief standard constructor
     39 */
     40NewClassID::NewClassID ()
     41  : _className("")
    2842{
    29    this->setClassID(CL_PROTO_ID, "ProtoClass");
    30 
    31    /* If you make a new class, what is most probably the case when you write this file
    32       don't forget to:
    33        1. Add the new file new_class.cc to the ./src/Makefile.am
    34        2. Add the class identifier to ./src/class_id.h eg. CL_NEW_CLASS
    35 
    36       Advanced Topics:
    37       - if you want to let your object be managed via the ObjectManager make sure to read
    38         the object_manager.h header comments. You will use this most certanly only if you
    39         make many objects of your class, like a weapon bullet.
    40    */
    4143}
    4244
    4345
    4446/**
    45  * standard deconstructor
    46 */
    47 ProtoClass::~ProtoClass ()
     47 * @brief standard deconstructor
     48 */
     49NewClassID::~NewClassID ()
    4850{
    4951  // delete what has to be deleted here
    5052}
     53
     54
     55int NewClassID::_idCounter = 0;
     56
     57//! TODO make access to the idCounter ThreadSafe!
     58void NewClassID::registerClass(ClassIDDeclaration* namer)
     59{
     60  assert (namer->id() != -1 && "Do not register any ClassID's for yourself.");
     61
     62  namer->_id = NewClassID::_idCounter++;
     63}
     64
     65void NewClassID::unregisterClass(ClassIDDeclaration* namer)
     66{
     67  // here nothing is done, because Classes cannot be realigned fast.
     68}
Note: See TracChangeset for help on using the changeset viewer.