Orxonox
0.0.5 Codename: Arcturus
|
The ClassTreeMask is a set of rules, containing the information for each class whether it's included or not. More...
#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/core/ClassTreeMask.h>
Public Member Functions | |
ClassTreeMask () | |
Constructor: Adds the root-node of the tree with the first rule ("include everything"). More... | |
ClassTreeMask (const ClassTreeMask &other) | |
Copy-constructor: Adds the root-node of the tree with the first rule ("include everything") and adds all rules from the other mask. More... | |
~ClassTreeMask () | |
Destructor: Deletes the root node (which will delete all subnodes too). More... | |
void | add (const Identifier *subclass, bool bInclude, bool overwrite=true, bool clean=true) |
Adds a new rule for a given subclass to the mask. More... | |
void | addSingle (const Identifier *subclass, bool bInclude, bool clean=true) |
Adds a new rule for a single subclass. More... | |
const ClassTreeMask & | begin () const |
Begin of the ClassTreeMaskObjectIterator. More... | |
void | clean () |
Removes all unneeded rules that don't change the information of the mask. More... | |
BaseObject * | end () const |
End of the ClassTreeMaskObjectIterator. More... | |
void | exclude (const Identifier *subclass, bool overwrite=true, bool clean=true) |
Adds a new "exclude" rule for a given subclass to the mask. More... | |
void | excludeSingle (const Identifier *subclass, bool clean=true) |
Adds a new "exclude" rule for a single subclass. More... | |
void | include (const Identifier *subclass, bool overwrite=true, bool clean=true) |
Adds a new "include" rule for a given subclass to the mask. More... | |
void | includeSingle (const Identifier *subclass, bool clean=true) |
Adds a new "include" rule for a single subclass. More... | |
bool | isExcluded (const Identifier *subclass) const |
Tells if a given subclass is excluded or not. More... | |
bool | isIncluded (const Identifier *subclass) const |
Tells if a given subclass is included or not. More... | |
ClassTreeMask | operator! () const |
Inverts the mask (all included classes are now excluded and vice versa). More... | |
bool | operator!= (const ClassTreeMask &other) const |
Compares the mask with another mask and returns true if they represent different logics. More... | |
ClassTreeMask | operator& (const ClassTreeMask &other) const |
Intersects two masks (only classes that are included in both masks will be included in the resulting mask too). More... | |
const ClassTreeMask & | operator&= (const ClassTreeMask &other) |
Intersects this mask with another mask (and-operation) More... | |
ClassTreeMask | operator* (const ClassTreeMask &other) const |
Intersects two masks (only classes that are included in both masks will be included in the resulting mask too). More... | |
const ClassTreeMask & | operator*= (const ClassTreeMask &other) |
Intersects this mask with another mask. More... | |
const ClassTreeMask & | operator+ () const |
Prefix operator + does nothing. More... | |
ClassTreeMask | operator+ (const ClassTreeMask &other) const |
Adds two masks in the sense of a union (all classes that are included in at least one of the masks will be included in the resulting mask too). More... | |
const ClassTreeMask & | operator+= (const ClassTreeMask &other) |
Unites this mask with another mask. More... | |
ClassTreeMask | operator- () const |
Prefix operator - inverts the mask. More... | |
ClassTreeMask | operator- (const ClassTreeMask &other) const |
Removes all elements of the second mask from the first mask (all classes that are included in the first mask stay included, except those that are included in the second mask too). More... | |
const ClassTreeMask & | operator-= (const ClassTreeMask &other) |
Subtracts another mask from this mask. More... | |
ClassTreeMask & | operator= (const ClassTreeMask &other) |
Assignment operator: Adds all rules of the other mask. More... | |
bool | operator== (const ClassTreeMask &other) const |
Compares the mask with another mask and returns true if they represent the same logic. More... | |
ClassTreeMask | operator^ (const ClassTreeMask &other) const |
Joins two masks in the sense of a xor (exclusivity) operation (all classes that are included in exactly one of the masks, but not in both, will be included in the resulting mask too). More... | |
const ClassTreeMask & | operator^= (const ClassTreeMask &other) |
Joins this mask with another mask with a xor-operation. More... | |
ClassTreeMask | operator| (const ClassTreeMask &other) const |
Adds two masks in the sense of a union (all classes that are included in at least one of the masks will be included in the resulting mask too). More... | |
const ClassTreeMask & | operator|= (const ClassTreeMask &other) |
Unites this mask with another mask (or-operation). More... | |
ClassTreeMask | operator~ () const |
Inverts the mask (all included classes are now excluded and vice versa). More... | |
void | reset () |
Resets the mask to "include everything". More... | |
Private Member Functions | |
void | add (ClassTreeMaskNode *node, const Identifier *subclass, bool bInclude, bool overwrite=true) |
Adds a new rule for a given subclass to a node of the internal rule-tree (recursive function). More... | |
void | clean (ClassTreeMaskNode *node) |
Removes all unneded rules that don't change the information of a node of a mask (recursive function). More... | |
bool | isIncluded (ClassTreeMaskNode *node, const Identifier *subclass) const |
Tells if a given subclass of a node in the rule-tree is included or not (recursive function). More... | |
bool | nodeExists (const Identifier *subclass) |
Checks if a node for the given subclass exists. More... | |
Private Attributes | |
ClassTreeMaskNode * | root_ |
The root-node of the internal rule-tree, usually BaseObject. More... | |
Friends | |
class | ClassTreeMaskObjectIterator |
std::ostream & | operator<< (std::ostream &out, const ClassTreeMask &mask) |
Converts the content of a mask into a human readable string and puts it on the ostream. More... | |
The ClassTreeMask is a set of rules, containing the information for each class whether it's included or not.
With a ClassTreeMask, you can include or exclude subtrees of the class-tree, starting with a given subclass, described by the corresponding Identifier. To minimize the size of the mask, the mask saves only relevant rules. But you can manually add rules that don't change the information of the mask by using clean = false
. If you want to drop useless rules, call the clean() function.
Example:
In this example, the classes A and B are excluded from the mask, but one of the child classes of A is included again.
orxonox::ClassTreeMask::ClassTreeMask | ( | ) |
Constructor: Adds the root-node of the tree with the first rule ("include everything").
orxonox::ClassTreeMask::ClassTreeMask | ( | const ClassTreeMask & | other | ) |
Copy-constructor: Adds the root-node of the tree with the first rule ("include everything") and adds all rules from the other mask.
orxonox::ClassTreeMask::~ClassTreeMask | ( | ) |
Destructor: Deletes the root node (which will delete all subnodes too).
void orxonox::ClassTreeMask::add | ( | const Identifier * | subclass, |
bool | bInclude, | ||
bool | overwrite = true , |
||
bool | clean = true |
||
) |
Adds a new rule for a given subclass to the mask.
subclass | The subclass |
bInclude | The rule: include (true) or exclude (false) |
overwrite | True = overwrite previously added rules for inheriting classes |
clean | True = clean the tree after adding the new rule |
|
private |
Adds a new rule for a given subclass to a node of the internal rule-tree (recursive function).
node | The node |
subclass | The subclass |
bInclude | The rule: include (true) or exclude (false) |
overwrite | True = overwrite previously added rules for inheriting classes |
void orxonox::ClassTreeMask::addSingle | ( | const Identifier * | subclass, |
bool | bInclude, | ||
bool | clean = true |
||
) |
Adds a new rule for a single subclass.
The new rule doesn't change the mask for inheriting classes.
bInclude | The rule: include (true) or exclude (false) |
subclass | The subclass |
clean | True = clean the tree after adding the new rule |
|
inline |
Begin of the ClassTreeMaskObjectIterator.
void orxonox::ClassTreeMask::clean | ( | ) |
Removes all unneeded rules that don't change the information of the mask.
|
private |
Removes all unneded rules that don't change the information of a node of a mask (recursive function).
node | The node |
|
inline |
End of the ClassTreeMaskObjectIterator.
void orxonox::ClassTreeMask::exclude | ( | const Identifier * | subclass, |
bool | overwrite = true , |
||
bool | clean = true |
||
) |
Adds a new "exclude" rule for a given subclass to the mask.
subclass | The subclass |
overwrite | True = overwrite previously added rules for inheriting classes |
clean | True = clean the tree after adding the new rule |
void orxonox::ClassTreeMask::excludeSingle | ( | const Identifier * | subclass, |
bool | clean = true |
||
) |
Adds a new "exclude" rule for a single subclass.
The new rule doesn't change the mask for inheriting classes.
subclass | The subclass |
clean | True = clean the tree after adding the new rule |
void orxonox::ClassTreeMask::include | ( | const Identifier * | subclass, |
bool | overwrite = true , |
||
bool | clean = true |
||
) |
Adds a new "include" rule for a given subclass to the mask.
subclass | The subclass |
overwrite | True = overwrite previously added rules for inheriting classes |
clean | True = clean the tree after adding the new rule |
void orxonox::ClassTreeMask::includeSingle | ( | const Identifier * | subclass, |
bool | clean = true |
||
) |
Adds a new "include" rule for a single subclass.
The new rule doesn't change the mask for inheriting classes.
subclass | The subclass |
clean | True = clean the tree after adding the new rule |
bool orxonox::ClassTreeMask::isExcluded | ( | const Identifier * | subclass | ) | const |
Tells if a given subclass is excluded or not.
subclass | The subclass |
bool orxonox::ClassTreeMask::isIncluded | ( | const Identifier * | subclass | ) | const |
Tells if a given subclass is included or not.
subclass | The subclass |
|
private |
Tells if a given subclass of a node in the rule-tree is included or not (recursive function).
node | The node |
subclass | The subclass |
|
private |
Checks if a node for the given subclass exists.
subclass | The Identifier of the subclass |
ClassTreeMask orxonox::ClassTreeMask::operator! | ( | ) | const |
Inverts the mask (all included classes are now excluded and vice versa).
bool orxonox::ClassTreeMask::operator!= | ( | const ClassTreeMask & | other | ) | const |
Compares the mask with another mask and returns true if they represent different logics.
other | The other mask |
ClassTreeMask orxonox::ClassTreeMask::operator& | ( | const ClassTreeMask & | other | ) | const |
Intersects two masks (only classes that are included in both masks will be included in the resulting mask too).
other | The mask to intersect with |
const ClassTreeMask & orxonox::ClassTreeMask::operator&= | ( | const ClassTreeMask & | other | ) |
Intersects this mask with another mask (and-operation)
other | The other mask |
ClassTreeMask orxonox::ClassTreeMask::operator* | ( | const ClassTreeMask & | other | ) | const |
Intersects two masks (only classes that are included in both masks will be included in the resulting mask too).
other | The mask to intersect with |
const ClassTreeMask & orxonox::ClassTreeMask::operator*= | ( | const ClassTreeMask & | other | ) |
Intersects this mask with another mask.
other | The other mask |
const ClassTreeMask & orxonox::ClassTreeMask::operator+ | ( | ) | const |
Prefix operator + does nothing.
ClassTreeMask orxonox::ClassTreeMask::operator+ | ( | const ClassTreeMask & | other | ) | const |
Adds two masks in the sense of a union (all classes that are included in at least one of the masks will be included in the resulting mask too).
other | The mask to unite with |
const ClassTreeMask & orxonox::ClassTreeMask::operator+= | ( | const ClassTreeMask & | other | ) |
Unites this mask with another mask.
other | The other mask |
ClassTreeMask orxonox::ClassTreeMask::operator- | ( | ) | const |
Prefix operator - inverts the mask.
ClassTreeMask orxonox::ClassTreeMask::operator- | ( | const ClassTreeMask & | other | ) | const |
Removes all elements of the second mask from the first mask (all classes that are included in the first mask stay included, except those that are included in the second mask too).
other | The mask to subtract. |
const ClassTreeMask & orxonox::ClassTreeMask::operator-= | ( | const ClassTreeMask & | other | ) |
Subtracts another mask from this mask.
other | The other mask |
ClassTreeMask & orxonox::ClassTreeMask::operator= | ( | const ClassTreeMask & | other | ) |
Assignment operator: Adds all rules of the other mask.
other | The other mask |
bool orxonox::ClassTreeMask::operator== | ( | const ClassTreeMask & | other | ) | const |
Compares the mask with another mask and returns true if they represent the same logic.
other | The other mask |
ClassTreeMask orxonox::ClassTreeMask::operator^ | ( | const ClassTreeMask & | other | ) | const |
Joins two masks in the sense of a xor (exclusivity) operation (all classes that are included in exactly one of the masks, but not in both, will be included in the resulting mask too).
other | The mask to join with |
const ClassTreeMask & orxonox::ClassTreeMask::operator^= | ( | const ClassTreeMask & | other | ) |
Joins this mask with another mask with a xor-operation.
other | The other mask |
ClassTreeMask orxonox::ClassTreeMask::operator| | ( | const ClassTreeMask & | other | ) | const |
Adds two masks in the sense of a union (all classes that are included in at least one of the masks will be included in the resulting mask too).
other | The mask to unite with |
const ClassTreeMask & orxonox::ClassTreeMask::operator|= | ( | const ClassTreeMask & | other | ) |
Unites this mask with another mask (or-operation).
other | The other mask |
ClassTreeMask orxonox::ClassTreeMask::operator~ | ( | ) | const |
Inverts the mask (all included classes are now excluded and vice versa).
void orxonox::ClassTreeMask::reset | ( | ) |
Resets the mask to "include everything".
|
friend |
|
friend |
Converts the content of a mask into a human readable string and puts it on the ostream.
out | The ostream |
mask | The mask |
|
private |
The root-node of the internal rule-tree, usually BaseObject.