|
BDE 4.14.0 Production release
|
#include <bdlcc_objectcatalog.h>
Public Member Functions | |
| BSLMF_NESTED_TRAIT_DECLARATION (ObjectCatalog, bslma::UsesBslmaAllocator) | |
| ObjectCatalog (bslma::Allocator *allocator=0) | |
| ~ObjectCatalog () | |
| Destroy this object catalog. | |
| int | add (TYPE const &object) |
| int | add (bslmf::MovableRef< TYPE > object) |
| int | remove (int handle, TYPE *valueBuffer=0) |
| void | removeAll () |
| void | removeAll (bsl::vector< TYPE > *buffer) |
| void | removeAll (std::vector< TYPE > *buffer) |
| int | replace (int handle, const TYPE &newObject) |
| int | replace (int handle, bslmf::MovableRef< TYPE > newObject) |
| bslma::Allocator * | allocator () const |
| Return the allocator used by this object. | |
| int | find (int handle) const |
| int | find (int handle, TYPE *valueBuffer) const |
| bool | isMember (const TYPE &object) const |
| int | length () const |
| BSLS_DEPRECATE_FEATURE ("bde", "ObjectCataloog::value(handle)", "use 'ObjectCatalogIter::value()' instead") const TYPE &value(int handle) const | |
| void | verifyState () const |
Friends | |
| class | ObjectCatalog_AutoCleanup< TYPE > |
| class | ObjectCatalogIter< TYPE > |
This class defines an efficient indexed object catalog of TYPE objects. This container is exception neutral with no guarantee of rollback: if an exception is thrown during the invocation of a method on a pre-existing instance, the object is left in a valid but undefined state. In no event is memory leaked or a mutex left in a locked state.
|
inlineexplicit |
Create an empty object catalog, using the optionally specified allocator to supply any memory.
|
inline |
| int bdlcc::ObjectCatalog< TYPE >::add | ( | bslmf::MovableRef< TYPE > | object | ) |
Add the value of the specified object to this catalog and return a non-zero integer handle that may be used to refer to the object in future calls to this catalog, leaving object in an unspecified but valid state. The behavior is undefined if the catalog was full.
| int bdlcc::ObjectCatalog< TYPE >::add | ( | TYPE const & | object | ) |
Add the value of the specified object to this catalog and return a non-zero integer handle that may be used to refer to the object in future calls to this catalog. The behavior is undefined if the catalog was full.
|
inline |
| bdlcc::ObjectCatalog< TYPE >::BSLMF_NESTED_TRAIT_DECLARATION | ( | ObjectCatalog< TYPE > | , |
| bslma::UsesBslmaAllocator | |||
| ) |
| bdlcc::ObjectCatalog< TYPE >::BSLS_DEPRECATE_FEATURE | ( | "bde" | , |
| "ObjectCataloog::value(handle)" | , | ||
| "use 'ObjectCatalogIter::value()' instead" | |||
| ) | const & |
Return a const reference to the object having the specified handle. The behavior is undefined unless handle is contained in this catalog.
This method is DEPRECATED because it is not thread-safe. Use find, isMember, or access the object through an iterator.
|
inline |
Locate the object having the specified handle and optionally load its value into the optionally specified valueBuffer. Return zero on success, and a non-zero value if the handle is not contained in this catalog. Note that valueBuffer is assigned into, and thus must point to a valid TYPE instance. Note that the overload with valueBuffer passed is not supported unless TYPE has a copy constructor.
|
inline |
| bool bdlcc::ObjectCatalog< TYPE >::isMember | ( | const TYPE & | object | ) | const |
Return true if the catalog contains an item that compares equal to the specified object and false otherwise.
|
inline |
Return a "snapshot" of the number of items currently contained in this catalog.
|
inline |
Optionally load into the optionally specified valueBuffer the value of the object having the specified handle and remove it from this catalog. Return zero on success, and a non-zero value if the handle is not contained in this catalog. Note that valueBuffer is assigned into, and thus must point to a valid TYPE instance.
|
inline |
|
inline |
|
inline |
Remove all objects that are currently held in this catalog and optionally load into the optionally specified buffer the removed objects.
| int bdlcc::ObjectCatalog< TYPE >::replace | ( | int | handle, |
| bslmf::MovableRef< TYPE > | newObject | ||
| ) |
Replace the object having the specified handle with the specified newObject, leaving newObject in an unspecified but valid state. Return 0 on success, and a non-zero value if the handle is not contained in this catalog.
| int bdlcc::ObjectCatalog< TYPE >::replace | ( | int | handle, |
| const TYPE & | newObject | ||
| ) |
Replace the object having the specified handle with the specified newObject. Return 0 on success, and a non-zero value if the handle is not contained in this catalog.
| void bdlcc::ObjectCatalog< TYPE >::verifyState | ( | ) | const |
Verify that this catalog is in a consistent state. This function is introduced for testing purposes only.
|
friend |
|
friend |