Made to Order Software Corporation Logo

odbcpp: odbcpp::buffer< T > Class Template Reference

Class used to manage a block of memory. More...

#include <record.h>

Inheritance diagram for odbcpp::buffer< T >:
Collaboration diagram for odbcpp::buffer< T >:

List of all members.

Public Member Functions

 buffer (size_t size=1)
 Allocate the block of data.

T * get () const
 Retrieve the memory pointer.

 ~buffer ()
 Free the block of data.

Private Attributes

T * f_ptr
 The memory pointer.


Detailed Description

template<class T>
class odbcpp::buffer< T >

Class used to manage a block of memory.

This class is used internally to manage a block of memory necessary to dynamically bind to a database column of data.

This class derives from the object class that ensures the reference count is properly managed. Buffers are used in smart pointers and thus can safely be pointed as many times as necessary.

Definition at line 46 of file record.h.


Constructor & Destructor Documentation

template<class T >
odbcpp::buffer< T >::buffer ( size_t  size = 1  )  [inline]

Allocate the block of data.

Initializes the buffer by allocating the necessary block of memory.

Note:
Also a buffer can have a size of 0, it is better to avoid such buffers since nothing can be done with them.
Parameters:
[in] size The size used to allocate the new buffer.

Definition at line 59 of file record.h.

template<class T >
odbcpp::buffer< T >::~buffer (  )  [inline]

Free the block of data.

The destructor ensures that the block of memory allocated by the constructor is freed.

Definition at line 66 of file record.h.

References odbcpp::buffer< T >::f_ptr.


Member Function Documentation

template<class T >
T* odbcpp::buffer< T >::get (  )  const [inline]

Retrieve the memory pointer.

This function returns the memory pointer that the constructor allocated. You can use it as required, but you cannot delete it.

This pointer cannot be null, however, it may pointer to an empty buffer (i.e. 0 size memory block.)

Returns:
The allocated memory pointer

Definition at line 79 of file record.h.

References odbcpp::buffer< T >::f_ptr.


Member Data Documentation

template<class T >
T* odbcpp::buffer< T >::f_ptr [private]

The memory pointer.

This variable holds the buffer memory pointer.

Definition at line 86 of file record.h.

Referenced by odbcpp::buffer< T >::get(), and odbcpp::buffer< T >::~buffer().


The documentation for this class was generated from the following file:
Generated on Mon Sep 19 12:52:27 2011 for odbcpp by  doxygen 1.6.3