halapi
hierarchichalalignmentformatapi
 All Classes Namespaces Functions Pages
halDNAIterator.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 _HALDNAITERATOR_H
8 #define _HALDNAITERATOR_H
9 
10 #include "halDefs.h"
11 
12 namespace hal {
13 
18 {
19 public:
20 
23  virtual char getChar() const = 0;
24 
28  virtual void setChar(char c) = 0;
29 
31  virtual void toLeft() const = 0;
32 
34  virtual void toRight() const = 0;
35 
39  virtual void jumpTo(hal_size_t index) const = 0;
40 
42  virtual void toReverse() const = 0;
43 
45  virtual bool getReversed() const = 0;
46 
48  virtual void setReversed(bool reversed) const = 0;
49 
51  virtual const Genome* getGenome() const = 0;
52 
54  virtual Genome* getGenome() = 0;
55 
57  virtual const Sequence* getSequence() const = 0;
58 
60  virtual Sequence* getSequence() = 0;
61 
63  virtual hal_index_t getArrayIndex() const = 0;
64 
66  virtual bool equals(DNAIteratorConstPtr& other) const = 0;
67 
69  virtual bool leftOf(DNAIteratorConstPtr& other) const = 0;
70 
71 protected:
72 
73  friend class counted_ptr<DNAIterator>;
74  friend class counted_ptr<const DNAIterator>;
75  virtual ~DNAIterator() = 0;
76 };
77 
78 inline DNAIterator::~DNAIterator() {}
79 
80 }
81 
82 #ifndef NDEBUG
83 #include "halGenome.h"
84 namespace hal {
85 inline std::ostream& operator<<(std::ostream& os,
86  const DNAIterator* dna)
87 {
88  const Genome* genome = dna->getGenome();
89  os << "dna: ";
90  os << "Genome=" << genome->getName();
91  os << " Seq=" << dna->getSequence()->getName();
92  os << " idx=" << dna->getArrayIndex();
93 
94  if (dna->getArrayIndex() >= 0 &&
95  dna->getArrayIndex() < (hal_index_t)genome->getSequenceLength())
96  {
97  os << " val=" << dna->getChar();
98  }
99  return os;
100 }
101 }
102 #endif
103 
104 #endif
Definition: halGenome.h:24
Definition: halDNAIterator.h:17
virtual void jumpTo(hal_size_t index) const =0
virtual const Genome * getGenome() const =0
virtual void toRight() const =0
virtual void toLeft() const =0
virtual bool leftOf(DNAIteratorConstPtr &other) const =0
virtual hal_index_t getArrayIndex() const =0
virtual const Sequence * getSequence() const =0
virtual void toReverse() const =0
virtual bool getReversed() const =0
virtual void setChar(char c)=0
virtual bool equals(DNAIteratorConstPtr &other) const =0
virtual char getChar() const =0
virtual void setReversed(bool reversed) const =0
Definition: halSequence.h:20