<
typenameT1,
typenameT2,
typenameT3,
typenameT4,
typenameT5>
64 typedefboost::variant<T1,T2,T3,T4,T5>
Type;
77 intp = (kmer_len+31)/32;
83 else{ std::cerr <<
"Not supported kmer length in Integer initialization";
exit(1); }
87 intp = (kmer.size()+31)/32;
89 else if(p <=
PREC_2)
v= T2(kmer);
90 else if(p <=
PREC_3)
v= T3(kmer);
91 else if(p <=
PREC_4)
v= T4(kmer);
92 else if(p <=
PREC_5)
v= T5(kmer);
93 else{ std::cerr <<
"Not supported kmer length in Integer initialization";
exit(1); }
96 IntegerTemplate(
conststd::string::const_iterator&
a,
conststd::string::const_iterator&
b) {
97 intp = (
b-
a+31)/32;
103 else{ std::cerr <<
"Not supported kmer length in Integer initialization";
exit(1); }
124 template<
typenameT>
134 const char*
getName()
const{
returnboost::apply_visitor (Integer_name(), *(*
this)); }
139 const size_t getSize()
const{
returnboost::apply_visitor (Integer_size(), *(*
this)); }
262u_int8_t
operator[](
size_tidx)
const{
returnboost::apply_visitor (Integer_value_at(idx), *(*
this)); }
275 std::string toString(
size_tsizeKmer)
const{
returnboost::apply_visitor (Integer_toString(sizeKmer), *(*
this)); }
289 template<
typenameU>
290 const U&
get()
const{
return* boost::get<U>(&
v); }
299u_int64_t
oahash()
const{
returnboost::apply_visitor (Integer_oahash(), *(*
this)); }
305 template<
typenameT,
typenameU>
void operator()(
T& newl,
U& origl)
const{
306 intorig_precision = origl.getSize()/64;
307 uint64_t* orig_guts = origl.GetGuts();
309 intnew_precision = newl.getSize()/64;
310 uint64_t* new_guts = newl.GetGuts();
312 std::copy(orig_guts, orig_guts+
std::min(orig_precision, new_precision), new_guts);
313 intpartial_part_bits = 2*(
kmer_len%32);
314 if(partial_part_bits > 0) {
316new_guts[new_precision-1] &=
mask;
322 template<
typenameT> u_int64_t
operator()(
const T&
a)
const{
return a.oahash(); }};
324 struct Pointer:
publicboost::static_visitor<void*> {
328 template<
typenameT>
const char*
operator()(
const T&
a)
const{
return a.getName(); }};
331 template<
typenameT>
const size_t operator()(
const T&
a)
const{
return a.getSize(); }};
343 struct Integer_or:
publicboost::static_visitor<IntegerTemplate> {
348 struct Integer_xor:
publicboost::static_visitor<IntegerTemplate> {
353 struct Integer_and:
publicboost::static_visitor<IntegerTemplate> {
359 template<
typenameT>
bool operator()(
const T&
a,
const T&
b)
const{
return a<
b; }
360 template<
typenameT,
typenameU>
bool operator()(
const T&
a,
const U&
b)
const{
return false; }
364 template<
typenameT>
bool operator()(
const T&
a,
const T&
b)
const{
return a<=
b; }
365 template<
typenameT,
typenameU>
bool operator()(
const T&
a,
const U&
b)
const{
return false; }
369 template<
typenameT>
bool operator()(
const T&
a,
const T&
b)
const{
return a==
b; }
370 template<
typenameT,
typenameU>
bool operator()(
const T&
a,
const U&
b)
const{
return false; }
375 template<
typenameT,
typenameU>
void operator()(
T&
a,
const U&
b)
const{ }
380 template<
typenameT,
typenameU>
void operator()(
T&
a,
const U&
b)
const{ }
386 template<
typenameResult,
typenameArg>
387 struct Visitor:
publicboost::static_visitor<Result>
403 template<
typenameT> u_int32_t
operator()(
const T&
a)
const{
return(
a%this->
arg); }};
419 template<
typenameT> u_int8_t
operator()(
const T&
a)
const{
return a[this->
arg]; }};
428 #define INTEGER_TYPES LargeInt<PREC_1>,LargeInt<PREC_2>,LargeInt<PREC_3>,LargeInt<PREC_4>,LargeInt<PREC_5>Class that manages large integers.
ncbi::TMaskedQueryRegions mask
Class for large integers calculus.
const char * getName() const
Get the name of the class used by the variant (ie.
const U & get() const
Get the value of the IntegerTemplate object as a U type, U being one of the T1,T2,...
friend std::ostream & operator<<(std::ostream &s, const IntegerTemplate &a)
Output stream operator for the IntegerTemplate class.
u_int8_t operator[](size_t idx) const
Operator[] access the ith nucleotide in the given integer.
friend bool operator<(const IntegerTemplate &a, const IntegerTemplate &b)
Operator <.
friend bool operator!=(const IntegerTemplate &a, const IntegerTemplate &b)
Operator !=.
friend IntegerTemplate revcomp(const IntegerTemplate &a, size_t sizeKmer)
Get the reverse complement of a kmer encoded as an IntegerTemplate object.
void operator^=(const IntegerTemplate &a)
Operator ^=.
IntegerTemplate(const T &t)
Construct from a different size IntegerTemplate Will clip (or add) extra nucs on the LEFT of the stri...
friend IntegerTemplate operator&(const IntegerTemplate &a, const IntegerTemplate &b)
Operator &.
friend IntegerTemplate operator^(const IntegerTemplate &a, const IntegerTemplate &b)
Operator ^.
friend bool operator==(const IntegerTemplate &a, const IntegerTemplate &b)
Operator ==.
friend IntegerTemplate operator+(const IntegerTemplate &a, const IntegerTemplate &b)
Operator +.
const size_t getSize() const
Get the size of an instance of the class used by the variant (ie.
IntegerTemplate(int kmer_len, uint64_t n)
void operator+=(const IntegerTemplate &a)
Operator +=.
friend IntegerTemplate operator/(const IntegerTemplate &a, const u_int32_t &c)
Operator /.
friend IntegerTemplate operator<<(const IntegerTemplate &a, const int &c)
Operator <<.
IntegerTemplate(const std::string::const_iterator &a, const std::string::const_iterator &b)
friend IntegerTemplate operator-(const IntegerTemplate &a, const IntegerTemplate &b)
Operator -.
friend bool operator<=(const IntegerTemplate &a, const IntegerTemplate &b)
Operator <=.
IntegerTemplate(const std::string &kmer)
IntegerTemplate & operator=(const T &t)
Affectation operator.
friend IntegerTemplate operator|(const IntegerTemplate &a, const IntegerTemplate &b)
Operator |.
friend u_int32_t operator%(const IntegerTemplate &a, const u_int32_t &c)
Operator %.
friend IntegerTemplate operator~(const IntegerTemplate &a)
Operator ~.
boost::variant< T1, T2, T3, T4, T5 > Type
friend IntegerTemplate operator>>(const IntegerTemplate &a, const int &c)
Operator >>
std::string toString(size_t sizeKmer) const
Get an ASCII string representation of a kmer encoded as a IntegerTemplate object.
void * getPointer()
Get pointer to the actual data - used for EMPHF.
u_int64_t oahash() const
Get a hash value on 64 bits for a given IntegerTemplate object.
unsigned int
A callback function used to compare two keys in a database.
IntegerTemplate< LargeInt< 1 >, LargeInt< 2 >, LargeInt< 4 >, LargeInt< 8 >, LargeInt< 16 > > TKmer
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
IntegerTemplate operator()(const T &a, const T &b) const
IntegerTemplate operator()(const T &a)
IntegerTemplate operator()(const T &a) const
Integer_div(const u_int32_t &c)
bool operator()(const T &a, const T &b) const
bool operator()(const T &a, const T &b) const
bool operator()(const T &a, const T &b) const
IntegerTemplate operator()(const T &a, const T &b) const
u_int32_t operator()(const T &a) const
Integer_mod(const u_int32_t &c)
IntegerTemplate operator()(const T &a) const
Integer_mult(const int &c)
const char * operator()(const T &a) const
u_int64_t operator()(const T &a) const
IntegerTemplate operator()(const T &a, const T &b) const
IntegerTemplate operator()(const T &a, const T &b) const
void operator()(T &a, const T &b) const
IntegerTemplate operator()(const T &a) const
Integer_revomp(const size_t &c)
Integer_shiftLeft(const int &c)
IntegerTemplate operator()(const T &a) const
Integer_shiftRight(const int &c)
IntegerTemplate operator()(const T &a) const
const size_t operator()(const T &a) const
Integer_toString(size_t c)
std::string operator()(const T &a) const
u_int8_t operator()(const T &a) const
Integer_value_at(size_t idx)
IntegerTemplate operator()(const T &a, const T &b) const
void operator()(T &a, const T &b) const
void * operator()(T &a) const
void operator()(T &newl, U &origl) const
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4