gstreamermm  1.10.0
Public Member Functions | Protected Member Functions | List of all members
Gst::IteratorBase< CppType > Class Template Reference

The base class for classes that retrieve multiple elements in a thread safe way. More...

#include <gstreamermm/iterator.h>

Inheritance diagram for Gst::IteratorBase< CppType >:
Inheritance graph
[legend]

Public Member Functions

virtual IteratorResult next ()
 Moves to the next iterator item. More...
 
void resync ()
 Resynchronize the iterator. More...
 
bool is_start () const
 Tells if the iterator is at the start of the list (not on the first item, but just before it). More...
 
bool is_end () const
 Tells if the iterator is at the end of the list (just after the last element). More...
 
 operator bool () const
 Tells whether the iterator is valid and can be dereferenced. More...
 
GstIterator* cobj ()
 Provides access to the underlying C GObject. More...
 
const GstIterator* cobj () const
 Provides access to the underlying C GObject. More...
 
virtual ~IteratorBase ()
 Frees the underlying C instance if a take_ownership value of true was used to wrap it. More...
 

Protected Member Functions

 IteratorBase ()
 Default constructor. More...
 
 IteratorBase (const IteratorBase< CppType >&)
 Copy constructor. More...
 
 IteratorBase (GstIterator* castitem, bool take_ownership=true)
 Constructs an IteratorBase from an underlying C object. More...
 
IteratorBase< CppType >& operator= (const IteratorBase< CppType >& other)
 Assignment operator. More...
 

Detailed Description

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

The 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

◆ ~IteratorBase()

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.

◆ IteratorBase() [1/3]

template <class CppType >
Gst::IteratorBase< CppType >::IteratorBase ( )
protected

Default constructor.

◆ IteratorBase() [2/3]

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.

◆ IteratorBase() [3/3]

template <class CppType >
Gst::IteratorBase< CppType >::IteratorBase ( GstIterator *  castitem,
bool  take_ownership = true 
)
explicitprotected

Constructs an IteratorBase from an underlying C object.

Parameters
castitemThe underlying C object.
take_ownershipWhether to take over the underlying C object. If true, C object is freed when wrapper is destroyed.

Member Function Documentation

◆ cobj() [1/2]

template <class CppType >
GstIterator* Gst::IteratorBase< CppType >::cobj ( )
inline

Provides access to the underlying C GObject.

◆ cobj() [2/2]

template <class CppType >
const GstIterator* Gst::IteratorBase< CppType >::cobj ( ) const
inline

Provides access to the underlying C GObject.

◆ is_end()

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.

◆ is_start()

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.

◆ next()

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 >.

◆ operator bool()

template <class CppType >
Gst::IteratorBase< CppType >::operator bool ( ) const

Tells whether the iterator is valid and can be dereferenced.

◆ operator=()

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.

◆ resync()

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.