This class provides a mechanism to build a Datum object having a map value in an exception-safe manner.
Declared in <bdld_datummapbuilder.h>
class DatumMapBuilder;
| Name | Description |
|---|---|
SizeType | SizeType is an alias for a unsigned integral value, representing the capacity or size of a datum map. |
allocator_type | Allocator type used by this builder. |
| Name | Description |
|---|---|
DatumMapBuilder [constructor] | Constructors |
~DatumMapBuilder [destructor] | Destroy this object. If this object is holding a datum map that has not been adopted, then the datum map is disposed after destroying each of its elements. |
append | Append the specified array entries having the specified size to the Datum map being build by this object. The behavior is undefined unless 0 != entries && 0 != size and each element in entries that needs dynamic memory, is allocated with the same allocator that was used to construct this object. The behavior is undefined if commit or sortAndCommit has already been called on this object. |
capacity | Return the capacity of the held Datum map. The behavior is undefined if commit or sortAndCommit has already been called on this object. Note that similar to the capacity of a vector, the returned capacity has no bearing on the value of the Datum being constructed, but does indicate at which point additional memory will be required to grow the Datum map being built. |
commit | Return a Datum map value holding the elements supplied to pushBack or append. The caller is responsible for releasing the resources of the returned Datum object. Calling this method indicates that the caller is finished building the Datum map and no further values shall be appended. The behavior is undefined if any method of this object, other than its destructor, is called after commit invocation. |
get_allocator | Return the allocator used by this object to supply memory. Note that if no allocator was supplied at construction the default allocator in effect at construction is used. |
pushBack | Append the entry with the specified key and the specified value to the Datum map being build by this object. The behavior is undefined if value needs dynamic memory and was allocated using a different allocator than the one used to construct this object. The behavior is also undefined if commit or sortAndCommit has already been called on this object. |
setSorted | Mark the Datum map being built by this object as sorted if the specified value is true and mark it unsorted otherwise. This function does not sort the map entries, or mark them to be sorted later; the function should be used to indicate if the entries are being appended in sorted order. The behavior is undefined if commit or sortAndCommit has already been called on this object. The behavior is also undefined if the map being constructed is marked sorted, but the entries are not appended in sorted order. Note also that the map being constructed is marked unsorted by default. |
size | Return the size of the held Datum map. The behavior is undefined if commit or sortAndCommit has already been called on this object. |
sortAndCommit | Return a Datum map value holding the elements supplied to pushBack or append sorted by their keys. The caller is responsible for releasing the resources of the returned Datum object. Calling this method indicates that the caller is finished building the Datum map and no further values shall be appended. The behavior is undefined if any method of this object, other than its destructor, is called after sortAndCommit invocation. |
operator BloombergLP::bslmf::NestedTraitDeclaration<DatumMapBuilder, UsesBslmaAllocator> | DatumMapBuilder is allocator-aware. |