Rudiments
Public Member Functions | List of all members
tablecollection< valuetype > Class Template Referenceabstract

#include <tablecollection.h>

Inherits collection.

Inherited by table< valuetype >.

Public Member Functions

 tablecollection ()
 
 tablecollection (tablecollection &c)
 
tablecollectionoperator= (tablecollection &c)
 
virtual ~tablecollection ()
 
virtual const chargetType ()
 
virtual uint64_t getCount ()
 
virtual void setColumnName (uint64_t col, const char *name)=0
 
virtual const chargetColumnName (uint64_t col)=0
 
virtual void setCopyColumnNames (bool copy)
 
virtual bool getCopyColumnNames ()
 
virtual uint64_t getColumnCount ()=0
 
virtual void setValue (uint64_t row, uint64_t col, valuetype value)=0
 
virtual valuetype getValue (uint64_t row, uint64_t col)=0
 
virtual valuetypegetReference (uint64_t row, uint64_t col)=0
 
virtual valuetype getValue (uint64_t row, const char *colname)=0
 
virtual uint64_t getRowCount ()=0
 
virtual bool getAllRowsAvailable ()=0
 
virtual ssize_t write ()
 
virtual ssize_t write (output *out)
 
virtual ssize_t writeJson ()
 
virtual ssize_t writeJson (bool indent)
 
virtual ssize_t writeJson (output *out)
 
virtual ssize_t writeJson (output *out, bool indent)
 
- Public Member Functions inherited from collection
 collection ()
 
 collection (collection &c)
 
collectionoperator= (collection &c)
 
virtual ~collection ()
 
comparatorgetComparator ()
 
void setComparator (comparator *newcomp)
 
virtual bool isReadOnly ()
 
virtual bool isBlockBased ()
 
virtual uint64_t getBlockSize ()
 
virtual bool isSequentialAccess ()
 
virtual void setManageValues (bool manage)
 
virtual bool getManageValues ()
 
virtual void setManageArrayValues (bool manage)
 
virtual bool getManageArrayValues ()
 
virtual void setManageKeys (bool manage)
 
virtual bool getManageKeys ()
 
virtual void setManageArrayKeys (bool manage)
 
virtual bool getManageArrayKeys ()
 
virtual bool clear ()=0
 
- Public Member Functions inherited from object
virtual ~object ()
 

Detailed Description

template<class valuetype>
class tablecollection< valuetype >

The tablecollection class is the parent class for all rudiments table collections.

Tables have rows and columns. Columns may have names.

Tables may be read-write or read-only, monolithic or block-based, and random-access or sequential-access.

In a monolithic implemenatation, all rows are immediately available at all times.

In a block-based implementation, rows are only immediately available in blocks. Eg. If the table has a block size of 10, then getting a value in row 6 would cause rows 0-9 to be loaded. Getting a value in row 22 would cause rows 20-29 to be loaded.

In a random implementation, values from any row may be accessed at any time. If the implementation is also block-based, then it may be more efficient to access values from adjacent rows within the current block than to access values from rows outside of the current block.

In a sequential implementation, values may only be accessed from rows within the current block or subsequent blocks. Eg. If the table has a block size of 10, then getting a value in row 6, followed by a value in row 22 would succeed, but a subsequent attempt to get a value from row 7 would fail.

Constructor & Destructor Documentation

◆ tablecollection() [1/2]

Creates an instance of the tablecollection class.

◆ tablecollection() [2/2]

Creates an instance of the tablecollection class that is a copy of "c".

◆ ~tablecollection()

template<class valuetype >
tablecollection< valuetype >::~tablecollection ( )
inlinevirtual

Deletes this instance of the tablecollection class.

Member Function Documentation

◆ getAllRowsAvailable()

template<class valuetype >
virtual bool tablecollection< valuetype >::getAllRowsAvailable ( )
pure virtual

Always returns true for monolithic implementations. Only returns true in a block-based implementation if the current block contains the last row in the table.

Implemented in table< valuetype >.

◆ getColumnCount()

template<class valuetype >
virtual uint64_t tablecollection< valuetype >::getColumnCount ( )
pure virtual

Returns the current number of columns in the table.

In a read-write implementation, returns larger and larger values as calls to setColumnName() or setValue() extend the table.

Implemented in table< valuetype >.

◆ getColumnName()

template<class valuetype >
virtual const char * tablecollection< valuetype >::getColumnName ( uint64_t col)
pure virtual

Returns the name of column "col" or NULL if column "col" has no name.

Implemented in table< valuetype >.

◆ getCopyColumnNames()

template<class valuetype >
bool tablecollection< valuetype >::getCopyColumnNames ( )
inlinevirtual

Returns whether or not this instance of the tablecollection class is configured to make copies of the values that are passed in to setColumnName().

Returns true if it is and false if it is not.

Reimplemented in table< valuetype >.

◆ getCount()

template<class valuetype >
uint64_t tablecollection< valuetype >::getCount ( )
inlinevirtual

Returns the number of elements in the table.

Implements collection.

◆ getReference()

template<class valuetype >
virtual valuetype & tablecollection< valuetype >::getReference ( uint64_t row,
uint64_t col )
pure virtual

Returns a reference to the value at "row", "col".

Implemented in table< valuetype >.

◆ getRowCount()

template<class valuetype >
virtual uint64_t tablecollection< valuetype >::getRowCount ( )
pure virtual

Returns the current number of rows in the table.

In a read-write implementation, returns larger and larger values as calls to setValue() extend the table.

In a block-based implementation, returns the total number of rows through the end of the current block, which is only the total number of rows in the table when getAllRowsAvailable() returns true.

Implemented in table< valuetype >.

◆ getType()

template<class valuetype >
const char * tablecollection< valuetype >::getType ( )
inlinevirtual

Returns "table".

Implements collection.

◆ getValue() [1/2]

template<class valuetype >
virtual valuetype tablecollection< valuetype >::getValue ( uint64_t row,
const char * colname )
pure virtual

Returns the value at "row", "colname". Returns NULL or 0 if there is no value at that address.

Implemented in table< valuetype >.

◆ getValue() [2/2]

template<class valuetype >
virtual valuetype tablecollection< valuetype >::getValue ( uint64_t row,
uint64_t col )
pure virtual

Returns the value at "row", "col". Returns NULL or 0 if there is no value at that address.

Implemented in table< valuetype >.

◆ operator=()

Makes this instance of the tablecollection class identical to "c".

◆ setColumnName()

template<class valuetype >
virtual void tablecollection< valuetype >::setColumnName ( uint64_t col,
const char * name )
pure virtual

In a read-write implementation, sets the name of column "col" to "name".

In a read-only implementation, has no effect.

Implemented in table< valuetype >.

◆ setCopyColumnNames()

template<class valuetype >
void tablecollection< valuetype >::setCopyColumnNames ( bool copy)
inlinevirtual

Indicates whether or not this instance of the tablecollection class should make copies the values that are passed in to setColumnName().

Defaults to "false".

Reimplemented in table< valuetype >.

◆ setValue()

template<class valuetype >
virtual void tablecollection< valuetype >::setValue ( uint64_t row,
uint64_t col,
valuetype value )
pure virtual

In a read-write implementation, sets the value at "row", "col" to "value".

In a read-only implementation, has no effect.

Implemented in table< valuetype >.

◆ write() [1/2]

template<class valuetype >
ssize_t tablecollection< valuetype >::write ( )
inlinevirtual

Writes a representation of the tablecollection to standard output.

Implements collection.

◆ write() [2/2]

template<class valuetype >
ssize_t tablecollection< valuetype >::write ( output * out)
inlinevirtual

Writes a representation of the tablecollection to "out".

Implements collection.

◆ writeJson() [1/4]

template<class valuetype >
ssize_t tablecollection< valuetype >::writeJson ( )
inlinevirtual

Writes a JSON representation of the tablecollection to standard output.

Implements collection.

◆ writeJson() [2/4]

template<class valuetype >
ssize_t tablecollection< valuetype >::writeJson ( bool indent)
inlinevirtual

Writes a JSON representation of the tablecollection to standard output.

If "indent" is true, then the output is automatically indented. If "indent" is false, then the tree is written without indentation.

Implements collection.

◆ writeJson() [3/4]

template<class valuetype >
ssize_t tablecollection< valuetype >::writeJson ( output * out)
inlinevirtual

Writes a JSON representation of the tablecollection to "out".

Implements collection.

◆ writeJson() [4/4]

template<class valuetype >
ssize_t tablecollection< valuetype >::writeJson ( output * out,
bool indent )
inlinevirtual

Writes a JSON representation of the tablecollection to "out".

If "indent" is true, then the output is automatically indented. If "indent" is false, then the tree is written without indentation.

Implements collection.