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

Classes

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

Public Member Functions

virtual ibis::table::stringArray columnNames () const
 
virtual ibis::table::typeArray columnTypes () const
 
 cursor (const ibis::mensa &t)
 Constructure a cursor object for row-wise data access to a ibis::mensa object. More...
 
virtual int dump (std::ostream &out, const char *del) const
 Print the current row. More...
 
int dumpBlock (std::ostream &out, const char *del)
 Print out the content of the current block. More...
 
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 ()
 Points the the next row.
 
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. More...
 
virtual int fetch (uint64_t, ibis::table::row &)
 Fetch the content of the specified row and make that row the current row as well. More...
 
virtual int getColumnAsByte (const char *, char &) const
 
virtual int getColumnAsByte (uint32_t, char &) const
 
virtual int getColumnAsDouble (const char *, double &) const
 
virtual int getColumnAsDouble (uint32_t, double &) const
 
virtual int getColumnAsFloat (const char *, float &) const
 
virtual int getColumnAsFloat (uint32_t, float &) const
 
virtual int getColumnAsInt (const char *, int32_t &) const
 
virtual int getColumnAsInt (uint32_t, int32_t &) const
 
virtual int getColumnAsLong (const char *, int64_t &) const
 
virtual int getColumnAsLong (uint32_t, int64_t &) const
 
virtual int getColumnAsOpaque (const char *, ibis::opaque &) const
 
virtual int getColumnAsOpaque (uint32_t, ibis::opaque &) const
 
virtual int getColumnAsShort (const char *, int16_t &) const
 
virtual int getColumnAsShort (uint32_t, int16_t &) const
 
virtual int getColumnAsString (const char *, std::string &) const
 
virtual int getColumnAsString (uint32_t, std::string &) const
 
virtual int getColumnAsUByte (const char *, unsigned char &) const
 
virtual int getColumnAsUByte (uint32_t, unsigned char &) const
 
virtual int getColumnAsUInt (const char *, uint32_t &) const
 
virtual int getColumnAsUInt (uint32_t, uint32_t &) const
 
virtual int getColumnAsULong (const char *, uint64_t &) const
 
virtual int getColumnAsULong (uint32_t, uint64_t &) const
 
virtual int getColumnAsUShort (const char *, uint16_t &) const
 
virtual int getColumnAsUShort (uint32_t, uint16_t &) const
 
virtual uint64_t getCurrentRowNumber () const
 Return the current row number. More...
 
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 ()
 !< the current row number More...
 
int dumpIJ (std::ostream &, uint32_t, uint32_t) const
 Print the ith element in the current block for column j. More...
 
int fillBuffer (uint32_t) const
 Fill the buffer for variable number i. More...
 
int fillBuffers () const
 Fill the buffers for every column. More...
 
void fillRow (ibis::table::row &res) const
 
- Protected Member Functions inherited from ibis::table::cursor
 cursor (const cursor &)
 
cursoroperator= (const cursor &)
 

Protected Attributes

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

Constructor & Destructor Documentation

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

Member Function Documentation

void ibis::mensa::cursor::clearBuffers ( )
protected

!< the current row number

Mark all existing buffer as empty.

References ibis::mensa::clear(), ibis::DOUBLE, ibis::FLOAT, ibis::INT, ibis::LONG, ibis::OID, ibis::SHORT, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.

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.

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::CATEGORY, ibis::DOUBLE, ibis::FLOAT, ibis::blob::getBlob(), ibis::text::getString(), ibis::INT, ibis::LONG, ibis::OID, ibis::SHORT, ibis::TEXT, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.

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::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::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::CATEGORY, ibis::DOUBLE, ibis::FLOAT, ibis::part::getColumn(), ibis::INT, ibis::LONG, ibis::column::name(), ibis::part::nRows(), ibis::OID, 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::DOUBLE, ibis::FLOAT, ibis::INT, ibis::LONG, ibis::OID, ibis::SHORT, ibis::TYPESTRING, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.

int ibis::mensa::cursor::getColumnAsByte ( const char *  cname,
char &   
) const
inlinevirtual

Retrieve the value of the named column.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

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.

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.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Implements ibis::table::cursor.

References ibis::UBYTE.

int ibis::mensa::cursor::getColumnAsDouble ( const char *  cname,
double &   
) const
inlinevirtual

Retrieve the value of the named column.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

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

Implements ibis::table::cursor.

int ibis::mensa::cursor::getColumnAsDouble ( uint32_t  cnum,
double &  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.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Implements ibis::table::cursor.

References ibis::DOUBLE, ibis::INT, ibis::SHORT, ibis::UBYTE, ibis::UINT, and ibis::USHORT.

int ibis::mensa::cursor::getColumnAsFloat ( const char *  cname,
float &   
) const
inlinevirtual

Retrieve the value of the named column.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

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

Implements ibis::table::cursor.

int ibis::mensa::cursor::getColumnAsFloat ( uint32_t  cnum,
float &  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.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Implements ibis::table::cursor.

References ibis::FLOAT, ibis::SHORT, ibis::UBYTE, and ibis::USHORT.

int ibis::mensa::cursor::getColumnAsInt ( const char *  cname,
int32_t &   
) const
inlinevirtual

Retrieve the value of the named column.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

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

Implements ibis::table::cursor.

int ibis::mensa::cursor::getColumnAsInt ( uint32_t  cnum,
int32_t &  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.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Implements ibis::table::cursor.

References ibis::INT, ibis::SHORT, ibis::UBYTE, ibis::UINT, and ibis::USHORT.

int ibis::mensa::cursor::getColumnAsLong ( const char *  cname,
int64_t &   
) const
inlinevirtual

Retrieve the value of the named column.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

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

Implements ibis::table::cursor.

int ibis::mensa::cursor::getColumnAsLong ( uint32_t  cnum,
int64_t &  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.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Implements ibis::table::cursor.

References ibis::INT, ibis::LONG, ibis::OID, ibis::SHORT, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.

int ibis::mensa::cursor::getColumnAsOpaque ( const char *  cname,
ibis::opaque &   
) const
inlinevirtual

Retrieve the value of the named column.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

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

Implements ibis::table::cursor.

int ibis::mensa::cursor::getColumnAsOpaque ( uint32_t  cnum,
ibis::opaque &  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.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Implements ibis::table::cursor.

References ibis::BLOB, ibis::CATEGORY, ibis::DOUBLE, ibis::FLOAT, ibis::column::getOpaque(), ibis::column::getString(), ibis::INT, ibis::LONG, ibis::OID, ibis::SHORT, ibis::TEXT, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.

int ibis::mensa::cursor::getColumnAsShort ( const char *  cname,
int16_t &   
) const
inlinevirtual

Retrieve the value of the named column.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

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

Implements ibis::table::cursor.

int ibis::mensa::cursor::getColumnAsShort ( uint32_t  cnum,
int16_t &  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.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Implements ibis::table::cursor.

References ibis::SHORT, ibis::UBYTE, and ibis::USHORT.

int ibis::mensa::cursor::getColumnAsString ( const char *  cname,
std::string &   
) const
inlinevirtual

Retrieve the value of the named column.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

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

Implements ibis::table::cursor.

int ibis::mensa::cursor::getColumnAsString ( uint32_t  cnum,
std::string &  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.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Implements ibis::table::cursor.

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

int ibis::mensa::cursor::getColumnAsUByte ( const char *  cname,
unsigned char &   
) const
inlinevirtual

Retrieve the value of the named column.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

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

Implements ibis::table::cursor.

int ibis::mensa::cursor::getColumnAsUByte ( uint32_t  cnum,
unsigned 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.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Implements ibis::table::cursor.

References ibis::UBYTE.

int ibis::mensa::cursor::getColumnAsUInt ( const char *  cname,
uint32_t &   
) const
inlinevirtual

Retrieve the value of the named column.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

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

Implements ibis::table::cursor.

int ibis::mensa::cursor::getColumnAsUInt ( uint32_t  cnum,
uint32_t &  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.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Implements ibis::table::cursor.

References ibis::INT, ibis::SHORT, ibis::UBYTE, ibis::UINT, and ibis::USHORT.

int ibis::mensa::cursor::getColumnAsULong ( const char *  cname,
uint64_t &   
) const
inlinevirtual

Retrieve the value of the named column.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

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

Implements ibis::table::cursor.

int ibis::mensa::cursor::getColumnAsULong ( uint32_t  cnum,
uint64_t &  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.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Implements ibis::table::cursor.

References ibis::INT, ibis::LONG, ibis::OID, ibis::SHORT, ibis::UBYTE, ibis::UINT, ibis::ULONG, and ibis::USHORT.

int ibis::mensa::cursor::getColumnAsUShort ( const char *  cname,
uint16_t &   
) const
inlinevirtual

Retrieve the value of the named column.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

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

Implements ibis::table::cursor.

int ibis::mensa::cursor::getColumnAsUShort ( uint32_t  cnum,
uint16_t &  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.

These functions return the number of elements copied upon successful completion, otherwise they return a negative number to indicate failure.

Implements ibis::table::cursor.

References ibis::SHORT, ibis::UBYTE, and ibis::USHORT.

virtual uint64_t ibis::mensa::cursor::getCurrentRowNumber ( ) const
inlinevirtual

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