Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 10, 2007, 8:34:48 PM (17 years ago)
Author:
landauf
Message:

changed the class-hierarchy creation: call Factory::createClassHierarchy() to create the hierarchy.
until now it was automatically created at the program-start, but that could have been a problem in the future when classes depend on ogre, because ogre isn't already initialized at that program-start, so i've changed it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/core/Factory.cc

    r447 r457  
    66#include "Factory.h"
    77#include "Identifier.h"
     8#include "Debug.h"
     9#include "../objects/BaseObject.h"
    810
    911namespace orxonox
     
    6062        pointer_s->identifierNetworkIDMap_[newID] = identifier;
    6163    }
     64
     65    /**
     66        @brief Creates the class-hierarchy by creating and destroying one object of each type.
     67    */
     68    void Factory::createClassHierarchy()
     69    {
     70        if (!pointer_s)
     71            pointer_s = new Factory;
     72
     73        COUT(4) << "*** Factory -> Create class-hierarchy\n";
     74        std::map<std::string, Identifier*>::iterator it;
     75        it = pointer_s->identifierStringMap_.begin();
     76        (*pointer_s->identifierStringMap_.begin()).second->startCreatingHierarchy();
     77        for (it = pointer_s->identifierStringMap_.begin(); it != pointer_s->identifierStringMap_.end(); ++it)
     78        {
     79            // To create the new branch of the class-hierarchy, we create a new object and delete it afterwards.
     80            BaseObject* temp = (*it).second->fabricate();
     81            delete temp;
     82        }
     83        (*pointer_s->identifierStringMap_.begin()).second->stopCreatingHierarchy();
     84        COUT(4) << "*** Factory -> Finished class-hierarchy creation\n";
     85    }
    6286}
Note: See TracChangeset for help on using the changeset viewer.