Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Aug 21, 2006, 6:22:53 PM (18 years ago)
Author:
bensch
Message:

ClassList seems to work as it should.

File:
1 edited

Legend:

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

    r9672 r9673  
    88#define _NEW_CLASS_ID_H
    99
    10 #include "type_info.h"
     10#include "new_object_list.h"
     11
    1112#include <string>
    1213#include <list>
    13 #include "new_object_list.h"
    1414
    1515
     
    2323  ~NewClassID();
    2424
     25
    2526  template<class T> void registerObject(T* object, NewObjectList<T>& list);
     27  bool isA(const NewObjectListBase& objectList) const;
     28  bool isA(int id) const;
     29  bool isA(const std::string& className) const;
    2630
    2731private:
    28   std::list<NewObjectListBase::ClassEntry>       _classes;
     32
     33  //////////////////////////////
     34  //// Type Definition Part ////
     35  //////////////////////////////
     36  //! A ClassEntry so we can store Classes inside of Objects
     37  struct ClassEntry{
     38    /** Simple Constuctor @param objectList the NewObjectList, @param iterator the (intrusive) Iterator inside of the ObjectList */
     39    inline ClassEntry (NewObjectListBase* objectList, NewObjectListBase::IteratorBase* iterator) : _objectList(objectList), _iterator(iterator) {}
     40    NewObjectListBase*                _objectList;  //!< A ObjectList this Object is part of
     41    NewObjectListBase::IteratorBase*  _iterator;    //!< An iterator pointing to the position of the Object inside of the List.
     42  };
     43  typedef std::list<ClassEntry>        ClassList;   //!< Type definition for the List.
     44  ClassList                           _classes;     //!< All Classes this object is part of.
    2945};
    3046
    3147
     48/**
     49 * @brief Registeres an Object of Type T to objectList
     50 * @param object The Object to append to the objectList.
     51 * @param objectList The ObjectList to append the Object to.
     52 *
     53 * This function is essential to integrate objects into their designated ObjectList.
     54 * Remember if you do not want objects to be stored in Lists (less overhead),
     55 * do not attempt to call this function.
     56 */
    3257template<class T>
    3358    inline void NewClassID::registerObject(T* object, NewObjectList<T>& objectList)
    3459{
    35   this->_classes.push_back(NewObjectListBase::ClassEntry(&objectList, objectList.registerObject(object)));
    36 
    37   /*  this->_objectList = &objectList;
    38   _iterators.push_back(objectList.registerObject(object, this->_objectList));*/
     60  this->_classes.push_back(ClassEntry(&objectList, objectList.registerObject(object)));
    3961}
    4062
Note: See TracChangeset for help on using the changeset viewer.