#include <bdld_manageddatum.h>
List of all members.
Detailed Description
This class implements a smart-pointer-like resource manager for a Datum
object.
See Component bdld_manageddatum
Member Typedef Documentation
Constructor & Destructor Documentation
bdld::ManagedDatum::ManagedDatum |
( |
|
) |
|
bdld::ManagedDatum::ManagedDatum |
( |
const allocator_type & |
allocator |
) |
[explicit] |
Create a ManagedDatum
object having the default (null) value. Optionally specify an allocator
(e.g., the address of a bslma::Allocator
object) to supply memory; otherwise, the default allocator is used. Calling isNull
on the resulting managed Datum
object returns true
.
Create a ManagedDatum
object that assumes ownership of the specified datum
. Optionally specify an allocator
(e.g., the address of a bslma::Allocator
object) to supply memory; otherwise, the default allocator is used. The behavior is undefined unless datum
was allocated using the indicated allocator and is not subsequently destroyed externally using Datum::destroy
.
Create a ManagedDatum
object having the same value as the specified original
object. Optionally specify an allocator
(e.g., the address of a bslma::Allocator
object) used to supply memory; otherwise, the default allocator is used. This operation performs a clone
of the underlying Datum
, see Value Semantics for more detail.
bdld::ManagedDatum::~ManagedDatum |
( |
|
) |
|
Destroy this object and release all dynamically allocated memory managed by this object.
Member Function Documentation
ManagedDatum
objects are allocator-aware and bitwise movable.
Assign to this object the value of the specified rhs
object, and return a non-'const' reference to this object. This operation performs a clone
of the underlying Datum
, see Value Semantics for more detail.
void bdld::ManagedDatum::adopt |
( |
const Datum & |
obj |
) |
|
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
.
void bdld::ManagedDatum::clone |
( |
const Datum & |
value |
) |
|
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
.
void bdld::ManagedDatum::makeNull |
( |
|
) |
|
Make the Datum
object managed by this object null and release all dynamically allocated memory managed by this object.
Datum bdld::ManagedDatum::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.
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
.
const Datum* bdld::ManagedDatum::operator-> |
( |
|
) |
const |
Return an address providing non-modifiable access to the Datum
object managed by this object.
const Datum& bdld::ManagedDatum::operator* |
( |
|
) |
const |
Return a const
reference to the Datum
object managed by this object.
const Datum& bdld::ManagedDatum::datum |
( |
|
) |
const |
Return a const
reference to the Datum
object managed by this object.
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.
bsl::ostream& bdld::ManagedDatum::print |
( |
bsl::ostream & |
stream, |
|
|
int |
level = 0 , |
|
|
int |
spacesPerLevel = 4 | |
|
) |
| | const |
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.
The documentation for this class was generated from the following file: