SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
Template class that encapsulates a fixed-sized array of elements of type T. More...
#include <rw/db/tbuffer.h>
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 () |
const T & | operator[] (size_t index) const |
T & | operator[] (size_t index) |
void | setData (const T &newData) |
void | setData (size_t index, const T &newData) |
size_t | entries () const |
void | paramType (RWDBColumn::ParamType newType) |
RWDBColumn::ParamType | paramType () const |
bool | isNull (size_t index) const |
void | setNull () |
void | setNull (size_t index) |
void | unsetNull () |
void | unsetNull (size_t index) |
Class RWDBTBuffer<T> 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<T> 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:
T::T(const T&)
or the equivalentT::operator=(const T&)
or the equivalent<rw/db/tbuffer_ustr.h>
instead of <rw/db/tbuffer.h>
. #include <rw/db/tbuffer.h>
Please see Example 1 in the entry for RWDBOSql.
RWDBTBuffer< T >::RWDBTBuffer | ( | RWSize_T | entries = 1 , |
|
RWSize_T | width = 0 | |||
) | [inline] |
Constructs an RWDBTBuffer<T> 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
.
RWDBTBuffer< T >::RWDBTBuffer | ( | T * | data, | |
RWSize_T | entries = 1 , |
|||
RWSize_T | width = 0 | |||
) | [inline] |
Same as RWDBTBuffer(RWSize_T,RWSize_T), but the RWDBTBuffer<T> 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.
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<T> uses the null indicator array passed as indicator, and does not allocate or manage memory for the null indicator array.
virtual RWDBTBuffer< T >::~RWDBTBuffer | ( | ) | [inline, virtual] |
Deletes all data owned by self.
size_t RWDBTBuffer< T >::entries | ( | ) | const [inline] |
Returns the number of entries
.
bool RWDBTBuffer< T >::isNull | ( | size_t | index | ) | const [inline, virtual] |
Performs a bounds check on index in debug mode. Returns true
if the indexth entry is NULL
.
Reimplemented from RWDBAbstractBuffer.
T& RWDBTBuffer< T >::operator[] | ( | size_t | index | ) | [inline] |
Performs a bounds check on index in debug mode. Returns a reference to the indexth entry 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.
Reimplemented in RWDBBinaryVector, RWDBStringVector, and RWDBDecimalVector.
const T& RWDBTBuffer< T >::operator[] | ( | size_t | index | ) | const [inline] |
Performs a bounds check on index in debug mode. Returns the indexth entry in the array by value. The returned reference may be used as an rvalue
.
RWDBColumn::ParamType RWDBTBuffer< T >::paramType | ( | ) | const [inline] |
Returns a value indicating the parameter type of the column.
Reimplemented from RWDBAbstractBuffer.
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. Returns a reference to self.
Reimplemented from RWDBAbstractBuffer.
void RWDBTBuffer< T >::setData | ( | size_t | index, | |
const T & | newData | |||
) | [inline] |
Sets the indexth entry of the array to be newData. Unsets NULL
for the indexth entry.
void RWDBTBuffer< T >::setData | ( | const T & | newData | ) | [inline] |
Sets all the contents of the array to be newData. Unsets NULL
for each entry.
void RWDBTBuffer< T >::setNull | ( | size_t | index | ) | [inline, virtual] |
Sets NULL
at the indexth entry.
Reimplemented from RWDBAbstractBuffer.
void RWDBTBuffer< T >::setNull | ( | ) | [inline, virtual] |
Sets NULL
for all entries.
Reimplemented from RWDBAbstractBuffer.
void RWDBTBuffer< T >::unsetNull | ( | size_t | index | ) | [inline, virtual] |
Unsets NULL
at the indexth entry.
Reimplemented from RWDBAbstractBuffer.
void RWDBTBuffer< T >::unsetNull | ( | ) | [inline, virtual] |
Unsets NULL
for all entries.
Reimplemented from RWDBAbstractBuffer.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.