Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 804 for code/branches/core


Ignore:
Timestamp:
Feb 12, 2008, 3:49:41 AM (17 years ago)
Author:
landauf
Message:

added code for testing

Location:
code/branches/core/src/orxonox
Files:
2 edited

Legend:

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

    r797 r804  
    7676#include "GraphicsEngine.h"
    7777
     78#include "core/ClassTreeMask.h"
    7879#include "objects/WorldEntity.h"
    7980#include "core/BaseObject.h"
     
    717718        std::cout << "13\n";
    718719*/
     720/*
    719721        std::cout << "Test 11\n";
    720 /*
    721722        std::cout << "1\n";
    722723        count = 0; for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it) { count++; }
     
    736737        Test2* test11_2 = new Test2;
    737738*/
    738 
     739/*
    739740        std::cout << "3\n";
    740741        Test3* test11_3 = new Test3;
     
    742743
    743744        std::cout << "4\n";
     745*/
    744746/*
    745747        std::cout << "Test 12\n";
     
    752754        std::cout << "2\n";
    753755*/
     756        std::cout << "Test 13\n";
     757
     758        #define BoolToYesNo(bool) \
     759            if (bool) \
     760                std::cout << "yes "; \
     761            else \
     762                std::cout << "no  "
     763
     764        #define TestClassTreeMask(mask) \
     765            std::cout << "========== ClassTreeMask-Test ===========" << std::endl; \
     766            std::cout << "                 "; \
     767            BoolToYesNo(mask.isIncluded(Class(BaseObject))); \
     768            std::cout << std::endl; \
     769            \
     770            std::cout << "     "; \
     771            BoolToYesNo(mask.isIncluded(Class(A1))); \
     772            std::cout << "        "; \
     773            BoolToYesNo(mask.isIncluded(Class(A2))); \
     774            std::cout << "           "; \
     775            BoolToYesNo(mask.isIncluded(Class(A3))); \
     776            std::cout << std::endl; \
     777            \
     778            std::cout << "  "; \
     779            BoolToYesNo(mask.isIncluded(Class(A1B1))); \
     780            std::cout << "  "; \
     781            BoolToYesNo(mask.isIncluded(Class(A1B2))); \
     782            std::cout << "  "; \
     783            BoolToYesNo(mask.isIncluded(Class(A2B1))); \
     784            std::cout << "  "; \
     785            BoolToYesNo(mask.isIncluded(Class(A2B2))); \
     786            std::cout << "    "; \
     787            BoolToYesNo(mask.isIncluded(Class(A3B1))); \
     788            std::cout << "    "; \
     789            BoolToYesNo(mask.isIncluded(Class(A3B2))); \
     790            std::cout << std::endl; \
     791            \
     792            BoolToYesNo(mask.isIncluded(Class(A1B1C1))); \
     793            BoolToYesNo(mask.isIncluded(Class(A1B1C2))); \
     794            BoolToYesNo(mask.isIncluded(Class(A1B2C1))); \
     795            std::cout << "  "; \
     796            BoolToYesNo(mask.isIncluded(Class(A2B1C1))); \
     797            std::cout << "  "; \
     798            BoolToYesNo(mask.isIncluded(Class(A2B2C1))); \
     799            std::cout << "  "; \
     800            BoolToYesNo(mask.isIncluded(Class(A3B1C1))); \
     801            BoolToYesNo(mask.isIncluded(Class(A3B1C2))); \
     802            BoolToYesNo(mask.isIncluded(Class(A3B2C1))); \
     803            BoolToYesNo(mask.isIncluded(Class(A3B2C2))); \
     804            std::cout << std::endl; \
     805            std::cout << "=========================================" << std::endl
     806
     807        std::cout << "1\n";
     808
     809        ClassTreeMask test13_1;
     810//        test13_1.include(Class(BaseObject));
     811        test13_1.exclude(Class(A1B1));
     812        test13_1.exclude(Class(A2));
     813        test13_1.include(Class(A2B2));
     814        test13_1.exclude(Class(A2B2C1));
     815        test13_1.exclude(Class(A3B1));
     816        test13_1.include(Class(A3B1C2));
     817        test13_1.exclude(Class(A3B2C1));
     818        test13_1.exclude(Class(A3B2C2));
     819
     820        ClassTreeMask test13_2;
     821        test13_2.exclude(Class(BaseObject));
     822        test13_2.include(Class(A1));
     823        test13_2.exclude(Class(A1B2));
     824        test13_2.exclude(Class(A1B1C2));
     825        test13_2.include(Class(A2));
     826        test13_2.exclude(Class(A2B2));
     827        test13_2.include(Class(A3B1));
     828        test13_2.include(Class(A3B2));
     829        test13_2.exclude(Class(A3B2C2));
     830
     831//        TestClassTreeMask(test13_1);
     832std::cout << "1_0: " << ClassIdentifier<BaseObject>::getIdentifier() << std::endl;
     833
     834        TestClassTreeMask(test13_2);
     835
     836        std::cout << "2\n";
     837
     838        std::cout << "3\n";
    754839
    755840//    startRenderLoop();
  • code/branches/core/src/orxonox/core/ClassTreeMask.cc

    r803 r804  
    237237    bool ClassTreeMask::isIncluded(ClassTreeMaskNode* node, const Identifier* subclass) const
    238238    {
     239std::cout << "1_0: " << ClassIdentifier<BaseObject>::getIdentifier() << std::endl;
     240std::cout << "1_1: " << subclass->getName() << " (" << subclass << ") / " << node->getClass()->getName() << " (" << node->getClass() << ")" << std::endl;
    239241        // Check if the searched subclass is of the same type as the class in the current node or a derivative
    240242        if (subclass->isA(node->getClass()))
    241243        {
     244std::cout << "1_2\n";
    242245            // Check for the special case
    243246            if (subclass == node->getClass())
     247            {
     248std::cout << "1_3\n";
    244249                return node->isIncluded();
    245 
     250            }
     251
     252std::cout << "1_4\n";
    246253            // Go through the list of subnodes and look for a node containing the searched subclass
    247254            for (std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); ++it)
     
    249256                    return isIncluded(*it, subclass);
    250257
     258std::cout << "1_5\n";
    251259            // There is no subnode containing our class -> the rule of the current node takes in effect
    252260            return node->isIncluded();
     
    254262        else
    255263        {
     264std::cout << "1_6\n";
    256265            // The class is not included in the mask: return false
    257266            return false;
Note: See TracChangeset for help on using the changeset viewer.