ClassTreeMask.h File Reference

Definition of the ClassTreeMask, ClassTreeMaskNode and ClassTreeMaskIterator classes. More...

#include "CorePrereqs.h"
#include <list>
#include <stack>
#include "BaseObject.h"
#include "Iterator.h"

Namespaces

namespace  orxonox

Classes

class  orxonox::ClassTreeMask
 The ClassTreeMask is a set of rules, containing the information for each class whether it's included or not. More...
class  orxonox::ClassTreeMaskIterator
 The ClassTreeMaskIterator moves through all ClassTreeMaskNodes of the internal tree of a ClassTreeMask, containing the rules. More...
class  orxonox::ClassTreeMaskNode
 The ClassTreeMaskNode is a node in the internal tree of the ClassTreeMask, containing the rules of the mask. More...
class  orxonox::ClassTreeMaskObjectIterator
 The ClassTreeMaskObjectIterator iterates through all objects of all classes, included by a ClassTreeMask. More...


Detailed Description

Definition of the ClassTreeMask, ClassTreeMaskNode and ClassTreeMaskIterator classes.

ClassTreeMask is a class to define a mask of the class-tree beginning with BaseObject. You can include or exclude classes by calling the corresponding functions with the Identifier of the class.

You can work with a ClassTreeMask in the sense of the set-theory, meaning that you can create unions, intersections, complements and differences by using overloaded operators.

The ClassTreeMask is internally represented by a tree. The nodes in the tree are ClassTreeMaskNodes, containing the rule (included or excluded) for this class and all subclasses and a list of all subnodes. To minimize the size, the tree contains only nodes changing the mask. By adding new rules, the tree gets reordered dynamically.

Adding a new rule overwrites all rules assigned to inherited classes. Use overwrite = false if you don't like this feature. Useless rules that don't change the information of the mask aren't saved in the internal tree. Use clean = false if you wan't to save them.

With overwrite = false and clean = false it doesn't matter in which way you create the mask. You can manually drop useless rules from the tree by calling clean().

Because of the complicated shape of the internal tree, there is an iterator to iterate through all ClassTreeMaskNodes of a mask. It starts with the BaseObject and moves on to the first subclass until it reaches a leaf of the tree. Then the iterator moves one step back and iterates to the second subclass. If there are no more subclasses, it steps another step back, and so on.

Example: A and B are children of BaseObject, A1 and A2 are children of A, B1 and B2 are children of B. The ClassTreeMaskIterator would move trough the tree in the following order: BaseObject, A, A1, A2, B, B1, B2.

Note that the iterator doesn't move trough the whole class-tree, but only through the internal tree of the mask, containing the minimal needed set of nodes to describe the mask.


Generated on Tue Jul 28 16:21:08 2009 for Orxonox by  doxygen 1.5.6