BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslma::ManagedPtrDeleter Class Reference

#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
 
ManagedPtrDeleteroperator= (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.
 

Detailed Description

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:

  • supports a complete set of value-semantic operations
  • is exception-safe
  • is alias-safe
  • is const thread-safe For terminology see bsldoc_glossary .

See bslma_managedptrdeleter

Member Typedef Documentation

◆ Deleter

typedef void(* bslma::ManagedPtrDeleter::Deleter) (void *managedObject, void *cookie)

Constructor & Destructor Documentation

◆ ManagedPtrDeleter() [1/3]

bslma::ManagedPtrDeleter::ManagedPtrDeleter ( )
inline

Create a default ManagedPtrDeleter object that does not refer to any object or factory instance.

◆ ManagedPtrDeleter() [2/3]

bslma::ManagedPtrDeleter::ManagedPtrDeleter ( void *  object,
void *  factory,
Deleter  deleter 
)
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.

◆ ManagedPtrDeleter() [3/3]

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.

◆ ~ManagedPtrDeleter()

bslma::ManagedPtrDeleter::~ManagedPtrDeleter ( )
default

Destroy this object. Note that this trivial destructor's definition is compiler generated.

Member Function Documentation

◆ clear()

void bslma::ManagedPtrDeleter::clear ( )
inline

◆ deleteManagedObject()

void bslma::ManagedPtrDeleter::deleteManagedObject ( ) const
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.

◆ deleter()

ManagedPtrDeleter::Deleter bslma::ManagedPtrDeleter::deleter ( ) const
inline

◆ factory()

void * bslma::ManagedPtrDeleter::factory ( ) const
inline

Return a pointer to the factory instance associated with this deleter.

◆ object()

void * bslma::ManagedPtrDeleter::object ( ) const
inline

◆ operator=()

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.

◆ set()

void bslma::ManagedPtrDeleter::set ( void *  object,
void *  factory,
Deleter  deleter 
)
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.


The documentation for this class was generated from the following file: