Quick Links:

bal | bbl | bdl | bsl

Public Types | Public Member Functions

bslma::ManagedPtrDeleter Class Reference

#include <bslma_managedptrdeleter.h>

List of all members.

Public Types

typedef void(* Deleter )(void *managedObject, void *cookie)

Public Member Functions

 ManagedPtrDeleter ()
 ManagedPtrDeleter (void *object, void *factory, Deleter deleter)
 ManagedPtrDeleter (const ManagedPtrDeleter &original)
 ~ManagedPtrDeleter ()
ManagedPtrDeleteroperator= (const ManagedPtrDeleter &rhs)
void clear ()
void set (void *object, void *factory, Deleter deleter)
void deleteManagedObject () const
Deleter deleter () const
void * factory () const
void * object () const

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:

For terminology see bsldoc_glossary.

See Component bslma_managedptrdeleter


Member Typedef Documentation

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

Deleter function prototype used to destroy the managed pointer.


Constructor & Destructor Documentation

bslma::ManagedPtrDeleter::ManagedPtrDeleter (  ) 

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

bslma::ManagedPtrDeleter::ManagedPtrDeleter ( void *  object,
void *  factory,
Deleter  deleter 
)

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.

bslma::ManagedPtrDeleter::~ManagedPtrDeleter (  ) 

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


Member Function Documentation

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.

void bslma::ManagedPtrDeleter::clear (  ) 

Reset this ManagedPtrDeleter to its default-constructed state.

void bslma::ManagedPtrDeleter::set ( void *  object,
void *  factory,
Deleter  deleter 
)

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.

void bslma::ManagedPtrDeleter::deleteManagedObject (  )  const

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 bslma::ManagedPtrDeleter::deleter (  )  const

Return the deleter function associated with this deleter.

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

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

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

Return a pointer to the managed object associated with this deleter.


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