File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/config/TeX-MML-AM_CHTML/MathJax.js
DGtal 2.0.0
DGtal::IntegerConverter< dim, DGtal::int32_t > Struct Template Reference

#include <DGtal/kernel/IntegerConverter.h>

Inheritance diagram for DGtal::IntegerConverter< dim, DGtal::int32_t >:
[legend]

Public Types

typedef DGtal::int32_t Integer

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CInteger< DGtal::int32_t >))

Static Public Member Functions

static DGtal::int32_t cast (DGtal::int32_t i)
static PointVector< dim, DGtal::int32_tcast (PointVector< dim, DGtal::int32_t > p)
static DGtal::int32_t cast (DGtal::int64_t i)
static PointVector< dim, DGtal::int32_tcast (PointVector< dim, DGtal::int64_t > p)
static DGtal::int32_t cast (DGtal::BigInteger i)
static PointVector< dim, DGtal::int32_tcast (PointVector< dim, DGtal::BigInteger > p)

Detailed Description

template<DGtal::Dimension dim>
struct DGtal::IntegerConverter< dim, DGtal::int32_t >

Allows seamless conversion of integral types and lattice points, while checking for errors when going from a more precise to a less precise type.

Specialized version for int32_t.

Template Parameters
dimstatic constant of type DGtal::Dimension that specifies the static dimension of the space and thus the number of elements of the Point or Vector.

Definition at line 102 of file IntegerConverter.h.

Member Typedef Documentation

◆ Integer

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

◆ cast() [1/6]

Parameters
iany integer
Returns
the same integer

Definition at line 150 of file IntegerConverter.h.

151 {
153 if ( DGtal::BigInteger( r ) != i )
154 trace.warning() << "Bad integer conversion: " << i << " -> " << r
155 << std::endl;
156 return (DGtal::int32_t)r;
157 }
----------— INTEGER/POINT CONVERSION SERVICES -----------------—
static DGtal::int64_t castToInt64_t(const T &aT)

References DGtal::NumberTraitsImpl< std::decay< T >::type >::castToInt64_t(), and DGtal::trace.

◆ cast() [2/6]

Parameters
iany integer
Returns
the same integer

Definition at line 107 of file IntegerConverter.h.

108 {
109 return i;
110 }

◆ cast() [3/6]

Parameters
iany integer
Returns
the same integer

Definition at line 125 of file IntegerConverter.h.

126 {
128 if ( DGtal::int64_t( r ) != i )
129 trace.warning() << "Bad integer conversion: " << i << " -> " << r
130 << std::endl;
131 return r;
132 }
std::int32_t int32_t
signed 32-bit integer.
Definition BasicTypes.h:71

References DGtal::trace.

◆ cast() [4/6]

Conversion of a lattice point.

Parameters
pany point
Returns
the same point

Definition at line 165 of file IntegerConverter.h.

166 {
168 for ( DGtal::Dimension i = 0; i < dim; i++ )
169 q[ i ] = cast( p[ i ] );
170 return q;
171 }
static DGtal::int32_t cast(DGtal::int32_t i)

References DGtal::IntegerConverter< dim, TInteger >::cast(), and dim.

◆ cast() [5/6]

Conversion of a lattice point.

Parameters
pany point
Returns
the same point

Definition at line 118 of file IntegerConverter.h.

119 {
120 return p;
121 }

◆ cast() [6/6]

Conversion of a lattice point.

Parameters
pany point
Returns
the same point

Definition at line 140 of file IntegerConverter.h.

141 {
143 for ( DGtal::Dimension i = 0; i < dim; i++ )
144 q[ i ] = cast( p[ i ] );
145 return q;
146 }

References DGtal::IntegerConverter< dim, TInteger >::cast(), and dim.


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