1 #include <string> 2 3 #ifndef BAMAUX_H 4 #define BAMAUX_H 5 namespace BamTools { 6 struct RefData 7 { 8 9 std::string RefName; //!< name of reference sequence 10 int32_t RefLength; //!< length of reference sequence 11 12 //! constructor 13 RefData(const std::string& name = std::string(), const int32_t& length = 0) RefNameRefData14 : RefName(name) 15 , RefLength(length) 16 {} 17 }; 18 struct BamRegion 19 { 20 21 int LeftRefID; //!< reference ID for region's left boundary 22 int LeftPosition; //!< position for region's left boundary 23 int RightRefID; //!< reference ID for region's right boundary 24 int RightPosition; //!< position for region's right boundary 25 26 //! constructor 27 BamRegion(const int& leftID = -1, const int& leftPos = -1, const int& rightID = -1, 28 const int& rightPos = -1) LeftRefIDBamRegion29 : LeftRefID(leftID) 30 , LeftPosition(leftPos) 31 , RightRefID(rightID) 32 , RightPosition(rightPos) 33 {} 34 35 //! copy constructor BamRegionBamRegion36 BamRegion(const BamRegion& other) 37 : LeftRefID(other.LeftRefID) 38 , LeftPosition(other.LeftPosition) 39 , RightRefID(other.RightRefID) 40 , RightPosition(other.RightPosition) 41 {} 42 43 //! Clears region boundaries clearBamRegion44 void clear() 45 { 46 LeftRefID = -1; 47 LeftPosition = -1; 48 RightRefID = -1; 49 RightPosition = -1; 50 } 51 52 //! Returns true if region has a left boundary isLeftBoundSpecifiedBamRegion53 bool isLeftBoundSpecified() const 54 { 55 return (LeftRefID >= 0 && LeftPosition >= 0); 56 } 57 58 //! Returns true if region boundaries are not defined isNullBamRegion59 bool isNull() const 60 { 61 return (!isLeftBoundSpecified() && !isRightBoundSpecified()); 62 } 63 64 //! Returns true if region has a right boundary isRightBoundSpecifiedBamRegion65 bool isRightBoundSpecified() const 66 { 67 return (RightRefID >= 0 && RightPosition >= 1); 68 } 69 }; 70 } 71 #endif 72