|
DGtal
0.6.devel
|
#include <Labels.h>


Data Structures | |
| class | ConstEnumerator |
Public Types | |
| typedef TWord | Word |
| typedef Labels< L, Word > | Self |
| typedef unsigned int | Label |
| typedef Label | SizeType |
| typedef ConstEnumerator | ConstIterator |
| typedef ConstIterator | const_iterator |
Public Member Functions | |
| ~Labels () | |
| Labels () | |
| Labels (const Self &other) | |
| Self & | operator= (const Self &other) |
| bool | test (Label l) const |
| Self & | set (Label l, bool val=true) |
| Self & | reset (Label l) |
| Self & | flip (Label l) |
| Self & | reset () |
| SizeType | count () const |
| void | getLabels (std::vector< Label > &labels) const |
| SizeType | index (Label l) const |
| ConstIterator | begin () const |
| ConstIterator | end () const |
| void | selfDisplay (std::ostream &out) const |
| bool | isValid () const |
Static Public Member Functions | |
| static SizeType | size () |
Static Protected Member Functions | |
| static SizeType | _word (Label l) |
| static SizeType | _digit (Label l) |
| static Word | _mask (Label l) |
Protected Attributes | |
| Word | myLabels [__DGTAL_LABELS_NBWORDS] |
Private Member Functions | |
| BOOST_STATIC_ASSERT ((L >=1)) | |
Aim: Stores a set of labels in {O..L-1} as a sequence of bits.
Description of template class 'Labels'
This class is useful to stores a set of numbers as a characteristic set. It is very similar to a bitset, except it provides more functions, like giving the index of a label (i.e., if (1, 5, 6, 13, 20) are the labels, then 1 has index 0, 5 has index 1, 6 has index 2, 13 has index 3, 20 has index 4.)
| L | is the maximum number of labels. |
| TWord | the integer used to store the labels (if L >= log_2( digits( TWord ) ) then several consecutive words are stored.) |
| typedef ConstIterator DGtal::Labels< L, TWord >::const_iterator |
| typedef ConstEnumerator DGtal::Labels< L, TWord >::ConstIterator |
| typedef unsigned int DGtal::Labels< L, TWord >::Label |
| typedef Labels<L, Word> DGtal::Labels< L, TWord >::Self |
| typedef Label DGtal::Labels< L, TWord >::SizeType |
| typedef TWord DGtal::Labels< L, TWord >::Word |
|
inline |
|
inline |
Constructor.
Definition at line 213 of file Labels.ih.
References DGtal::Labels< L, TWord >::reset().
|
inline |
Copy constructor.
| other | the object to clone. |
Definition at line 220 of file Labels.ih.
References DGtal::Labels< L, TWord >::myLabels.
|
inlinestaticprotected |
Returns the bit at which is the label l.
Definition at line 192 of file Labels.ih.
Referenced by DGtal::Labels< L, TWord >::_mask(), and DGtal::Labels< L, TWord >::index().
|
inlinestaticprotected |
Returns the mask for the label l (1 << _digit( l )).
Definition at line 200 of file Labels.ih.
References DGtal::Labels< L, TWord >::_digit().
Referenced by DGtal::Labels< L, TWord >::flip(), DGtal::Labels< L, TWord >::index(), DGtal::Labels< L, TWord >::reset(), DGtal::Labels< L, TWord >::set(), and DGtal::Labels< L, TWord >::test().
|
inlinestaticprotected |
Returns the word in which is the label l.
Definition at line 184 of file Labels.ih.
Referenced by DGtal::Labels< L, TWord >::flip(), DGtal::Labels< L, TWord >::index(), DGtal::Labels< L, TWord >::reset(), DGtal::Labels< L, TWord >::set(), and DGtal::Labels< L, TWord >::test().
|
inline |
Definition at line 357 of file Labels.ih.
References DGtal::Labels< L, TWord >::myLabels.
|
private |
|
inline |
Definition at line 291 of file Labels.ih.
References DGtal::Labels< L, TWord >::myLabels, and DGtal::Bits::nbSetBits().
|
inline |
Definition at line 366 of file Labels.ih.
References DGtal::Labels< L, TWord >::myLabels.
|
inline |
Flips l in or out of the set.
| l | any label in 0..L-1 |
Definition at line 281 of file Labels.ih.
References DGtal::Labels< L, TWord >::_mask(), DGtal::Labels< L, TWord >::_word(), and DGtal::Labels< L, TWord >::myLabels.
|
inline |
As output, labels[0] contains the label of index 0, labels[1] the label of index 1, and so on.
| labels | (modified) the (ordered) labels set. |
Definition at line 314 of file Labels.ih.
References DGtal::Bits::firstSetBit(), DGtal::Labels< L, TWord >::index(), DGtal::Bits::leastSignificantBit(), and DGtal::Labels< L, TWord >::myLabels.
Referenced by DGtal::Labels< L, TWord >::selfDisplay().
|
inline |
| l | any label in 0..L-1 |
Definition at line 340 of file Labels.ih.
References DGtal::Labels< L, TWord >::_digit(), DGtal::Labels< L, TWord >::_mask(), DGtal::Labels< L, TWord >::_word(), DGtal::Bits::indexInSetBits(), DGtal::Labels< L, TWord >::myLabels, and DGtal::Bits::nbSetBits().
Referenced by DGtal::Labels< L, TWord >::getLabels().
|
inline |
|
inline |
Assignment.
| other | the object to copy. |
Definition at line 229 of file Labels.ih.
References DGtal::Labels< L, TWord >::myLabels.
|
inline |
Removes l from the set.
| l | any label in 0..L-1 |
Definition at line 272 of file Labels.ih.
References DGtal::Labels< L, TWord >::_mask(), DGtal::Labels< L, TWord >::_word(), and DGtal::Labels< L, TWord >::myLabels.
|
inline |
Clears the set.
Definition at line 240 of file Labels.ih.
References DGtal::Labels< L, TWord >::myLabels.
Referenced by DGtal::Labels< L, TWord >::Labels().
|
inline |
Writes/Displays the object on an output stream.
| out | the output stream where the object is written. |
Definition at line 382 of file Labels.ih.
References DGtal::Labels< L, TWord >::getLabels().
|
inline |
If val is true, inserts l in the set, otherwise removes it.
| l | any label in 0..L-1 |
| val | either true or false. |
Definition at line 260 of file Labels.ih.
References DGtal::Labels< L, TWord >::_mask(), DGtal::Labels< L, TWord >::_word(), and DGtal::Labels< L, TWord >::myLabels.
|
inlinestatic |
|
inline |
| l | any label in 0..L-1 |
Definition at line 252 of file Labels.ih.
References DGtal::Labels< L, TWord >::_mask(), DGtal::Labels< L, TWord >::_word(), and DGtal::Labels< L, TWord >::myLabels.
|
protected |
Stores the labels as bits. The bit of index l is set if l is in the set.
Definition at line 88 of file Labels.h.
Referenced by DGtal::Labels< L, TWord >::begin(), DGtal::Labels< L, TWord >::count(), DGtal::Labels< L, TWord >::end(), DGtal::Labels< L, TWord >::flip(), DGtal::Labels< L, TWord >::getLabels(), DGtal::Labels< L, TWord >::index(), DGtal::Labels< L, TWord >::Labels(), DGtal::Labels< L, TWord >::operator=(), DGtal::Labels< L, TWord >::reset(), DGtal::Labels< L, TWord >::set(), and DGtal::Labels< L, TWord >::test().
1.8.1.1