#include <LbmByteSegment.h>
Public Member Functions | |
void | reset () |
LcsRid | getSrid () const |
Returns the Srid of the starting byte (not the first rid set). | |
bool | isNull () const |
Whether the segment has valid data. | |
LbmByteNumber | getEnd () const |
Returns the end byte number. | |
LcsRid | getEndRid () const |
Returns the end rid (one past last valid rid). | |
void | advanceToByteNum (LbmByteNumber newStartByteNum) |
Ensures the segment begins with the requested byte number. | |
uint | countBits () |
Count the number of bits in the current byte segment. | |
void | print (std::ostream &output) |
Prints a byte segment. | |
Static Public Member Functions | |
static uint | countBits (TupleDatum const &datum) |
Counts the number of rows represented by a bitmap datum. | |
static uint | countBits (PConstBuffer pBuf, uint len) |
Counts the number of bits in an array. | |
static void | verifyBitsInByte () |
Public Attributes | |
LbmByteNumber | byteNum |
PBuffer | byteSeg |
uint | len |
Static Public Attributes | |
static const uint | bitsInByte [] |
This array quickly dertermines how many bits are set in a byte. |
Definition at line 35 of file LbmByteSegment.h.
void LbmByteSegment::reset | ( | ) | [inline] |
Definition at line 44 of file LbmByteSegment.h.
Referenced by LbmUnionWorkspace::getSegment(), and LbmUnionWorkspace::reset().
LcsRid LbmByteSegment::getSrid | ( | ) | const [inline] |
Returns the Srid of the starting byte (not the first rid set).
Definition at line 54 of file LbmByteSegment.h.
References byteNumberToRid().
Referenced by LbmUnionExecStream::transfer(), and LbmChopperExecStream::writeSegment().
00055 { 00056 return byteNumberToRid(byteNum); 00057 }
bool LbmByteSegment::isNull | ( | ) | const [inline] |
Whether the segment has valid data.
Definition at line 62 of file LbmByteSegment.h.
Referenced by LbmUnionWorkspace::addSegment().
00063 { 00064 return byteSeg == NULL; 00065 }
LbmByteNumber LbmByteSegment::getEnd | ( | ) | const [inline] |
Returns the end byte number.
Definition at line 70 of file LbmByteSegment.h.
Referenced by LbmUnionWorkspace::addSegment().
LcsRid LbmByteSegment::getEndRid | ( | ) | const [inline] |
Returns the end rid (one past last valid rid).
Definition at line 78 of file LbmByteSegment.h.
References byteNumberToRid().
Referenced by LbmChopperExecStream::writeSegment().
00079 { 00080 return byteNumberToRid(getEnd()); 00081 }
void LbmByteSegment::advanceToByteNum | ( | LbmByteNumber | newStartByteNum | ) | [inline] |
Ensures the segment begins with the requested byte number.
As a result, the beginning of the segment or even the entire segment may be truncated.
This function assumes bytes are reverse order.
Definition at line 90 of file LbmByteSegment.h.
References opaqueToInt().
Referenced by LbmUnionWorkspace::addSegment().
00091 { 00092 // ignore null values 00093 if (isNull()) { 00094 return; 00095 } 00096 00097 // check if the segment will have valid data after truncation 00098 if (getEnd() <= newStartByteNum) { 00099 reset(); 00100 return; 00101 } 00102 00103 // advance the segment in place if required 00104 if (byteNum < newStartByteNum) { 00105 uint diff = opaqueToInt(newStartByteNum - byteNum); 00106 byteNum += diff; 00107 byteSeg -= diff; 00108 len -= diff; 00109 } 00110 }
uint LbmByteSegment::countBits | ( | ) | [inline] |
Count the number of bits in the current byte segment.
Definition at line 115 of file LbmByteSegment.h.
Referenced by LbmNormalizerExecStream::readSegment(), and LbmRepeatingAggComputer::updateAccumulator().
static uint LbmByteSegment::countBits | ( | TupleDatum const & | datum | ) | [inline, static] |
Counts the number of rows represented by a bitmap datum.
An empty datum represents a single row.
Definition at line 124 of file LbmByteSegment.h.
References TupleDatum::cbData, and TupleDatum::pData.
00125 { 00126 if (datum.pData == NULL || datum.cbData == 0) { 00127 return 1; 00128 } 00129 return countBits(datum.pData, datum.cbData); 00130 }
static uint LbmByteSegment::countBits | ( | PConstBuffer | pBuf, | |
uint | len | |||
) | [inline, static] |
Counts the number of bits in an array.
Definition at line 135 of file LbmByteSegment.h.
00136 { 00137 uint total = 0; 00138 for (uint i = 0; i < len; i++) { 00139 total += bitsInByte[pBuf[i]]; 00140 } 00141 return total; 00142 }
static void LbmByteSegment::verifyBitsInByte | ( | ) | [inline, static] |
Definition at line 144 of file LbmByteSegment.h.
Referenced by LbmNormalizerExecStreamTest::testBitsInByte().
00145 { 00146 for (uint i = 0; i < 256; i++) { 00147 uint slowBits = 0; 00148 for (uint j = 0; j < 8; j++) { 00149 if (i & (1 << j)) { 00150 slowBits++; 00151 } 00152 } 00153 assert (slowBits == bitsInByte[i]); 00154 } 00155 }
void LbmByteSegment::print | ( | std::ostream & | output | ) | [inline] |
Prints a byte segment.
This function assumes bytes are in order.
Definition at line 162 of file LbmByteSegment.h.
References opaqueToInt().
00163 { 00164 output << std::dec << opaqueToInt(byteNum) << "."; 00165 output << std::dec << len << " ("; 00166 for (uint i = 0; i < len; i++) { 00167 uint val = byteSeg[i]; 00168 if (i > 0) { 00169 output << ","; 00170 } 00171 output << std::hex << val; 00172 } 00173 output << ")" << std::endl; 00174 }
const uint LbmByteSegment::bitsInByte [static] |
This array quickly dertermines how many bits are set in a byte.
Definition at line 38 of file LbmByteSegment.h.
LbmByteNumber LbmByteSegment::byteNum |
Definition at line 40 of file LbmByteSegment.h.
Referenced by LbmUnionWorkspace::addSegment(), LbmUnionWorkspace::advancePastSegment(), LbmUnionWorkspace::getSegment(), LbmUnionExecStream::readSegment(), LbmNormalizerExecStream::readSegment(), and LbmChopperExecStream::readSegment().
Definition at line 41 of file LbmByteSegment.h.
Referenced by LbmUnionWorkspace::addSegment(), LbmUnionWorkspace::getSegment(), LbmUnionExecStream::readSegment(), LbmNormalizerExecStream::readSegment(), LbmChopperExecStream::readSegment(), LbmUnionExecStream::transfer(), and LbmChopperExecStream::writeSegment().
Definition at line 42 of file LbmByteSegment.h.
Referenced by LbmUnionWorkspace::addSegment(), LbmUnionWorkspace::advancePastSegment(), LbmUnionWorkspace::getSegment(), LbmUnionExecStream::readSegment(), LbmNormalizerExecStream::readSegment(), LbmChopperExecStream::readSegment(), LbmUnionExecStream::transfer(), and LbmChopperExecStream::writeSegment().