Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
ibis::mensa::cursor Class Reference
Inheritance diagram for ibis::mensa::cursor:
ibis::table::cursor

List of all members.

Classes

struct  bufferElement
 A buffer element is a minimal data structure to store a column in memory. More...

Public Member Functions

virtual ibis::table::stringList columnNames () const
virtual ibis::table::typeList columnTypes () const
 cursor (const ibis::mensa &t)
 Constructure a cursor object for row-wise data access to a ibis::mensa object.
virtual int dump (std::ostream &out, const char *del) const
 Print the current row.
int dumpBlock (std::ostream &out, const char *del)
 Print out the content of the current block.
int dumpSome (std::ostream &out, uint64_t nr, const char *del)
 Print the next nr rows of the table to the specified output stream.
virtual int fetch (uint64_t)
 Pointers to the specified row.
virtual int fetch (ibis::table::row &)
 Fetch the content of the next row and make the next row as the current row as well.
virtual int fetch (uint64_t, ibis::table::row &)
 Fetch the content of the specified row and make that row the current row as well.
virtual int fetch ()
 Points the the next row.
virtual int getColumnAsByte (uint32_t, char &) const
 This version of getColumnAsTTT directly use the column number, i.e., the position of a column in the list returned by function columnNames or columnTypes.
virtual int getColumnAsByte (const char *, char &) const
 Retrieve the value of the named column.
virtual int getColumnAsDouble (uint32_t, double &) const
virtual int getColumnAsDouble (const char *, double &) const
virtual int getColumnAsFloat (uint32_t, float &) const
virtual int getColumnAsFloat (const char *, float &) const
virtual int getColumnAsInt (const char *, int32_t &) const
virtual int getColumnAsInt (uint32_t, int32_t &) const
virtual int getColumnAsLong (uint32_t, int64_t &) const
virtual int getColumnAsLong (const char *, int64_t &) const
virtual int getColumnAsShort (const char *, int16_t &) const
virtual int getColumnAsShort (uint32_t, int16_t &) const
virtual int getColumnAsString (uint32_t, std::string &) const
virtual int getColumnAsString (const char *, std::string &) const
virtual int getColumnAsUByte (const char *, unsigned char &) const
virtual int getColumnAsUByte (uint32_t, unsigned char &) const
virtual int getColumnAsUInt (uint32_t, uint32_t &) const
virtual int getColumnAsUInt (const char *, uint32_t &) const
virtual int getColumnAsULong (const char *, uint64_t &) const
virtual int getColumnAsULong (uint32_t, uint64_t &) const
virtual int getColumnAsUShort (uint32_t, uint16_t &) const
virtual int getColumnAsUShort (const char *, uint16_t &) const
virtual uint64_t getCurrentRowNumber () const
 Return the current row number.
virtual uint32_t nColumns () const
virtual uint64_t nRows () const

Protected Types

typedef std::map< const char
*, uint32_t, ibis::lessi
bufferMap

Protected Member Functions

void clearBuffers ()
 Mark all existing buffer as empty.
int dumpIJ (std::ostream &, uint32_t, uint32_t) const
 Print the ith element in the current block for column j.
int fillBuffer (uint32_t) const
 Fill the buffer for variable number i.
int fillBuffers () const
 Fill the buffers for every column.
void fillRow (ibis::table::row &res) const

Protected Attributes

uint64_t bBegin
 the first row number of the current block
uint64_t bEnd
 end of the current block
std::vector< bufferElementbuffer
bufferMap bufmap
unsigned curPart
int64_t curRow
 the current row number
uint64_t pBegin
 the first row number of the current partition
unsigned preferred_block_size
const ibis::mensatab

Constructor & Destructor Documentation

ibis::mensa::cursor::cursor ( const ibis::mensa t)

Member Function Documentation

int ibis::mensa::cursor::dump ( std::ostream &  out,
const char *  del 
) const [virtual]

Print the current row.

Assumes the caller has performed the fetch operation.

Return values:

  • 0 -- normal (successful) completion.
  • -1 -- cursor objection not initialized, call fetch first.
  • -2 -- unable to load data into memory.
  • -4 -- error in the output stream.

Implements ibis::table::cursor.

int ibis::mensa::cursor::dumpBlock ( std::ostream &  out,
const char *  del 
)

Print out the content of the current block.

Also move the pointer to the last row of the block.

References ibis::gVerbose.

Referenced by ibis::mensa::dump().

int ibis::mensa::cursor::dumpIJ ( std::ostream &  out,
uint32_t  i,
uint32_t  j 
) const [protected]

Print the ith element in the current block for column j.

Note:
This function does not perform array bounds check.

References ibis::BLOB, ibis::BYTE, ibis::CATEGORY, ibis::DOUBLE, ibis::FLOAT, ibis::blob::getBlob(), ibis::text::getString(), ibis::gVerbose, ibis::INT, ibis::LONG, ibis::SHORT, ibis::TEXT, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.

int ibis::mensa::cursor::fetch ( uint64_t  rownum,
ibis::table::row  
) [virtual]

Fetch the content of the specified row and make that row the current row as well.

Implements ibis::table::cursor.

int ibis::mensa::cursor::fetch ( ibis::table::row ) [virtual]

Fetch the content of the next row and make the next row as the current row as well.

Implements ibis::table::cursor.

int ibis::mensa::cursor::fillBuffer ( uint32_t  i) const [protected]

Fill the buffer for variable number i.

On success, return 0, otherwise return a negative value.

Note:
The member variable cval in the buffer for a string valued column is not the usual ibis::fileManager::storage object, instead it is simply the pointer to the ibis::column object. The string variable is retrieved through the column object one at a time using the function getString.

References ibis::bitvector::adjustSize(), ibis::bitvector::appendFill(), ibis::BLOB, ibis::BYTE, ibis::CATEGORY, ibis::DOUBLE, ibis::FLOAT, ibis::part::getColumn(), ibis::gVerbose, ibis::INT, ibis::LONG, ibis::column::name(), ibis::part::nRows(), ibis::column::selectValues(), ibis::SHORT, ibis::TEXT, ibis::TYPESTRING, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.

int ibis::mensa::cursor::fillBuffers ( ) const [protected]

Fill the buffers for every column.

If all column buffers are not empty, then they are assumed to contain the expected content already. Otherwise, it calls fillBuffer on each column.

References ibis::BYTE, ibis::DOUBLE, ibis::FLOAT, ibis::gVerbose, ibis::INT, ibis::LONG, ibis::SHORT, ibis::TYPESTRING, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.

int ibis::mensa::cursor::getColumnAsByte ( uint32_t  cnum,
char &  val 
) const [virtual]

This version of getColumnAsTTT directly use the column number, i.e., the position of a column in the list returned by function columnNames or columnTypes.

This version of the data access function may be able to avoid the name lookup and reduce the execution time.

Implements ibis::table::cursor.

References ibis::BYTE, and ibis::UBYTE.

int ibis::mensa::cursor::getColumnAsByte ( const char *  cname,
char &   
) const [inline, virtual]

Retrieve the value of the named column.

Note:
Note the cost of name lookup is likely to dominate the total cost of such a function.

Implements ibis::table::cursor.

References ibis::mensa::parts.

virtual uint64_t ibis::mensa::cursor::getCurrentRowNumber ( ) const [inline, virtual]

Return the current row number.

Rows in a data set are numbered [0

  • nRows()-1]. If the cursor is not ready, such as before the first call to fetch or function fetch returned an error, this function return the same value as function nRows.

Implements ibis::table::cursor.

References curRow.


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

Make It A Bit Faster
Contact us
Disclaimers
FastBit source code
FastBit mailing list archive