Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 12, 2008, 1:30:43 AM (16 years ago)
Author:
landauf
Message:

I'm doing strange things… expanded the ClassTreeMask with scary operators and an iterator. it's not yet tested, it's probably doing bullshit right now, but it looks much better than the last approach with the Level class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core/src/orxonox/core/ClassTreeMask.h

    r802 r803  
    3030
    3131#include <list>
     32#include <stack>
    3233
    3334#include "CorePrereqs.h"
     
    3839    {
    3940        friend class ClassTreeMask;
     41        friend class ClassTreeMaskIterator;
    4042
    4143        public:
     
    6062    };
    6163
     64    class ClassTreeMaskIterator
     65    {
     66        public:
     67            ClassTreeMaskIterator(ClassTreeMaskNode* node);
     68            ~ClassTreeMaskIterator();
     69
     70            ClassTreeMaskIterator& operator++();
     71            ClassTreeMaskNode* operator*() const;
     72            ClassTreeMaskNode* operator->() const;
     73            operator bool();
     74            bool operator==(ClassTreeMaskNode* compare);
     75            bool operator!=(ClassTreeMaskNode* compare);
     76
     77        private:
     78            std::stack<std::pair<std::list<ClassTreeMaskNode*>::iterator, std::list<ClassTreeMaskNode*>::iterator> > nodes_;
     79    };
     80
    6281    class ClassTreeMask
    6382    {
     
    7089            void add(const Identifier* subclass, bool bInclude);
    7190            void reset();
     91            void clean();
    7292
    73             bool isIncluded(const Identifier* subclass);
    74             bool isExcluded(const Identifier* subclass);
     93            bool isIncluded(const Identifier* subclass) const;
     94            bool isExcluded(const Identifier* subclass) const;
     95
     96            ClassTreeMask operator+(const ClassTreeMask& other) const;
     97            ClassTreeMask operator*(const ClassTreeMask& other) const;
     98            ClassTreeMask operator!() const;
     99            ClassTreeMask operator-(const ClassTreeMask& other) const;
     100
     101            ClassTreeMask operator&(const ClassTreeMask& other) const;
     102            ClassTreeMask operator|(const ClassTreeMask& other) const;
     103            ClassTreeMask operator^(const ClassTreeMask& other) const;
     104            ClassTreeMask operator~() const;
    75105
    76106        private:
    77107            void add(ClassTreeMaskNode* node, const Identifier* subclass, bool bInclude);
    78             bool isIncluded(ClassTreeMaskNode* node, const Identifier* subclass);
     108            bool isIncluded(ClassTreeMaskNode* node, const Identifier* subclass) const;
     109            void clean(ClassTreeMaskNode* node);
    79110
    80111            ClassTreeMaskNode* root_;
Note: See TracChangeset for help on using the changeset viewer.