Ignore:
Timestamp:
Mar 15, 2014, 10:10:37 AM (9 years ago)
Author:
Peter
Message:

closes #784. New class BamPairProxy? to finalize implementation of BamPairIterator?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/omic/BamPairIterator.h

    r3175 r3176  
    6060  class BamPairIterator
    6161    : public boost::iterator_facade<
    62     BamPairIterator<Base>, const BamPair, std::input_iterator_tag
     62    BamPairIterator<Base>, const BamPair, std::input_iterator_tag,
     63    const BamPairProxy
    6364    >
    6465  {
     
    8182    Base iter_;
    8283    Base end_;
    83     BamPair x_;
     84    const BamRead* mate_;
    8485    boost::shared_ptr<std::map<std::string, BamRead> > siam_reads_;
    8586    typedef std::pair<int32_t, int32_t> Position;
     
    8788    friend class boost::iterator_core_access;
    8889
    89     const BamPair& dereference(void) const;
     90    const BamPairProxy dereference(void) const;
    9091    bool equal(const BamPairIterator& other) const;
    9192    void increment(void);
     
    143144
    144145  template<typename Base>
    145   const BamPair&
     146  const BamPairProxy
    146147  BamPairIterator<Base>::dereference(void) const
    147148  {
    148     return x_;
     149    return BamPairProxy(mate_, &*iter_);
    149150  }
    150151
     
    189190        for (; lower!=reads_->end() && lower->first == position; ++lower)
    190191          if (same_query_name(lower->second, *iter_)) {
    191             x_.first() = lower->second;
    192             x_.second() = *iter_;
     192            mate_ = &lower->second;
    193193            return;
    194194          }
     
    199199          mate = siam_reads_->lower_bound(iter_->name());
    200200        if (mate!=siam_reads_->end() && same_query_name(mate->second, *iter_)) {
    201           x_.first() = mate->second;
    202           x_.second() = *iter_;
     201          mate_ = &mate->second;
    203202          return;
    204203        }
Note: See TracChangeset for help on using the changeset viewer.