SourcePro® API Reference Guide

Product Documentation:
   SourcePro
Documentation Home
List of all members | Public Member Functions
RWDBTBuffer< T > Class Template Reference

Template class that encapsulates a fixed-sized array of elements of type T. More...

#include <rw/db/tbuffer.h>

Inheritance diagram for RWDBTBuffer< T >:
RWDBAbstractBuffer RWDBBinaryVector RWDBDecimalVector RWDBStringVector RWDBVector< T >

Public Member Functions

 RWDBTBuffer (RWSize_T entries=1, RWSize_T width=0)
 
 RWDBTBuffer (T *data, RWSize_T entries=1, RWSize_T width=0)
 
 RWDBTBuffer (T *data, RWDBNullIndicator *indicator, RWSize_T entries=1, RWSize_T width=0)
 
virtual ~RWDBTBuffer ()
 
size_t entries () const
 
bool isNull (size_t index) const
 
const T & operator[] (size_t index) const
 
T & operator[] (size_t index)
 
void paramType (RWDBColumn::ParamType newType)
 
RWDBColumn::ParamType paramType () const
 
void setData (const T &newData)
 
void setData (size_t index, const T &newData)
 
void setNull ()
 
void setNull (size_t index)
 
void unsetNull ()
 
void unsetNull (size_t index)
 

Detailed Description

template<class T>
class RWDBTBuffer< T >

Class RWDBTBuffer encapsulates a fixed-sized array of elements of type T. Memory for these type T elements can be managed explicitly in your applications, or by an RWDBTBuffer itself. In addition, this class keeps a null indicator vector that indicates whether any item in the array is NULL. The class also provides mechanisms for converting buffer items to and from RWDBValue objects, if the chosen type T can be converted.

The parameter T represents the type of object to be inserted into the array, either a class or a fundamental data type. The class T must have:

Note
To create an instance of RWDBTBuffer with the data type RWUString from the Internationalization Module, you must include the header file <rw/db/tbuffer_ustr.h> instead of <rw/db/tbuffer.h>.
Synopsis
#include <rw/db/tbuffer.h>
Example
Please see Example 1 in the entry for RWDBOSql.

Constructor & Destructor Documentation

template<class T>
RWDBTBuffer< T >::RWDBTBuffer ( RWSize_T  entries = 1,
RWSize_T  width = 0 
)
inline

Constructs an RWDBTBuffer with entries entries, and width width. Allocates the array of element-type T of length entries, whose memory is managed by self. entries must be greater than or equal to 1. Allocates the array of null indicators, of length entries, and sets them to false. Memory for the null indicator array is managed by self. If width = 0, the object uses the default width for type T.

template<class T>
RWDBTBuffer< T >::RWDBTBuffer ( T *  data,
RWSize_T  entries = 1,
RWSize_T  width = 0 
)
inline

Same as RWDBTBuffer(RWSize_T,RWSize_T), but the RWDBTBuffer uses data and does not allocate or manage memory for the array. Also, the null indicator array is set to false, and its memory is managed by self.

template<class T>
RWDBTBuffer< T >::RWDBTBuffer ( T *  data,
RWDBNullIndicator indicator,
RWSize_T  entries = 1,
RWSize_T  width = 0 
)
inline

Same as RWDBTBuffer(T*,RWSize_T,RWSize_T), but the RWDBTBuffer uses the null indicator array passed as indicator, and does not allocate or manage memory for the null indicator array.

template<class T>
virtual RWDBTBuffer< T >::~RWDBTBuffer ( )
inlinevirtual

Deletes all data owned by self.

Member Function Documentation

template<class T>
size_t RWDBTBuffer< T >::entries ( ) const
inline

Returns the number of entries.

template<class T>
bool RWDBTBuffer< T >::isNull ( size_t  index) const
inlinevirtual

Performs a bounds check on index in debug mode. Returns true if the entry at index is NULL.

Reimplemented from RWDBAbstractBuffer.

template<class T>
const T& RWDBTBuffer< T >::operator[] ( size_t  index) const
inline

Performs a bounds check on index in debug mode. Returns the entry at index in the array by value. The returned reference may be used as an rvalue.

template<class T>
T& RWDBTBuffer< T >::operator[] ( size_t  index)
inline

Performs a bounds check on index in debug mode. Returns a reference to the entry at index in the array. The returned reference may be used as an lvalue. If using this method to assign a new value to this entry, an explicit call to unsetNull(size_t) using index is needed.

template<class T>
void RWDBTBuffer< T >::paramType ( RWDBColumn::ParamType  newType)
inline

Changes the paramType attribute of self to newType. By default, the paramType is set to RWDBColumn::inParameter. Note that this does not change the definition of the parameter in the database.

template<class T>
RWDBColumn::ParamType RWDBTBuffer< T >::paramType ( ) const
inline

Returns a value indicating the parameter type of the column.

template<class T>
void RWDBTBuffer< T >::setData ( const T &  newData)
inline

Sets all the contents of the array to be newData. Unsets NULL for each entry.

template<class T>
void RWDBTBuffer< T >::setData ( size_t  index,
const T &  newData 
)
inline

Sets the entry at index of the array to be newData. Unsets NULL for the entry at index.

template<class T>
void RWDBTBuffer< T >::setNull ( )
inlinevirtual

Sets NULL for all entries.

Reimplemented from RWDBAbstractBuffer.

template<class T>
void RWDBTBuffer< T >::setNull ( size_t  index)
inlinevirtual

Sets NULL for the entry at index.

Reimplemented from RWDBAbstractBuffer.

template<class T>
void RWDBTBuffer< T >::unsetNull ( )
inlinevirtual

Unsets NULL for all entries.

Reimplemented from RWDBAbstractBuffer.

template<class T>
void RWDBTBuffer< T >::unsetNull ( size_t  index)
inlinevirtual

Unsets NULL for the entry at index.

Reimplemented from RWDBAbstractBuffer.

Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.