[#BloombergLP-bdld-ManagedDatum] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdld.adoc[bdld]::ManagedDatum :relfileprefix: ../../ :mrdocs: This class implements a smart‐pointer‐like resource manager for a `Datum` object. == Synopsis Declared in `<bdld_manageddatum.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class ManagedDatum; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdld/ManagedDatum/allocator_type.adoc[`allocator_type`] | Alias for the allocator type used by this class. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdld/ManagedDatum/2constructor-0e.adoc[`ManagedDatum`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdld/ManagedDatum/2destructor.adoc[`~ManagedDatum`] [.small]#[destructor]# | Destroy this object and release all dynamically allocated memory managed by this object. | xref:BloombergLP/bdld/ManagedDatum/operator_assign-02.adoc[`operator=`] | Assignment operators | xref:BloombergLP/bdld/ManagedDatum/adopt.adoc[`adopt`] | Take ownership of the specified `obj` and destroy the `Datum` object previously managed by this object. The behavior is undefined unless `obj` was allocated using the same allocator used by this object and is not subsequently destroyed externally using `Datum::destroy`. | xref:BloombergLP/bdld/ManagedDatum/allocator.adoc[`allocator`] | Return `get_allocator().mechanism()`. | xref:BloombergLP/bdld/ManagedDatum/clone.adoc[`clone`] | Assign to this object the specified `value` by making a "deep copy" of `value`, so that any dynamically allocated memory managed by `value` is cloned and not shared with `value`. | xref:BloombergLP/bdld/ManagedDatum/datum.adoc[`datum`] | Return a `const` reference to the `Datum` object managed by this object. | xref:BloombergLP/bdld/ManagedDatum/get_allocator.adoc[`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. | xref:BloombergLP/bdld/ManagedDatum/makeNull.adoc[`makeNull`] | Make the `Datum` object managed by this object null and release all dynamically allocated memory managed by this object. | xref:BloombergLP/bdld/ManagedDatum/operator_star.adoc[`operator*`] | Return a `const` reference to the `Datum` object managed by this object. | xref:BloombergLP/bdld/ManagedDatum/operator_ptr.adoc[`operator‐>`] | Return an address providing non‐modifiable access to the `Datum` object managed by this object. | xref:BloombergLP/bdld/ManagedDatum/print.adoc[`print`] | Format this object to the specified output `stream` at the (absolute value of) the optionally specified indentation `level` and return a reference to the modifiable `stream`. If `level` is specified, optionally specify `spacesPerLevel`, the number of spaces per indentation level for this and all of its nested objects. If `level` is negative, suppress indentation of the first line. If `spacesPerLevel` is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by `level`). If `stream` is not valid on entry, this operation has no effect. | xref:BloombergLP/bdld/ManagedDatum/release.adoc[`release`] | Return, _by_ _value_, the `Datum` object managed by this object and set the managed object to null. Ownership of the previously managed `Datum` object is transferred to the caller. | xref:BloombergLP/bdld/ManagedDatum/swap.adoc[`swap`] | Efficiently exchange the value of this object with the value of the specified `other` object. This method provides the no‐throw exception‐safety guarantee. The behavior is undefined unless this object was created with the same allocator as `other`. | xref:BloombergLP/bdld/ManagedDatum/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<ManagedDatum, IsBitwiseMoveable>`] | 'ManagedDatum' objects are allocator‐aware and bitwise movable. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdld/operator_not_eq-05.adoc[`operator!=`] | Return `true` if the specified `lhs` and `rhs` `ManagedDatum` objects do not have the same value, and `false` otherwise. Two `ManagedDatum` objects do not have the same value if their corresponding managed `Datum` objects do not have the same value. See the function‐level documentation of the `Datum` equality‐comparison operators for details. | xref:BloombergLP/bdld/operator_eq-08a.adoc[`operator==`] | Return `true` if the specified `lhs` and `rhs` `ManagedDatum` objects have the same value, and `false` otherwise. Two `ManagedDatum` objects have the same value if their corresponding managed `Datum` objects have the same value. See the function‐level documentation of the `Datum` equality‐comparison operators for details. | xref:BloombergLP/bdld/swap.adoc[`swap`] | Exchange the values of the specified `a` and `b` objects. This function provides the no‐throw exception‐safety guarantee if the two objects were created with the same allocator and the basic guarantee otherwise. Note that in case the allocators are different this function places a _clone_ of `a` into `b`, and vice versa. See {Value Semantics} on details of the cloning that may happen. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#