DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Private Attributes
DGtal::Labels< L, TWord >::ConstEnumerator Class Reference

#include <Labels.h>

Collaboration diagram for DGtal::Labels< L, TWord >::ConstEnumerator:
Collaboration graph
[legend]

Public Types

typedef ConstEnumerator Self
typedef Label Value
typedef const ValuePointer
typedef const ValueReference
typedef std::ptrdiff_t DifferenceType
typedef Value value_type
typedef std::size_t size_type
typedef DifferenceType difference_type
typedef Pointer pointer
typedef Reference reference
typedef std::forward_iterator_tag iterator_category

Public Member Functions

 ~ConstEnumerator ()
 ConstEnumerator ()
 ConstEnumerator (const Word *address, SizeType firstWord)
 ConstEnumerator (const ConstEnumerator &other)
Selfoperator= (const Self &other)
Reference operator* () const
Pointer operator-> () const
Selfoperator++ ()
Self operator++ (int)
bool operator== (const Self &other) const
bool operator!= (const Self &other) const

Private Attributes

const WordmyWordAddress
Label myWordLabel
Label myLabel
Word myWord

Detailed Description

template<unsigned int L, typename TWord = DGtal::uint8_t>
class DGtal::Labels< L, TWord >::ConstEnumerator

This class is used to enumerate the set values in the Labels container. A model of boost::ForwardIterator.

Definition at line 102 of file Labels.h.


Member Typedef Documentation

template<unsigned int L, typename TWord = DGtal::uint8_t>
typedef DifferenceType DGtal::Labels< L, TWord >::ConstEnumerator::difference_type

Definition at line 113 of file Labels.h.

template<unsigned int L, typename TWord = DGtal::uint8_t>
typedef std::ptrdiff_t DGtal::Labels< L, TWord >::ConstEnumerator::DifferenceType

Definition at line 108 of file Labels.h.

template<unsigned int L, typename TWord = DGtal::uint8_t>
typedef std::forward_iterator_tag DGtal::Labels< L, TWord >::ConstEnumerator::iterator_category

Definition at line 116 of file Labels.h.

template<unsigned int L, typename TWord = DGtal::uint8_t>
typedef const Value* DGtal::Labels< L, TWord >::ConstEnumerator::Pointer

Definition at line 106 of file Labels.h.

template<unsigned int L, typename TWord = DGtal::uint8_t>
typedef Pointer DGtal::Labels< L, TWord >::ConstEnumerator::pointer

Definition at line 114 of file Labels.h.

template<unsigned int L, typename TWord = DGtal::uint8_t>
typedef const Value& DGtal::Labels< L, TWord >::ConstEnumerator::Reference

Definition at line 107 of file Labels.h.

template<unsigned int L, typename TWord = DGtal::uint8_t>
typedef Reference DGtal::Labels< L, TWord >::ConstEnumerator::reference

Definition at line 115 of file Labels.h.

template<unsigned int L, typename TWord = DGtal::uint8_t>
typedef ConstEnumerator DGtal::Labels< L, TWord >::ConstEnumerator::Self

Definition at line 104 of file Labels.h.

template<unsigned int L, typename TWord = DGtal::uint8_t>
typedef std::size_t DGtal::Labels< L, TWord >::ConstEnumerator::size_type

Definition at line 112 of file Labels.h.

template<unsigned int L, typename TWord = DGtal::uint8_t>
typedef Label DGtal::Labels< L, TWord >::ConstEnumerator::Value

Definition at line 105 of file Labels.h.

template<unsigned int L, typename TWord = DGtal::uint8_t>
typedef Value DGtal::Labels< L, TWord >::ConstEnumerator::value_type

Definition at line 111 of file Labels.h.


Constructor & Destructor Documentation

template<unsigned int L, typename TWord >
DGtal::Labels< L, TWord >::ConstEnumerator::~ConstEnumerator ( )
inline

Default destructor.

Definition at line 49 of file Labels.ih.

{}
template<unsigned int L, typename TWord >
DGtal::Labels< L, TWord >::ConstEnumerator::ConstEnumerator ( )
inline

Default constructor (Invalid).

Definition at line 55 of file Labels.ih.

: myWordAddress( 0 ), myLabel( 0 )
{}
template<unsigned int L, typename TWord >
DGtal::Labels< L, TWord >::ConstEnumerator::ConstEnumerator ( const Word address,
SizeType  firstWord 
)
inline

Constructor from word address.

Parameters:
addressis some Labels.myLabels
firstWordis 0 (begin) or __DGTAL_LABELS_NBWORDS (end)

Definition at line 62 of file Labels.ih.

References DGtal::Labels< L, TWord >::ConstEnumerator::myLabel, DGtal::Labels< L, TWord >::ConstEnumerator::myWord, DGtal::Labels< L, TWord >::ConstEnumerator::myWordAddress, and DGtal::Labels< L, TWord >::ConstEnumerator::operator++().

: myWordAddress( address + firstWord ),
myWordLabel( firstWord * __DGTAL_WORD_NBDIGITS )
{
ASSERT( firstWord <= __DGTAL_LABELS_NBWORDS );
if ( firstWord != __DGTAL_LABELS_NBWORDS )
{
this->operator++(); // find first bit
}
else
{
myWord = 0;
myLabel = 0;
}
}
template<unsigned int L, typename TWord >
DGtal::Labels< L, TWord >::ConstEnumerator::ConstEnumerator ( const ConstEnumerator other)
inline

Copy constructor.

Parameters:
otherthe object to clone.

Definition at line 82 of file Labels.ih.

: myWordAddress( other.myWordAddress ), myWordLabel( other.myWordLabel ),
myLabel( other.myLabel ), myWord( other.myWord )
{}

Member Function Documentation

template<unsigned int L, typename TWord >
bool DGtal::Labels< L, TWord >::ConstEnumerator::operator!= ( const Self other) const
inline

Inequality operator.

Parameters:
otherany other iterator.
Returns:
'true' iff the iterators points on different elements.

Definition at line 172 of file Labels.ih.

References DGtal::Labels< L, TWord >::ConstEnumerator::myLabel, and DGtal::Labels< L, TWord >::ConstEnumerator::myWordAddress.

{
return ( myWordAddress != other.myWordAddress )
|| ( myLabel != other.myLabel );
}
template<unsigned int L, typename TWord >
DGtal::Labels< L, TWord >::ConstEnumerator::Reference DGtal::Labels< L, TWord >::ConstEnumerator::operator* ( ) const
inline

Dereference operator.

Returns:
the current value of the iterator, if valid.

Definition at line 107 of file Labels.ih.

{
return myLabel;
}
template<unsigned int L, typename TWord >
DGtal::Labels< L, TWord >::ConstEnumerator::Self & DGtal::Labels< L, TWord >::ConstEnumerator::operator++ ( )
inline

Pre-increment operator.

Returns:
a reference to itself.

Definition at line 125 of file Labels.ih.

References DGtal::Bits::firstSetBit(), and DGtal::Bits::leastSignificantBit().

Referenced by DGtal::Labels< L, TWord >::ConstEnumerator::ConstEnumerator().

{
ASSERT( ( myWordLabel < ( __DGTAL_LABELS_NBWORDS
* __DGTAL_WORD_NBDIGITS ) ) );
while ( myWord == 0 )
{
myWordLabel += __DGTAL_WORD_NBDIGITS;
if ( myWordLabel == ( __DGTAL_LABELS_NBWORDS
* __DGTAL_WORD_NBDIGITS ) )
{
myLabel = 0;
return *this;
}
}
ASSERT( myWord != 0 );
myWord -= fsb;
return *this;
}
template<unsigned int L, typename TWord >
DGtal::Labels< L, TWord >::ConstEnumerator::Self DGtal::Labels< L, TWord >::ConstEnumerator::operator++ ( int  )
inline

Post-increment operator.

Returns:
a reference to itself.

Definition at line 151 of file Labels.ih.

{
ConstEnumerator tmp( *this );
this->operator++();
return tmp;
}
template<unsigned int L, typename TWord >
DGtal::Labels< L, TWord >::ConstEnumerator::Pointer DGtal::Labels< L, TWord >::ConstEnumerator::operator-> ( ) const
inline

Pointer dereference operator.

Returns:
a non-mutable pointer on the current value.

Definition at line 116 of file Labels.ih.

{
return &myLabel;
}
template<unsigned int L, typename TWord >
DGtal::Labels< L, TWord >::ConstEnumerator::Self & DGtal::Labels< L, TWord >::ConstEnumerator::operator= ( const Self other)
inline

Assignment.

Parameters:
otherthe object to copy.
Returns:
a reference on 'this'.

Definition at line 91 of file Labels.ih.

References DGtal::Labels< L, TWord >::ConstEnumerator::myLabel, DGtal::Labels< L, TWord >::ConstEnumerator::myWord, DGtal::Labels< L, TWord >::ConstEnumerator::myWordAddress, and DGtal::Labels< L, TWord >::ConstEnumerator::myWordLabel.

{
if ( this != &other )
{
myWordAddress = other.myWordAddress;
myWordLabel = other.myWordLabel;
myLabel = other.myLabel;
myWord = other.myWord;
}
return *this;
}
template<unsigned int L, typename TWord >
bool DGtal::Labels< L, TWord >::ConstEnumerator::operator== ( const Self other) const
inline

Equality operator.

Parameters:
otherany other iterator.
Returns:
'true' iff the iterators points on the same element.

Definition at line 162 of file Labels.ih.

References DGtal::Labels< L, TWord >::ConstEnumerator::myLabel, and DGtal::Labels< L, TWord >::ConstEnumerator::myWordAddress.

{
return ( myWordAddress == other.myWordAddress )
&& ( myLabel == other.myLabel );
}

Field Documentation

template<unsigned int L, typename TWord = DGtal::uint8_t>
Label DGtal::Labels< L, TWord >::ConstEnumerator::myLabel
private
template<unsigned int L, typename TWord = DGtal::uint8_t>
Word DGtal::Labels< L, TWord >::ConstEnumerator::myWord
private
template<unsigned int L, typename TWord = DGtal::uint8_t>
const Word* DGtal::Labels< L, TWord >::ConstEnumerator::myWordAddress
private
template<unsigned int L, typename TWord = DGtal::uint8_t>
Label DGtal::Labels< L, TWord >::ConstEnumerator::myWordLabel
private

Definition at line 120 of file Labels.h.

Referenced by DGtal::Labels< L, TWord >::ConstEnumerator::operator=().


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