TuplePrinter Class Reference

#include <TuplePrinter.h>

Inheritance diagram for TuplePrinter:

DataVisitor List of all members.

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

Detailed Description

Definition at line 36 of file TuplePrinter.h.


Constructor & Destructor Documentation

TuplePrinter::TuplePrinter (  )  [explicit]

Definition at line 32 of file TuplePrinter.cpp.

References pStream.

00033 {
00034     pStream = NULL;
00035 }


Member Function Documentation

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]

Implements DataVisitor.

Definition at line 135 of file TuplePrinter.cpp.

00136 {
00137     // unused
00138 }

void TuplePrinter::postVisitDocument (  )  [private, virtual]

Implements DataVisitor.

Definition at line 140 of file TuplePrinter.cpp.

00141 {
00142     // unused
00143 }

void TuplePrinter::preVisitTable ( std::string  title  )  [private, virtual]

Implements DataVisitor.

Definition at line 145 of file TuplePrinter.cpp.

00146 {
00147     // unused
00148 }

void TuplePrinter::postVisitTable (  )  [private, virtual]

Implements DataVisitor.

Definition at line 150 of file TuplePrinter.cpp.

00151 {
00152     // unused
00153 }

void TuplePrinter::preVisitRow (  )  [private, virtual]

Implements DataVisitor.

Definition at line 155 of file TuplePrinter.cpp.

00156 {
00157     // unused
00158 }

void TuplePrinter::postVisitRow (  )  [private, virtual]

Implements DataVisitor.

Definition at line 160 of file TuplePrinter.cpp.

00161 {
00162     // unused
00163 }

void TuplePrinter::visitAttribute ( std::string   )  [private, virtual]

Implements DataVisitor.

Definition at line 165 of file TuplePrinter.cpp.

00166 {
00167     // unused
00168 }

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]

Implements DataVisitor.

Definition at line 170 of file TuplePrinter.cpp.

00171 {
00172     // unused
00173 }

void TuplePrinter::visitPageOwnerId ( PageOwnerId   )  [private, virtual]

Implements DataVisitor.

Definition at line 175 of file TuplePrinter.cpp.

00176 {
00177     // unused
00178 }

void TuplePrinter::visitSegByteId ( SegByteId   )  [private, virtual]

Implements DataVisitor.

Definition at line 180 of file TuplePrinter.cpp.

00181 {
00182     // unused
00183 }

void TuplePrinter::visitFormatted ( char const *   )  [private, virtual]

Implements DataVisitor.

Definition at line 185 of file TuplePrinter.cpp.

00186 {
00187     // unused
00188 }

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 }


Member Data Documentation

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().


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