gatb.core-API-0.0.0
|
Class for large integers calculus. More...
#include <Integer.hpp>
Public Types | |
typedef boost::make_variant_over< transfolist >::type | Type |
Public Member Functions | |
IntegerTemplate (int64_t n=0) | |
template<typename T > | |
IntegerTemplate (const T &t) | |
template<typename T > | |
IntegerTemplate & | operator= (const T &t) |
const char * | getName () |
size_t | getSize () |
hid_t | hdf5 (bool &isCompound) |
void | operator+= (const IntegerTemplate &a) |
void | operator^= (const IntegerTemplate &a) |
u_int8_t | operator[] (size_t idx) const |
std::string | toString (size_t sizeKmer) const |
template<typename U > | |
const U & | get () const |
Static Public Member Functions | |
template<template< size_t > class Functor, typename Parameter > | |
static void | apply (size_t kmerSize, Parameter params) |
Class for large integers calculus.
The IntegerTemplate is implemented as a boost variant, which means that it can act like T1, T2, T3 or T4, etc.. type according to the configuration.
All the methods are implemented through a boost variant visitor.
Note that we have 2 possible native implementations (NativeInt64 and NativeInt128) that rely on native types uint64_t and __uint128_t.
For larger integer, a multi-precision LargeInt is used.
From the user point of view, [s]he has just to include this file and use the Integer class.
typedef boost::make_variant_over<transfolist>::type Type |
We define a boost variant from this type list.
|
inline |
Constructor. Note that the type (see getType and setType) has to be first initialized otherwise no instance can be created (exception thrown).
[in] | n | : value for initialization of the integer. |
|
inlineexplicit |
Copy constructor. Relies on the copy constructor of boost variant
[in] | t | : the object to be used for initialization |
|
inlinestatic |
Apply a functor with the best template specialization according to the provided kmer size.
|
inline |
Get the value of the IntegerTemplate object as a U type, U being one of the T1,T2,T3,T4 template class parameters. This method can be seen as a converter from the IntegerTemplate class to a specific U type (given as a template parameter of this method).
|
inline |
Get the name of the class used by the variant (ie. one of the Ti template class parameters)
|
inline |
Get the size of an instance of the class used by the variant (ie. one of the Ti template class parameters)
|
inline |
Get the HDF5 type for the the class used by the variant (ie. one of the Ti template class parameters)
[in] | isCompound | : tells whether the type is composed or not |
|
inline |
Operator +=
[in] | a | : first operand |
|
inline |
Affectation operator. Relies on the affectation operator of boost variant
[in] | t | : object to be copied |
|
inline |
Operator[] access the ith nucleotide in the given integer. For instance a[4] get the 5th nucleotide of a kmer encoded as an Integer object.
[in] | idx | : index of the nucleotide to be retrieved |
|
inline |
Operator ^=
[in] | a | : first operand |
|
inline |
Get an ASCII string representation of a kmer encoded as a IntegerTemplate object
[in] | sizeKmer | : size of the kmer |
|
friend |
Get the lexicographical minimizer of the k-mer, quickly, using bit tricks. minimizers containing 'AA' are forbidden. might not return a valid result sometimes.
[in] | nbminimizers | number of minimizers inside this kmer |
[in] | &validResult | whether the returned result should be considered valid (if not, compute minimizer with another approach please) |
|
friend |
Get a hash value on 64 bits for a given IntegerTemplate object.
[in] | a | : the integer value |
[in] | seed | : some seed value used for the hash computation. |
|
friend |
Get a hash value on 64 bits for a given IntegerTemplate object.
[in] | a | : the integer value |
|
friend |
Operator !=
[in] | a | : first operand |
[in] | b | : second operand |
|
friend |
Operator %
[in] | a | : first operand |
[in] | c | : second operand |
|
friend |
Operator &
[in] | a | : first operand |
[in] | b | : second operand |
|
friend |
Operator *
[in] | a | : first operand |
[in] | c | : second operand |
|
friend |
Operator +
[in] | a | : first operand |
[in] | b | : second operand |
|
friend |
Operator -
[in] | a | : first operand |
[in] | b | : second operand |
|
friend |
Operator /
[in] | a | : first operand |
[in] | c | : second operand |
|
friend |
Operator <
[in] | a | : first operand |
[in] | b | : second operand |
|
friend |
Operator <<
[in] | a | : first operand |
[in] | c | : second operand |
|
friend |
Output stream operator for the IntegerTemplate class
[in] | s | : the output stream to be used. |
[in] | a | : the object to output |
|
friend |
Operator <=
[in] | a | : first operand |
[in] | b | : second operand |
|
friend |
Operator ==
[in] | a | : first operand |
[in] | b | : second operand |
|
friend |
Operator >>
[in] | a | : first operand |
[in] | c | : second operand |
|
friend |
Operator ^
[in] | a | : first operand |
[in] | b | : second operand |
|
friend |
Operator |
[in] | a | : first operand |
[in] | b | : second operand |
|
friend |
Operator ~
[in] | a | : operand |
|
friend |
Get the reverse complement of a kmer encoded as an IntegerTemplate object. Note that the kmer size must be known.
[in] | a | : kmer value to be reversed-complemented |
[in] | sizeKmer | : size of the kmer |
|
friend |
Get a hash value on 64 bits for a given IntegerTemplate object. Note: although we return 64 bits, only the first 16 bits are set
[in] | a | : the integer value |
[in] | shift | : some value used for the hash computation. |