ARB
PT_complement.h
Go to the documentation of this file.
1 // =============================================================== //
2 // //
3 // File : PT_complement.h //
4 // Purpose : //
5 // //
6 // Coded by Ralf Westram (coder@reallysoft.de) in January 2013 //
7 // Institute of Microbiology (Technical University Munich) //
8 // http://www.arb-home.de/ //
9 // //
10 // =============================================================== //
11 
12 #ifndef PT_COMPLEMENT_H
13 #define PT_COMPLEMENT_H
14 
15 #ifndef PT_PROTOTYPES_H
16 #include "pt_prototypes.h"
17 #endif
18 
19 class Complement {
20  int complement[256];
21 
22  static int calc_complement(int base); // DO NOT INLINE! (workaround a gcc-4.4.3-bug; see [9355] for details)
23 
24 public:
25  Complement() { for (int i = 0; i<256; ++i) complement[i] = calc_complement(i); }
26  int get(int base) const { return complement[base]; }
27 };
28 
29 inline int get_complement(int base) {
30  static Complement c;
31  pt_assert(base >= 0 && base <= 255);
32  return c.get(base);
33 }
34 
35 inline void complement_probe(char *Probe, int len) {
36  for (int i = 0; i<len; i++) {
37  Probe[i] = get_complement(Probe[i]);
38  }
39 }
40 
41 #else
42 #error PT_complement.h included twice
43 #endif // PT_COMPLEMENT_H
void complement_probe(char *Probe, int len)
Definition: PT_complement.h:35
int get(int base) const
Definition: PT_complement.h:26
#define pt_assert(bed)
Definition: PT_tools.h:22
int get_complement(int base)
Definition: PT_complement.h:29