version 3.3

VRS::FilterTag Class Reference

Tags are bitfields used for assinging group affiliations to shapes. More...

#include <vrs/filtertag.h>

Inheritance diagram for VRS::FilterTag:

VRS::MonoAttribute VRS::Attribute VRS::RenderObj VRS::SharedObj VRS::Visitable

List of all members.

Public Types

enum  CombiOp {
  BIT_AND, BIT_OR, BIT_XOR, BIT_NOT_AND,
  BIT_NOT_OR, BIT_NOT_XOR, BIT_REPLACE
}

Public Member Functions

 VRS_SERIALIZABLE_CLASS_ENUM (CombiOp)
 FilterTag (unsigned int bitfield=0x0, CombiOp combination=FilterTag::BIT_OR)
virtual ~FilterTag ()
int size () const
void setCombination (FilterTag::CombiOp mode)
FilterTag::CombiOp getCombination () const
unsigned int getBitField () const
void set (int index, bool onOff)
bool get (int index) const
void flip (int index)
void setAll ()
void resetAll ()
void flipAll ()
void logicalAnd (const FilterTag *tag)
void logicalOr (const FilterTag *tag)
void logicalXor (const FilterTag *tag)
void logicalNotAnd (const FilterTag *tag)
void logicalNotOr (const FilterTag *tag)
void logicalNotXor (const FilterTag *tag)
bool isEmpty () const
bool isEqual (const FilterTag *tag) const
bool isDisjoint (const FilterTag *tag) const
bool hasCommons (const FilterTag *tag) const
bool contains (const FilterTag *tag) const
bool isUnique () const
 VRS_TYPEINFO (FilterTag, MonoAttribute)
 VRS_SERIALIZABLE (FilterTag)

Static Public Member Functions

static FilterTagnewUniqueTag (FilterTag::CombiOp combination=FilterTag::BIT_OR)
static bool canAllocUniqueTag ()
static const IDcurrentBitsId ()
 For internal use only.

Friends

class FilterTagPainter
class Filter


Detailed Description

Tags are bitfields used for assinging group affiliations to shapes.

Member Enumeration Documentation

Enumerator:
BIT_AND 
BIT_OR 
BIT_XOR 
BIT_NOT_AND 
BIT_NOT_OR 
BIT_NOT_XOR 
BIT_REPLACE 


Constructor & Destructor Documentation

VRS::FilterTag::FilterTag ( unsigned int  bitfield = 0x0,
CombiOp  combination = FilterTag::BIT_OR 
)

virtual VRS::FilterTag::~FilterTag (  )  [virtual]

FilterTag represents a bitfield which can be used to filter shapes during shape processing such as rendering and ray requests. Filter tags are scarce resources since (in the current implementation, the bitfield has a fixed size.) You can allocate filter tags by the static methods which also manage a global filter-tag space, that is, they take care of remembering all bits already in use by other tags. Make no assumptions about the internal representation. To construct a new filter tag which has one bit set which is not used by other filter tag constructed this way, call `newUniqueTag'. Filter tags are mono attributes. The combination mode defines how a new filter tag is combined with the current filter tag.


Member Function Documentation

VRS::FilterTag::VRS_SERIALIZABLE_CLASS_ENUM ( CombiOp   ) 

int VRS::FilterTag::size (  )  const

Returns the number of single bits available. The size is fixed in the current implementation, and equal to sizeof(unsigned int)*8.

void VRS::FilterTag::setCombination ( FilterTag::CombiOp  mode  ) 

FilterTag::CombiOp VRS::FilterTag::getCombination (  )  const

Sets and returns the combination operation used when the filter tag is pushed to an engine.

unsigned int VRS::FilterTag::getBitField (  )  const [inline]

void VRS::FilterTag::set ( int  index,
bool  onOff 
)

bool VRS::FilterTag::get ( int  index  )  const

void VRS::FilterTag::flip ( int  index  ) 

All bits of the bitfield are numbered, starting with 0. The state of each bit can be inquired by 'get' and modified by 'set'. The state can also be flipped, i.e. inverted.

void VRS::FilterTag::setAll (  )  [inline]

void VRS::FilterTag::resetAll (  )  [inline]

void VRS::FilterTag::flipAll (  )  [inline]

`setAll' sets all bits of the bitfield to on `resetAll' sets all bits of the bitfield to off

void VRS::FilterTag::logicalAnd ( const FilterTag tag  )  [inline]

void VRS::FilterTag::logicalOr ( const FilterTag tag  )  [inline]

void VRS::FilterTag::logicalXor ( const FilterTag tag  )  [inline]

Assigns to the filter tag object the result of the logical operation of the bitfields of both filter tags.

void VRS::FilterTag::logicalNotAnd ( const FilterTag tag  )  [inline]

void VRS::FilterTag::logicalNotOr ( const FilterTag tag  )  [inline]

void VRS::FilterTag::logicalNotXor ( const FilterTag tag  )  [inline]

Assigns to the filter tag object the result of the logical operation of the bitfields of filter tag and the complementary bitfields of the parameter tag.

bool VRS::FilterTag::isEmpty ( void   )  const [inline]

bool VRS::FilterTag::isEqual ( const FilterTag tag  )  const [inline]

bool VRS::FilterTag::isDisjoint ( const FilterTag tag  )  const [inline]

bool VRS::FilterTag::hasCommons ( const FilterTag tag  )  const [inline]

bool VRS::FilterTag::contains ( const FilterTag tag  )  const [inline]

`isEmpty' tells if there are any bits set in the filter tag. `isEqual' tells if both bitfields are identical. `isDisjoint' checks if two filter tags have disjoint bitfields. `hasCommons' checks if two filter tags have common bits in their bitfields. `contains' tells if the parameter bits of the filter tag represent a subset of own bits.

static FilterTag* VRS::FilterTag::newUniqueTag ( FilterTag::CombiOp  combination = FilterTag::BIT_OR  )  [static]

static bool VRS::FilterTag::canAllocUniqueTag (  )  [static]

bool VRS::FilterTag::isUnique (  )  const [inline]

The FilterTag class maintains a filter-tag space. Each bit in that space can be alloced only once, the class takes care of that. `newUniqueTag' constructs a filter tag with exactly one bit set, no other filter tag objects which have been created by this method have set that bit. `canAllocateUniqueTag' checks if there is currently at least one bit free for a new unique filter tag object. Filter tags which are destructed remember whether they are unique or not. During destruction, such a filter tag will free its "unique" bit in the filter-tag space. `isUnique' tells whether the filter tag object has been constructed using the newUniqueTag method. A unique filter tag can be modified later one. If it is destructed, the original unique bit, which is stored and remembered internally, is freed in the filter-tag space.

static const ID& VRS::FilterTag::currentBitsId (  )  [static]

For internal use only.

VRS::FilterTag::VRS_TYPEINFO ( FilterTag  ,
MonoAttribute   
)

VRS::FilterTag::VRS_SERIALIZABLE ( FilterTag   ) 


Friends And Related Function Documentation

friend class FilterTagPainter [friend]

friend class Filter [friend]


The documentation for this class was generated from the following file:

Generated on Mon May 21 06:00:17 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact