Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 20, 2007, 10:42:34 PM (16 years ago)
Author:
landauf
Message:

added preprocessor-flag to change verbose mode of class-hierarchy and set it to false:

Identifier.h:
#define HIERARCHY_VERBOSE false

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchie/src/Identifier.h

    r224 r231  
    66#include "IdentifierList.h"
    77#include "ObjectList.h"
    8 //#include "OrxonoxClass.h"
    98#include "Factory.h"
    109
    11 // DONE AND TESTED:
    12 // - build class hierarchy
    13 // - isA, isChildOf, ...
    14 // - insert into class-lists
    15 // - ClassIdentifier
    16 // - BaseIdentifier
    17 // - Factory
    18 
    19 // IN WORK:
    20 
    21 // TO DO:
    22 // - iterate through lists
     10#define HIERARCHY_VERBOSE false
     11
    2312
    2413namespace orxonox
     
    6352            void initialize(IdentifierList* parents);
    6453
    65             static void startCreatingHierarchy() { hierarchyCreatingCounter_s++; std::cout << "*** Increased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << "\n"; }
    66             static void stopCreatingHierarchy() { hierarchyCreatingCounter_s--; std::cout << "*** Decreased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << "\n"; }
     54            static void startCreatingHierarchy()
     55            {
     56                hierarchyCreatingCounter_s++;
     57#if HIERARCHY_VERBOSE
     58                std::cout << "*** Increased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << "\n";
     59#endif
     60            }
     61
     62            static void stopCreatingHierarchy()
     63            {
     64                hierarchyCreatingCounter_s--;
     65#if HIERARCHY_VERBOSE
     66                std::cout << "*** Decreased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << "\n";
     67#endif
     68            }
    6769
    6870            IdentifierList directParents_;
     
    144146    ClassIdentifier<T>* ClassIdentifier<T>::registerClass(IdentifierList* parents, std::string name, bool bRootClass, bool bIsAbstractClass)
    145147    {
     148#if HIERARCHY_VERBOSE
    146149        std::cout << "*** Register Class in " << name << "-Singleton.\n";
     150#endif
    147151        if (!pointer_s)
    148152        {
     153#if HIERARCHY_VERBOSE
    149154            std::cout << "*** Register Class in " << name << "-Singleton -> Create Singleton.\n";
     155#endif
    150156            if (parents || bRootClass)
    151157            {
     
    173179    ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier()
    174180    {
     181#if HIERARCHY_VERBOSE
    175182//        std::cout << "*** Get Identifier.\n";
     183#endif
    176184        if (!pointer_s)
    177185        {
     186#if HIERARCHY_VERBOSE
    178187            std::cout << "*** Get Identifier -> Create Class\n";
     188#endif
    179189            Identifier::startCreatingHierarchy();
    180190            T* temp = new T();
     
    189199    void ClassIdentifier<T>::addObject(T* object)
    190200    {
     201#if HIERARCHY_VERBOSE
    191202        std::cout << "*** Added object to " << ClassIdentifier<T>::getIdentifier()->getName() << "-list.\n";
     203#endif
    192204        ClassIdentifier<T>::getIdentifier()->objects_s.add(object);
    193205    }
     
    198210        bool bIterateForwards = !Identifier::isCreatingHierarchy();
    199211
     212#if HIERARCHY_VERBOSE
    200213        if (bIterateForwards)
    201214            std::cout << "*** Removed object from " << this->name_ << "-list, iterating forwards.\n";
    202215        else
    203216            std::cout << "*** Removed object from " << this->name_ << "-list, iterating backwards.\n";
     217#endif
    204218
    205219        this->objects_s.remove(object, bIterateForwards);
Note: See TracChangeset for help on using the changeset viewer.