halapi
hierarchichalalignmentformatapi
hdf5_impl/hdf5BottomSegmentIterator.h
00001 /*
00002  * Copyright (C) 2012 by Glenn Hickey (hickey@soe.ucsc.edu)
00003  *
00004  * Released under the MIT license, see LICENSE.txt
00005  */
00006 
00007 #ifndef _HDF5BOTTOMSEGMENTITERATOR_H
00008 #define _HDF5BOTTOMSEGMENTITERATOR_H
00009 
00010 #include <limits>
00011 #include <H5Cpp.h>
00012 #include "halBottomSegmentIterator.h"
00013 #include "hdf5ExternalArray.h"
00014 #include "hdf5Genome.h"
00015 #include "hdf5BottomSegment.h"
00016 
00017 namespace hal {
00018 
00019 class HDF5TopSegmentIterator;
00020 
00021 class HDF5BottomSegmentIterator : public BottomSegmentIterator
00022 {
00023 
00024    friend class HDF5TopSegmentIterator;
00025 
00026 public:
00027    
00028    HDF5BottomSegmentIterator(HDF5Genome* genome, hal_index_t index,
00029                              hal_size_t startOffset = 0, 
00030                              hal_size_t endOffset = 0,
00031                              hal_bool_t inverted = false);
00032    ~HDF5BottomSegmentIterator();
00033    
00034    // ITERATOR METHODS
00035    void toLeft() const;
00036    void toRight() const;
00037    void toReverse() const;
00038    void toNextParalogy() const;
00039    hal_offset_t getStartOffset() const;
00040    hal_offset_t getEndOffset() const;
00041    hal_size_t getLength() const;
00042    hal_bool_t getReversed() const;
00043    void getString(std::string& outString) const;
00044 
00045    //BOTTOM ITERATOR METHODS
00046    BottomSegmentIteratorPtr copy();
00047    BottomSegmentIteratorConstPtr copy() const;
00048    void toParent(TopSegmentIteratorConstPtr ts) const; 
00049    void toParseDown(TopSegmentIteratorConstPtr ts) const;
00050    BottomSegment* getBottomSegment();
00051    const BottomSegment* getBottomSegment() const;
00052 
00053    bool inRange() const;
00054 
00055 protected:
00056    HDF5BottomSegment _bottomSegment;
00057    mutable hal_offset_t _startOffset;
00058    mutable hal_offset_t _endOffset;
00059    mutable hal_bool_t _reversed;
00060 };
00061 
00062 inline bool HDF5BottomSegmentIterator::inRange() const
00063 {
00064   return _bottomSegment._index >= 0 && _bottomSegment._index < 
00065      (hal_index_t)_bottomSegment._genome->_bottomArray.getSize();
00066 }
00067 
00068 }
00069 #endif
 All Classes Namespaces Functions Variables Friends