DGtal 1.4.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 320 of file IntegerConverter.h.

Member Typedef Documentation

◆ Integer

Member Function Documentation

◆ cast() [1/6]

Parameters
iany integer
Returns
the same integer

Definition at line 369 of file IntegerConverter.h.

370 {
371 return i;
372 }

◆ cast() [2/6]

Parameters
iany integer
Returns
the same integer

Definition at line 325 of file IntegerConverter.h.

326 {
327 return DGtal::BigInteger( i );
328 }
mpz_class BigInteger
Multi-precision integer with GMP implementation.
Definition BasicTypes.h:79

◆ cast() [3/6]

Parameters
iany integer
Returns
the same integer

Definition at line 346 of file IntegerConverter.h.

347 {
349 detail::mpz_set_sll( tmp.get_mpz_t(), i );
350 return tmp;
351 }
static void mpz_set_sll(mpz_t n, long long sll)
----------— GMP SPECIALIZED SERVICES -------------------------—

References DGtal::detail::mpz_set_sll().

◆ cast() [4/6]

Conversion of a lattice point.

Parameters
pany point
Returns
the same point

Definition at line 380 of file IntegerConverter.h.

381 {
382 return p;
383 }

◆ cast() [5/6]

Conversion of a lattice point.

Parameters
pany point
Returns
the same point

Definition at line 336 of file IntegerConverter.h.

337 {
338 PointVector< dim, DGtal::BigInteger > q;
339 for ( DGtal::Dimension i = 0; i < dim; i++ )
340 q[ i ] = cast( p[ i ] );
341 return q;
342 }
DGtal::uint32_t Dimension
Definition Common.h:136
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 359 of file IntegerConverter.h.

360 {
361 PointVector< dim, DGtal::BigInteger > q;
362 for ( DGtal::Dimension i = 0; i < dim; i++ )
363 q[ i ] = cast( p[ i ] );
364 return q;
365 }

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


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