source: tags/ms_r18q1/PRIMER_DESIGN/PRD_Node.cxx

Last change on this file was 16766, checked in by westram, 6 years ago
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.3 KB
Line 
1#include "PRD_Node.hxx"
2
3using namespace std;
4
5//
6// Constructors
7//
8void Node::init (Node* parent_, char base_, PRD_Sequence_Pos last_index_, PRD_Sequence_Pos offset_) {
9  parent          = parent_;
10  child[0]        = NULp;
11  child[1]        = NULp;
12  child[2]        = NULp;
13  child[3]        = NULp;
14  base            = base_;
15  last_base_index = last_index_;
16  child_bits      = 0;
17  offset          = offset_;
18}
19
20Node::Node (Node* parent_, char base_, PRD_Sequence_Pos last_index_, PRD_Sequence_Pos offset_) {
21  init (parent_, base_, last_index_, offset_);
22}
23
24Node::Node (Node* parent_, char base_, PRD_Sequence_Pos last_index_) {
25  init (parent_, base_, last_index_, 0);
26}
27
28Node::Node (Node* parent_, char base_) {
29  init (parent_, base_, 0, 0);
30}
31
32Node::Node () {
33  init (NULp, ' ', 0, 0);
34}
35
36
37//
38// Destructor
39//
40Node::~Node () {
41  if (child[0]) delete child[0];
42  if (child[1]) delete child[1];
43  if (child[2]) delete child[2];
44  if (child[3]) delete child[3];
45}
46
47
48//
49// print
50//
51// recursively print Node and its children
52//
53void Node::print () {
54  printf ("[%c,%li,%li,%u (", base, last_base_index, offset, child_bits);
55  if (child[0]) { child[0]->print(); printf(","); }
56  if (child[1]) { child[1]->print(); printf(","); }
57  if (child[2]) { child[2]->print(); printf(","); }
58  if (child[3]) { child[3]->print(); }
59  printf(")]");
60}
Note: See TracBrowser for help on using the repository browser.