DGtal 2.1.0
Loading...
Searching...
No Matches
DGtal::IntegerConverter< dim, DGtal::BigInteger > Struct Template Reference

#include <DGtal/kernel/IntegerConverter.h>

Public Types

typedef DGtal::BigInteger Integer
 

Static Public Member Functions

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

Detailed Description

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

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 BigInteger

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 264 of file IntegerConverter.h.

Member Typedef Documentation

◆ Integer

Member Function Documentation

◆ cast() [1/6]

Parameters
iany integer
Returns
the same integer

Definition at line 312 of file IntegerConverter.h.

313 {
314 return i;
315 }

◆ cast() [2/6]

Parameters
iany integer
Returns
the same integer

Definition at line 269 of file IntegerConverter.h.

270 {
271 return DGtal::BigInteger( i );
272 }
boost::multiprecision::number< boost::multiprecision::cpp_int_backend<>, boost::multiprecision::et_off > BigInteger
Definition BasicTypes.h:75

◆ cast() [3/6]

Parameters
iany integer
Returns
the same integer

Definition at line 290 of file IntegerConverter.h.

291 {
292 DGtal::BigInteger tmp = i;
293 return tmp;
294 }

◆ cast() [4/6]

Conversion of a lattice point.

Parameters
pany point
Returns
the same point

Definition at line 323 of file IntegerConverter.h.

324 {
325 return p;
326 }

◆ cast() [5/6]

Conversion of a lattice point.

Parameters
pany point
Returns
the same point

Definition at line 280 of file IntegerConverter.h.

281 {
282 PointVector< dim, DGtal::BigInteger > q;
283 for ( DGtal::Dimension i = 0; i < dim; i++ )
284 q[ i ] = cast( p[ i ] );
285 return q;
286 }
DGtal::uint32_t Dimension
Definition Common.h:119
static DGtal::BigInteger cast(DGtal::int32_t i)

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

◆ cast() [6/6]

Conversion of a lattice point.

Parameters
pany point
Returns
the same point

Definition at line 302 of file IntegerConverter.h.

303 {
304 PointVector< dim, DGtal::BigInteger > q;
305 for ( DGtal::Dimension i = 0; i < dim; i++ )
306 q[ i ] = cast( p[ i ] );
307 return q;
308 }

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


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