Fennel: RegisterReference Class Reference (original) (raw)

A reference to a register. More...

#include <[RegisterReference.h](RegisterReference%5F8h-source.html)>

Inheritance diagram for RegisterReference:

List of all members.

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
RegisterReference ()
Constructor for an invalid RegisterReference.
RegisterReference (ERegisterSet set, unsigned long index, StandardTypeDescriptorOrdinal datatype)
Constructor for a valid RegisterReference.
virtual ~RegisterReference ()
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.
virtual string valueToString () const=0
Returns current value of register.
virtual bool isNull () const=0
Is the register currently set to NULL?
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

A reference to a register.

Base class provides non-templated interface to RegisterRef.

Optionally optimizes subsequent reads and writes and resets pointers.

To provide different properties in RegisterReferences, such as read-only access, and resetability, in a "clean" way would require run-time-polymorphism in the Instruction tree. At this point the extra overhead of function pointers and vtables doesn't seem like the best choice for this performance critical object. So, for the moment, object properties will be internal-state-based vs. object-type-based.

Definition at line 113 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

| RegisterReference::RegisterReference | ( | | ) | [inline, explicit] | | ------------------------------------ | - | | - | -------------------- |

Constructor for a valid RegisterReference.

Parameters:

set Register set
index Register with a given set
datatype The type of the underlying data.

Definition at line 148 of file RegisterReference.h.

| virtual RegisterReference::~RegisterReference | ( | | ) | [inline, virtual] | | ---------------------------------------------- | - | | - | ------------------- |


Member Function Documentation

void RegisterReference::setCalc ( Calculator * calcP )

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 EOutput, EPropByRefOnly, EPropReadOnly, Calculator::getDynamicParamManager(), Calculator::mOutputRegisterByReference, mPDynamicParamManager, mProp, Calculator::mRegisterReset, Calculator::mRegisterSetBinding, mRegisterSetDescP, Calculator::mRegisterSetDescriptor, mRegisterSetP, mResetP, and mSetIndex.

Referenced by Calculator::appendRegRef().

| void RegisterReference::cachePointer | ( | | ) | | ------------------------------------ | - | | - |

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, EPropCachePointer, EPropPtrReset, getBinding(), mCachePtrModified, mCbData, mCbStorage, mIndex, mPData, mProp, mRegisterSetDescP, mSetIndex, and TupleDatum::pData.

Referenced by Calculator::bind(), and Calculator::exec().

| unsigned long RegisterReference::index | ( | | ) | const [inline] | | -------------------------------------- | - | | - | ---------------- |

| bool RegisterReference::isValid | ( | | ) | const [inline] | | ------------------------------- | - | | - | ---------------- |

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]

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]

| string RegisterReference::toString | ( | | ) | const | | ---------------------------------- | - | | - | ----- |

| virtual string RegisterReference::valueToString | ( | | ) | const [pure virtual] | | ----------------------------------------------- | - | | - | ---------------------- |

Returns current value of register.

Implemented in RegisterRef< TMPLT >, RegisterRef< T0 >, RegisterRef< PointerSizeT >, RegisterRef< T1 >, RegisterRef< T2 >, RegisterRef< OP2T >, RegisterRef< T3 >, RegisterRef< T4 >, RegisterRef< RESULT_T >, RegisterRef< SOURCE_T >, RegisterRef< PTR_TYPE >, RegisterRef< bool >, RegisterRef< unsigned __int32 >, and RegisterRef< char * >.

Referenced by Instruction::describeHelper().

| virtual bool RegisterReference::isNull | ( | | ) | const [pure virtual] | | -------------------------------------- | - | | - | ---------------------- |

Is the register currently set to NULL?

Implemented in RegisterRef< TMPLT >, RegisterRef< T0 >, RegisterRef< PointerSizeT >, RegisterRef< T1 >, RegisterRef< T2 >, RegisterRef< OP2T >, RegisterRef< T3 >, RegisterRef< T4 >, RegisterRef< RESULT_T >, RegisterRef< SOURCE_T >, RegisterRef< PTR_TYPE >, RegisterRef< bool >, RegisterRef< unsigned __int32 >, and RegisterRef< char * >.

Referenced by Instruction::describeHelper().

TupleDatum* RegisterReference::getBinding ( bool resetFromNull = false ) const [inline]

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(), 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] | | -------------------------------------------- | - | | - | ------------- |

Defines default properties for registers based on register set.

Definition at line 107 of file RegisterReference.cpp.

References EInput, ELiteral, ELocal, EOutput, EPropNone, EStatus, KInputSetDefault, KLiteralSetDefault, KLocalSetDefault, KOutputSetDefault, KStatusSetDefault, mProp, and mSetIndex.


Member Data Documentation

Behavior properties of this register.

Definition at line 341 of file RegisterReference.h.

Referenced by cachePointer(), RegisterRef< char * >::isNull(), RegisterRef< char * >::isNullable(), RegisterRef< char * >::length(), RegisterRef< char * >::pointer(), RegisterRef< char * >::refer(), setCalc(), setDefaultProperties(), RegisterRef< char * >::storage(), RegisterRef< char * >::toNull(), and RegisterRef< char * >::value().


The documentation for this class was generated from the following files:


Generated on Mon Jun 22 04:00:45 2009 for Fennel by doxygen 1.5.1