halapi
hierarchichalalignmentformatapi
 All Classes Namespaces Functions Pages
halTopSegmentIterator.h
1 /*
2  * Copyright (C) 2012 by Glenn Hickey (hickey@soe.ucsc.edu)
3  *
4  * Released under the MIT license, see LICENSE.txt
5  */
6 
7 #ifndef _HALTOPSEGMENTITERATOR_H
8 #define _HALTOPSEGMENTITERATOR_H
9 
10 #include <iostream>
11 #include "halDefs.h"
12 #include "halSegmentIterator.h"
13 #include "halTopSegment.h"
14 
15 namespace hal {
16 
22 class TopSegmentIterator : public virtual TopSegment,
23  public virtual SegmentIterator
24 {
25 public:
27  virtual TopSegmentIteratorPtr copy() = 0;
28 
30  virtual TopSegmentIteratorConstPtr copy() const = 0;
31 
35  virtual void copy(TopSegmentIteratorConstPtr ts) const = 0;
36 
40  virtual void toChild(BottomSegmentIteratorConstPtr bs,
41  hal_size_t child) const = 0;
42 
46  virtual void toChildG(BottomSegmentIteratorConstPtr bs,
47  const Genome* childGenome) const = 0;
48 
53  virtual void toParseUp(BottomSegmentIteratorConstPtr bs) const = 0;
54 
56  virtual TopSegment* getTopSegment() = 0;
57 
59  virtual const TopSegment* getTopSegment() const = 0;
60 
64  virtual bool equals(TopSegmentIteratorConstPtr other) const = 0;
65 
69  virtual void toNextParalogy() const = 0;
70 
71 protected:
72  friend class counted_ptr<TopSegmentIterator>;
73  friend class counted_ptr<const TopSegmentIterator>;
74  virtual ~TopSegmentIterator() = 0;
75 };
76 
77 inline TopSegmentIterator::~TopSegmentIterator() {}
78 
79 inline bool operator==(TopSegmentIteratorConstPtr p1,
80  TopSegmentIteratorConstPtr p2)
81 {
82  if (p1.get() == NULL || p2.get() == NULL)
83  {
84  return p1.get() == NULL && p2.get() == NULL;
85  }
86  return p1->equals(p2);
87 }
88 
89 inline bool operator!=(TopSegmentIteratorConstPtr p1,
90  TopSegmentIteratorConstPtr p2)
91 {
92  return !(p1 == p2);
93 }
94 
95 }
96 
97 
98 #endif
Definition: halGenome.h:24
virtual void toNextParalogy() const =0
virtual TopSegment * getTopSegment()=0
Definition: halTopSegment.h:18
virtual bool equals(TopSegmentIteratorConstPtr other) const =0
Definition: halSegmentIterator.h:20
Definition: halTopSegmentIterator.h:22
virtual TopSegmentIteratorPtr copy()=0
virtual void toChild(BottomSegmentIteratorConstPtr bs, hal_size_t child) const =0
virtual void toChildG(BottomSegmentIteratorConstPtr bs, const Genome *childGenome) const =0
virtual void toParseUp(BottomSegmentIteratorConstPtr bs) const =0