Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 562 for code/branches


Ignore:
Timestamp:
Dec 17, 2007, 3:58:42 AM (17 years ago)
Author:
landauf
Message:

modified DebugLevel-hack

Location:
code/branches/FICN/src/orxonox/core
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/core/DebugLevel.cc

    r561 r562  
    55namespace orxonox
    66{
    7     int DebugLevel::softDebugLevel_s;
    8 
    9 //    CreateFactory(DebugLevel);
     7    DebugLevel* DebugLevel::pointer_s = 0;
     8    bool DebugLevel::bCreatingDebugLevelObject_s = false;
    109
    1110    DebugLevel::DebugLevel()
    1211    {
    13         RegisterObject(DebugLevel);
     12        RegisterRootObject(DebugLevel);
    1413        SetConfigValue(softDebugLevel_s, 2);
    1514    }
     
    1716    int DebugLevel::getSoftDebugLevel()
    1817    {
    19         return DebugLevel::softDebugLevel_s;
     18        if (!pointer_s && !bCreatingDebugLevelObject_s)
     19        {
     20            bCreatingDebugLevelObject_s = true;
     21            pointer_s = new DebugLevel;
     22            bCreatingDebugLevelObject_s = false;
     23        }
     24
     25        if (bCreatingDebugLevelObject_s)
     26            return 4;
     27
     28        return pointer_s->softDebugLevel_s;
    2029    }
    2130}
  • code/branches/FICN/src/orxonox/core/DebugLevel.h

    r561 r562  
    1313
    1414        private:
    15             static int softDebugLevel_s;
    16     } myDebugObject;
     15            int softDebugLevel_s;
     16            static DebugLevel* pointer_s;
     17            static bool bCreatingDebugLevelObject_s;
     18    };
    1719}
    1820
  • code/branches/FICN/src/orxonox/core/Factory.cc

    r553 r562  
    3838namespace orxonox
    3939{
     40    Factory* Factory::pointer_s = 0;
     41
    4042    /**
    4143        @returns the Identifier with a given name.
     
    103105    Factory* Factory::getFactoryPointer()
    104106    {
    105       static Factory theOneAndOnlyInstance = Factory();
    106       return &theOneAndOnlyInstance;
     107//        static Factory theOneAndOnlyInstance = Factory();
     108//        return &theOneAndOnlyInstance;
     109        if (!pointer_s)
     110            pointer_s = new Factory();
     111
     112        return pointer_s;
    107113    }
    108114}
  • code/branches/FICN/src/orxonox/core/Factory.h

    r553 r562  
    3737            static void changeNetworkID(Identifier* identifier, const unsigned int oldID, const unsigned int newID);
    3838            static void createClassHierarchy();
    39 
    4039            static Factory* getFactoryPointer();// avoid overriding pointer_s in the static intialisation process
    4140
     
    4443            Factory(const Factory& factory) {}      // don't copy
    4544            ~Factory() {}                           // don't delete
    46             static void checkPointer();
    4745
     46            static Factory* pointer_s;
    4847            std::map<std::string, Identifier*> identifierStringMap_;            //!< The map, mapping the name with the Identifier
    4948            std::map<unsigned int, Identifier*> identifierNetworkIDMap_;        //!< The map, mapping the network ID with the Identifier
Note: See TracChangeset for help on using the changeset viewer.