# Gst::IteratorBase<CppType> Class Template Reference

Gst::IteratorBase - Base class for classes that retrieve multiple elements in a thread safe way. More...

`#include <iterator.h>`

List of all members.

## Public Member Functions
virtual IteratorResult | next ()
| Moves to the next iterator item.
void | resync ()
| Resynchronize the iterator.
bool | is_start () const
| Tells if the iterator is at the start of the list (not on the first item, but just before it).
bool | is_end () const
| Tells if the iterator is at the end of the list (just after the last element).
| operator bool () const
| Tells whether the iterator is valid and can be dereferenced.
GstIterator* | cobj ()
| Provides access to the underlying C GObject.
const GstIterator* | cobj () const
| Provides access to the underlying C GObject.
virtual | ~IteratorBase ()
| Frees the underlying C instance if a take_ownership value of true was used to wrap it.
## Protected Member Functions
| IteratorBase ()
| Default constructor.
| IteratorBase (const IteratorBase<CppType>&)
| Copy constructor.
| IteratorBase (GstIterator* castitem, bool take_ownership=true)
| Constructs an IteratorBase from an underlying C object.
IteratorBase<CppType>& | operator= (const IteratorBase<CppType>& other)
| Assignment operator.

## Detailed Description

### template <class CppType>
class Gst::IteratorBase< CppType >

Gst::IteratorBase - Base class for classes that retrieve multiple elements in a thread safe way.

Classes derived from Gst::IteratorBase are used to retrieve multiple objects from another object in a thread safe way. They are implemented as C++ like input iterators so they do not support multi-passing, but they are usable enough for iterating through a list of items and referencing them in a single pass.

Various GStreamer objects provide access to their internal structures using an iterator.

## Constructor & Destructor Documentation

template <class CppType>

virtual Gst::IteratorBase<CppType>::~IteratorBase | ( |  | ) | `[virtual]`

Frees the underlying C instance if a take_ownership value of true was used to wrap it.

template <class CppType>

Gst::IteratorBase<CppType>::IteratorBase | ( |  | ) | `[protected]`

Default constructor.

template <class CppType>

Gst::IteratorBase<CppType>::IteratorBase | ( | const IteratorBase<CppType>& |  | ) | `[protected]`

Copy constructor.

Please note that copying and assigning merely shares the underlying C object. Operations on the copy are also performed in the underlying C object of the original and if the original is destroyed, the copy is invalid.

template <class CppType>

Gst::IteratorBase<CppType>::IteratorBase | ( | GstIterator * | castitem,
|  | bool | take_ownership = `true` |
| ) |  |  | `[protected]`

Constructs an IteratorBase from an underlying C object.

Parameters:

  | castitem | The underlying C object.
  | take_ownership | Whether to take over the underlying C object. If true, C object is freed when wrapper is destroyed.

## Member Function Documentation

template <class CppType>

const GstIterator* Gst::IteratorBase<CppType>::cobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

template <class CppType>

GstIterator* Gst::IteratorBase<CppType>::cobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

template <class CppType>

bool Gst::IteratorBase<CppType>::is_end | ( |  | ) | const

Tells if the iterator is at the end of the list (just after the last element).

Returns:
  true if the iterator is at the end of the list, false otherwise.

template <class CppType>

bool Gst::IteratorBase<CppType>::is_start | ( |  | ) | const

Tells if the iterator is at the start of the list (not on the first item, but just before it).

Increment the iterator or use Gst::IteratorBasic::begin() to go to the first item.

Returns:
  true if the iterator is at the start of the list, false otherwise.

template <class CppType>

virtual IteratorResult Gst::IteratorBase<CppType>::next | ( |  | ) | `[virtual]`

Moves to the next iterator item.

Returns:
  The result of the iteration. MT safe.

Reimplemented in Gst::Iterator<CppType>.

template <class CppType>

Gst::IteratorBase<CppType>::operator bool | ( |  | ) | const

Tells whether the iterator is valid and can be dereferenced.

template <class CppType>

IteratorBase<CppType>& Gst::IteratorBase<CppType>::operator= | ( | const IteratorBase<CppType>& | other | ) | `[protected]`

Assignment operator.

It replaces the contents of the iterator with the contents of the new one freeing the underlying C object if a take_ownership value of true was used when wrapping it. Please note that copying and assigning merely shares the underlying C object. Operations on the copy are also performed in the underlying C object of the original and if the original is destroyed, the copy is invalid.

template <class CppType>

void Gst::IteratorBase<CppType>::resync | ( |  | ) |

Resynchronize the iterator.

This function is mostly called after next() returns Gst::ITERATOR_RESYNC. A result of Gst::ITERATOR_RESYNC from next() means that a concurrent update was made to the iterator list during iteration and the iterator needs to be resynchronized before continuing. Use this function to resynchronize.

The documentation for this class was generated from the following file:

- iterator.h