Fennel: RegisterRef< TMPLT > Class Template Reference (original) (raw)
A typed group of accessor functions to a register. More...
#include <[RegisterReference.h](RegisterReference%5F8h-source.html)>
Inheritance diagram for RegisterRef< TMPLT >:

| Public Types | |
|---|---|
| enum | ERegisterSet { EFirstSet = 0, ELiteral = 0, EInput = 1, EOutput = 2, ELocal = 3, EStatus = 4, ELastSet, EUnknown = 1000 } |
| Index all register sets. More... | |
| enum | EProperties { EPropNone = 0, EPropReadOnly = 1, EPropCachePointer = 2, EPropPtrReset = 4, EPropByRefOnly = 8 } |
| Properties control behavior of RegisterReference. More... | |
| Public Member Functions | |
| RegisterRef () | |
| Creates an invalid object. | |
| RegisterRef (ERegisterSet set, unsigned long index, StandardTypeDescriptorOrdinal datatype) | |
| Creates a valid register reference. | |
| TMPLT | value () const |
| gets/peeks/reads a value from a register | |
| void | value (TMPLT newV) |
| puts/pokes/sets a value into a register | |
| bool | isNullable () |
| Returns true if the register can be set to null. | |
| void | toNull () |
| Sets a register to null. | |
| bool | isNull () const |
| Checks if register is null. | |
| TMPLT | pointer () const |
| Gets pointer value, rather than what pointer references. | |
| void | pointer (TMPLT newP, TupleStorageByteLength len) |
| Sets pointer value, rather than what pointer references. | |
| TMPLT * | refer () const |
| Gets reference by pointer for non-pointer types. | |
| void | refer (RegisterRef< TMPLT > *from) |
| Refers to other RegisterRef for non-pointer types. | |
| TupleStorageByteLength | length () const |
| Gets length, in bytes, of data buffer. | |
| TupleStorageByteLength | storage () const |
| Gets storage length / maximum length, in bytes, of data buffer. | |
| TupleStorageByteLength | stringLength () const |
| Gets length of string, in bytes, based on string type. | |
| void | length (TupleStorageByteLength newLen) |
| Sets length, in bytes, of data buffer. | |
| void | stringLength (TupleStorageByteLength newLen) |
| Sets length of string, in bytes, based on string type. | |
| string | valueToString () const |
| Returns a nicely formatted string representing register's current value. | |
| void | setCalc (Calculator *calcP) |
| Provides a pointer to encapsulating Calculator. | |
| void | cachePointer () |
| Performs pre-execution optimizations. | |
| ERegisterSet | setIndex () const |
| Returns set index. | |
| unsigned long | index () const |
| Returns register index within a set. | |
| bool | isValid () const |
| Is this a valid RegisterReference? | |
| StandardTypeDescriptorOrdinal | type () const |
| Returns type information. | |
| string | toString () const |
| Provides a nicely formatted string describing this register. | |
| DynamicParamManager * | getDynamicParamManager () const |
| Gets the DynamicParamManager belonging to the Calculator. | |
| TupleDatum * | getBinding (bool resetFromNull=false) const |
| gets the register binding | |
| Static Public Member Functions | |
| static string | getSetName (ERegisterSet set) |
| Returns a string describing the register set. | |
| static string | toString (ERegisterSet set, unsigned long index) |
| Provides a nicely formatted string describing the register for the specified set and index. | |
| Static Public Attributes | |
| static const uint32_t | KLiteralSetDefault |
| Literal set can be cached, and really should be read only. | |
| static const uint32_t | KInputSetDefault = EPropReadOnly |
| Input must be read only. Caching doesn't make sense for input. | |
| static const uint32_t | KOutputSetDefault = EPropNone |
| Caching doesn't make sense for output. | |
| static const uint32_t | KLocalSetDefault |
| Local set can be cached, and must reset pointers if Calculator::exec() is to be called again and NULLs are written or pointers are moved. | |
| static const uint32_t | KStatusSetDefault = EPropNone |
| Status register can be cached if it is never re-bound. | |
| Protected Member Functions | |
| void | setDefaultProperties () |
| Defines default properties for registers based on register set. | |
| Protected Attributes | |
| const ERegisterSet | mSetIndex |
| Register set index. | |
| const unsigned long | mIndex |
| Register index within a register set. | |
| const StandardTypeDescriptorOrdinal | mType |
| Underlying type of register. | |
| TRegisterSetP | mRegisterSetP |
| Array of pointers to register set bindings. | |
| TRegisterSetDescP | mRegisterSetDescP |
| Array of pointers to register set descriptors. | |
| vector< RegisterReference * > * | mResetP |
| RegisterReferences that will be reset before next exec. | |
| bool | mCachePtrModified |
| Cached pointer was set to null or moved. | |
| PBuffer | mPData |
| Cached and/or duplicated data pointer. | |
| TupleStorageByteLength | mCbData |
| Cached and/or duplicated length of mPData;. | |
| TupleStorageByteLength | mCbStorage |
| Cached and/or duplicated capacity of mPData;. | |
| TRegisterRefProp | mProp |
| Behavior properties of this register. | |
| DynamicParamManager * | mPDynamicParamManager |
| The DynamicParamManager set after a call to setCalc. |
Detailed Description
template
class RegisterRef< TMPLT >
A typed group of accessor functions to a register.
Definition at line 353 of file RegisterReference.h.
Member Enumeration Documentation
Index all register sets.
Enumerator:
| EFirstSet | |
|---|---|
| ELiteral | |
| EInput | |
| EOutput | |
| ELocal | |
| EStatus | |
| ELastSet | Insert new register set before this entry. |
| EUnknown |
Definition at line 117 of file RegisterReference.h.
Properties control behavior of RegisterReference.
Note: Values are powers of two to allow bitmasking.
Enumerator:
| EPropNone | No properties set. |
|---|---|
| EPropReadOnly | Prevent writes and re-pointing pData. Enforced only through assert() |
| EPropCachePointer | Keep a pointer to data instead of just in time indexing. |
| EPropPtrReset | Journal pointer changes to allow resetting. |
| EPropByRefOnly | No memory associated. Can only be repointed to other registers. See Calculator::outputRegisterByReference(). |
Definition at line 172 of file RegisterReference.h.
Constructor & Destructor Documentation
Creates a valid register reference.
Parameters:
| set | Register set |
|---|---|
| index | Register with a given set |
| datatype | The type of the underlying data. |
Definition at line 367 of file RegisterReference.h.
Member Function Documentation
template
| TMPLT RegisterRef< TMPLT >::value | ( | | ) | const [inline] | | ---------------------------------------------------------- | - | | - | ---------------- |
gets/peeks/reads a value from a register
Assumes register is not null.
Definition at line 377 of file RegisterReference.h.
Referenced by WinAggHistogram< STDTYPE >::addRow(), castApproxToStrA(), castBooleanToStrA(), CastDateTimeToInt64(), CastDateToStrA(), castExactToStrA(), CastStrAToDate(), CastStrAToTime(), CastStrAToTimestamp(), castStrToApproxA(), castStrToBooleanA(), castStrToExactA(), CastTimestampToStrA(), CastTimeToStrA(), convertDecimal(), convertDoubleToFloat(), convertExactNumberToString(), convertFloatToDouble(), convertFloatToInt(), convertIntToFloat(), convertStringToExactNumber(), ctxInst1(), ctxInst2(), ctxInst3(), ctxInst4(), ctxInst5(), CurrentTime(), CurrentTimestamp(), dynamicVariable(), PointerSub< PTR_TYPE >::exec(), PointerAdd< PTR_TYPE >::exec(), WinAggHistogram< STDTYPE >::getAvg(), WinAggHistogram< STDTYPE >::getCount(), getData(), WinAggHistogram< STDTYPE >::getFirstValue(), WinAggHistogram< STDTYPE >::getLastValue(), WinAggHistogram< STDTYPE >::getMax(), WinAggHistogram< STDTYPE >::getMin(), WinAggHistogram< STDTYPE >::getSum(), LocalTime(), LocalTimestamp(), mathAbs(), mathLn(), mathLog10(), mathPow(), strCmpA(), strCmpOct(), strLenBitA(), strLenCharA(), strLenOctA(), strLikeEscapeA(), strOverlayA4(), strOverlayA5(), strPosA(), strSimilarEscapeA(), strSubStringA3(), strSubStringA4(), strTrimA(), and RegisterRef< char * >::valueToString().
template
| void RegisterRef< TMPLT >::value | ( | TMPLT | newV | ) | [inline] |
|---|
template
| bool RegisterRef< TMPLT >::isNullable | ( | | ) | [inline] | | -------------------------------------------------------------- | - | | - | ---------- |
template
| void RegisterRef< TMPLT >::toNull | ( | | ) | [inline] | | ---------------------------------------------------------- | - | | - | ---------- |
Sets a register to null.
Will append to mResetP to allow register to be reset.
Definition at line 420 of file RegisterReference.h.
Referenced by castApproxToStrA(), castBooleanToStrA(), CastDateTimeToInt64(), CastDateToStrA(), castExactToStrA(), CastStrAToDate(), CastStrAToTime(), CastStrAToTimestamp(), castStrToApproxA(), castStrToBinaryA(), castStrToBooleanA(), castStrToCharA(), castStrToExactA(), castStrToVarBinaryA(), castStrToVarCharA(), CastTimestampToStrA(), CastTimeToStrA(), PointerSub< PTR_TYPE >::exec(), PointerAdd< PTR_TYPE >::exec(), NativeNativeInstruction< TMPLT >::fnSetRegisterToNull(), WinAggHistogramStrA::getFirstValue(), WinAggHistogram< STDTYPE >::getFirstValue(), WinAggHistogramStrA::getLastValue(), WinAggHistogram< STDTYPE >::getLastValue(), WinAggHistogramStrA::getMax(), WinAggHistogram< STDTYPE >::getMax(), WinAggHistogramStrA::getMin(), WinAggHistogram< STDTYPE >::getMin(), WinAggHistogram< STDTYPE >::getSum(), mathAbs(), mathLn(), mathLog10(), mathPow(), strCatA2(), strCatA3(), strCmpA(), strCmpOct(), strCpyA(), strLenBitA(), strLenCharA(), strLenOctA(), strLikeEscapeA(), strOverlayA4(), strOverlayA5(), strPosA(), strSimilarEscapeA(), strSubStringA3(), strSubStringA4(), strToLowerA(), strToUpperA(), and strTrimA().
template
| bool RegisterRef< TMPLT >::isNull | ( | | ) | const [inline, virtual] | | ---------------------------------------------------------- | - | | - | ------------------------- |
Checks if register is null.
Implements RegisterReference.
Definition at line 436 of file RegisterReference.h.
Referenced by WinAggHistogramStrA::addRow(), WinAggHistogram< STDTYPE >::addRow(), castApproxToStrA(), castBooleanToStrA(), CastDateTimeToInt64(), CastDateToStrA(), castExactToStrA(), CastStrAToDate(), CastStrAToTime(), CastStrAToTimestamp(), castStrToApproxA(), castStrToBinaryA(), castStrToBooleanA(), castStrToCharA(), castStrToExactA(), castStrToVarBinaryA(), castStrToVarCharA(), CastTimestampToStrA(), CastTimeToStrA(), ExtendedInstruction::describeArg(), JumpInstruction::describeHelper(), WinAggHistogramStrA::dropRow(), WinAggHistogram< STDTYPE >::dropRow(), PointerSub< PTR_TYPE >::exec(), PointerAdd< PTR_TYPE >::exec(), getData(), mathAbs(), mathLn(), mathLog10(), mathPow(), strCatA2(), strCatA3(), strCpyA(), strLenBitA(), strLenCharA(), strLenOctA(), strLikeEscapeA(), strOverlayA4(), strOverlayA5(), strPosA(), strSimilarEscapeA(), strSubStringA3(), strSubStringA4(), strToLowerA(), strToUpperA(), and strTrimA().
template
| TMPLT RegisterRef< TMPLT >::pointer | ( | | ) | const [inline] | | ------------------------------------------------------------ | - | | - | ---------------- |
Gets pointer value, rather than what pointer references.
Used by PointerInstruction, where TMPLT is a pointer type, never in other Instruction types, where TMPLT is not a pointer.
Definition at line 451 of file RegisterReference.h.
Referenced by castApproxToStrA(), castBooleanToStrA(), CastDateToStrA(), castExactToStrA(), CastStrAToDate(), CastStrAToTime(), CastStrAToTimestamp(), castStrToApproxA(), castStrToBinaryA(), castStrToBooleanA(), castStrToCharA(), castStrToExactA(), castStrToVarBinaryA(), castStrToVarCharA(), CastTimestampToStrA(), CastTimeToStrA(), convertExactNumberToString(), convertStringToExactNumber(), WinAggHistogramStrA::dropRow(), PointerSub< PTR_TYPE >::exec(), PointerAdd< PTR_TYPE >::exec(), LocalTime(), LocalTimestamp(), WinAggHistogramStrA::setReturnReg(), strCatA2(), strCatA3(), strCpyA(), strLenCharA(), strLikeEscapeA(), strOverlayA4(), strOverlayA5(), strPosA(), strSimilarEscapeA(), strSubStringA3(), strSubStringA4(), strToLowerA(), strToUpperA(), and strTrimA().
Sets pointer value, rather than what pointer references.
Used by PointerInstruction, where TMPLT is a pointer type, never in other Instruction types, where TMPLT is not a pointer. Will append to mResetP to allow register to be reset.
Definition at line 469 of file RegisterReference.h.
template
| TMPLT* RegisterRef< TMPLT >::refer | ( | | ) | const [inline] | | ------------------------------------------------------------ | - | | - | ---------------- |
Refers to other RegisterRef for non-pointer types.
Convenience function, replaces: to->pointer(from->pointer(), from->length()) Currently does not support cachepointer or reset as ByRefOnly implies a do-not-care register set.
Definition at line 504 of file RegisterReference.h.
Gets length, in bytes, of data buffer.
This is the actual length of the object pointed to, not the amount of memory allocated for the object. For example, this could be the length, in bytes, of a VARCHAR string.
Definition at line 519 of file RegisterReference.h.
Referenced by castApproxToStrA(), castBooleanToStrA(), CastDateToStrA(), castExactToStrA(), castStrToBinaryA(), castStrToCharA(), castStrToVarBinaryA(), castStrToVarCharA(), CastTimestampToStrA(), CastTimeToStrA(), WinAggHistogramStrA::dropRow(), PointerSub< PTR_TYPE >::exec(), PointerAdd< PTR_TYPE >::exec(), RegisterRef< char * >::refer(), WinAggHistogramStrA::setReturnReg(), strCatA2(), strCatA3(), strCpyA(), RegisterRef< char * >::stringLength(), strLikeEscapeA(), strOverlayA4(), strOverlayA5(), strSimilarEscapeA(), strSubStringA3(), strSubStringA4(), strToLowerA(), strToUpperA(), and strTrimA().
Gets storage length / maximum length, in bytes, of data buffer.
Note that there is no corresponding write storage(arg). Calculator considers cbStorage to be read-only information. Calculator can change neither the defined column width nor the amount of memory allocated.
Definition at line 535 of file RegisterReference.h.
Referenced by WinAggHistogramStrA::addRow(), castApproxToStrA(), castBooleanToStrA(), CastDateToStrA(), castExactToStrA(), castStrToBinaryA(), castStrToCharA(), castStrToVarBinaryA(), castStrToVarCharA(), CastTimestampToStrA(), CastTimeToStrA(), convertExactNumberToString(), WinAggHistogramStrA::dropRow(), PointerSub< PTR_TYPE >::exec(), strCatA2(), strCatA3(), strCpyA(), RegisterRef< char * >::stringLength(), strOverlayA4(), strOverlayA5(), strSubStringA3(), strSubStringA4(), strToLowerA(), and strToUpperA().
Gets length of string, in bytes, based on string type.
Fixed width, CHAR, BINARY: Returns storage() Variable width, VARCHAR, VARBINARY: Returns length()
Definition at line 555 of file RegisterReference.h.
Referenced by CastStrAToDate(), CastStrAToTime(), CastStrAToTimestamp(), castStrToApproxA(), castStrToBinaryA(), castStrToBooleanA(), castStrToCharA(), castStrToExactA(), castStrToVarBinaryA(), castStrToVarCharA(), convertStringToExactNumber(), LocalTime(), LocalTimestamp(), strCpyA(), strLenBitA(), strLenCharA(), strLenOctA(), strOverlayA4(), strOverlayA5(), strPosA(), strSubStringA3(), strSubStringA4(), strToLowerA(), strToUpperA(), and strTrimA().
Sets length, in bytes, of data buffer.
This is the actual length of the object pointed to, not the amount of memory allocated for the object. For example, this could be the length, in bytes, of a VARCHAR string.
Definition at line 570 of file RegisterReference.h.
Sets length of string, in bytes, based on string type.
Fixed width, CHAR/BINARY: has no effect. Variable width, VARCHAR/VARBINARY: acts as a length(arg) wrapper.
Definition at line 591 of file RegisterReference.h.
template
| string RegisterRef< TMPLT >::valueToString | ( | | ) | const [inline, virtual] | | ------------------------------------------------------------------- | - | | - | ------------------------- |
| void RegisterReference::setCalc | ( | Calculator * | calcP | ) | [inherited] |
|---|
Provides a pointer to encapsulating Calculator.
Must be in .cpp file for recursive include requirement reasons. Refers to Calculator and RegisterReference objects. See also Calculator::outputRegisterByReference().
See Calculator::outputRegisterByReference()
Definition at line 79 of file RegisterReference.cpp.
References RegisterReference::EOutput, RegisterReference::EPropByRefOnly, RegisterReference::EPropReadOnly, Calculator::getDynamicParamManager(), Calculator::mOutputRegisterByReference, RegisterReference::mPDynamicParamManager, RegisterReference::mProp, Calculator::mRegisterReset, Calculator::mRegisterSetBinding, RegisterReference::mRegisterSetDescP, Calculator::mRegisterSetDescriptor, RegisterReference::mRegisterSetP, RegisterReference::mResetP, and RegisterReference::mSetIndex.
Referenced by Calculator::appendRegRef().
| void RegisterReference::cachePointer | ( | | ) | [inherited] | | ------------------------------------ | - | | - | ------------- |
Performs pre-execution optimizations.
If CachePointer or PtrReset properties are set, save a pointer directly to the data.
Definition at line 91 of file RegisterReference.cpp.
References TupleDatum::cbData, RegisterReference::EPropCachePointer, RegisterReference::EPropPtrReset, RegisterReference::getBinding(), RegisterReference::mCachePtrModified, RegisterReference::mCbData, RegisterReference::mCbStorage, RegisterReference::mIndex, RegisterReference::mPData, RegisterReference::mProp, RegisterReference::mRegisterSetDescP, RegisterReference::mSetIndex, and TupleDatum::pData.
Referenced by Calculator::bind(), and Calculator::exec().
| ERegisterSet RegisterReference::setIndex | ( | | ) | const [inline, inherited] | | -------------------------------------------------------------------------------------------------------- | - | | - | --------------------------- |
| unsigned long RegisterReference::index | ( | | ) | const [inline, inherited] | | -------------------------------------- | - | | - | --------------------------- |
| bool RegisterReference::isValid | ( | | ) | const [inline, inherited] | | ------------------------------- | - | | - | --------------------------- |
Returns type information.
Definition at line 232 of file RegisterReference.h.
Referenced by WinAggHistogramStrA::addRow(), castApproxToStrA(), castBooleanToStrA(), CastDateTimeToInt64(), CastDateToStrA(), castExactToStrA(), CastStrAToDate(), CastStrAToTime(), CastStrAToTimestamp(), castStrToApproxA(), castStrToBinaryA(), castStrToBooleanA(), castStrToCharA(), castStrToExactA(), castStrToVarBinaryA(), castStrToVarCharA(), CastTimestampToStrA(), CastTimeToStrA(), CurrentTime(), CurrentTimestamp(), WinAggHistogramStrA::dropRow(), CalcAssembler::getRegisterType(), histogramAlloc(), LocalTime(), LocalTimestamp(), mathAbs(), mathLn(), mathLog10(), mathPow(), strCpyA(), strLenBitA(), strLenCharA(), strLenOctA(), strLikeEscapeA(), strOverlayA4(), strOverlayA5(), strPosA(), strSimilarEscapeA(), strSubStringA3(), strSubStringA4(), strToLowerA(), strToUpperA(), and strTrimA().
00232 { 00233 return mType; 00234 }
| static string RegisterReference::getSetName | ( | ERegisterSet | set | ) | [inline, static, inherited] |
|---|
Returns a string describing the register set.
Definition at line 237 of file RegisterReference.h.
Referenced by CalcAssembler::getRegister().
00238 { 00239 switch (set) { 00240 case ELiteral: 00241 return "C"; 00242 case ELocal: 00243 return "L"; 00244 case EInput: 00245 return "I"; 00246 case EOutput: 00247 return "O"; 00248 case EStatus: 00249 return "S"; 00250 default: 00251 throw std::invalid_argument( 00252 "fennel/calculator/RegisterReference::getSetName"); 00253 } 00254 }
| static string RegisterReference::toString | ( | ERegisterSet | set, |
|---|---|---|---|
| unsigned long | index | ||
| ) | [inline, static, inherited] |
| string RegisterReference::toString | ( | | ) | const [inherited] | | ---------------------------------- | - | | - | ------------------- |
| TupleDatum* RegisterReference::getBinding | ( | bool | resetFromNull = false | ) | const [inline, inherited] |
|---|
gets the register binding
Parameters:
| resetFromNull,: | if the register is null, reset the address to the target buffer so the value can be changed. |
|---|
Definition at line 282 of file RegisterReference.h.
References TupleDatum::pData.
Referenced by add(), WinAggHistogramStrA::addRow(), avg(), RegisterReference::cachePointer(), count(), drop(), firstValue(), histogramAlloc(), RegisterRef< char * >::isNull(), lastValue(), RegisterRef< char * >::length(), max(), min(), RegisterRef< char * >::pointer(), RegisterRef< char * >::refer(), sum(), RegisterRef< char * >::toNull(), and RegisterRef< char * >::value().
| void RegisterReference::setDefaultProperties | ( | | ) | [protected, inherited] | | -------------------------------------------- | - | | - | ------------------------ |
Defines default properties for registers based on register set.
Definition at line 107 of file RegisterReference.cpp.
References RegisterReference::EInput, RegisterReference::ELiteral, RegisterReference::ELocal, RegisterReference::EOutput, RegisterReference::EPropNone, RegisterReference::EStatus, RegisterReference::KInputSetDefault, RegisterReference::KLiteralSetDefault, RegisterReference::KLocalSetDefault, RegisterReference::KOutputSetDefault, RegisterReference::KStatusSetDefault, RegisterReference::mProp, and RegisterReference::mSetIndex.
Member Data Documentation
Behavior properties of this register.
Definition at line 341 of file RegisterReference.h.
Referenced by RegisterReference::cachePointer(), RegisterRef< char * >::isNull(), RegisterRef< char * >::isNullable(), RegisterRef< char * >::length(), RegisterRef< char * >::pointer(), RegisterRef< char * >::refer(), RegisterReference::setCalc(), RegisterReference::setDefaultProperties(), RegisterRef< char * >::storage(), RegisterRef< char * >::toNull(), and RegisterRef< char * >::value().
The documentation for this class was generated from the following file:
- /home/pub/open/dev/fennel/calculator/RegisterReference.h
