#include <TuplePrinter.h>
Inheritance diagram for TuplePrinter:
Public Member Functions | |
TuplePrinter () | |
void | print (std::ostream &stream, TupleDescriptor const &tupleDesc, TupleData const &tupleData) |
Private Member Functions | |
void | preVisitValue () |
void | postVisitValue () |
virtual void | preVisitDocument (std::string) |
virtual void | postVisitDocument () |
virtual void | preVisitTable (std::string title) |
virtual void | postVisitTable () |
virtual void | preVisitRow () |
virtual void | postVisitRow () |
virtual void | visitAttribute (std::string) |
virtual void | visitString (std::string) |
virtual void | visitChars (char const *, TupleStorageByteLength nChars) |
virtual void | visitUnicodeChars (Ucs2ConstBuffer, uint nChars) |
virtual void | visitUnsignedInt (uint64_t) |
virtual void | visitSignedInt (int64_t) |
virtual void | visitDouble (double) |
virtual void | visitFloat (float) |
virtual void | visitBoolean (bool) |
virtual void | visitPageId (PageId) |
virtual void | visitPageOwnerId (PageOwnerId) |
virtual void | visitSegByteId (SegByteId) |
virtual void | visitFormatted (char const *) |
virtual void | visitBytes (void const *v, TupleStorageByteLength iBytes) |
Private Attributes | |
std::ostream * | pStream |
uint | iValue |
Definition at line 36 of file TuplePrinter.h.
TuplePrinter::TuplePrinter | ( | ) | [explicit] |
Definition at line 32 of file TuplePrinter.cpp.
References pStream.
00033 { 00034 pStream = NULL; 00035 }
void TuplePrinter::preVisitValue | ( | ) | [private] |
Definition at line 51 of file TuplePrinter.cpp.
References iValue.
Referenced by visitBoolean(), visitBytes(), visitDouble(), visitFloat(), visitSignedInt(), visitString(), and visitUnsignedInt().
00052 { 00053 if (iValue) { 00054 (*pStream) << ", "; 00055 } 00056 }
void TuplePrinter::postVisitValue | ( | ) | [private] |
Definition at line 58 of file TuplePrinter.cpp.
References iValue.
Referenced by visitBoolean(), visitBytes(), visitDouble(), visitFloat(), visitSignedInt(), visitString(), and visitUnsignedInt().
00059 { 00060 ++iValue; 00061 }
void TuplePrinter::preVisitDocument | ( | std::string | ) | [private, virtual] |
void TuplePrinter::postVisitDocument | ( | ) | [private, virtual] |
void TuplePrinter::preVisitTable | ( | std::string | title | ) | [private, virtual] |
void TuplePrinter::postVisitTable | ( | ) | [private, virtual] |
void TuplePrinter::preVisitRow | ( | ) | [private, virtual] |
void TuplePrinter::postVisitRow | ( | ) | [private, virtual] |
void TuplePrinter::visitAttribute | ( | std::string | ) | [private, virtual] |
void TuplePrinter::visitString | ( | std::string | ) | [private, virtual] |
Implements DataVisitor.
Definition at line 63 of file TuplePrinter.cpp.
References postVisitValue(), and preVisitValue().
Referenced by visitChars().
00064 { 00065 preVisitValue(); 00066 // TODO: escaping 00067 (*pStream) << "'" << s << "'"; 00068 postVisitValue(); 00069 }
void TuplePrinter::visitChars | ( | char const * | , | |
TupleStorageByteLength | nChars | |||
) | [private, virtual] |
Implements DataVisitor.
Definition at line 71 of file TuplePrinter.cpp.
References visitString().
00072 { 00073 std::string s(c,n); 00074 visitString(s); 00075 }
void TuplePrinter::visitUnicodeChars | ( | Ucs2ConstBuffer | , | |
uint | nChars | |||
) | [private, virtual] |
Implements DataVisitor.
Definition at line 77 of file TuplePrinter.cpp.
References visitBytes().
00078 { 00079 // TODO jvs 13-Jan-2009: something prettier 00080 visitBytes(c, n*2); 00081 }
void TuplePrinter::visitUnsignedInt | ( | uint64_t | ) | [private, virtual] |
Implements DataVisitor.
Definition at line 83 of file TuplePrinter.cpp.
References postVisitValue(), and preVisitValue().
00084 { 00085 preVisitValue(); 00086 (*pStream) << i; 00087 postVisitValue(); 00088 }
void TuplePrinter::visitSignedInt | ( | int64_t | ) | [private, virtual] |
Implements DataVisitor.
Definition at line 90 of file TuplePrinter.cpp.
References postVisitValue(), and preVisitValue().
00091 { 00092 preVisitValue(); 00093 // FIXME: this comes out as garbage for the smallest negative value; not 00094 // sure why 00095 (*pStream) << i; 00096 postVisitValue(); 00097 }
void TuplePrinter::visitDouble | ( | double | ) | [private, virtual] |
Implements DataVisitor.
Definition at line 99 of file TuplePrinter.cpp.
References postVisitValue(), and preVisitValue().
00100 { 00101 preVisitValue(); 00102 (*pStream) << d; 00103 postVisitValue(); 00104 }
void TuplePrinter::visitFloat | ( | float | ) | [private, virtual] |
Implements DataVisitor.
Definition at line 106 of file TuplePrinter.cpp.
References postVisitValue(), and preVisitValue().
00107 { 00108 preVisitValue(); 00109 (*pStream) << f; 00110 postVisitValue(); 00111 }
void TuplePrinter::visitBoolean | ( | bool | ) | [private, virtual] |
Implements DataVisitor.
Definition at line 113 of file TuplePrinter.cpp.
References postVisitValue(), and preVisitValue().
00114 { 00115 preVisitValue(); 00116 if (b) { 00117 (*pStream) << "true"; 00118 } else { 00119 (*pStream) << "false"; 00120 } 00121 postVisitValue(); 00122 }
void TuplePrinter::visitPageId | ( | PageId | ) | [private, virtual] |
void TuplePrinter::visitPageOwnerId | ( | PageOwnerId | ) | [private, virtual] |
void TuplePrinter::visitSegByteId | ( | SegByteId | ) | [private, virtual] |
void TuplePrinter::visitFormatted | ( | char const * | ) | [private, virtual] |
void TuplePrinter::visitBytes | ( | void const * | v, | |
TupleStorageByteLength | iBytes | |||
) | [private, virtual] |
Implements DataVisitor.
Definition at line 124 of file TuplePrinter.cpp.
References hexDump(), postVisitValue(), preVisitValue(), and pStream.
Referenced by visitUnicodeChars().
00125 { 00126 preVisitValue(); 00127 if (!v) { 00128 (*pStream) << "NULL"; 00129 } else { 00130 hexDump(*pStream,v,iBytes); 00131 } 00132 postVisitValue(); 00133 }
void TuplePrinter::print | ( | std::ostream & | stream, | |
TupleDescriptor const & | tupleDesc, | |||
TupleData const & | tupleData | |||
) |
Definition at line 37 of file TuplePrinter.cpp.
References iValue, pStream, and TupleDescriptor::visit().
Referenced by BTreeDuplicateKeyExcn::BTreeDuplicateKeyExcn(), CalcExcn::CalcExcn(), BTreeNodeAccessor::dumpNode(), Calculator::exec(), UncollectExecStream::execute(), MockProducerExecStream::execute(), MockConsumerExecStream::execute(), CollectExecStream::execute(), BTreeWriter::insertTupleFromBuffer(), TestCalculator::printOutput(), CalcExtWinAggFuncTest::printOutput(), CalcExtStringTest::printOutput(), CalcExtRegExpTest::printOutput(), CalcExtMathTest::printOutput(), CalcExtDynamicVariableTest::printOutput(), CalcExtDateTimeTest::printOutput(), CalcExtContextTest::printOutput(), CalcExtCastTest::printOutput(), LhxHashTableTest::readPartition(), TestCalculator::setInput(), TestCalculator::setOutput(), CalcMiscTest::testCalcContinueOnException(), CalcMiscTest::testCalcRaise(), CalcMiscTest::testCalcReturn(), CalcMiscTest::testCalcStatusReg(), LhxHashTableTest::testInsert(), LhxHashKeyAccessor::toString(), LhxHashDataAccessor::toString(), ExecStreamScheduler::traceStreamBufferContents(), TupleTest::traceTuple(), tupleFiddle(), TupleOverflowExcn::TupleOverflowExcn(), CalcAssemblerTestCase::tupleToString(), unitTestBool(), unitTestFloat(), unitTestLong(), unitTestNullableLocal(), unitTestPointer(), unitTestPointerCache(), unitTestStatusRegister(), unitTestWarnings(), LbmEntry::validateEntrySize(), ExecStreamUnitTestBase::verifyConstantOutput(), and FlatFileExecStreamTest::verifyOutput().
00041 { 00042 boost::io::ios_all_saver streamStateSaver(stream); 00043 pStream = &stream; 00044 iValue = 0; 00045 (*pStream) << "[ "; 00046 tupleDesc.visit(tupleData,*this,false); 00047 (*pStream) << " ]"; 00048 pStream = NULL; 00049 }
std::ostream* TuplePrinter::pStream [private] |
Definition at line 40 of file TuplePrinter.h.
Referenced by print(), TuplePrinter(), and visitBytes().
uint TuplePrinter::iValue [private] |
Definition at line 41 of file TuplePrinter.h.
Referenced by postVisitValue(), preVisitValue(), and print().