BDE 4.14.0 Production release
|
#include <bslma_managedptrdeleter.h>
Public Types | |
typedef void(* | Deleter) (void *managedObject, void *cookie) |
Deleter function prototype used to destroy the managed pointer. | |
Public Member Functions | |
ManagedPtrDeleter () | |
ManagedPtrDeleter (void *object, void *factory, Deleter deleter) | |
ManagedPtrDeleter (const ManagedPtrDeleter &original) | |
~ManagedPtrDeleter ()=default | |
ManagedPtrDeleter & | operator= (const ManagedPtrDeleter &rhs) |
void | clear () |
Reset this ManagedPtrDeleter to its default-constructed state. | |
void | set (void *object, void *factory, Deleter deleter) |
void | deleteManagedObject () const |
Deleter | deleter () const |
Return the deleter function associated with this deleter. | |
void * | factory () const |
void * | object () const |
Return a pointer to the managed object associated with this deleter. | |
This complex constrained in-core value-semantic class holds the information necessary for ManagedPtr
to correctly manage its underlying object, namely the addresses of object
and factory
, and the deleter
function, optionally supplied through the constructors or through the set
method. This information is stored in a sub-structure to allow the compiler to copy it more efficiently.
See the {Attributes} section in the component-level documentation. Note that the class invariants are identically the constraints on the individual attributes.
This class:
const
thread-safe For terminology see bsldoc_glossary .typedef void(* bslma::ManagedPtrDeleter::Deleter) (void *managedObject, void *cookie) |
|
inline |
Create a default ManagedPtrDeleter
object that does not refer to any object or factory instance.
|
inline |
Create a ManagedPtrDeleter
object that refers to the object and factory instances located at the specified object
and factory
memory locations, and the specified deleter
. The behavior is undefined unless deleter
is either 0, or points to a function whose behavior is defined if called once with object
and factory
as arguments.
bslma::ManagedPtrDeleter::ManagedPtrDeleter | ( | const ManagedPtrDeleter & | original | ) |
Create a ManagedPtrDeleter
object having the same value as the specified original
object. Note that this trivial copy constructor's definition is compiler generated.
|
default |
Destroy this object. Note that this trivial destructor's definition is compiler generated.
|
inline |
|
inline |
Invoke the deleter object. The behavior is undefined unless deleter
is not 0 and has not already been called on the managed object associated with this deleter.
|
inline |
|
inline |
Return a pointer to the factory instance associated with this deleter.
|
inline |
ManagedPtrDeleter & bslma::ManagedPtrDeleter::operator= | ( | const ManagedPtrDeleter & | rhs | ) |
Assign to this object the value of the specified rhs
object, and return a reference providing modifiable access to this object. Note that this trivial copy-assignment operator's definition is compiler generated.
|
inline |
Set this ManagedPtrDeleter
to refer to the object and factory instances located at the specified object
and factory
memory locations, and the specified deleter
. The behavior is undefined unless deleter
is either 0, or points to a function whose behavior is defined if called once with object
and factory
as arguments.