ARB
PRD_Node.hxx
Go to the documentation of this file.
1 #ifndef PRD_NODE_HXX
2 #define PRD_NODE_HXX
3 
4 #include <cstdio>
5 #ifndef PRD_GLOBALS_HXX
6 #include "PRD_Globals.hxx"
7 #endif
8 
9 class Node : virtual Noncopyable {
10  void init(Node* parent_, char base_, PRD_Sequence_Pos last_index_, PRD_Sequence_Pos offset_);
11 
12 public:
14  Node *child[4]; // 0=C 1=G 2=A 3=T/U
15  unsigned char base;
16  unsigned int child_bits : 4; // see BitField in PRD_Globals.hxx
17  PRD_Sequence_Pos offset; // index of base in sequence : left = index of first base of primer, right = index of last base of primer
18  PRD_Sequence_Pos last_base_index; // abs(last_base_index) = pos (last_base_index > 0) ? valid : invalid
19 
20  Node (Node* parent_, char base_, PRD_Sequence_Pos last_index_, PRD_Sequence_Pos offset_);
21  Node (Node* parent_, char base_, PRD_Sequence_Pos last_index_);
22  Node (Node* parent_, char base_);
23  Node ();
24  ~Node ();
25 
26  Node *childByBase (unsigned char base_) { return child[CHAR2CHILD.INDEX[base_]]; };
27  bool isValidPrimer () { return last_base_index > 0; };
28  bool isPrimer () { return last_base_index != 0; }
29  bool isLeaf () { return child_bits == 0; };
30  void print (); // print subtree started here
31 
32 };
33 
34 #else
35 #error PRD_Node.hxx included twice
36 #endif // PRD_NODE_HXX
unsigned char base
Definition: PRD_Node.hxx:15
Definition: PRD_Node.hxx:9
Node()
Definition: PRD_Node.cxx:32
Node * child[4]
Definition: PRD_Node.hxx:14
bool isLeaf()
Definition: PRD_Node.hxx:29
static ChildLookupTable CHAR2CHILD
Definition: PRD_Globals.hxx:72
unsigned int child_bits
Definition: PRD_Node.hxx:16
Node * childByBase(unsigned char base_)
Definition: PRD_Node.hxx:26
void print()
Definition: PRD_Node.cxx:53
PRD_Sequence_Pos last_base_index
Definition: PRD_Node.hxx:18
bool isValidPrimer()
Definition: PRD_Node.hxx:27
~Node()
Definition: PRD_Node.cxx:40
PRD_Sequence_Pos offset
Definition: PRD_Node.hxx:17
bool isPrimer()
Definition: PRD_Node.hxx:28
long int PRD_Sequence_Pos
Definition: PRD_Globals.hxx:21
Node * parent
Definition: PRD_Node.hxx:13