VarOffsetAccessor< network > Class Template Reference

VarOffsetAccessor accesses subsequent variable-width attributes that are NOT NULL. More...

#include <AttributeAccessorImpl.h>

Inheritance diagram for VarOffsetAccessor< network >:

AttributeAccessorImpl AttributeAccessor List of all members.

Public Member Functions

void unmarshalValue (TupleAccessor const &tupleAccessor, TupleDatum &value) const
 Unmarshals the attribute's value by setting up the data pointer, length, and null indicator; does not actually copy any data.
bool unmarshalNullableValue (TupleAccessor const &tupleAccessor, TupleDatum &value) const
 Tests the null indicator for this attribute in the tuple's null bit array.
void marshalValueData (PBuffer pDestData, TupleDatum const &value) const
 Marshals value data for the attribute.

Public Attributes

uint iNullBit
 Index of this attribute's null indicator bit in the tuple's bit array, or MAXU for a NOT NULL attribute.
uint iFixedOffset
 Byte offset of this attribute within a stored tuple image, or MAXU if the start is variable.
uint iEndIndirectOffset
 Indirect offset of the end of this attribute within a stored tuple image, or MAXU if the end is fixed.
uint iValueBit
 Index of this attribute's value in the tuple's bit array, or MAXU for a non-bit attribute.
TupleStorageByteLength cbStorage
 Copied from TupleAttributeDescriptor.cbStorage.

Detailed Description

template<bool network>
class VarOffsetAccessor< network >

VarOffsetAccessor accesses subsequent variable-width attributes that are NOT NULL.

Definition at line 204 of file AttributeAccessorImpl.h.


Member Function Documentation

template<bool network>
void VarOffsetAccessor< network >::unmarshalValue ( TupleAccessor const &  tupleAccessor,
TupleDatum value 
) const [inline, virtual]

Unmarshals the attribute's value by setting up the data pointer, length, and null indicator; does not actually copy any data.

Parameters:
tupleAccessor containing TupleAccessor set up with the current tuple image to be accessed
value receives the reference to the unmarshalled value

Implements AttributeAccessor.

Definition at line 208 of file AttributeAccessorImpl.h.

References TupleDatum::cbData, AttributeAccessor::cbStorage, TupleAccessor::getCurrentTupleBuf(), AttributeAccessor::iEndIndirectOffset, TupleDatum::pData, and TupleAccessor::referenceIndirectOffset().

00210     {
00211         TupleAccessor::StoredValueOffset const *pEndOffset =
00212             tupleAccessor.referenceIndirectOffset(iEndIndirectOffset);
00213         uint iOffset = pEndOffset[-1];
00214         uint iEndOffset = pEndOffset[0];
00215         if (network) {
00216             iOffset = ntohs(iOffset);
00217             iEndOffset = ntohs(iEndOffset);
00218         }
00219         value.pData = tupleAccessor.getCurrentTupleBuf() + iOffset;
00220         value.cbData = iEndOffset - iOffset;
00221         assert(value.cbData <= cbStorage);
00222     }

bool AttributeAccessorImpl::unmarshalNullableValue ( TupleAccessor const &  tupleAccessor,
TupleDatum value 
) const [inline, inherited]

Tests the null indicator for this attribute in the tuple's null bit array.

Parameters:
tupleAccessor containing TupleAccessor set up with the current tuple image to be accessed
value receives the null bit
Returns:
true if value is null; false otherwise

Definition at line 60 of file AttributeAccessorImpl.h.

References TupleAccessor::getBitFields(), and TupleDatum::pData.

00062     {
00063         if (tupleAccessor.getBitFields()[iNullBit]) {
00064             value.pData = NULL;
00065             return true;
00066         } else {
00067             return false;
00068         }
00069     }

void AttributeAccessorImpl::marshalValueData ( PBuffer  pDestData,
TupleDatum const &  value 
) const [inline, virtual, inherited]

Marshals value data for the attribute.

Only deals with the data bytes, not length and null indicators.

Parameters:
pDestData the target address where the data should be marshalled
value the value to be marshalled

Implements AttributeAccessor.

Reimplemented in FixedWidthNetworkAccessor16, FixedWidthNetworkAccessor32, and FixedWidthNetworkAccessor64.

Definition at line 71 of file AttributeAccessorImpl.h.

References TupleDatum::cbData, and TupleDatum::pData.

00074     {
00075         memcpy(pDestData,value.pData,value.cbData);
00076     }


Member Data Documentation

uint AttributeAccessor::iNullBit [inherited]

Index of this attribute's null indicator bit in the tuple's bit array, or MAXU for a NOT NULL attribute.

Definition at line 53 of file AttributeAccessor.h.

Referenced by AttributeAccessorImpl::AttributeAccessorImpl(), TupleAccessor::compute(), Java_net_sf_farrago_fennel_FennelStorage_getAccessorXmiForTupleDescriptor(), TupleAccessor::marshal(), and TupleAccessor::unmarshal().

uint AttributeAccessor::iFixedOffset [inherited]

Byte offset of this attribute within a stored tuple image, or MAXU if the start is variable.

Definition at line 59 of file AttributeAccessor.h.

Referenced by AttributeAccessorImpl::AttributeAccessorImpl(), TupleAccessor::compute(), TupleAccessor::initFixedAccessors(), TupleAccessor::marshal(), TupleAccessor::unmarshal(), and FixedOffsetVarWidthAccessor< network >::unmarshalValue().

uint AttributeAccessor::iEndIndirectOffset [inherited]

Indirect offset of the end of this attribute within a stored tuple image, or MAXU if the end is fixed.

Definition at line 65 of file AttributeAccessor.h.

Referenced by AttributeAccessorImpl::AttributeAccessorImpl(), TupleAccessor::marshal(), TupleAccessor::unmarshal(), VarOffsetAccessor< network >::unmarshalValue(), and FixedOffsetVarWidthAccessor< network >::unmarshalValue().

uint AttributeAccessor::iValueBit [inherited]

Index of this attribute's value in the tuple's bit array, or MAXU for a non-bit attribute.

Definition at line 71 of file AttributeAccessor.h.

Referenced by AttributeAccessorImpl::AttributeAccessorImpl(), TupleAccessor::marshal(), and TupleAccessor::unmarshal().

TupleStorageByteLength AttributeAccessor::cbStorage [inherited]

Copied from TupleAttributeDescriptor.cbStorage.

This is not used for anything except assertions.

Definition at line 77 of file AttributeAccessor.h.

Referenced by AttributeAccessorImpl::AttributeAccessorImpl(), TupleAccessor::compute(), TupleAccessor::marshal(), TupleAccessor::unmarshal(), VarOffsetAccessor< network >::unmarshalValue(), and FixedOffsetVarWidthAccessor< network >::unmarshalValue().


The documentation for this class was generated from the following file:
Generated on Mon Jun 22 04:00:49 2009 for Fennel by  doxygen 1.5.1