halapi
hierarchichalalignmentformatapi
 All Classes Namespaces Functions Pages
halMappedSegment.h
1 /*
2  * Copyright (C) 2013 by Glenn Hickey (hickey@soe.ucsc.edu)
3  *
4  * Released under the MIT license, see LICENSE.txt
5  */
6 
7 #ifndef _HALMAPPEDSEGMENT_H
8 #define _HALMAPPEDSEGMENT_H
9 
10 #include "halDefs.h"
11 #include "halSlicedSegment.h"
12 
13 namespace hal {
14 
23 class MappedSegment : public virtual SlicedSegment
24 {
25 public:
26 
28  virtual SlicedSegmentConstPtr getSource() const = 0;
29 
33  virtual bool lessThan(const MappedSegmentConstPtr& other) const = 0;
34 
38  virtual bool lessThanBySource(const MappedSegmentConstPtr& other) const = 0;
39 
43  virtual bool equals(const MappedSegmentConstPtr& other) const = 0;
44 
47  virtual void flip() const = 0;
48 
51  virtual void fullReverse() const = 0;
52 
54  virtual MappedSegmentConstPtr copy() const = 0;
55 
59  virtual bool canMergeRightWith(
60  const MappedSegmentConstPtr& next,
61  const std::set<hal_index_t>* cutSet = NULL,
62  const std::set<hal_index_t>* sourceCutSet = NULL) const = 0;
63 
66  struct LessSource { bool operator()(const MappedSegmentConstPtr& ms1,
67  const MappedSegmentConstPtr& ms2) const {
68  return ms1->lessThanBySource(ms2); }
69  };
70 
73  struct Less { bool operator()(const MappedSegmentConstPtr& ms1,
74  const MappedSegmentConstPtr& ms2) const {
75  return ms1->lessThan(ms2); }
76  };
77 
79  struct EqualTo { bool operator()(const MappedSegmentConstPtr& ms1,
80  const MappedSegmentConstPtr& ms2) const {
81  return ms1->equals(ms2); }
82  };
83 
84  // NEEDS TO BE ADDED TO SEGMENT INTERFACE
85  virtual void print(std::ostream& os) const = 0;
86 
87 protected:
88  friend class counted_ptr<MappedSegment>;
89  friend class counted_ptr<const MappedSegment>;
90  virtual ~MappedSegment() = 0;
91 };
92 
93 inline MappedSegment::~MappedSegment() {}
94 
95 }
96 
97 namespace std {
98 template<>
99 struct less<hal::MappedSegmentConstPtr>
100 {
101  bool operator()(const hal::MappedSegmentConstPtr& m1,
102  const hal::MappedSegmentConstPtr& m2) const
103  {
104  return m1->lessThan(m2);
105  }
106 };
107 
108 }
109 
110 #endif
virtual bool lessThanBySource(const MappedSegmentConstPtr &other) const =0
virtual bool canMergeRightWith(const MappedSegmentConstPtr &next, const std::set< hal_index_t > *cutSet=NULL, const std::set< hal_index_t > *sourceCutSet=NULL) const =0
Definition: halMappedSegment.h:66
virtual bool equals(const MappedSegmentConstPtr &other) const =0
virtual void flip() const =0
Definition: halMappedSegment.h:73
virtual bool lessThan(const MappedSegmentConstPtr &other) const =0
virtual MappedSegmentConstPtr copy() const =0
virtual SlicedSegmentConstPtr getSource() const =0
virtual void fullReverse() const =0
Definition: halMappedSegment.h:23
virtual void print(std::ostream &os) const =0
Definition: halSlicedSegment.h:22
Definition: halMappedSegment.h:79