Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

pqxx::PQAlloc< T > Class Template Reference

Keep track of a libpq-allocated pointer to be free()d automatically. More...

#include <util.h>

List of all members.

Public Member Functions

 PQAlloc ()
 PQAlloc (T *obj)
 Assume ownership of a pointer.

 ~PQAlloc ()
PQAlloc & operator= (T *obj) throw ()
 Assume ownership of a pointer, freeing the previous one (if any).

 operator bool () const throw ()
 Is this pointer non-null?

bool operator! () const throw ()
 Is this pointer null?

T * operator-> () const throw (PGSTD::logic_error)
 Dereference pointer.

T & operator * () const throw (PGSTD::logic_error)
 Dereference pointer.

T * c_ptr () const throw ()
 Obtain underlying pointer.

void close () throw ()
 Free and reset current pointer (if any).


Detailed Description

template<typename T>
class pqxx::PQAlloc< T >

Keep track of a libpq-allocated pointer to be free()d automatically.

Ownership policy is simple: object dies when PQAlloc object's value does. If the available PostgreSQL development files supply PQfreemem(), this is used to free the memory. If not, free() is used instead. This matters on Windows, where memory allocated by a DLL must be freed by the same DLL.


Constructor & Destructor Documentation

template<typename T>
pqxx::PQAlloc< T >::PQAlloc  
 

template<typename T>
pqxx::PQAlloc< T >::PQAlloc T *    obj [explicit]
 

Assume ownership of a pointer.

template<typename T>
pqxx::PQAlloc< T >::~PQAlloc  
 


Member Function Documentation

template<typename T>
T* pqxx::PQAlloc< T >::c_ptr   const throw ()
 

Obtain underlying pointer.

Ownership of the pointer's memory remains with the PQAlloc object

template<typename T>
void pqxx::PQAlloc< T >::close   throw ()
 

Free and reset current pointer (if any).

template<typename T>
T& pqxx::PQAlloc< T >::operator *   const throw (PGSTD::logic_error)
 

Dereference pointer.

Throws a logic_error if the pointer is null.

template<typename T>
pqxx::PQAlloc< T >::operator bool   const throw ()
 

Is this pointer non-null?

template<typename T>
bool pqxx::PQAlloc< T >::operator!   const throw ()
 

Is this pointer null?

template<typename T>
T* pqxx::PQAlloc< T >::operator->   const throw (PGSTD::logic_error)
 

Dereference pointer.

Throws a logic_error if the pointer is null.

template<typename T>
PQAlloc& pqxx::PQAlloc< T >::operator= T *    obj throw ()
 

Assume ownership of a pointer, freeing the previous one (if any).

If the new and the old pointer are identical, no action is performed.


The documentation for this class was generated from the following file:
Generated on Sat May 24 02:03:12 2003 for libpqxx by doxygen1.3-rc3