RowBlock Class Reference

The RowBlock class represents a block of memory containing 1..N rows, where N is the maximum number of whole rows that this block will allow. More...

List of all members.

Public Member Functions

INLINE_ const simba_byte * GetCellBuffer (simba_uint32 &out_length, simba_uint16 in_columnNum, simba_uint64 in_rowNum)
 Get the buffer for the cell at the input column and row.
simba_uint32 GetRowCount () const
 Get the number of rows within this RowBlock.
simba_uint64 GetStartRow () const
 Get the number of the first row within this RowBlock.
simba_uint32 GetWritableRows () const
 Get the max number of rows that can be written to this block. This represents the total number of rows that can be written to the block. GetRowCount() provides the data for the number of rows within the block.
bool HasRow (simba_uint64 in_rowNumber) const
 Check if this block contains the input row number.
bool IsReadable () const
 Check if it is possible to read from this RowBlock.
bool IsWritable () const
 Check if it is possible to write to this RowBlock. This method does not consider if a new row can be written to the RowBlock, just if it is in a writable state.
bool RetrieveData (simba_uint64 in_row, simba_uint16 in_column, SqlData *io_data, simba_signed_native in_offset, simba_signed_native in_maxSize)
 Fills in in_data with a chunk of data for the given column in the current row.
template<class RowCompare >
void SortRows (RowCompare &rowCompare, std::vector< simba_uint64 > &out_rows)
void WriteData (simba_uint16 in_column, const void *in_data, simba_uint32 in_length)
 Write the given data to the column in the current row. Each cell can only be written to once.
void WriteData (simba_uint16 in_column, SqlData *in_data)
 Write the given data to the column in the current row. Each cell can only be written to once. Meaning, RowBlocks do not accept partial writes.
void WriteRow (RowBlock &in_other, const simba_uint64 in_rowToWrite)
 Write a row from the input block to this block. A free row must first be appended with AppendRow().
 ~RowBlock ()
 Destructor.

Protected Member Functions

bool AppendRow ()
 Append a row to the end of this RowBlock.
void CloseForWrite ()
 Method that allows the caller to force this RowBlock not to accept any more rows, even if it has room for them.
void Flushed ()
 Notify this block that its contents have been flushed to disk.
simba_byte * GetBuffer (simba_int64 &io_length)
 Get the data buffer held by this class. This method can be used to read and write a block of data to and from the buffer. If the required length is unknown (for reading the buffer) the length should be a negative number. If the required length is known (for writing to the buffer) the length should be a non-zero positive number.
bool IsFlushed () const
 Check if the data in this block has already been flushed to disk.
void PrepareRead ()
 Notify this RowBlock that it should prepare to be read from.
void PrepareWrite ()
 Notify this RowBlock that it should prepare to be written to.
void Reset ()
 Reset the data in this RowBlock.
 RowBlock (const RowBlockProperties &in_properties)
 Constructor.
void Serialize ()
 Notify this DataSource that it should serialize its internal data buffer.
void TransferSlick (RowBlock &in_other)
 Take the ENSLICK* from the input block. Used to cache a ENSLICK object between blocks owned by the same SwapManager.
void Update (simba_uint64 in_startRowNum, simba_uint32 in_count)
 Set a new start row for this block.
void UpdateRowBlockPropertiesReference (const RowBlockProperties &in_properties)
 Change the RowBlockProperties referenced by this object.

Friends

class SwapManager

Detailed Description

The RowBlock class represents a block of memory containing 1..N rows, where N is the maximum number of whole rows that this block will allow.


Constructor & Destructor Documentation

~RowBlock (  ) 

Destructor.

RowBlock ( const RowBlockProperties in_properties  )  [protected]

Constructor.

Parameters:
in_properties The RowBlock properties (NOT OWN).

Member Function Documentation

bool AppendRow (  )  [protected]

Append a row to the end of this RowBlock.

Returns:
true if the row was added successfully; false otherwise.
void CloseForWrite (  )  [inline, protected]

Method that allows the caller to force this RowBlock not to accept any more rows, even if it has room for them.

void Flushed (  )  [protected]

Notify this block that its contents have been flushed to disk.

simba_byte* GetBuffer ( simba_int64 &  io_length  )  [protected]

Get the data buffer held by this class. This method can be used to read and write a block of data to and from the buffer. If the required length is unknown (for reading the buffer) the length should be a negative number. If the required length is known (for writing to the buffer) the length should be a non-zero positive number.

Parameters:
io_length Input the requested length or a negative number if unknown. Output The actual length.
INLINE_ const simba_byte* GetCellBuffer ( simba_uint32 &  out_length,
simba_uint16  in_columnNum,
simba_uint64  in_rowNum 
) [inline]

Get the buffer for the cell at the input column and row.

Parameters:
out_length Output the length of the returned buffer. If the data is NULL, the length will be 0 and NULL will be returned.
in_columnNum The column number to get.
in_rowNum The row number to get. Should be relative to the start position of this RowBlock.
Returns:
a buffer to the requested cell. NULL if the data is NULL. (NOT OWN).
simba_uint32 GetRowCount (  )  const [inline]

Get the number of rows within this RowBlock.

Returns:
the number of the rows in this RowBlock.
simba_uint64 GetStartRow (  )  const [inline]

Get the number of the first row within this RowBlock.

Returns:
the number of the first row in this RowBlock.
simba_uint32 GetWritableRows (  )  const [inline]

Get the max number of rows that can be written to this block. This represents the total number of rows that can be written to the block. GetRowCount() provides the data for the number of rows within the block.

The value returned from this method is only accurate after PrepareWrite() has been

Returns:
the max number of rows that can be written to this block.
bool HasRow ( simba_uint64  in_rowNumber  )  const [inline]

Check if this block contains the input row number.

Parameters:
in_rowNumber The row number to check for.
Returns:
true if this block contains the input row. false otherwise.
bool IsFlushed (  )  const [protected]

Check if the data in this block has already been flushed to disk.

Returns:
true if the data has been flushed; false otherwise.
bool IsReadable (  )  const

Check if it is possible to read from this RowBlock.

Returns:
true if this RowBlock can be read from; false otherwise.
bool IsWritable (  )  const

Check if it is possible to write to this RowBlock. This method does not consider if a new row can be written to the RowBlock, just if it is in a writable state.

Returns:
true if this RowBlock is in a writable state; false otherwise.
void PrepareRead (  )  [protected]

Notify this RowBlock that it should prepare to be read from.

Parameters:
in_numRows The number of rows that are contained in this object's buffer.
void PrepareWrite (  )  [protected]

Notify this RowBlock that it should prepare to be written to.

void Reset (  )  [protected]

Reset the data in this RowBlock.

bool RetrieveData ( simba_uint64  in_row,
simba_uint16  in_column,
SqlData io_data,
simba_signed_native  in_offset,
simba_signed_native  in_maxSize 
)

Fills in in_data with a chunk of data for the given column in the current row.

The SqlTypeMetadata* used by in_data is the same SqlTypeMetadata* exposed by the IColumn describing the column.

Parameters:
in_row The row to retrieve.
in_column A column index. The first column uses index 0.
io_data Holds a buffer to store the requested data. (NOT OWN)
in_offset Number of bytes in the data to skip before copying into in_data.
in_maxSize Maximum number of bytes of data to return in in_data.
Returns:
true if there is more data left after the retrieved chunk; false otherwise.
void Serialize (  )  [protected]

Notify this DataSource that it should serialize its internal data buffer.

void SortRows ( RowCompare &  rowCompare,
std::vector< simba_uint64 > &  out_rows 
) [inline]

Sort the rows of this block.

Parameters:
rowComparator Compare function that accepts simba_uint64 as arguments, and returns a value convertible to bool. See std::sort for more details.
out_rows The result of the sort.
void TransferSlick ( RowBlock in_other  )  [protected]

Take the ENSLICK* from the input block. Used to cache a ENSLICK object between blocks owned by the same SwapManager.

Parameters:
in_other The DataSource that contains the ENSLICK* to take.
void Update ( simba_uint64  in_startRowNum,
simba_uint32  in_count 
) [protected]

Set a new start row for this block.

Parameters:
in_startRowNum The start row for this block.
in_count The current row count of the block.
void UpdateRowBlockPropertiesReference ( const RowBlockProperties in_properties  )  [inline, protected]

Change the RowBlockProperties referenced by this object.

NOTE: This method MUST only be used to link this object to another RowBlockProperties object that has EXACTLY the same attributes. Typically, it is used during the sort when transferring a block from one SwapManager to its clone. Not applying to this rule leads to unexpected behaviour.

Parameters:
in_properties The RowBlockProperties object to reference.
void WriteData ( simba_uint16  in_column,
const void *  in_data,
simba_uint32  in_length 
)

Write the given data to the column in the current row. Each cell can only be written to once.

Parameters:
in_column A column index. The first column uses index 0.
in_data The buffer with the data to write to the column, or NULL to write NULL data.
in_length The length, in bytes, of in_data.
void WriteData ( simba_uint16  in_column,
SqlData in_data 
)

Write the given data to the column in the current row. Each cell can only be written to once. Meaning, RowBlocks do not accept partial writes.

Parameters:
in_column A column index. The first column uses index 0.
in_data Holds a buffer with the data to write to the column.
void WriteRow ( RowBlock in_other,
const simba_uint64  in_rowToWrite 
)

Write a row from the input block to this block. A free row must first be appended with AppendRow().

Parameters:
in_other The RowBlock to copy the row from.
in_rowToWrite The row to copy.

Friends And Related Function Documentation

friend class SwapManager [friend]

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

Generated on Wed May 17 14:21:16 2017 for SimbaEngine 10.1.3.1011 by simba