DGtal 1.4.0
Loading...
Searching...
No Matches
DGtal::Splitter< TElement, TWord > Struct Template Reference

#include <DGtal/kernel/UnorderedSetByBlock.h>

Inheritance diagram for DGtal::Splitter< TElement, TWord >:
[legend]

Public Types

typedef Splitter< TElement, TWord > Self
 
typedef TElement Element
 
typedef TWord Word
 
typedef Element::Coordinate Coordinate
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CBoundedNumber< Word >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CUnsignedNumber< Word >))
 

Static Public Member Functions

static std::pair< Element, Coordinatesplit (Element e)
 
static Element join (Element e, Coordinate x)
 
static Element join (const std::pair< Element, Coordinate > &p)
 

Detailed Description

template<typename TElement, typename TWord = uint32_t>
struct DGtal::Splitter< TElement, TWord >

Splits an integral-array element into an integral-array element and a 32 or 64 bit integer (depending on TWord). The expected behaviour is for an element e of dimension 3 (and 32 bits word):

Splitter< Point > split; // default is split with 32 bits word
auto v = split( Point( 117, 43, 52 ) );
v.first == 117 & 31
v.second == Point( 117 - v.first, 43, 52 );
static std::pair< Element, Coordinate > split(Element e)
MyPointD Point
Splitter< Point,uint64_t > split; // for 64 bits word
auto v = split( Point( 117, 43, 52 ) );
v.first == 117 & 63
v.second == Point( 117 - v.first, 43, 52 );
Template Parameters
TElementthe type of array-like element.
TWordthe type for holding blocks (uint64_t or uint32_t generally), a model of concepts::CIntegralNumber and concepts::CUnsignedNumber.
See also
UnorderedSetByBlock

Definition at line 67 of file UnorderedSetByBlock.h.

Member Typedef Documentation

◆ Coordinate

template<typename TElement , typename TWord = uint32_t>
typedef Element::Coordinate DGtal::Splitter< TElement, TWord >::Coordinate

Definition at line 71 of file UnorderedSetByBlock.h.

◆ Element

template<typename TElement , typename TWord = uint32_t>
typedef TElement DGtal::Splitter< TElement, TWord >::Element

Definition at line 69 of file UnorderedSetByBlock.h.

◆ Self

template<typename TElement , typename TWord = uint32_t>
typedef Splitter< TElement,TWord > DGtal::Splitter< TElement, TWord >::Self

Definition at line 68 of file UnorderedSetByBlock.h.

◆ Word

template<typename TElement , typename TWord = uint32_t>
typedef TWord DGtal::Splitter< TElement, TWord >::Word

Definition at line 70 of file UnorderedSetByBlock.h.

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT() [1/2]

template<typename TElement , typename TWord = uint32_t>
DGtal::Splitter< TElement, TWord >::BOOST_CONCEPT_ASSERT ( (concepts::CBoundedNumber< Word >) )

◆ BOOST_CONCEPT_ASSERT() [2/2]

template<typename TElement , typename TWord = uint32_t>
DGtal::Splitter< TElement, TWord >::BOOST_CONCEPT_ASSERT ( (concepts::CUnsignedNumber< Word >) )

◆ join() [1/2]

template<typename TElement , typename TWord = uint32_t>
static Element DGtal::Splitter< TElement, TWord >::join ( const std::pair< Element, Coordinate > & p)
inlinestatic

Rejoins a splitted element (see split).

Parameters
pa pair grouping the block coordinate and the bit coordinate of the element.
Returns
the corresponding rejoined element.

Definition at line 115 of file UnorderedSetByBlock.h.

116 {
117 Element ge = p.first;
118 ge[ 0 ] |= p.second;
119 return ge;
120 }

◆ join() [2/2]

template<typename TElement , typename TWord = uint32_t>
static Element DGtal::Splitter< TElement, TWord >::join ( Element e,
Coordinate x )
inlinestatic

Rejoins a splitted element (see split).

Parameters
ethe block coordinate of the element.
xthe bit coordinate of the element.
Returns
the corresponding rejoined element.

Definition at line 101 of file UnorderedSetByBlock.h.

102 {
103 e[ 0 ] |= x;
104 return e;
105 }

◆ split()

template<typename TElement , typename TWord = uint32_t>
static std::pair< Element, Coordinate > DGtal::Splitter< TElement, TWord >::split ( Element e)
inlinestatic

Splits an element e into a pair grouping its block coordinates and its bit within this block.

Parameters
eany lattice point
Returns
a pair grouping its block coordinates and its bit within this block.

Definition at line 85 of file UnorderedSetByBlock.h.

86 {
87 auto block_coords =
88 ( e[ 0 ] & static_cast<Coordinate>( sizeof( Word ) * CHAR_BIT - 1 ) );
89 e[ 0 ] -= block_coords;
90 return { e, block_coords };
91 }
Element::Coordinate Coordinate

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