Orxonox  0.0.5 Codename: Arcturus
Classes | Namespaces
ClassTreeMask.h File Reference

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

#include "CorePrereqs.h"
#include <list>
#include <stack>
#include "BaseObject.h"
#include "object/Iterator.h"
#include "class/Identifier.h"

Go to the source code of this file.

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 which contains 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 the classes that were included by a ClassTreeMask. More...
 

Namespaces

 orxonox
 Die Wagnis Klasse hat die folgenden Aufgaben:
 

Detailed Description

Declaration of the ClassTreeMask, ClassTreeMaskNode, and ClassTreeMaskIterator classes.

ClassTreeMask is a class to define a mask of the class-tree beginning with orxonox::BaseObject. You can include or exclude classes by calling the corresponding functions with the orxonox::Identifier of the class. This mask can then be used to filter out objects that are instances of classes which aren't included in the tree, for example when Loading a level file or if a Trigger should be triggered by only a few classes.

See the description of orxonox::ClassTreeMask for a short example.

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.

Tree structure

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 still want to save them.

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

Objects

To iterate through all objects of the classes that were included by a ClassTreeMask, use orxonox::ClassTreeMaskObjectIterator. The description of this class also contains a short example of how to use it.