All Classes Namespaces Functions Pages
halSequenceIterator.h
/*
* Copyright (C) 2012 by Glenn Hickey (hickey@soe.ucsc.edu)
*
* Released under the MIT license, see LICENSE.txt
*/
#ifndef _HALSEQUENCEITERATOR_H
#define _HALSEQUENCEITERATOR_H
#include "halDefs.h"
#include "halSequence.h"
namespace hal {
class SequenceIterator
{
public:
virtual SequenceIteratorPtr copy() = 0;
virtual SequenceIteratorConstPtr copy() const = 0;
virtual void toNext() const = 0;
virtual void toPrev() const = 0;
virtual Sequence* getSequence() = 0;
virtual const Sequence* getSequence() const = 0;
virtual bool equals(SequenceIteratorConstPtr p2) const = 0;
protected:
friend class counted_ptr<SequenceIterator>;
friend class counted_ptr<const SequenceIterator>;
virtual ~SequenceIterator() = 0;
};
inline SequenceIterator::~SequenceIterator() {}
inline bool operator==(SequenceIteratorConstPtr p1,
SequenceIteratorConstPtr p2)
{
if (p1.get() == NULL || p2.get() == NULL)
{
return p1.get() == NULL && p2.get() == NULL;
}
return p1->equals(p2);
}
inline bool operator!=(SequenceIteratorConstPtr p1,
SequenceIteratorConstPtr p2)
{
return !(p1 == p2);
}
}
#endif
hal::SequenceIterator::getSequence
virtual Sequence * getSequence()=0
hal::SequenceIterator::toNext
virtual void toNext() const =0
hal::SequenceIterator::copy
virtual SequenceIteratorPtr copy()=0
hal::SequenceIterator
Definition: halSequenceIterator.h:18
hal::SequenceIterator::toPrev
virtual void toPrev() const =0
hal::SequenceIterator::equals
virtual bool equals(SequenceIteratorConstPtr p2) const =0
hal::Sequence
Definition: halSequence.h:20