Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 14, 2008, 3:42:49 AM (16 years ago)
Author:
landauf
Message:

merged core2 back to trunk
there might be some errors, wasn't able to test it yet due to some strange g++ and linker behaviour.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/core/ClassTreeMask.cc

    r1021 r1052  
    327327        {
    328328            // No it's not: Search for classes inheriting from the given class and add the rules for them
    329             for (std::list<const Identifier*>::const_iterator it = subclass->getDirectChildrenBegin(); it != subclass->getDirectChildrenEnd(); ++it)
     329            for (std::set<const Identifier*>::const_iterator it = subclass->getDirectChildrenBegin(); it != subclass->getDirectChildrenEnd(); ++it)
    330330                if ((*it)->isA(this->root_->getClass()))
    331331                    if (overwrite || (!this->nodeExists(*it))) // If we don't want to overwrite, only add nodes that don't already exist
     
    422422    void ClassTreeMask::addSingle(const Identifier* subclass, bool bInclude, bool clean)
    423423    {
    424         for (std::list<const Identifier*>::const_iterator it = subclass->getDirectChildrenBegin(); it != subclass->getDirectChildrenEnd(); ++it)
     424        for (std::set<const Identifier*>::const_iterator it = subclass->getDirectChildrenBegin(); it != subclass->getDirectChildrenEnd(); ++it)
    425425            this->add(*it, this->isIncluded(*it), false, false);
    426426
     
    561561
    562562    /**
     563        @brief Compares the mask with another mask and returns true if they represent the same logic.
     564        @param other The other mask
     565        @return True if both masks represent the same logic
     566    */
     567    bool ClassTreeMask::operator==(const ClassTreeMask& other) const
     568    {
     569        ClassTreeMask temp1 = other;
     570        ClassTreeMask temp2 = (*this);
     571
     572        temp1.clean();
     573        temp2.clean();
     574
     575        ClassTreeMaskIterator it1 = temp1.root_;
     576        ClassTreeMaskIterator it2 = temp2.root_;
     577
     578        for ( ; it1 && it2; ++it1, ++it2)
     579            if (it1->getClass() != it2->getClass())
     580                return false;
     581
     582        return true;
     583    }
     584
     585    /**
     586        @brief Compares the mask with another mask and returns true if they represent different logics.
     587        @param other The other mask
     588        @return True if the masks represent different logics
     589    */
     590    bool ClassTreeMask::operator!=(const ClassTreeMask& other) const
     591    {
     592        return (!((*this) == other));
     593    }
     594
     595    /**
    563596        @brief Prefix operator + does nothing.
    564597        @return A reference to the mask itself
Note: See TracChangeset for help on using the changeset viewer.