Index: code/trunk/src/core/ClassTreeMask.h
===================================================================
--- code/trunk/src/core/ClassTreeMask.h	(revision 1755)
+++ code/trunk/src/core/ClassTreeMask.h	(revision 1757)
@@ -76,4 +76,6 @@
 #include <stack>
 
+#include "Iterator.h"
+
 namespace orxonox
 {
@@ -91,4 +93,5 @@
         friend class ClassTreeMask;
         friend class ClassTreeMaskIterator;
+        friend class ClassTreeMaskObjectIterator;
 
         public:
@@ -102,8 +105,14 @@
             void addSubnode(ClassTreeMaskNode* subnode);
 
-            bool isIncluded() const;
-            bool isExcluded() const;
-
-            const Identifier* getClass() const;
+            /** @brief Tells if the rule is "included" or not. @return The rule: true = included, false = excluded */
+            inline bool isIncluded() const { return this->bIncluded_; }
+            /** @brief Tells if the rule is "excluded" or not. @return The inverted rule: true = excluded, false = included */
+            inline bool isExcluded() const { return (!this->bIncluded_); }
+
+            /** @brief Returns the Identifier of the class the rule refers to. @return The Identifier representing the class */
+            inline const Identifier* getClass() const { return this->subclass_; }
+
+            /** @brief Returns true if the Node has some subnodes. */
+            inline bool hasSubnodes() const { return !this->subnodes_.empty(); }
 
         private:
@@ -133,10 +142,10 @@
             ~ClassTreeMaskIterator();
 
-            ClassTreeMaskIterator& operator++();
+            const ClassTreeMaskIterator& operator++();
             ClassTreeMaskNode* operator*() const;
             ClassTreeMaskNode* operator->() const;
-            operator bool();
-            bool operator==(ClassTreeMaskNode* compare);
-            bool operator!=(ClassTreeMaskNode* compare);
+            operator bool() const;
+            bool operator==(ClassTreeMaskNode* compare) const;
+            bool operator!=(ClassTreeMaskNode* compare) const;
 
         private:
@@ -159,4 +168,6 @@
     class _CoreExport ClassTreeMask
     {
+        friend class ClassTreeMaskObjectIterator;
+
         public:
             ClassTreeMask();
@@ -178,10 +189,15 @@
             bool isExcluded(const Identifier* subclass) const;
 
-            ClassTreeMask& operator=(const ClassTreeMask& other);
+            /** @brief Begin of the ClassTreeMaskObjectIterator. */
+            inline const ClassTreeMask& begin() const { return (*this); }
+            /** @brief End of the ClassTreeMaskObjectIterator. */
+            inline BaseObject*          end()   const { return 0; }
+
+            const ClassTreeMask& operator=(const ClassTreeMask& other);
 
             bool operator==(const ClassTreeMask& other) const;
             bool operator!=(const ClassTreeMask& other) const;
 
-            ClassTreeMask& operator+();
+            const ClassTreeMask& operator+() const;
             ClassTreeMask operator-() const;
 
@@ -191,7 +207,7 @@
             ClassTreeMask operator!() const;
 
-            ClassTreeMask& operator+=(const ClassTreeMask& other);
-            ClassTreeMask& operator*=(const ClassTreeMask& other);
-            ClassTreeMask& operator-=(const ClassTreeMask& other);
+            const ClassTreeMask& operator+=(const ClassTreeMask& other);
+            const ClassTreeMask& operator*=(const ClassTreeMask& other);
+            const ClassTreeMask& operator-=(const ClassTreeMask& other);
 
             ClassTreeMask operator&(const ClassTreeMask& other) const;
@@ -200,7 +216,7 @@
             ClassTreeMask operator~() const;
 
-            ClassTreeMask& operator&=(const ClassTreeMask& other);
-            ClassTreeMask& operator|=(const ClassTreeMask& other);
-            ClassTreeMask& operator^=(const ClassTreeMask& other);
+            const ClassTreeMask& operator&=(const ClassTreeMask& other);
+            const ClassTreeMask& operator|=(const ClassTreeMask& other);
+            const ClassTreeMask& operator^=(const ClassTreeMask& other);
 
             friend std::ostream& operator<<(std::ostream& out, const ClassTreeMask& mask);
@@ -219,10 +235,50 @@
     // ### ClassTreeMaskObjectIterator ###
     // ###################################
-    //! ...
-    /**
-        ...
+    //! The ClassTreeMaskObjectIterator iterates through all objects of all classes, included by a ClassTreeMask.
+    /**
+        The ClassTreeMaskObjectIterator iterates through all objects of all classes,
+        included by a ClassTreeMask. This is done the following way:
+
+        ClassTreeMask mask;
+        for (ClassTreeMaskObjectIterator it = mask.begin(); it != mask.end(); ++it)
+            it->doSomething();
+
+        Note: The ClassTreeMaskObjectIterator handles all objects as BaseObjects. If
+              you want to use another class, you should use a dynamic_cast.
+
+        Performance of ClassTreeMaskObjectIterator is good as long as you don't exclude
+        subclasses of included classes. Of course you can still exlucde subclasses, but
+        if this is done more often, we need a new implementation using a second ObjectList
+        in the Identifier, containing all objects of exactly one class.
     */
     class _CoreExport ClassTreeMaskObjectIterator
     {
+        public:
+            /** @brief Defaultconstructor: Does nothing. */
+            inline ClassTreeMaskObjectIterator() {}
+            /** @brief Constructor: Initializes the iterator from a given ClassTreeMask. @param mask The mask */
+            inline ClassTreeMaskObjectIterator(const ClassTreeMask& mask) { (*this) = mask; }
+
+            const ClassTreeMaskObjectIterator& operator=(const ClassTreeMask& mask);
+
+            const ClassTreeMaskObjectIterator& operator++();
+
+            /** @brief Returns true if the ClassTreeMaskObjectIterator points at the given object. @param pointer The pointer of the object */
+            inline bool operator==(BaseObject* pointer) const { return ((*this->objectIterator_) == pointer); }
+            /** @brief Returns true if the ClassTreeMaskObjectIterator doesn't point at the given object. @param pointer The pointer of the object */
+            inline bool operator!=(BaseObject* pointer) const { return ((*this->objectIterator_) != pointer); }
+            /** @brief Returns true if the ClassTreeMaskObjectIterator hasn't already reached the end. */
+            inline operator bool() const { return (this->objectIterator_); }
+            /** @brief Returns the object the ClassTreeMaskObjectIterator currently points at. */
+            inline BaseObject* operator*() const { return (*this->objectIterator_); }
+            /** @brief Returns the object the ClassTreeMaskObjectIterator currently points at. */
+            inline BaseObject* operator->() const { return (*this->objectIterator_); }
+
+        private:
+            void create(ClassTreeMaskNode* node);
+
+            std::list<std::pair<const Identifier*, bool> >           subclasses_;       //!< A list of all Identifiers through which objects the iterator should iterate
+            std::list<std::pair<const Identifier*, bool> >::iterator subclassIterator_; //!< The current class of the iterator
+            Iterator<BaseObject>                                     objectIterator_;   //!< The current object of the iterator
     };
 }
