IODA Bundle
|
Represents a smart iterator. More...
#include <SharedIterator.h>
Public Types | |
typedef T::difference_type | difference_type |
Difference type of the managed iterator. Provided for compatibility with C++ STL algorithms. More... | |
typedef T::value_type | value_type |
Value type of the managed iterator. Provided for compatibility with C++ STL algorithms. More... | |
typedef T::reference | reference |
Reference type of the managed iterator. Provided for compatibility with C++ STL algorithms. More... | |
typedef T::pointer | pointer |
Pointer type of the managed iterator. Provided for compatibility with C++ STL algorithms. More... | |
typedef T::iterator_category | iterator_category |
Cagegory of the managed iterator. Provided for compatibility with C++ STL algorithms. More... | |
Public Member Functions | |
template<typename U > | |
SharedIterator (U *it) | |
Creates a smart iterator. More... | |
SharedIterator (const SharedIterator &other) | |
Creates a smart iterator which shares ownership of the iterator object managed by the other smart iterator. More... | |
template<typename U > | |
SharedIterator (const SharedIterator< U > &other) | |
Creates a smart iterator which shares ownership of the iterator object managed by the other smart iterator. More... | |
~SharedIterator () | |
Destroys the managed iterator if there are no more SharedIterator instances referring to it. More... | |
SharedIterator & | operator= (const SharedIterator &other) |
Replaces the wrapped iterator object with the one managed by other. More... | |
bool | operator== (const SharedIterator &other) |
Compares two managed iterator objects. More... | |
bool | operator!= (const SharedIterator &other) |
Compares two managed iterator objects. More... | |
SharedIterator & | operator++ () |
Increments the managed iterator object. More... | |
reference | operator* () const |
Dereferences the managed iterator object. More... | |
pointer | operator-> () const |
Dereferences the managed iterator object. More... | |
T * | get () const |
Returns pointer to the managed iterator object. More... | |
bool | unique () const |
Checks if this is the only SharedIterator instance managing the iterator object. More... | |
long | useCount () const |
Returns the number of SharedIterator instances (including this ) managing the same iterator object. More... | |
Private Member Functions | |
void | destruct () |
Private Attributes | |
T * | it_ |
long * | useCount_ |
Represents a smart iterator.
The SharedIterator class uses reference counting to manage shared ownership of an iterator object. Several instances of SharedIterator may refer to the same iterator object. The managed iterator object is destroyed only when the last SharedIterator pointing to it is destroyed.
Definition at line 20 of file SharedIterator.h.
typedef T::difference_type odc::SharedIterator< T >::difference_type |
Difference type of the managed iterator. Provided for compatibility with C++ STL algorithms.
Definition at line 26 of file SharedIterator.h.
typedef T::iterator_category odc::SharedIterator< T >::iterator_category |
Cagegory of the managed iterator. Provided for compatibility with C++ STL algorithms.
Definition at line 46 of file SharedIterator.h.
typedef T::pointer odc::SharedIterator< T >::pointer |
Pointer type of the managed iterator. Provided for compatibility with C++ STL algorithms.
Definition at line 41 of file SharedIterator.h.
typedef T::reference odc::SharedIterator< T >::reference |
Reference type of the managed iterator. Provided for compatibility with C++ STL algorithms.
Definition at line 36 of file SharedIterator.h.
typedef T::value_type odc::SharedIterator< T >::value_type |
Value type of the managed iterator. Provided for compatibility with C++ STL algorithms.
Definition at line 31 of file SharedIterator.h.
|
inlineexplicit |
Creates a smart iterator.
This templated constructor allows to create a new SharedIterator instance from any pointer to an iterator object it that is implicitly convertible to type T.
this
SharedIterator will result in undefined behavior. Definition at line 59 of file SharedIterator.h.
|
inline |
Creates a smart iterator which shares ownership of the iterator object managed by the other smart iterator.
Definition at line 69 of file SharedIterator.h.
|
inline |
Creates a smart iterator which shares ownership of the iterator object managed by the other smart iterator.
This templated copy-constructor allows to create new SharedIterator from any other SharedIterator who's iterator type is implicitly convertible to T.
Definition at line 84 of file SharedIterator.h.
|
inline |
Destroys the managed iterator if there are no more SharedIterator instances referring to it.
Definition at line 93 of file SharedIterator.h.
|
inlineprivate |
|
inline |
Returns pointer to the managed iterator object.
Definition at line 139 of file SharedIterator.h.
|
inline |
Compares two managed iterator objects.
Definition at line 120 of file SharedIterator.h.
|
inline |
Dereferences the managed iterator object.
Definition at line 133 of file SharedIterator.h.
|
inline |
Increments the managed iterator object.
Definition at line 126 of file SharedIterator.h.
|
inline |
Dereferences the managed iterator object.
Definition at line 136 of file SharedIterator.h.
|
inline |
Replaces the wrapped iterator object with the one managed by other.
Definition at line 99 of file SharedIterator.h.
|
inline |
Compares two managed iterator objects.
Definition at line 114 of file SharedIterator.h.
|
inline |
Checks if this
is the only SharedIterator instance managing the iterator object.
Retuns true
if this
is the only SharedIterator instance managing the current iterator object (i.e. useCount() == 1), otherwise returns false
.
Definition at line 148 of file SharedIterator.h.
|
inline |
Returns the number of SharedIterator instances (including this
) managing the same iterator object.
Definition at line 156 of file SharedIterator.h.
|
private |
Definition at line 171 of file SharedIterator.h.
|
private |
Definition at line 172 of file SharedIterator.h.