halapi
hierarchichalalignmentformatapi
 All Classes Namespaces Functions Pages
halBottomSegmentIterator.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 _HALBOTTOMSEGMENTITERATOR_H
8 #define _HALBOTTOMSEGMENTITERATOR_H
9 
10 #include "halDefs.h"
11 #include "halBottomSegment.h"
12 #include "halSegmentIterator.h"
13 
14 namespace hal {
15 
21 class BottomSegmentIterator : public virtual BottomSegment,
22  public virtual SegmentIterator
23 {
24 public:
26  virtual BottomSegmentIteratorPtr copy() = 0;
27 
29  virtual BottomSegmentIteratorConstPtr copy() const = 0;
30 
34  virtual void copy(BottomSegmentIteratorConstPtr bs) const = 0;
35 
38  virtual void toParent(TopSegmentIteratorConstPtr ts) const = 0;
39 
43  virtual void toParseDown(TopSegmentIteratorConstPtr ts) const = 0;
44 
46  virtual BottomSegment* getBottomSegment() = 0;
47 
49  virtual const BottomSegment* getBottomSegment() const = 0;
50 
54  virtual bool equals(BottomSegmentIteratorConstPtr other) const = 0;
55 
56 protected:
57  friend class counted_ptr<BottomSegmentIterator>;
58  friend class counted_ptr<const BottomSegmentIterator>;
59  virtual ~BottomSegmentIterator() = 0;
60 };
61 
62 inline BottomSegmentIterator::~BottomSegmentIterator() {}
63 
64 inline bool operator==(BottomSegmentIteratorConstPtr p1,
65  BottomSegmentIteratorConstPtr p2)
66 {
67  if (p1.get() == NULL || p2.get() == NULL)
68  {
69  return p1.get() == NULL && p2.get() == NULL;
70  }
71  return p1->equals(p2);
72 }
73 
74 inline bool operator!=(BottomSegmentIteratorConstPtr p1,
75  BottomSegmentIteratorConstPtr p2)
76 {
77  return !(p1 == p2);
78 }
79 
80 }
81 
82 
83 #endif
Definition: halBottomSegment.h:18
Definition: halBottomSegmentIterator.h:21
virtual void toParseDown(TopSegmentIteratorConstPtr ts) const =0
virtual BottomSegment * getBottomSegment()=0
Definition: halSegmentIterator.h:20
virtual bool equals(BottomSegmentIteratorConstPtr other) const =0
virtual void toParent(TopSegmentIteratorConstPtr ts) const =0
virtual BottomSegmentIteratorPtr copy()=0