RWDBTBuffer<Type> RWDBTSingleBuffer<Type> RWDBAbstract Buffer
Member Functions | |||
entries() isNull() |
operator[]() setData() |
setNull() unsetNull() |
#include <rw/db/tbuffer.h>
A public derivative of RWDBTSingleBuffer<Type> and RWDBAbstractBuffer, class RWDBTBuffer<Type> encapsulates a fixed-size array of Types. Memory for these Types can be managed by the user or by an RWDBTBuffer<Type> 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 RWDBValues, if the chosen Type can be converted.
The parameter Type represents the type of object to be inserted into the Type array, either a class or a fundamental datatype. The class Type must have:
Well-defined copy semantics, meaning T::T(const T&) or the equivalent
Well-defined assignment semantics, meaning
T::operator=(const T&) or the equivalent
Please see Example 1 in the entry for RWDBOSql.
RWDBTBuffer(RWSize_T entries=1, RWSize_T width=0);
Constructs an RWDBTBuffer<Type> with entries entries, and width width. Allocates the array of Types of length entries, whose memory is managed by self. entries is forced to be greater than or equal to 1. Allocates the array of null indicators, of length entries, and sets them to TRUE. Memory for the null indicator array is managed by self. If width = 0, the object uses the default width for the Type.
NOTE:If an invalid value is entered for width, this constructor will ignore it and substitute the default value.
RWDBTBuffer(Type *data, RWSize_T entries=1, RWSize_T width = 0);
Same as above, but the RWDBTBuffer<Type> 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(Type *data, RWDBNullIndicator *ni, RWSize_T entries=1, RWSize_T width = 0);
Same as above, but the RWDBTBuffer<Type> uses the null indicator passed as ni, and does not allocate or manage memory for the null indicator array.
~RWDBTBuffer();
Deletes all data owned by self.
Type& operator[](size_t index);
Performs a bounds check on index in debug mode. Returns a reference to the indexth entry in the Type array. The returned reference may be used as an lvalue.
Type operator[](size_t index) const;
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.
size_t entries() const;
Returns the number of entries.
RWBoolean isNull(size_t index) const;
Performs a bounds check on index in debug mode. Returns TRUE if the indexth entry is NULL.
void setData(const Type& newData);
Sets all the contents of the Type array to be newData. Unsets NULL for each entry.
void setNull();
Sets NULL for all entries.
void setNull(size_t index);
Sets NULL at the indexth entry.
void unsetNull();
Unsets NULL for all entries.
void unsetNull(size_t index);
Unsets NULL at the indexth entry.
©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.