BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlcc::ObjectCatalogIter< TYPE > Class Template Reference

#include <bdlcc_objectcatalog.h>

Public Member Functions

 ObjectCatalogIter (const ObjectCatalog< TYPE > &catalog)
 
 ObjectCatalogIter (const ObjectCatalog< TYPE > &catalog, int handle)
 
 ~ObjectCatalogIter ()
 Destroy this iterator and unlock the catalog associated with it.
 
void operator++ ()
 
 operator const void * () const
 Return non-zero if the iterator is valid, and 0 otherwise.
 
bsl::pair< int, TYPE > operator() () const
 
int handle () const
 
const TYPE & value () const
 

Detailed Description

template<class TYPE>
class bdlcc::ObjectCatalogIter< TYPE >

Provide thread safe iteration through all the objects of an object catalog of parameterized TYPE. The order of the iteration is implementation defined. An iterator is valid if it is associated with an object in the catalog, otherwise it is invalid. Thread-safe iteration is provided by (read)locking the object catalog during the iterator's construction and unlocking it at the iterator's destruction. This guarantees that during the life time of an iterator, the object catalog can't be modified (nevertheless, multiple threads can concurrently read the object catalog).

See bdlcc_objectcatalog

Constructor & Destructor Documentation

◆ ObjectCatalogIter() [1/2]

template<class TYPE >
bdlcc::ObjectCatalogIter< TYPE >::ObjectCatalogIter ( const ObjectCatalog< TYPE > &  catalog)
inlineexplicit

Create an iterator for the specified catalog and associate it with the first member of the catalog. If the catalog is empty then the iterator is initialized to be invalid. The catalog is locked for read for the duration of iterator's life.

◆ ObjectCatalogIter() [2/2]

template<class TYPE >
bdlcc::ObjectCatalogIter< TYPE >::ObjectCatalogIter ( const ObjectCatalog< TYPE > &  catalog,
int  handle 
)
inline

Create an iterator for the specified catalog and associate it with the member of the catalog associated with the specified handle. If the catalog is empty or if handle is invalid, then the iterator is initialized to be invalid. The catalog is locked for read for the duration of iterator's life.

◆ ~ObjectCatalogIter()

template<class TYPE >
bdlcc::ObjectCatalogIter< TYPE >::~ObjectCatalogIter ( )
inline

Member Function Documentation

◆ handle()

template<class TYPE >
int bdlcc::ObjectCatalogIter< TYPE >::handle ( ) const
inline

Return the handle referred to by the iterator. The behavior is undefined unless the iterator is valid.

◆ operator()()

template<class TYPE >
bsl::pair< int, TYPE > bdlcc::ObjectCatalogIter< TYPE >::operator() ( ) const
inline

Return a pair containing the handle (as the first element of the pair) and the object (as the second element of the pair) associated with this iterator. The behavior is undefined unless the iterator is valid.

◆ operator++()

template<class TYPE >
void bdlcc::ObjectCatalogIter< TYPE >::operator++ ( )

Advance this iterator to refer to the next object of the associated catalog; if there is no next object in the associated catalog, then this iterator becomes invalid. The behavior is undefined unless this iterator is valid. Note that the order of the iteration is not specified.

◆ value()

template<class TYPE >
const TYPE & bdlcc::ObjectCatalogIter< TYPE >::value ( ) const
inline

Return a const reference to the value referred to by the iterator. The behavior is undefined unless the iterator is valid.


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