Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 231


Ignore:
Timestamp:
Nov 20, 2007, 10:42:34 PM (17 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

Location:
code/branches/objecthierarchie/src
Files:
3 edited

Legend:

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

    r224 r231  
    2020    void Identifier::initialize(IdentifierList* parents)
    2121    {
     22#if HIERARCHY_VERBOSE
    2223        std::cout << "*** Initialize " << this->name_ << "-Singleton.\n";
     24#endif
    2325        if (parents)
    2426        {
  • 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);
  • code/branches/objecthierarchie/src/IdentifierIncludes.h

    r224 r231  
    1515    ClassIdentifier<ClassName>::addObject(this)
    1616
     17#if HIERARCHY_VERBOSE
    1718#define registerRootObject(ClassName) \
    1819    std::cout << "*** Register Root-Object: " << #ClassName << "\n"; \
    1920    internRegisterRootObject(ClassName, false)
     21#else
     22#define registerRootObject(ClassName) \
     23    internRegisterRootObject(ClassName, false)
     24#endif
    2025
     26#if HIERARCHY_VERBOSE
    2127#define registerAbstractRootObject(ClassName) \
    2228    std::cout << "*** Register abstract Root-Object: " << #ClassName << "\n"; \
    2329    internRegisterRootObject(ClassName, true)
     30#else
     31#define registerAbstractRootObject(ClassName) \
     32    internRegisterRootObject(ClassName, true)
     33#endif
    2434
    2535#define internRegisterObject(ClassName, bAbstract) \
     
    2939    ClassIdentifier<ClassName>::addObject(this)
    3040
     41#if HIERARCHY_VERBOSE
    3142#define registerObject(ClassName) \
    3243    std::cout << "*** Register Object: " << #ClassName << "\n"; \
    3344    internRegisterObject(ClassName, false)
     45#else
     46#define registerObject(ClassName) \
     47    internRegisterObject(ClassName, false)
     48#endif
    3449
     50#if HIERARCHY_VERBOSE
    3551#define registerAbstractObject(ClassName) \
    3652    std::cout << "*** Register abstract Object: " << #ClassName << "\n"; \
    3753    internRegisterObject(ClassName, true)
     54#else
     55#define registerAbstractObject(ClassName) \
     56    internRegisterObject(ClassName, true)
     57#endif
    3858
    3959#define unregisterObject() \
Note: See TracChangeset for help on using the changeset viewer.