Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 818 for code/branches/core


Ignore:
Timestamp:
Feb 16, 2008, 8:00:06 PM (17 years ago)
Author:
landauf
Message:

new feature in ClassTreeMask:
you can include or exclude a single class without changing the rule for inheriting classes

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

Legend:

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

    r817 r818  
    10881088        std::cout << "12\n";
    10891089
     1090        ClassTreeMask test13_21;
     1091        test13_21.excludeSingle(Class(A2));
     1092        std::cout << std::endl;
     1093        std::cout << "Mask with single-excluded A2:\n";
     1094        TestClassTreeMask(test13_21);
     1095
     1096        test13_21.exclude(Class(A2));
     1097        std::cout << std::endl;
     1098        std::cout << "Mask with excluded A2:\n";
     1099        TestClassTreeMask(test13_21);
     1100
     1101        test13_21.includeSingle(Class(A2));
     1102        std::cout << std::endl;
     1103        std::cout << "Previous mask with single-included A2:\n";
     1104        TestClassTreeMask(test13_21);
     1105
     1106        test13_21.includeSingle(Class(A2), false);
     1107        std::cout << std::endl;
     1108        std::cout << "Previous mask with single-included A2 without clean:\n";
     1109        TestClassTreeMask(test13_21);
     1110
     1111        std::cout << "13\n";
    10901112/*
    10911113        std::cout << "Test 14\n";
  • code/branches/core/src/orxonox/core/ClassTreeMask.cc

    r817 r818  
    6262    /**
    6363        @brief Sets the rule for the node to "included".
     64        @param overwrite True = overwrite previously added rules for inheriting classes
    6465    */
    6566    void ClassTreeMaskNode::include(bool overwrite)
     
    7071    /**
    7172        @brief Sets the rule for the node to "excluded".
     73        @param overwrite True = overwrite previously added rules for inheriting classes
    7274    */
    7375    void ClassTreeMaskNode::exclude(bool overwrite)
     
    7981        @brief Sets the rule for the node to a given value and erases all following rules.
    8082        @param bIncluded The rule: included (true) or excluded (false)
     83        @param overwrite True = overwrite previously added rules for inheriting classes
    8184    */
    8285    void ClassTreeMaskNode::setIncluded(bool bIncluded, bool overwrite)
     
    287290        @brief Adds a new "include" rule for a given subclass to the mask.
    288291        @param subclass The subclass
     292        @param overwrite True = overwrite previously added rules for inheriting classes
     293        @param clean True = clean the tree after adding the new rule
    289294    */
    290295    void ClassTreeMask::include(const Identifier* subclass, bool overwrite, bool clean)
     
    296301        @brief Adds a new "exclude" rule for a given subclass to the mask.
    297302        @param subclass The subclass
     303        @param overwrite True = overwrite previously added rules for inheriting classes
     304        @param clean True = clean the tree after adding the new rule
    298305    */
    299306    void ClassTreeMask::exclude(const Identifier* subclass, bool overwrite, bool clean)
     
    306313        @param subclass The subclass
    307314        @param bInclude The rule: include (true) or exclude (false)
     315        @param overwrite True = overwrite previously added rules for inheriting classes
     316        @param clean True = clean the tree after adding the new rule
    308317    */
    309318    void ClassTreeMask::add(const Identifier* subclass, bool bInclude, bool overwrite, bool clean)
     
    334343        @param subclass The subclass
    335344        @param bInclude The rule: include (true) or exclude (false)
     345        @param overwrite True = overwrite previously added rules for inheriting classes
    336346    */
    337347    void ClassTreeMask::add(ClassTreeMaskNode* node, const Identifier* subclass, bool bInclude, bool overwrite)
     
    385395
    386396    /**
     397        @brief Adds a new "include" rule for a single subclass. The new rule doesn't change the mask for inheriting classes.
     398        @param subclass The subclass
     399        @param clean True = clean the tree after adding the new rule
     400    */
     401    void ClassTreeMask::includeSingle(const Identifier* subclass, bool clean)
     402    {
     403        this->addSingle(subclass, true, clean);
     404    }
     405
     406    /**
     407        @brief Adds a new "exclude" rule for a single subclass. The new rule doesn't change the mask for inheriting classes.
     408        @param subclass The subclass
     409        @param clean True = clean the tree after adding the new rule
     410    */
     411    void ClassTreeMask::excludeSingle(const Identifier* subclass, bool clean)
     412    {
     413        this->addSingle(subclass, false, clean);
     414    }
     415
     416    /**
     417        @brief Adds a new rule for a single subclass. The new rule doesn't change the mask for inheriting classes.
     418        @param bInclude The rule: include (true) or exclude (false)
     419        @param subclass The subclass
     420        @param clean True = clean the tree after adding the new rule
     421    */
     422    void ClassTreeMask::addSingle(const Identifier* subclass, bool bInclude, bool clean)
     423    {
     424        for (std::list<const Identifier*>::const_iterator it = subclass->getDirectChildrenBegin(); it != subclass->getDirectChildrenEnd(); ++it)
     425            this->add(*it, this->isIncluded(*it), false, false);
     426
     427        this->add(subclass, bInclude, false, clean);
     428    }
     429
     430    /**
    387431        @brief Resets the mask to "include everything".
    388432    */
  • code/branches/core/src/orxonox/core/ClassTreeMask.h

    r817 r818  
    166166            void exclude(const Identifier* subclass, bool overwrite = true, bool clean = true);
    167167            void add(const Identifier* subclass, bool bInclude, bool overwrite = true, bool clean = true);
     168
     169            void includeSingle(const Identifier* subclass, bool clean = true);
     170            void excludeSingle(const Identifier* subclass, bool clean = true);
     171            void addSingle(const Identifier* subclass, bool bInclude, bool clean = true);
     172
    168173            void reset();
    169174            void clean();
Note: See TracChangeset for help on using the changeset viewer.