DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions
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 321 of file IntegerConverter.h.

Member Typedef Documentation

◆ Integer

Definition at line 322 of file IntegerConverter.h.

Member Function Documentation

◆ cast() [1/6]

Parameters
iany integer
Returns
the same integer

Definition at line 370 of file IntegerConverter.h.

371 {
372 return i;
373 }

◆ cast() [2/6]

Parameters
iany integer
Returns
the same integer

Definition at line 326 of file IntegerConverter.h.

327 {
328 return DGtal::BigInteger( i );
329 }
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 347 of file IntegerConverter.h.

348 {
350 detail::mpz_set_sll( tmp.get_mpz_t(), i );
351 return tmp;
352 }
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 381 of file IntegerConverter.h.

382 {
383 return p;
384 }

◆ cast() [5/6]

Conversion of a lattice point.

Parameters
pany point
Returns
the same point

Definition at line 337 of file IntegerConverter.h.

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

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

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


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