Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set
// doxy/ or-tools/ src/ base/

operations_research::scoped_ptr_malloc< C, FreeProc > Class Template Reference

scoped_ptr_malloc<> is similar to scoped_ptr<>, but it accepts a second template argument, the functor used to free the object. More...

#include <scoped_ptr.h>

List of all members.

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.


Detailed Description

template<class C, class FreeProc = ScopedPtrMallocFree>
class operations_research::scoped_ptr_malloc< C, FreeProc >

scoped_ptr_malloc<> is similar to scoped_ptr<>, but it accepts a second template argument, the functor used to free the object.

Definition at line 272 of file scoped_ptr.h.


Member Typedef Documentation

template<class C, class FreeProc = ScopedPtrMallocFree>
typedef C operations_research::scoped_ptr_malloc< C, FreeProc >::element_type

The element type.

Definition at line 276 of file scoped_ptr.h.


Constructor & Destructor Documentation

template<class C, class FreeProc = ScopedPtrMallocFree>
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.

template<class C, class FreeProc = ScopedPtrMallocFree>
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.


Member Function Documentation

template<class C, class FreeProc = ScopedPtrMallocFree>
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.

template<class C, class FreeProc = ScopedPtrMallocFree>
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.

template<class C, class FreeProc = ScopedPtrMallocFree>
C* operations_research::scoped_ptr_malloc< C, FreeProc >::operator-> (  )  const [inline]

Definition at line 308 of file scoped_ptr.h.

template<class C, class FreeProc = ScopedPtrMallocFree>
C* operations_research::scoped_ptr_malloc< C, FreeProc >::get (  )  const [inline]

Definition at line 313 of file scoped_ptr.h.

template<class C, class FreeProc = ScopedPtrMallocFree>
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.

template<class C, class FreeProc = ScopedPtrMallocFree>
bool operations_research::scoped_ptr_malloc< C, FreeProc >::operator!= ( C *  p  )  const [inline]

Definition at line 326 of file scoped_ptr.h.

template<class C, class FreeProc = ScopedPtrMallocFree>
void operations_research::scoped_ptr_malloc< C, FreeProc >::swap ( scoped_ptr_malloc< C, FreeProc > &  b  )  [inline]

Swap two scoped pointers.

Definition at line 331 of file scoped_ptr.h.

template<class C, class FreeProc = ScopedPtrMallocFree>
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.


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