Inheritance diagram for TestCalculator:
Public Member Functions | ||||
TestCalculator (DynamicParamManager *pdpm, bool isNullable, ExtendedInstructionDef *instrDef) | ||||
void | setUp () | |||
template<typename T> | ||||
void | setInput (int index, T *valP) | |||
template<typename T> | ||||
void | setInput (int index, T *valP, TupleStorageByteLength length) | |||
template<typename T> | ||||
void | setOutput (int index, T *valP, TupleStorageByteLength cbData, TupleStorageByteLength cbStorage) | |||
void | printOutput () | |||
void | bind () | |||
template<typename T> | ||||
void | getOutput (int i, T &val) | |||
template<typename T> | ||||
void | getOutputP (int i, T &val) | |||
DynamicParamManager * | getDynamicParamManager () const | |||
Gets this calculator instance's DynamicParamManager. | ||||
void | outputRegisterByReference (bool flag) | |||
Pre-execution: Configure output register to be set by reference (default), or by value. | ||||
void | appendInstruction (Instruction *newInst) | |||
Pre-execution: Appends an Instruction to the Calculator. | ||||
void | appendRegRef (RegisterReference *newRef) | |||
Pre-execution: Appends a RegisterReference to the Calculator. | ||||
void | assemble (const char *program) | |||
Pre-execution: Given a serialized program, populates Calculator. | ||||
void | bind (RegisterReference::ERegisterSet regset, TupleData *data, const TupleDescriptor &desc) | |||
Pre-execution: Binds Tuples to Register Sets when XO is populating Calculator. | ||||
void | bind (TupleData *input, TupleData *output, bool takeOwnership=false, const TupleData *outputWrite=0) | |||
| ||||
TupleDescriptor | getOutputRegisterDescriptor () const | |||
Determines Output Tuple format. | ||||
TupleDescriptor | getInputRegisterDescriptor () const | |||
Determines Input Tuple format. | ||||
TupleDescriptor | getStatusRegisterDescriptor () const | |||
Determines Status Tuple format. | ||||
TupleData const *const | getStatusRegister () const | |||
Gets a pointer to Status Register Tuple. | ||||
void | zeroStatusRegister () | |||
Zeroes out the values of all TupleDatum within the Staus Register Tuple. | ||||
void | continueOnException (bool c) | |||
Configures Calculator to either exit immediately upon exceptions or to continue execution. | ||||
void | exec () | |||
Executes program. | ||||
string | warnings () | |||
Returns a formatting string containing all warnings generated during exec(). | ||||
virtual void | initTraceSource (SharedTraceTarget pTraceTarget, std::string name) | |||
For use when initialization has to be deferred until after construction. | ||||
void | trace (TraceLevel level, std::string message) const | |||
Records a trace message. | ||||
bool | isTracing () const | |||
| ||||
bool | isTracingLevel (TraceLevel level) const | |||
Determines whether a particular level is being traced. | ||||
TraceTarget & | getTraceTarget () const | |||
| ||||
SharedTraceTarget | getSharedTraceTarget () const | |||
| ||||
std::string | getTraceSourceName () const | |||
Gets the name of this source. | ||||
void | setTraceSourceName (std::string const &n) | |||
Sets the name of this source. | ||||
TraceLevel | getMinimumTraceLevel () const | |||
void | disableTracing () | |||
Public Attributes | ||||
deque< CalcMessage > | mWarnings | |||
A deque of warnings encapsulated by CalcMessage object. | ||||
Protected Attributes | ||||
vector< Instruction * > | mCode | |||
Program instructions. | ||||
RegisterSetBinding * | mRegisterSetBinding [RegisterReference::ELastSet] | |||
How registers are bound to underlying tuples, indexed by register set (null element means the register set is not bound) Note: Referenced in class RegisterReference and CalcAssembler. | ||||
vector< RegisterReference * > | mRegisterRef [RegisterReference::ELastSet] | |||
All active registers, indexed by register set. | ||||
vector< RegisterReference * > | mRegisterReset | |||
A list of registers to be reset by next call to exec(). | ||||
TupleDescriptor * | mRegisterSetDescriptor [RegisterReference::ELastSet] | |||
A TupleDescriptor for each Register Set (i.e. | ||||
const bool | mIsUsingAssembler | |||
Assembler was/will-be used. | ||||
bool | mIsAssembling | |||
Assembler is actively assembling. | ||||
bool | mOutputRegisterByReference | |||
If set, output register can only be set by reference. | ||||
bool | mContinueOnException | |||
Exceptions cause calculator to return immediately, or do they allow execution to conitnue? | ||||
vector< FixedBuffer * > | mBuffers | |||
Actual storage used by the CalcAssembler for the literal, local and status registers. | ||||
DynamicParamManager * | mPDynamicParamManager | |||
Reference to the Dynamic Parameter Manager. | ||||
Private Attributes | ||||
TupleDescriptor | _tupleDescLiteral | |||
TupleDescriptor | _tupleDescInput | |||
TupleDescriptor | _tupleDescOutput | |||
TupleDescriptor | _tupleDescLocal | |||
TupleDescriptor | _tupleDescStatus | |||
bool | _isNullable | |||
ExtendedInstructionDef * | _instrDef | |||
TupleAccessor | _tupleAccessorLiteral | |||
TupleAccessor | _tupleAccessorInput | |||
TupleAccessor | _tupleAccessorOutput | |||
TupleAccessor | _tupleAccessorLocal | |||
TupleAccessor | _tupleAccessorStatus | |||
boost::scoped_array< FixedBuffer > | _pTupleBufLiteral | |||
boost::scoped_array< FixedBuffer > | _pTupleBufInput | |||
boost::scoped_array< FixedBuffer > | _pTupleBufOutput | |||
boost::scoped_array< FixedBuffer > | _pTupleBufLocal | |||
boost::scoped_array< FixedBuffer > | _pTupleBufStatus | |||
TupleData | _tupleDataLiteral | |||
TupleData | _tupleDataInput | |||
TupleData | _tupleDataOutput | |||
TupleData | _tupleDataLocal | |||
TupleData | _tupleDataStatus | |||
Friends | ||||
class | RegisterRef | |||
class | RegisterReference | |||
class | CalcAssembler |
The Calculator initializes itself with registers appropriate to the instruction, the caller then sets the register values, and executes the program, and checks the result.
Definition at line 225 of file testCalcExtended.cpp.
TestCalculator::TestCalculator | ( | DynamicParamManager * | pdpm, | |
bool | isNullable, | |||
ExtendedInstructionDef * | instrDef | |||
) | [inline] |
Definition at line 249 of file testCalcExtended.cpp.
References setUp().
00253 : Calculator(pdpm, 0, 0, 0, 0, 0, 0), 00254 _isNullable(isNullable), 00255 _instrDef(instrDef), 00256 _pTupleBufLiteral(NULL), 00257 _pTupleBufInput(NULL), 00258 _pTupleBufOutput(NULL), 00259 _pTupleBufLocal(NULL), 00260 _pTupleBufStatus(NULL), 00261 _tupleDataLiteral(), 00262 _tupleDataInput(), 00263 _tupleDataOutput(), 00264 _tupleDataLocal(), 00265 _tupleDataStatus() 00266 { 00267 setUp(); 00268 }
void TestCalculator::setUp | ( | ) | [inline] |
Definition at line 270 of file testCalcExtended.cpp.
References _instrDef, _isNullable, _pTupleBufInput, _pTupleBufLiteral, _pTupleBufLocal, _pTupleBufOutput, _pTupleBufStatus, _tupleAccessorInput, _tupleAccessorLiteral, _tupleAccessorLocal, _tupleAccessorOutput, _tupleAccessorStatus, _tupleDataInput, _tupleDataLiteral, _tupleDataLocal, _tupleDataOutput, _tupleDataStatus, _tupleDescInput, _tupleDescLiteral, _tupleDescLocal, _tupleDescOutput, _tupleDescStatus, TupleData::compute(), TupleAccessor::compute(), FixedBuffer, TupleAccessor::getMaxByteCount(), ExtendedInstructionDef::getParameterTypes(), StandardTypeDescriptorFactory::newDataType(), TupleAccessor::setCurrentTupleBuf(), TUPLE_FORMAT_ALL_FIXED, and TupleAccessor::unmarshal().
Referenced by TestCalculator().
00270 { 00271 const vector<StandardTypeDescriptorOrdinal> parameterTypes = 00272 _instrDef->getParameterTypes(); 00273 // assume first parameter is out, rest are in 00274 StandardTypeDescriptorFactory typeFactory; 00275 for (uint i = 0; i < parameterTypes.size(); i++) { 00276 StoredTypeDescriptor const &typeDesc = 00277 typeFactory.newDataType(parameterTypes[i]); 00278 if (i == 0) { 00279 // 0th parameter is "OUT" 00280 _tupleDescOutput.push_back( 00281 TupleAttributeDescriptor(typeDesc, _isNullable)); 00282 } else if (i > 0) { 00283 // other parameters are "IN" 00284 _tupleDescInput.push_back( 00285 TupleAttributeDescriptor(typeDesc, _isNullable)); 00286 } 00287 } 00288 // Create a tuple accessor from the description 00289 // 00290 // Note: Must use a NOT_NULL_AND_FIXED accessor when creating 00291 // a tuple out of the air like this, otherwise unmarshal() 00292 // does not know what to do. If you need a STANDARD type tuple 00293 // that supports nulls, it has to be built as a copy. 00294 _tupleAccessorLiteral.compute( 00295 _tupleDescLiteral, TUPLE_FORMAT_ALL_FIXED); 00296 _tupleAccessorInput.compute(_tupleDescInput, TUPLE_FORMAT_ALL_FIXED); 00297 _tupleAccessorOutput.compute(_tupleDescOutput, TUPLE_FORMAT_ALL_FIXED); 00298 _tupleAccessorLocal.compute(_tupleDescLocal, TUPLE_FORMAT_ALL_FIXED); 00299 _tupleAccessorStatus.compute(_tupleDescStatus, TUPLE_FORMAT_ALL_FIXED); 00300 // Allocate memory for the tuple 00301 _pTupleBufLiteral.reset( 00302 new FixedBuffer[_tupleAccessorLiteral.getMaxByteCount()]); 00303 _pTupleBufInput.reset( 00304 new FixedBuffer[_tupleAccessorInput.getMaxByteCount()]); 00305 _pTupleBufOutput.reset( 00306 new FixedBuffer[_tupleAccessorOutput.getMaxByteCount()]); 00307 _pTupleBufLocal.reset( 00308 new FixedBuffer[_tupleAccessorLocal.getMaxByteCount()]); 00309 _pTupleBufStatus.reset( 00310 new FixedBuffer[_tupleAccessorStatus.getMaxByteCount()]); 00311 // Link memory to accessor 00312 _tupleAccessorLiteral.setCurrentTupleBuf( 00313 _pTupleBufLiteral.get(), false); 00314 _tupleAccessorInput.setCurrentTupleBuf(_pTupleBufInput.get(), false); 00315 _tupleAccessorOutput.setCurrentTupleBuf(_pTupleBufOutput.get(), false); 00316 _tupleAccessorLocal.setCurrentTupleBuf(_pTupleBufLocal.get(), false); 00317 _tupleAccessorStatus.setCurrentTupleBuf(_pTupleBufStatus.get(), false); 00318 // Create a vector of TupleDatum objects based on the 00319 // description we built 00320 _tupleDataLiteral.compute(_tupleDescLiteral); 00321 _tupleDataInput.compute(_tupleDescInput); 00322 _tupleDataOutput.compute(_tupleDescOutput); 00323 _tupleDataLocal.compute(_tupleDescLocal); 00324 _tupleDataStatus.compute(_tupleDescStatus); 00325 // Do something mysterious. Probably binding pointers in the 00326 // accessor to items in the TupleData vector. 00327 _tupleAccessorLiteral.unmarshal(_tupleDataLiteral); 00328 _tupleAccessorInput.unmarshal(_tupleDataInput); 00329 _tupleAccessorOutput.unmarshal(_tupleDataOutput); 00330 _tupleAccessorLocal.unmarshal(_tupleDataLocal); 00331 }
void TestCalculator::setInput | ( | int | index, | |
T * | valP | |||
) | [inline] |
Definition at line 334 of file testCalcExtended.cpp.
References _tupleDataInput, _tupleDataLiteral, _tupleDataLocal, _tupleDataOutput, _tupleDescInput, _tupleDescLiteral, _tupleDescLocal, _tupleDescOutput, and TuplePrinter::print().
Referenced by testConvertDecimal(), testConvertDoubleToFloat(), testConvertExactNumberToString(), testConvertFloatToDouble(), testConvertFloatToIntTypes(), testConvertIntTypesToFloat(), and testConvertStringToExactNumber().
00335 { 00336 // reinterpret_cast<T *>(const_cast<PBuffer>( 00337 // _tupleDataInput[index].pData)) = valP; 00338 _tupleDataInput[index].pData = reinterpret_cast<const uint8_t *>(valP); 00339 if (true) { 00340 // Print out the nullable tuple 00341 TuplePrinter tuplePrinter; 00342 printf("Literals\n"); 00343 tuplePrinter.print(cout, _tupleDescLiteral, _tupleDataLiteral); 00344 printf("\nInput\n"); 00345 tuplePrinter.print(cout, _tupleDescInput, _tupleDataInput); 00346 cout << endl; 00347 printf("\nOutput\n"); 00348 tuplePrinter.print(cout, _tupleDescOutput, _tupleDataOutput); 00349 cout << endl; 00350 printf("\nLocal\n"); 00351 tuplePrinter.print(cout, _tupleDescLocal, _tupleDataLocal); 00352 cout << endl; 00353 } 00354 }
void TestCalculator::setInput | ( | int | index, | |
T * | valP, | |||
TupleStorageByteLength | length | |||
) | [inline] |
Definition at line 356 of file testCalcExtended.cpp.
References _tupleDataInput, _tupleDataLiteral, _tupleDataLocal, _tupleDataOutput, _tupleDescInput, _tupleDescLiteral, _tupleDescLocal, _tupleDescOutput, and TuplePrinter::print().
00357 { 00358 // reinterpret_cast<T *>(const_cast<PBuffer>( 00359 // _tupleDataInput[index].pData)) = valP; 00360 _tupleDataInput[index].pData = reinterpret_cast<const uint8_t *>(valP); 00361 _tupleDataInput[index].cbData = length; 00362 if (true) { 00363 // Print out the nullable tuple 00364 TuplePrinter tuplePrinter; 00365 printf("Literals\n"); 00366 tuplePrinter.print(cout, _tupleDescLiteral, _tupleDataLiteral); 00367 printf("\nInput\n"); 00368 tuplePrinter.print(cout, _tupleDescInput, _tupleDataInput); 00369 cout << endl; 00370 printf("\nOutput\n"); 00371 tuplePrinter.print(cout, _tupleDescOutput, _tupleDataOutput); 00372 cout << endl; 00373 printf("\nLocal\n"); 00374 tuplePrinter.print(cout, _tupleDescLocal, _tupleDataLocal); 00375 cout << endl; 00376 } 00377 }
void TestCalculator::setOutput | ( | int | index, | |
T * | valP, | |||
TupleStorageByteLength | cbData, | |||
TupleStorageByteLength | cbStorage | |||
) | [inline] |
Definition at line 380 of file testCalcExtended.cpp.
References _tupleDataInput, _tupleDataLiteral, _tupleDataLocal, _tupleDataOutput, _tupleDescInput, _tupleDescLiteral, _tupleDescLocal, _tupleDescOutput, and TuplePrinter::print().
Referenced by testConvertExactNumberToString().
00385 { 00386 // reinterpret_cast<T *>(const_cast<PBuffer>( 00387 // _tupleDataOutput[index].pData)) = valP; 00388 _tupleDataOutput[index].pData = reinterpret_cast<const uint8_t *>(valP); 00389 _tupleDataOutput[index].cbData = cbData; 00390 _tupleDescOutput[index].cbStorage = cbStorage; 00391 if (true) { 00392 // Print out the nullable tuple 00393 TuplePrinter tuplePrinter; 00394 printf("Literals\n"); 00395 tuplePrinter.print(cout, _tupleDescLiteral, _tupleDataLiteral); 00396 printf("\nInput\n"); 00397 tuplePrinter.print(cout, _tupleDescInput, _tupleDataInput); 00398 cout << endl; 00399 printf("\nOutput\n"); 00400 tuplePrinter.print(cout, _tupleDescOutput, _tupleDataOutput); 00401 cout << endl; 00402 printf("\nLocal\n"); 00403 tuplePrinter.print(cout, _tupleDescLocal, _tupleDataLocal); 00404 cout << endl; 00405 } 00406 }
void TestCalculator::printOutput | ( | ) | [inline] |
Definition at line 407 of file testCalcExtended.cpp.
References _tupleDataOutput, _tupleDescOutput, and TuplePrinter::print().
Referenced by testConvertDecimal(), testConvertDoubleToFloat(), testConvertExactNumberToString(), testConvertFloatToDouble(), testConvertFloatToIntTypes(), testConvertIntTypesToFloat(), and testConvertStringToExactNumber().
00407 { 00408 TuplePrinter tuplePrinter; 00409 printf("\nOutput\n"); 00410 tuplePrinter.print(cout, _tupleDescOutput, _tupleDataOutput); 00411 cout << endl; 00412 }
void TestCalculator::bind | ( | ) | [inline] |
Definition at line 413 of file testCalcExtended.cpp.
References _tupleDataInput, _tupleDataLiteral, _tupleDataLocal, _tupleDataOutput, _tupleDataStatus, _tupleDescInput, _tupleDescLiteral, _tupleDescLocal, _tupleDescOutput, _tupleDescStatus, Calculator::bind(), RegisterReference::EInput, RegisterReference::ELiteral, RegisterReference::ELocal, RegisterReference::EOutput, and RegisterReference::EStatus.
Referenced by testConvertDecimal(), testConvertDoubleToFloat(), testConvertExactNumberToString(), testConvertFloatToDouble(), testConvertFloatToIntTypes(), testConvertIntTypesToFloat(), and testConvertStringToExactNumber().
00414 { 00415 Calculator::bind( 00416 RegisterReference::ELiteral, 00417 &_tupleDataLiteral, 00418 _tupleDescLiteral); 00419 Calculator::bind( 00420 RegisterReference::EInput, 00421 &_tupleDataInput, 00422 _tupleDescInput); 00423 Calculator::bind( 00424 RegisterReference::EOutput, 00425 &_tupleDataOutput, 00426 _tupleDescOutput); 00427 Calculator::bind( 00428 RegisterReference::ELocal, 00429 &_tupleDataLocal, 00430 _tupleDescLocal); 00431 Calculator::bind( 00432 RegisterReference::EStatus, 00433 &_tupleDataStatus, 00434 _tupleDescStatus); 00435 }
void TestCalculator::getOutput | ( | int | i, | |
T & | val | |||
) | [inline] |
Definition at line 438 of file testCalcExtended.cpp.
References _tupleDataOutput.
Referenced by testConvertDecimal(), testConvertDoubleToFloat(), testConvertFloatToDouble(), testConvertFloatToIntTypes(), testConvertIntTypesToFloat(), and testConvertStringToExactNumber().
00441 { 00442 val = *(reinterpret_cast<T *>(const_cast<PBuffer>( 00443 _tupleDataOutput[i].pData))); 00444 }
void TestCalculator::getOutputP | ( | int | i, | |
T & | val | |||
) | [inline] |
Definition at line 447 of file testCalcExtended.cpp.
References _tupleDataOutput.
Referenced by testConvertExactNumberToString().
00450 { 00451 val = (reinterpret_cast<T>(const_cast<PBuffer>( 00452 _tupleDataOutput[i].pData))); 00453 }
DynamicParamManager* Calculator::getDynamicParamManager | ( | ) | const [inline, inherited] |
Gets this calculator instance's DynamicParamManager.
Definition at line 86 of file Calculator.h.
Referenced by RegisterReference::setCalc().
00086 { 00087 return mPDynamicParamManager; 00088 }
void Calculator::outputRegisterByReference | ( | bool | flag | ) | [inherited] |
Pre-execution: Configure output register to be set by reference (default), or by value.
Default: True.
If flag is true, output register can only be set by reference using the reference "REF" instructions, PointerRef and NativeRef. Copy by value into the output register is disallowed, as the registers may point to another read-only register set. Reading from the output register in this mode is possible, but should only occur after the appropriate REF instruction. Output register may be passed to the Calculator in a don't care state.
If flag is false, output register is assumed to point to appropriately allocated memory and is set using copy by value instructions.
Must be set before appending instructions.
Definition at line 121 of file Calculator.cpp.
References Calculator::mOutputRegisterByReference.
Referenced by CalcAssemblerTestCase::assemble(), CalcExtWinAggFuncTest::initWindowedAggDataBlock(), unitTestBool(), unitTestFloat(), unitTestLong(), unitTestNullableLocal(), unitTestPointer(), unitTestPointerCache(), unitTestStatusRegister(), unitTestWarnings(), WinAggAddTest(), WinAggAddTestStr(), WinAggDropTest(), and WinAggDropTestStr().
00122 { 00123 mOutputRegisterByReference = flag; 00124 }
void Calculator::appendInstruction | ( | Instruction * | newInst | ) | [inline, inherited] |
Pre-execution: Appends an Instruction to the Calculator.
Definition at line 120 of file Calculator.h.
Referenced by CalcAssembler::addInstruction(), testConvertDecimal(), testConvertDoubleToFloat(), testConvertExactNumberToString(), testConvertFloatToDouble(), testConvertFloatToIntTypes(), testConvertIntTypesToFloat(), testConvertStringToExactNumber(), unitTestBool(), unitTestFloat(), unitTestLong(), unitTestNullableLocal(), unitTestPointer(), unitTestPointerCache(), unitTestStatusRegister(), and unitTestWarnings().
00121 { 00122 assert(mIsUsingAssembler ? mIsAssembling : true); 00123 mCode.push_back(newInst); 00124 }
void Calculator::appendRegRef | ( | RegisterReference * | newRef | ) | [inline, inherited] |
Pre-execution: Appends a RegisterReference to the Calculator.
Must occur only before a call to exec() or bind()
Definition at line 129 of file Calculator.h.
References RegisterReference::EInput, RegisterReference::ELastSet, RegisterReference::ELiteral, RegisterReference::ELocal, RegisterReference::EOutput, RegisterReference::EStatus, RegisterReference::setCalc(), and RegisterReference::setIndex().
Referenced by testConvertDecimal(), testConvertDoubleToFloat(), testConvertExactNumberToString(), testConvertFloatToDouble(), testConvertFloatToIntTypes(), testConvertIntTypesToFloat(), testConvertStringToExactNumber(), unitTestBool(), unitTestFloat(), unitTestLong(), unitTestNullableLocal(), unitTestPointer(), unitTestPointerCache(), unitTestStatusRegister(), and unitTestWarnings().
00130 { 00131 assert(mIsUsingAssembler ? mIsAssembling : true); 00132 assert(newRef->setIndex() < RegisterReference::ELastSet); 00133 00134 // do not allow more RegisterReferences after bind() 00135 assert(!mRegisterSetBinding[RegisterReference::ELiteral]); 00136 assert(!mRegisterSetBinding[RegisterReference::EInput]); 00137 assert(!mRegisterSetBinding[RegisterReference::EOutput]); 00138 assert(!mRegisterSetBinding[RegisterReference::ELocal]); 00139 assert(!mRegisterSetBinding[RegisterReference::EStatus]); 00140 00141 mRegisterRef[newRef->setIndex()].push_back(newRef); 00142 newRef->setCalc(this); 00143 }
void Calculator::assemble | ( | const char * | program | ) | [inherited] |
Pre-execution: Given a serialized program, populates Calculator.
Given a serialized program, creates register sets, sets up literals and prepares instructions
Definition at line 127 of file Calculator.cpp.
References CalcAssembler::assemble(), InstructionFactory::extendedSignatures(), Calculator::mIsAssembling, Calculator::mIsUsingAssembler, InstructionFactory::signatures(), TRACE_FINE, and TRACE_FINEST.
Referenced by CalcAssemblerTestCase::assemble(), CalcExtWinAggFuncTest::initWindowedAggDataBlock(), CalcExtCastTest::testCalcExtCastApproxToString(), CalcExtCastTest::testCalcExtCastBigExactToString(), CalcExtCastTest::testCalcExtCastBooleanToChar(), CalcExtCastTest::testCalcExtCastBooleanToVarChar(), CalcExtCastTest::testCalcExtCastCharToBoolean(), CalcExtCastTest::testCalcExtCastCharToDecimal(), CalcExtCastTest::testCalcExtCastCharToExact(), CalcExtCastTest::testCalcExtCastDecimalToChar(), CalcExtCastTest::testCalcExtCastDecimalToStringTruncates(), CalcExtCastTest::testCalcExtCastDecimalToVarChar(), CalcExtCastTest::testCalcExtCastExactToChar(), CalcExtCastTest::testCalcExtCastExactToStringTruncates(), CalcExtCastTest::testCalcExtCastExactToVarChar(), CalcExtCastTest::testCalcExtCastStringToApprox(), CalcExtCastTest::testCalcExtCastStringToChar(), CalcExtCastTest::testCalcExtCastStringToDecimalFails(), CalcExtCastTest::testCalcExtCastStringToDecimalMinMax(), CalcExtCastTest::testCalcExtCastStringToDecimalRange(), CalcExtCastTest::testCalcExtCastStringToExactFails(), CalcExtCastTest::testCalcExtCastStringToVarChar(), CalcExtCastTest::testCalcExtCastVarCharToBoolean(), CalcExtCastTest::testCalcExtCastVarCharToDecimal(), CalcExtCastTest::testCalcExtCastVarCharToExact(), CalcExtContextTest::testCalcExtContext(), CalcExtDateTimeTest::testCalcExtConvertDateToString(), CalcExtDynamicVariableTest::testCalcExtDynamicVariable(), CalcExtDateTimeTest::testCalcExtLocalTime(), CalcExtDateTimeTest::testCalcExtLocalTimestamp(), CalcExtMathTest::testCalcExtMathAbs(), CalcExtMathTest::testCalcExtMathLogarithms(), CalcExtMathTest::testCalcExtMathPow(), CalcExtRegExpTest::testCalcExtRegExpLikeAChar(), CalcExtRegExpTest::testCalcExtRegExpLikeAVarChar(), CalcExtRegExpTest::testCalcExtRegExpSimilarAChar(), CalcExtRegExpTest::testCalcExtRegExpSimilarAVarChar(), CalcExtStringTest::testCalcExtStringCatA2(), CalcExtStringTest::testCalcExtStringCatA3(), CalcExtStringTest::testCalcExtStringCmpA(), CalcExtStringTest::testCalcExtStringCmpOct(), CalcExtStringTest::testCalcExtStringLenBitA(), CalcExtStringTest::testCalcExtStringLenCharA(), CalcExtStringTest::testCalcExtStringLenOctA(), CalcExtStringTest::testCalcExtStringOverlayA4(), CalcExtStringTest::testCalcExtStringOverlayA5(), CalcExtStringTest::testCalcExtStringPosA(), CalcExtStringTest::testCalcExtStringSubStringA3(), CalcExtStringTest::testCalcExtStringSubStringA4(), CalcExtStringTest::testCalcExtStringToANull(), CalcExtStringTest::testCalcExtStringToLower(), CalcExtStringTest::testCalcExtStringToUpper(), CalcExtStringTest::testCalcExtStringTrim(), CalcMiscTest::testCalcRaise(), CalcMiscTest::testCalcRefInst(), CalcMiscTest::testCalcReturn(), CalcMiscTest::testCalcStatusReg(), CalcMiscTest::testCalcStatusRegZero(), WinAggAddTest(), WinAggAddTestStr(), WinAggDropTest(), and WinAggDropTestStr().
00128 { 00129 assert(mIsUsingAssembler); 00130 00131 FENNEL_TRACE( 00132 TRACE_FINEST, 00133 "Calculator instructions:" << endl << 00134 InstructionFactory::signatures()); 00135 FENNEL_TRACE( 00136 TRACE_FINEST, 00137 "Calculator extended instructions:" << endl << 00138 InstructionFactory::extendedSignatures()); 00139 FENNEL_TRACE( 00140 TRACE_FINE, 00141 "Calculator assembly = |" << endl 00142 << program << "|" << endl); 00143 00144 mIsAssembling = true; 00145 CalcAssembler assembler(this); 00146 assembler.assemble(program); 00147 mIsAssembling = false; 00148 }
void Calculator::bind | ( | RegisterReference::ERegisterSet | regset, | |
TupleData * | data, | |||
const TupleDescriptor & | desc | |||
) | [inherited] |
Pre-execution: Binds Tuples to Register Sets when XO is populating Calculator.
Allows for the initial bind of externally allocated register memory tuples. Used only when tuples are allocated by XO, not by Assembler
Definition at line 164 of file Calculator.cpp.
References RegisterReference::cachePointer(), RegisterReference::ELastSet, RegisterReference::ELiteral, RegisterReference::ELocal, Calculator::mIsAssembling, Calculator::mIsUsingAssembler, Calculator::mRegisterRef, Calculator::mRegisterReset, Calculator::mRegisterSetBinding, Calculator::mRegisterSetDescriptor, and Calculator::unbind().
Referenced by bind(), CalcAssembler::bindRegisters(), CalcExtWinAggFuncTest::initWindowedAggDataBlock(), CalcAssemblerTestCase::test(), CalcExtCastTest::testCalcExtCastApproxToString(), CalcExtCastTest::testCalcExtCastBigExactToString(), CalcExtCastTest::testCalcExtCastBooleanToChar(), CalcExtCastTest::testCalcExtCastBooleanToVarChar(), CalcExtCastTest::testCalcExtCastCharToBoolean(), CalcExtCastTest::testCalcExtCastCharToDecimal(), CalcExtCastTest::testCalcExtCastCharToExact(), CalcExtCastTest::testCalcExtCastDecimalToChar(), CalcExtCastTest::testCalcExtCastDecimalToStringTruncates(), CalcExtCastTest::testCalcExtCastDecimalToVarChar(), CalcExtCastTest::testCalcExtCastExactToChar(), CalcExtCastTest::testCalcExtCastExactToStringTruncates(), CalcExtCastTest::testCalcExtCastExactToVarChar(), CalcExtCastTest::testCalcExtCastStringToApprox(), CalcExtCastTest::testCalcExtCastStringToChar(), CalcExtCastTest::testCalcExtCastStringToDecimalFails(), CalcExtCastTest::testCalcExtCastStringToDecimalMinMax(), CalcExtCastTest::testCalcExtCastStringToDecimalRange(), CalcExtCastTest::testCalcExtCastStringToExactFails(), CalcExtCastTest::testCalcExtCastStringToVarChar(), CalcExtCastTest::testCalcExtCastVarCharToBoolean(), CalcExtCastTest::testCalcExtCastVarCharToDecimal(), CalcExtCastTest::testCalcExtCastVarCharToExact(), CalcExtContextTest::testCalcExtContext(), CalcExtDateTimeTest::testCalcExtConvertDateToString(), CalcExtDynamicVariableTest::testCalcExtDynamicVariable(), CalcExtDateTimeTest::testCalcExtLocalTime(), CalcExtDateTimeTest::testCalcExtLocalTimestamp(), CalcExtMathTest::testCalcExtMathAbs(), CalcExtMathTest::testCalcExtMathLogarithms(), CalcExtMathTest::testCalcExtMathPow(), CalcExtRegExpTest::testCalcExtRegExpLikeAChar(), CalcExtRegExpTest::testCalcExtRegExpLikeAVarChar(), CalcExtRegExpTest::testCalcExtRegExpSimilarAChar(), CalcExtRegExpTest::testCalcExtRegExpSimilarAVarChar(), CalcExtStringTest::testCalcExtStringCatA2(), CalcExtStringTest::testCalcExtStringCatA3(), CalcExtStringTest::testCalcExtStringCmpA(), CalcExtStringTest::testCalcExtStringCmpOct(), CalcExtStringTest::testCalcExtStringLenBitA(), CalcExtStringTest::testCalcExtStringLenCharA(), CalcExtStringTest::testCalcExtStringLenOctA(), CalcExtStringTest::testCalcExtStringOverlayA4(), CalcExtStringTest::testCalcExtStringOverlayA5(), CalcExtStringTest::testCalcExtStringPosA(), CalcExtStringTest::testCalcExtStringSubStringA3(), CalcExtStringTest::testCalcExtStringSubStringA4(), CalcExtStringTest::testCalcExtStringToANull(), CalcExtStringTest::testCalcExtStringToLower(), CalcExtStringTest::testCalcExtStringToUpper(), CalcExtStringTest::testCalcExtStringTrim(), CalcMiscTest::testCalcRaise(), CalcMiscTest::testCalcRefInst(), CalcMiscTest::testCalcReturn(), CalcMiscTest::testCalcStatusReg(), CalcMiscTest::testCalcStatusRegZero(), unitTestBool(), unitTestFloat(), unitTestLong(), unitTestNullableLocal(), unitTestPointer(), unitTestPointerCache(), unitTestStatusRegister(), unitTestWarnings(), WinAggAddTest(), WinAggAddTestStr(), WinAggDropTest(), and WinAggDropTestStr().
00168 { 00169 assert(mIsUsingAssembler ? mIsAssembling : true); 00170 assert(regset < RegisterReference::ELastSet); 00171 assert(data); // Not strictly needed 00172 00173 // At the moment, do not allow literal and local register sets 00174 // to ever be rebound as they (may) have cached pointers. 00175 // If rebinding these register sets is a required feature, you 00176 // must reset each RegisterReference that points to these 00177 // tuples 00178 assert((regset == RegisterReference::ELiteral) ? 00179 !mRegisterSetBinding[RegisterReference::ELiteral] : true); 00180 assert((regset == RegisterReference::ELocal) ? 00181 !mRegisterSetBinding[RegisterReference::ELocal] : true); 00182 00183 unbind(regset); 00184 mRegisterSetBinding[regset] = new RegisterSetBinding(data); 00185 mRegisterSetDescriptor[regset] = new TupleDescriptor(desc); 00186 00187 // cache pointers for local and literal sets only 00188 if (regset == RegisterReference::ELiteral || 00189 regset == RegisterReference::ELocal) { 00190 for_each( 00191 mRegisterRef[regset].begin(), 00192 mRegisterRef[regset].end(), 00193 mem_fun(&RegisterReference::cachePointer)); 00194 } 00195 00196 // pre-allocate mReset vector to the largest possible value 00197 // trade memory for speed - vector should never have to reallocate 00198 // TODO: This calls reserve twice, which is wasteful, even at startup. 00199 size_t totalResetableRegisters = 00200 mRegisterRef[RegisterReference::ELiteral].size() + 00201 mRegisterRef[RegisterReference::ELocal].size(); 00202 mRegisterReset.reserve(totalResetableRegisters); 00203 }
void Calculator::bind | ( | TupleData * | input, | |
TupleData * | output, | |||
bool | takeOwnership = false , |
|||
const TupleData * | outputWrite = 0 | |||
) | [inherited] |
outputWrite | (optional, use when output contains null values). |
Equivalent to output
, except it has the allocated target address of each datum which is null in output
.
takeOwnership | When true, the Calculator owns these TupleData, and will delete them in its destructor. |
Definition at line 205 of file Calculator.cpp.
References RegisterReference::EInput, RegisterReference::EOutput, Calculator::mRegisterSetBinding, and Calculator::unbind().
00208 { 00209 unbind(RegisterReference::EInput, false); 00210 mRegisterSetBinding[RegisterReference::EInput] = 00211 new RegisterSetBinding(input, takeOwnwership); 00212 unbind(RegisterReference::EOutput, false); 00213 if (outputWrite) { 00214 mRegisterSetBinding[RegisterReference::EOutput] = 00215 new RegisterSetBinding(output, outputWrite, takeOwnwership); 00216 } else { 00217 mRegisterSetBinding[RegisterReference::EOutput] = 00218 new RegisterSetBinding(output, takeOwnwership); 00219 } 00220 }
TupleDescriptor Calculator::getOutputRegisterDescriptor | ( | ) | const [inherited] |
Determines Output Tuple format.
When assemble() is used, an XO learns the format of its output from Calculator. Provides a copy of the internally held output TupleDescriptor. Should only be called after assemble(). Typically called before exec().
Definition at line 223 of file Calculator.cpp.
References RegisterReference::EOutput, and Calculator::mRegisterSetDescriptor.
Referenced by CalcAssemblerTestCase::assemble(), CalcTestInfo< T >::checkResult(), Calculator::exec(), CalcAssemblerTestCase::getExpectedOutput(), CalcExtWinAggFuncTest::initWindowedAggDataBlock(), CalcExtWinAggFuncTest::printOutput(), CalcExtStringTest::printOutput(), CalcExtRegExpTest::printOutput(), CalcExtMathTest::printOutput(), CalcExtDynamicVariableTest::printOutput(), CalcExtDateTimeTest::printOutput(), CalcExtContextTest::printOutput(), CalcExtCastTest::printOutput(), CalcAssemblerTestCase::setExpectedOutput(), CalcAssemblerTestCase::setExpectedOutputMax(), CalcAssemblerTestCase::setExpectedOutputMin(), CalcAssemblerTestCase::test(), CalcExtCastTest::testCalcExtCastApproxToString(), CalcExtCastTest::testCalcExtCastBigExactToString(), CalcExtCastTest::testCalcExtCastBooleanToChar(), CalcExtCastTest::testCalcExtCastBooleanToVarChar(), CalcExtCastTest::testCalcExtCastCharToBoolean(), CalcExtCastTest::testCalcExtCastCharToDecimal(), CalcExtCastTest::testCalcExtCastCharToExact(), CalcExtCastTest::testCalcExtCastDecimalToChar(), CalcExtCastTest::testCalcExtCastDecimalToStringTruncates(), CalcExtCastTest::testCalcExtCastDecimalToVarChar(), CalcExtCastTest::testCalcExtCastExactToChar(), CalcExtCastTest::testCalcExtCastExactToStringTruncates(), CalcExtCastTest::testCalcExtCastExactToVarChar(), CalcExtCastTest::testCalcExtCastStringToApprox(), CalcExtCastTest::testCalcExtCastStringToChar(), CalcExtCastTest::testCalcExtCastStringToDecimalFails(), CalcExtCastTest::testCalcExtCastStringToDecimalMinMax(), CalcExtCastTest::testCalcExtCastStringToDecimalRange(), CalcExtCastTest::testCalcExtCastStringToExactFails(), CalcExtCastTest::testCalcExtCastStringToVarChar(), CalcExtCastTest::testCalcExtCastVarCharToBoolean(), CalcExtCastTest::testCalcExtCastVarCharToDecimal(), CalcExtCastTest::testCalcExtCastVarCharToExact(), CalcExtContextTest::testCalcExtContext(), CalcExtDateTimeTest::testCalcExtConvertDateToString(), CalcExtDynamicVariableTest::testCalcExtDynamicVariable(), CalcExtDateTimeTest::testCalcExtLocalTime(), CalcExtDateTimeTest::testCalcExtLocalTimestamp(), CalcExtMathTest::testCalcExtMathAbs(), CalcExtMathTest::testCalcExtMathLogarithms(), CalcExtMathTest::testCalcExtMathPow(), CalcExtRegExpTest::testCalcExtRegExpLikeAChar(), CalcExtRegExpTest::testCalcExtRegExpLikeAVarChar(), CalcExtRegExpTest::testCalcExtRegExpSimilarAChar(), CalcExtRegExpTest::testCalcExtRegExpSimilarAVarChar(), CalcExtStringTest::testCalcExtStringCatA2(), CalcExtStringTest::testCalcExtStringCatA3(), CalcExtStringTest::testCalcExtStringCmpA(), CalcExtStringTest::testCalcExtStringCmpOct(), CalcExtStringTest::testCalcExtStringLenBitA(), CalcExtStringTest::testCalcExtStringLenCharA(), CalcExtStringTest::testCalcExtStringLenOctA(), CalcExtStringTest::testCalcExtStringOverlayA4(), CalcExtStringTest::testCalcExtStringOverlayA5(), CalcExtStringTest::testCalcExtStringPosA(), CalcExtStringTest::testCalcExtStringSubStringA3(), CalcExtStringTest::testCalcExtStringSubStringA4(), CalcExtStringTest::testCalcExtStringToANull(), CalcExtStringTest::testCalcExtStringToLower(), CalcExtStringTest::testCalcExtStringToUpper(), CalcExtStringTest::testCalcExtStringTrim(), CalcMiscTest::testCalcRaise(), CalcMiscTest::testCalcRefInst(), CalcMiscTest::testCalcReturn(), CalcMiscTest::testCalcStatusReg(), CalcMiscTest::testCalcStatusRegZero(), WinAggAddTest(), WinAggAddTestStr(), WinAggDropTest(), and WinAggDropTestStr().
00224 { 00225 return *(mRegisterSetDescriptor[RegisterReference::EOutput]); 00226 }
TupleDescriptor Calculator::getInputRegisterDescriptor | ( | ) | const [inherited] |
Determines Input Tuple format.
When assemble() is used, an XO may learn the format of its input from Calculator. The XO could use this information to double-check the integrity of the TupleDescriptor via asserts. Typically called before exec().
Definition at line 229 of file Calculator.cpp.
References RegisterReference::EInput, and Calculator::mRegisterSetDescriptor.
Referenced by CalcAssemblerTestCase::assemble(), Calculator::exec(), CalcAssemblerTestCase::getInput(), CalcExtWinAggFuncTest::initWindowedAggDataBlock(), CalcAssemblerTestCase::setInput(), CalcAssemblerTestCase::setInputMax(), CalcAssemblerTestCase::setInputMin(), CalcAssemblerTestCase::test(), CalcExtCastTest::testCalcExtCastApproxToString(), CalcExtCastTest::testCalcExtCastBigExactToString(), CalcExtCastTest::testCalcExtCastBooleanToChar(), CalcExtCastTest::testCalcExtCastBooleanToVarChar(), CalcExtCastTest::testCalcExtCastCharToBoolean(), CalcExtCastTest::testCalcExtCastCharToDecimal(), CalcExtCastTest::testCalcExtCastCharToExact(), CalcExtCastTest::testCalcExtCastDecimalToChar(), CalcExtCastTest::testCalcExtCastDecimalToStringTruncates(), CalcExtCastTest::testCalcExtCastDecimalToVarChar(), CalcExtCastTest::testCalcExtCastExactToChar(), CalcExtCastTest::testCalcExtCastExactToStringTruncates(), CalcExtCastTest::testCalcExtCastExactToVarChar(), CalcExtCastTest::testCalcExtCastStringToApprox(), CalcExtCastTest::testCalcExtCastStringToChar(), CalcExtCastTest::testCalcExtCastStringToDecimalFails(), CalcExtCastTest::testCalcExtCastStringToDecimalMinMax(), CalcExtCastTest::testCalcExtCastStringToDecimalRange(), CalcExtCastTest::testCalcExtCastStringToExactFails(), CalcExtCastTest::testCalcExtCastStringToVarChar(), CalcExtCastTest::testCalcExtCastVarCharToBoolean(), CalcExtCastTest::testCalcExtCastVarCharToDecimal(), CalcExtCastTest::testCalcExtCastVarCharToExact(), CalcExtContextTest::testCalcExtContext(), CalcExtDateTimeTest::testCalcExtConvertDateToString(), CalcExtDynamicVariableTest::testCalcExtDynamicVariable(), CalcExtDateTimeTest::testCalcExtLocalTime(), CalcExtDateTimeTest::testCalcExtLocalTimestamp(), CalcExtMathTest::testCalcExtMathAbs(), CalcExtMathTest::testCalcExtMathLogarithms(), CalcExtMathTest::testCalcExtMathPow(), CalcExtRegExpTest::testCalcExtRegExpLikeAChar(), CalcExtRegExpTest::testCalcExtRegExpLikeAVarChar(), CalcExtRegExpTest::testCalcExtRegExpSimilarAChar(), CalcExtRegExpTest::testCalcExtRegExpSimilarAVarChar(), CalcExtStringTest::testCalcExtStringCatA2(), CalcExtStringTest::testCalcExtStringCatA3(), CalcExtStringTest::testCalcExtStringCmpA(), CalcExtStringTest::testCalcExtStringCmpOct(), CalcExtStringTest::testCalcExtStringLenBitA(), CalcExtStringTest::testCalcExtStringLenCharA(), CalcExtStringTest::testCalcExtStringLenOctA(), CalcExtStringTest::testCalcExtStringOverlayA4(), CalcExtStringTest::testCalcExtStringOverlayA5(), CalcExtStringTest::testCalcExtStringPosA(), CalcExtStringTest::testCalcExtStringSubStringA3(), CalcExtStringTest::testCalcExtStringSubStringA4(), CalcExtStringTest::testCalcExtStringToANull(), CalcExtStringTest::testCalcExtStringToLower(), CalcExtStringTest::testCalcExtStringToUpper(), CalcExtStringTest::testCalcExtStringTrim(), CalcMiscTest::testCalcRaise(), CalcMiscTest::testCalcRefInst(), CalcMiscTest::testCalcReturn(), CalcMiscTest::testCalcStatusReg(), CalcMiscTest::testCalcStatusRegZero(), WinAggAddTest(), and WinAggAddTestStr().
00230 { 00231 return *(mRegisterSetDescriptor[RegisterReference::EInput]); 00232 }
TupleDescriptor Calculator::getStatusRegisterDescriptor | ( | ) | const [inherited] |
Determines Status Tuple format.
When assemble() is used, an XO may learn the format of its status from Calculator. The XO could use this information to double-check the integrity of other plan information. Typically called before exec().
Definition at line 235 of file Calculator.cpp.
References RegisterReference::EStatus, and Calculator::mRegisterSetDescriptor.
Referenced by Calculator::exec(), CalcMiscTest::testCalcRaise(), CalcMiscTest::testCalcReturn(), and CalcMiscTest::testCalcStatusReg().
00236 { 00237 return *(mRegisterSetDescriptor[RegisterReference::EStatus]); 00238 }
TupleData const *const Calculator::getStatusRegister | ( | ) | const [inherited] |
Gets a pointer to Status Register Tuple.
Typically called once after Calculator configuration, as this tuple never changes.
Definition at line 241 of file Calculator.cpp.
References RegisterSetBinding::asTupleData(), RegisterReference::EStatus, and Calculator::mRegisterSetBinding.
Referenced by CalcMiscTest::testCalcRaise(), CalcMiscTest::testCalcReturn(), CalcMiscTest::testCalcStatusReg(), and CalcMiscTest::testCalcStatusRegZero().
00242 { 00243 return &(mRegisterSetBinding[RegisterReference::EStatus]->asTupleData()); 00244 }
void Calculator::zeroStatusRegister | ( | ) | [inherited] |
Zeroes out the values of all TupleDatum within the Staus Register Tuple.
Typically this is called before the first call to exec() and should never be called between calls to exec() unless execution is being restarted at the beginning of a series of tuples.
Definition at line 246 of file Calculator.cpp.
References RegisterSetBinding::asTupleData(), RegisterReference::EStatus, Calculator::mRegisterSetBinding, and Calculator::mRegisterSetDescriptor.
Referenced by CalcMiscTest::testCalcStatusRegZero().
00247 { 00248 if (mRegisterSetDescriptor[RegisterReference::EStatus] != NULL) { 00249 RegisterSetBinding *statusBinding = 00250 mRegisterSetBinding[RegisterReference::EStatus]; 00251 00252 int ncols = statusBinding->asTupleData().size(); 00253 00254 for (int i = 0; i < ncols; i++) { 00255 memset( 00256 const_cast<PBuffer>((*statusBinding)[i].pData), 00257 0, 00258 (*statusBinding)[i].cbData); 00259 } 00260 } 00261 }
void Calculator::continueOnException | ( | bool | c | ) | [inherited] |
Configures Calculator to either exit immediately upon exceptions or to continue execution.
Definition at line 264 of file Calculator.cpp.
References Calculator::mContinueOnException.
00265 { 00266 mContinueOnException = c; 00267 }
void Calculator::exec | ( | ) | [inherited] |
Executes program.
Definition at line 271 of file Calculator.cpp.
References RegisterReference::cachePointer(), RegisterReference::EInput, RegisterReference::EOutput, RegisterReference::EStatus, Calculator::getInputRegisterDescriptor(), Calculator::getOutputRegisterDescriptor(), Calculator::getStatusRegisterDescriptor(), TraceSource::isTracingLevel(), Calculator::mCode, Calculator::mContinueOnException, Calculator::mRegisterReset, Calculator::mRegisterSetBinding, Calculator::mWarnings, TuplePrinter::print(), TraceSource::trace(), TRACE_FINEST, and Calculator::warnings().
Referenced by CalcExtWinAggFuncTest::checkWarnings(), CalcExtMathTest::checkWarnings(), CalcExtWinAggFuncTest::initWindowedAggDataBlock(), CalcAssemblerTestCase::test(), CalcExtCastTest::testCalcExtCastApproxToString(), CalcExtCastTest::testCalcExtCastBigExactToString(), CalcExtCastTest::testCalcExtCastBooleanToChar(), CalcExtCastTest::testCalcExtCastBooleanToVarChar(), CalcExtCastTest::testCalcExtCastCharToBoolean(), CalcExtCastTest::testCalcExtCastCharToDecimal(), CalcExtCastTest::testCalcExtCastCharToExact(), CalcExtCastTest::testCalcExtCastDecimalToChar(), CalcExtCastTest::testCalcExtCastDecimalToStringTruncates(), CalcExtCastTest::testCalcExtCastDecimalToVarChar(), CalcExtCastTest::testCalcExtCastExactToChar(), CalcExtCastTest::testCalcExtCastExactToStringTruncates(), CalcExtCastTest::testCalcExtCastExactToVarChar(), CalcExtCastTest::testCalcExtCastStringToApprox(), CalcExtCastTest::testCalcExtCastStringToChar(), CalcExtCastTest::testCalcExtCastStringToDecimalFails(), CalcExtCastTest::testCalcExtCastStringToDecimalMinMax(), CalcExtCastTest::testCalcExtCastStringToDecimalRange(), CalcExtCastTest::testCalcExtCastStringToExactFails(), CalcExtCastTest::testCalcExtCastStringToVarChar(), CalcExtCastTest::testCalcExtCastVarCharToBoolean(), CalcExtCastTest::testCalcExtCastVarCharToDecimal(), CalcExtCastTest::testCalcExtCastVarCharToExact(), CalcExtContextTest::testCalcExtContext(), CalcExtDateTimeTest::testCalcExtConvertDateToString(), CalcExtDynamicVariableTest::testCalcExtDynamicVariable(), CalcExtDateTimeTest::testCalcExtLocalTime(), CalcExtDateTimeTest::testCalcExtLocalTimestamp(), CalcExtMathTest::testCalcExtMathAbs(), CalcExtMathTest::testCalcExtMathLogarithms(), CalcExtMathTest::testCalcExtMathPow(), CalcExtRegExpTest::testCalcExtRegExpLikeAChar(), CalcExtRegExpTest::testCalcExtRegExpLikeAVarChar(), CalcExtRegExpTest::testCalcExtRegExpSimilarAChar(), CalcExtRegExpTest::testCalcExtRegExpSimilarAVarChar(), CalcExtStringTest::testCalcExtStringCatA2(), CalcExtStringTest::testCalcExtStringCatA3(), CalcExtStringTest::testCalcExtStringCmpA(), CalcExtStringTest::testCalcExtStringCmpOct(), CalcExtStringTest::testCalcExtStringLenBitA(), CalcExtStringTest::testCalcExtStringLenCharA(), CalcExtStringTest::testCalcExtStringLenOctA(), CalcExtStringTest::testCalcExtStringOverlayA4(), CalcExtStringTest::testCalcExtStringOverlayA5(), CalcExtStringTest::testCalcExtStringPosA(), CalcExtStringTest::testCalcExtStringSubStringA3(), CalcExtStringTest::testCalcExtStringSubStringA4(), CalcExtStringTest::testCalcExtStringToANull(), CalcExtStringTest::testCalcExtStringToLower(), CalcExtStringTest::testCalcExtStringToUpper(), CalcExtStringTest::testCalcExtStringTrim(), CalcMiscTest::testCalcRaise(), CalcMiscTest::testCalcRefInst(), CalcMiscTest::testCalcReturn(), CalcMiscTest::testCalcStatusReg(), CalcMiscTest::testCalcStatusRegZero(), testConvertDecimal(), testConvertDoubleToFloat(), testConvertExactNumberToString(), testConvertFloatToDouble(), testConvertFloatToIntTypes(), testConvertIntTypesToFloat(), testConvertStringToExactNumber(), unitTestBool(), unitTestFloat(), unitTestLong(), unitTestNullableLocal(), unitTestPointer(), unitTestPointerCache(), unitTestStatusRegister(), unitTestWarnings(), WinAggAddTest(), WinAggAddTestStr(), WinAggDropTest(), and WinAggDropTestStr().
00272 { 00273 // Clear state from previous execution 00274 mWarnings.clear(); 00275 00276 // reset altered registers 00277 for_each( 00278 mRegisterReset.begin(), 00279 mRegisterReset.end(), 00280 mem_fun(&RegisterReference::cachePointer)); 00281 mRegisterReset.clear(); // does not change capacity 00282 00283 #ifdef DEBUG 00284 ostringstream oss; 00285 TuplePrinter p; 00286 if (isTracingLevel(TRACE_FINEST)) { 00287 oss << "Pre-Exec" << endl << "Output Register: " << endl; 00288 p.print( 00289 oss, getOutputRegisterDescriptor(), 00290 mRegisterSetBinding[RegisterReference::EOutput]->asTupleData()); 00291 oss << endl << "Input Register: " << endl; 00292 p.print( 00293 oss, getInputRegisterDescriptor(), 00294 mRegisterSetBinding[RegisterReference::EInput]->asTupleData()); 00295 oss << endl << "Status Register: " << endl; 00296 p.print( 00297 oss, getStatusRegisterDescriptor(), 00298 mRegisterSetBinding[RegisterReference::EStatus]->asTupleData()); 00299 oss << endl; 00300 trace(TRACE_FINEST, oss.str()); 00301 } 00302 #endif 00303 00304 00305 TProgramCounter pc = 0, endOfProgram; 00306 endOfProgram = mCode.size(); 00307 00308 while (pc >= 0 && pc < endOfProgram) { 00309 try { 00310 #ifdef DEBUG 00311 int oldpc = pc; 00312 string out; 00313 if (isTracingLevel(TRACE_FINEST)) { 00314 mCode[oldpc]->describe(out, true); 00315 FENNEL_TRACE( 00316 TRACE_FINEST, "BF [" << oldpc << "] " << out.c_str()); 00317 } 00318 #endif 00319 00320 mCode[pc]->exec(pc); 00321 00322 #ifdef DEBUG 00323 if (isTracingLevel(TRACE_FINEST)) { 00324 mCode[oldpc]->describe(out, true); 00325 FENNEL_TRACE( 00326 TRACE_FINEST, "AF [" << oldpc << "] " << out.c_str()); 00327 } 00328 #endif 00329 } catch (CalcMessage m) { 00330 // each instruction sets pc assuming continued execution 00331 mWarnings.push_back(m); 00332 if (!mContinueOnException) { 00333 break; 00334 } 00335 } 00336 } 00337 #ifdef DEBUG 00338 if (isTracingLevel(TRACE_FINEST)) { 00339 oss.clear(); 00340 oss << "Post-Exec" << endl << "Output Register: " << endl; 00341 p.print( 00342 oss, getOutputRegisterDescriptor(), 00343 mRegisterSetBinding[RegisterReference::EOutput]->asTupleData()); 00344 oss << endl << "Input Register: " << endl; 00345 p.print( 00346 oss, getInputRegisterDescriptor(), 00347 mRegisterSetBinding[RegisterReference::EInput]->asTupleData()); 00348 oss << endl << "Status Register: " << endl; 00349 p.print( 00350 oss, getStatusRegisterDescriptor(), 00351 mRegisterSetBinding[RegisterReference::EStatus]->asTupleData()); 00352 oss << endl << "Warnings: |" << warnings() << "|"<< endl; 00353 trace(TRACE_FINEST, oss.str()); 00354 } 00355 #endif 00356 }
string Calculator::warnings | ( | ) | [inherited] |
Returns a formatting string containing all warnings generated during exec().
String contains one warning per line, and includes PC and warning code. Cleared by each call to exec().
Definition at line 359 of file Calculator.cpp.
References Calculator::mWarnings.
Referenced by CalcExtWinAggFuncTest::checkWarnings(), CalcExtMathTest::checkWarnings(), Calculator::exec(), CalcExtStringTest::testCalcExtStringTrim(), unitTestBool(), unitTestFloat(), unitTestLong(), unitTestPointer(), unitTestPointerCache(), unitTestStatusRegister(), and unitTestWarnings().
00360 { 00361 string ret; 00362 deque<CalcMessage>::iterator iter = mWarnings.begin(), 00363 end = mWarnings.end(); 00364 int i = 0; 00365 00366 while (iter != end) { 00367 ret += boost::io::str(format("[%d]:PC=%ld Code=") % i % iter->pc); 00368 ret += iter->str; 00369 ret += " "; 00370 iter++; 00371 i++; 00372 } 00373 return ret; 00374 }
void TraceSource::initTraceSource | ( | SharedTraceTarget | pTraceTarget, | |
std::string | name | |||
) | [virtual, inherited] |
For use when initialization has to be deferred until after construction.
pTraceTarget | the TraceTarget to which messages will be sent | |
name | the name of this source |
Definition at line 46 of file TraceSource.cpp.
References TraceSource::isTracing(), TraceSource::minimumLevel, TraceSource::name, TraceSource::pTraceTarget, and TRACE_OFF.
Referenced by TestBase::beforeTestCase(), TestBase::TestBase(), and TraceSource::TraceSource().
00049 { 00050 assert(!pTraceTarget.get()); 00051 00052 pTraceTarget = pTraceTargetInit; 00053 name = nameInit; 00054 if (isTracing()) { 00055 minimumLevel = pTraceTarget->getSourceTraceLevel(name); 00056 } else { 00057 minimumLevel = TRACE_OFF; 00058 } 00059 }
void TraceSource::trace | ( | TraceLevel | level, | |
std::string | message | |||
) | const [inherited] |
Records a trace message.
Normally only called via FENNEL_TRACE.
level | severity level of event being trace | |
message | the text of the message |
Definition at line 61 of file TraceSource.cpp.
References TraceSource::getTraceTarget(), TraceSource::isTracing(), TraceSource::name, and TraceTarget::notifyTrace().
Referenced by Calculator::exec(), and ExecStreamScheduler::traceStreamBufferContents().
00062 { 00063 if (isTracing()) { 00064 getTraceTarget().notifyTrace(name,level,message); 00065 } 00066 }
bool TraceSource::isTracing | ( | ) | const [inline, inherited] |
Definition at line 88 of file TraceSource.h.
Referenced by TraceSource::initTraceSource(), CalcExecStream::prepare(), and TraceSource::trace().
00089 { 00090 return pTraceTarget.get() ? true : false; 00091 }
bool TraceSource::isTracingLevel | ( | TraceLevel | level | ) | const [inline, inherited] |
Determines whether a particular level is being traced.
level | trace level to test |
Definition at line 100 of file TraceSource.h.
Referenced by ExecStreamScheduler::addGraph(), SimpleExecStreamGovernor::assignCachePages(), SimpleExecStreamGovernor::distributeCachePages(), Calculator::exec(), ExecStreamScheduler::ExecStreamScheduler(), LcsClusterNodeWriter::getLastClusterPageForWrite(), LcsClusterNodeWriter::moveFromTempToIndex(), JavaSinkExecStream::stuffByteBuffer(), and ExecStreamScheduler::traceStreamBuffers().
00101 { 00102 return level >= minimumLevel; 00103 }
TraceTarget& TraceSource::getTraceTarget | ( | ) | const [inline, inherited] |
Definition at line 108 of file TraceSource.h.
Referenced by TraceSource::trace().
00109 { 00110 assert(isTracing()); 00111 return *(pTraceTarget.get()); 00112 }
SharedTraceTarget TraceSource::getSharedTraceTarget | ( | ) | const [inline, inherited] |
Definition at line 117 of file TraceSource.h.
Referenced by Database::init(), LcsClusterAppendExecStream::initLoad(), and CalcExecStream::prepare().
00118 { 00119 return pTraceTarget; 00120 }
std::string TraceSource::getTraceSourceName | ( | ) | const [inline, inherited] |
Gets the name of this source.
Useful to construct nested names for subcomponents that are also TraceSources.
Definition at line 127 of file TraceSource.h.
Referenced by LcsClusterAppendExecStream::initLoad().
00128 { 00129 return name; 00130 }
void TraceSource::setTraceSourceName | ( | std::string const & | n | ) | [inline, inherited] |
Sets the name of this source.
Useful to construct dynamic names for fine-grained filtering.
Definition at line 136 of file TraceSource.h.
00137 { 00138 name = n; 00139 }
TraceLevel TraceSource::getMinimumTraceLevel | ( | ) | const [inline, inherited] |
void TraceSource::disableTracing | ( | ) | [inherited] |
Definition at line 68 of file TraceSource.cpp.
References TraceSource::minimumLevel, TraceSource::pTraceTarget, and TRACE_OFF.
Referenced by TestBase::afterTestCase().
00069 { 00070 pTraceTarget.reset(); 00071 minimumLevel = TRACE_OFF; 00072 }
friend class RegisterRef [friend, inherited] |
Definition at line 253 of file Calculator.h.
friend class RegisterReference [friend, inherited] |
Definition at line 254 of file Calculator.h.
friend class CalcAssembler [friend, inherited] |
Definition at line 255 of file Calculator.h.
Definition at line 226 of file testCalcExtended.cpp.
Referenced by bind(), setInput(), setOutput(), and setUp().
Definition at line 227 of file testCalcExtended.cpp.
Referenced by bind(), setInput(), setOutput(), and setUp().
Definition at line 228 of file testCalcExtended.cpp.
Referenced by bind(), printOutput(), setInput(), setOutput(), and setUp().
Definition at line 229 of file testCalcExtended.cpp.
Referenced by bind(), setInput(), setOutput(), and setUp().
bool TestCalculator::_isNullable [private] |
ExtendedInstructionDef* TestCalculator::_instrDef [private] |
boost::scoped_array<FixedBuffer> TestCalculator::_pTupleBufLiteral [private] |
boost::scoped_array<FixedBuffer> TestCalculator::_pTupleBufInput [private] |
boost::scoped_array<FixedBuffer> TestCalculator::_pTupleBufOutput [private] |
boost::scoped_array<FixedBuffer> TestCalculator::_pTupleBufLocal [private] |
boost::scoped_array<FixedBuffer> TestCalculator::_pTupleBufStatus [private] |
TupleData TestCalculator::_tupleDataLiteral [private] |
Definition at line 243 of file testCalcExtended.cpp.
Referenced by bind(), setInput(), setOutput(), and setUp().
TupleData TestCalculator::_tupleDataInput [private] |
Definition at line 244 of file testCalcExtended.cpp.
Referenced by bind(), setInput(), setOutput(), and setUp().
TupleData TestCalculator::_tupleDataOutput [private] |
Definition at line 245 of file testCalcExtended.cpp.
Referenced by bind(), getOutput(), getOutputP(), printOutput(), setInput(), setOutput(), and setUp().
TupleData TestCalculator::_tupleDataLocal [private] |
Definition at line 246 of file testCalcExtended.cpp.
Referenced by bind(), setInput(), setOutput(), and setUp().
TupleData TestCalculator::_tupleDataStatus [private] |
deque<CalcMessage> Calculator::mWarnings [inherited] |
A deque of warnings encapsulated by CalcMessage object.
Deque is cleared by each call to exec().
Definition at line 248 of file Calculator.h.
Referenced by CalcTestInfo< T >::checkResult(), Calculator::exec(), CalcAssemblerTestCase::test(), CalcExtCastTest::testCalcExtCastApproxToString(), CalcExtCastTest::testCalcExtCastBigExactToString(), CalcExtCastTest::testCalcExtCastBooleanToChar(), CalcExtCastTest::testCalcExtCastBooleanToVarChar(), CalcExtCastTest::testCalcExtCastCharToBoolean(), CalcExtCastTest::testCalcExtCastCharToDecimal(), CalcExtCastTest::testCalcExtCastCharToExact(), CalcExtCastTest::testCalcExtCastDecimalToChar(), CalcExtCastTest::testCalcExtCastDecimalToStringTruncates(), CalcExtCastTest::testCalcExtCastDecimalToVarChar(), CalcExtCastTest::testCalcExtCastExactToChar(), CalcExtCastTest::testCalcExtCastExactToStringTruncates(), CalcExtCastTest::testCalcExtCastExactToVarChar(), CalcExtCastTest::testCalcExtCastStringToApprox(), CalcExtCastTest::testCalcExtCastStringToChar(), CalcExtCastTest::testCalcExtCastStringToDecimalFails(), CalcExtCastTest::testCalcExtCastStringToDecimalMinMax(), CalcExtCastTest::testCalcExtCastStringToDecimalRange(), CalcExtCastTest::testCalcExtCastStringToExactFails(), CalcExtCastTest::testCalcExtCastStringToVarChar(), CalcExtCastTest::testCalcExtCastVarCharToBoolean(), CalcExtCastTest::testCalcExtCastVarCharToDecimal(), CalcExtCastTest::testCalcExtCastVarCharToExact(), CalcExtRegExpTest::testCalcExtRegExpLikeAChar(), CalcExtRegExpTest::testCalcExtRegExpLikeAVarChar(), CalcExtRegExpTest::testCalcExtRegExpSimilarAChar(), CalcExtRegExpTest::testCalcExtRegExpSimilarAVarChar(), CalcExtStringTest::testCalcExtStringCatA2(), CalcExtStringTest::testCalcExtStringCatA3(), CalcExtStringTest::testCalcExtStringOverlayA4(), CalcExtStringTest::testCalcExtStringOverlayA5(), CalcExtStringTest::testCalcExtStringSubStringA3(), CalcExtStringTest::testCalcExtStringSubStringA4(), CalcExtStringTest::testCalcExtStringToANull(), CalcExtStringTest::testCalcExtStringToLower(), CalcExtStringTest::testCalcExtStringToUpper(), CalcExtStringTest::testCalcExtStringTrim(), CalcMiscTest::testCalcRaise(), unitTestBool(), unitTestFloat(), unitTestLong(), unitTestWarnings(), and Calculator::warnings().
vector<Instruction *> Calculator::mCode [protected, inherited] |
Program instructions.
Definition at line 258 of file Calculator.h.
Referenced by Calculator::exec(), Calculator::init(), and Calculator::~Calculator().
RegisterSetBinding* Calculator::mRegisterSetBinding[RegisterReference::ELastSet] [protected, inherited] |
How registers are bound to underlying tuples, indexed by register set (null element means the register set is not bound) Note: Referenced in class RegisterReference and CalcAssembler.
Definition at line 263 of file Calculator.h.
Referenced by Calculator::bind(), Calculator::exec(), Calculator::getStatusRegister(), Calculator::init(), RegisterReference::setCalc(), Calculator::unbind(), Calculator::zeroStatusRegister(), and CalcAssembler::~CalcAssembler().
vector<RegisterReference *> Calculator::mRegisterRef[RegisterReference::ELastSet] [protected, inherited] |
All active registers, indexed by register set.
Note: Referenced in class CalcAssembler
Definition at line 268 of file Calculator.h.
Referenced by Calculator::bind(), CalcAssembler::getRegister(), CalcAssembler::getRegisterSize(), Calculator::init(), and Calculator::~Calculator().
vector<RegisterReference *> Calculator::mRegisterReset [protected, inherited] |
A list of registers to be reset by next call to exec().
Note: mRegisterReset is appended to in class RegisterReference
Definition at line 273 of file Calculator.h.
Referenced by Calculator::bind(), Calculator::exec(), RegisterReference::setCalc(), and Calculator::~Calculator().
TupleDescriptor* Calculator::mRegisterSetDescriptor[RegisterReference::ELastSet] [protected, inherited] |
A TupleDescriptor for each Register Set (i.e.
each register tuple)
Used by XO to determine tuple layouts after a serialized program is assembled. Also needed for Pointer types to determine column width. Populated by the CalcAssembler.
Definition at line 281 of file Calculator.h.
Referenced by Calculator::bind(), CalcAssembler::bindRegisters(), Calculator::getInputRegisterDescriptor(), Calculator::getOutputRegisterDescriptor(), Calculator::getStatusRegisterDescriptor(), Calculator::init(), RegisterReference::setCalc(), Calculator::unbind(), and Calculator::zeroStatusRegister().
const bool Calculator::mIsUsingAssembler [protected, inherited] |
Assembler was/will-be used.
Definition at line 284 of file Calculator.h.
Referenced by Calculator::assemble(), Calculator::bind(), and Calculator::~Calculator().
bool Calculator::mIsAssembling [protected, inherited] |
Assembler is actively assembling.
Definition at line 286 of file Calculator.h.
Referenced by Calculator::assemble(), CalcAssembler::assemble(), and Calculator::bind().
bool Calculator::mOutputRegisterByReference [protected, inherited] |
If set, output register can only be set by reference.
Definition at line 288 of file Calculator.h.
Referenced by Calculator::init(), Calculator::outputRegisterByReference(), and RegisterReference::setCalc().
bool Calculator::mContinueOnException [protected, inherited] |
Exceptions cause calculator to return immediately, or do they allow execution to conitnue?
Definition at line 291 of file Calculator.h.
Referenced by Calculator::continueOnException(), Calculator::exec(), and Calculator::init().
vector<FixedBuffer*> Calculator::mBuffers [protected, inherited] |
Actual storage used by the CalcAssembler for the literal, local and status registers.
Definition at line 295 of file Calculator.h.
Referenced by CalcAssembler::bindRegisters(), and Calculator::~Calculator().
DynamicParamManager* Calculator::mPDynamicParamManager [protected, inherited] |