Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set | ||
|
||
#include <scoped_ptr.h>
Public Types | |
typedef C | element_type |
The element type. | |
Public Member Functions | |
scoped_ptr_malloc (C *p=NULL) | |
Constructor. | |
~scoped_ptr_malloc () | |
Destructor. If there is a C object, call the Free functor. | |
void | reset (C *p=NULL) |
Reset. | |
C & | operator* () const |
Get the current object. | |
C * | operator-> () const |
C * | get () const |
bool | operator== (C *p) const |
Comparison operators. | |
bool | operator!= (C *p) const |
void | swap (scoped_ptr_malloc &b) |
Swap two scoped pointers. | |
C * | release () |
Release a pointer. |
Definition at line 272 of file scoped_ptr.h.
typedef C operations_research::scoped_ptr_malloc< C, FreeProc >::element_type |
operations_research::scoped_ptr_malloc< C, FreeProc >::scoped_ptr_malloc | ( | C * | p = NULL |
) | [inline, explicit] |
Constructor.
Defaults to intializing with NULL. There is no way to create an uninitialized scoped_ptr. The input parameter must be allocated with an allocator that matches the Free functor. For the default Free functor, this is malloc, calloc, or realloc.
Definition at line 283 of file scoped_ptr.h.
operations_research::scoped_ptr_malloc< C, FreeProc >::~scoped_ptr_malloc | ( | ) | [inline] |
Destructor. If there is a C object, call the Free functor.
Definition at line 286 of file scoped_ptr.h.
void operations_research::scoped_ptr_malloc< C, FreeProc >::reset | ( | C * | p = NULL |
) | [inline] |
Reset.
Calls the Free functor on the current owned object, if any. Then takes ownership of a new object, if given. this->reset(this->get()) works.
Definition at line 293 of file scoped_ptr.h.
C& operations_research::scoped_ptr_malloc< C, FreeProc >::operator* | ( | ) | const [inline] |
Get the current object.
operator* and operator-> will cause an assert() failure if there is no current object.
Definition at line 303 of file scoped_ptr.h.
C* operations_research::scoped_ptr_malloc< C, FreeProc >::operator-> | ( | ) | const [inline] |
Definition at line 308 of file scoped_ptr.h.
C* operations_research::scoped_ptr_malloc< C, FreeProc >::get | ( | ) | const [inline] |
Definition at line 313 of file scoped_ptr.h.
bool operations_research::scoped_ptr_malloc< C, FreeProc >::operator== | ( | C * | p | ) | const [inline] |
Comparison operators.
These return whether a scoped_ptr_malloc and a plain pointer refer to the same object, not just to two different but equal objects. For compatibility wwith the boost-derived implementation, these take non-const arguments.
Definition at line 322 of file scoped_ptr.h.
bool operations_research::scoped_ptr_malloc< C, FreeProc >::operator!= | ( | C * | p | ) | const [inline] |
Definition at line 326 of file scoped_ptr.h.
void operations_research::scoped_ptr_malloc< C, FreeProc >::swap | ( | scoped_ptr_malloc< C, FreeProc > & | b | ) | [inline] |
C* operations_research::scoped_ptr_malloc< C, FreeProc >::release | ( | ) | [inline] |
Release a pointer.
The return value is the current pointer held by this object. If this object holds a NULL pointer, the return value is NULL. After this operation, this object will hold a NULL pointer, and will not own the object any more.
Definition at line 342 of file scoped_ptr.h.