halapi
hierarchichalalignmentformatapi
hdf5_impl/hdf5TopSegmentIterator.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 _HDF5TOPSEGMENTITERATOR_H
00008 #define _HDF5TOPSEGMENTITERATOR_H
00009 
00010 #include <H5Cpp.h>
00011 #include "halTopSegmentIterator.h"
00012 #include "hdf5ExternalArray.h"
00013 #include "hdf5Genome.h"
00014 #include "hdf5TopSegment.h"
00015 
00016 namespace hal {
00017 
00018 class HDF5BottomSegmentIterator;
00019 
00020 class HDF5TopSegmentIterator : public TopSegmentIterator
00021 {
00022    friend class HDF5BottomSegmentIterator;
00023 public:
00024    
00025    HDF5TopSegmentIterator(HDF5Genome* genome, hal_index_t index,
00026                           hal_offset_t startOffset = 0, 
00027                           hal_offset_t endOffset = 0,
00028                           hal_bool_t inverted = false);
00029    ~HDF5TopSegmentIterator();
00030    
00031    // ITERATOR METHODS
00032    void toLeft() const;
00033    void toRight() const;
00034    void toReverse() const;
00035    void toNextParalogy() const;
00036    hal_offset_t getStartOffset() const;
00037    hal_offset_t getEndOffset() const;
00038    hal_size_t getLength() const;
00039    hal_bool_t getReversed() const;
00040    void getString(std::string& outString) const;
00041 
00042    //TOP ITERATOR METHODS
00043    TopSegmentIteratorPtr copy();
00044    TopSegmentIteratorConstPtr copy() const;
00045    void toChild(BottomSegmentIteratorConstPtr bs, 
00046                         hal_size_t child) const;
00047    void toParseUp(BottomSegmentIteratorConstPtr bs) const;
00048    TopSegment* getTopSegment();
00049    const TopSegment* getTopSegment() const;
00050 
00051    bool inRange() const;
00052 protected:
00053    HDF5TopSegment _topSegment;
00054    mutable hal_offset_t _startOffset;
00055    mutable hal_offset_t _endOffset;
00056    mutable hal_bool_t _reversed;
00057 };
00058 
00059 inline bool HDF5TopSegmentIterator::inRange() const
00060 {
00061   return _topSegment._index >= 0 && _topSegment._index < 
00062      (hal_index_t)_topSegment._genome->_topArray.getSize();
00063 }
00064 
00065 }
00066 #endif
 All Classes Namespaces Functions Variables Friends