Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4931 in orxonox.OLD for orxonox/trunk/src/util


Ignore:
Timestamp:
Jul 22, 2005, 2:26:59 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: more elaborate (see last commit)
also a flush…. have to go to sleep… i am f tired

Location:
orxonox/trunk/src/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/object_manager.cc

    r4930 r4931  
    108108}
    109109
     110
     111
    110112/**
    111113 *  constructor
  • orxonox/trunk/src/util/object_manager.h

    r4930 r4931  
    2121
    2222#include "base_object.h"
     23#include "class_id.h"
    2324
    2425template<class T> class tList;
     
    5758
    5859/**
    59  * Creates a factory to a Loadable Class.
    60  * this should be used at the beginning of all the Classes that should be loadable (in the cc-file)
     60 * Creates a factory to a Loadable FastObject.
    6161 */
    62 #define CREATE_FAST_FACTORY(CLASS_NAME, CLASS_ID) \
    63     tObject<CLASS_NAME>* global_##CLASS_NAME##_Object = new tObject<CLASS_NAME>(#CLASS_NAME, CLASS_ID)
     62#define CREATE_FAST_OBJECT(CLASS_NAME, CLASS_ID) \
     63    tFastObject<CLASS_NAME>* global_##CLASS_NAME##_FastObject = new tFastObject<CLASS_NAME>(#CLASS_NAME, CLASS_ID)
    6464
    65 //! The Factory is a loadable object handler
     65//! The FastObject is a loadable object handler
    6666class FastObject : public BaseObject {
    6767
     
    7575    /** sets the Next factory in the list @param nextFactory the next factory */
    7676    inline void setNext( FastObject* nextFastObject) { this->next = nextFastObject; };
    77     /** @returns the first factory */
     77    /** @returns the first FastObject */
    7878    static FastObject* getFirst() { return FastObject::first; };
    79     /** @returns the next factory */
     79    /** @returns the next FastObject */
    8080    FastObject* getNext() const { return this->next; };
    8181
     82  protected:
     83    ClassID              storedClassID;        //!< The classID of the specified class.
     84
    8285  private:
    83     FastObject*          next;                 //!< pointer to the next factory.
    84     static FastObject*   first;                //!< A pointer to the first factory.
    85     ClassID              storedClassID;        //!< The classID of the specified class.
     86    FastObject*          next;                 //!< pointer to the next FastObject.
     87    static FastObject*   first;                //!< A pointer to the first FastObject.
    8688};
    8789
    8890/**
    89  *  a factory that is able to load any kind of Object
    90    (this is a Functor)
     91 *  a FastObject that is able to load any kind of Object
     92 * (this is a Functor)
    9193 */
    9294template<class T> class tFastObject : public FastObject
     
    100102
    101103/**
    102  * construnts a factory with
    103  * @param factoryName the name of the factory
     104 * construnts a FastObject with
     105 * @param fastObjectName the name of the FastObject
     106 * @param fastObject the ID of the class
    104107 */
    105108template<class T>
     
    112115BaseObject* tFastObject<T>::fabricate(ClassID fastObject)
    113116{
    114   if(this->classID == fastObject)
    115     return new T ( root);
    116   else if( getNext() != NULL)
    117     return getNext()->fabricate( root);
    118   else
     117//  if(this->classID == fastObject)
     118    //return new T ();
     119  //else if( getNext() != NULL)
     120//    return getNext()->fabricate();
     121//  else
    119122    return NULL;
    120123}
Note: See TracChangeset for help on using the changeset viewer.