Hyper API for C++ 0.0.18825
Hyper client library for C++ applications
Loading...
Searching...
No Matches
hyperapi::TableDefinition Class Referencefinal

A table definition. More...

#include <TableDefinition.hpp>

Classes

class  Column
 A Column of a table definition. More...
 

Public Types

using column_index_type = hyper_field_index_t
 Type of a column index.
 

Public Member Functions

 TableDefinition (TableName name, Persistence persistence=Persistence::Permanent)
 Creates a table definition with the given name and no columns.
 
 TableDefinition (TableName name, std::vector< Column > columns, Persistence persistence=Persistence::Permanent)
 Creates a table definition with the given name and columns.
 
const std::vector< Column > & getColumns () const noexcept
 Returns all columns.
 
const ColumngetColumn (hyper_field_index_t columnIndex) const
 Returns the column at the given position.
 
const ColumngetColumnByName (const Name &s) const noexcept
 Returns the column with the given name.
 
optional< hyper_field_index_t > getColumnPositionByName (const Name &s) const noexcept
 Returns the position of the column with the given name.
 
size_t getColumnCount () const noexcept
 Returns the numbers of columns.
 
Persistence getPersistence () const noexcept
 Returns the table persistence.
 
const TableNamegetTableName () const noexcept
 Returns the name of the table.
 
TableDefinitionaddColumn (Column &&c) noexcept
 Adds a column to the definition.
 
TableDefinitionaddColumn (const Column &c) noexcept
 Adds a column to the definition.
 
TableDefinitionsetTableName (TableName n) noexcept
 Sets the table's name.
 
TableDefinitionsetPersistence (Persistence p) noexcept
 Sets the table's persistence.
 

Detailed Description

Member Typedef Documentation

◆ column_index_type

using hyperapi::TableDefinition::column_index_type = hyper_field_index_t

Type of a column index.

Definition at line 47 of file TableDefinition.hpp.

Constructor & Destructor Documentation

◆ TableDefinition() [1/2]

hyperapi::TableDefinition::TableDefinition ( TableName  name,
Persistence  persistence = Persistence::Permanent 
)
explicit

Creates a table definition with the given name and no columns.

Parameters
nameThe name of the table.
persistenceThe persistence of the table.

◆ TableDefinition() [2/2]

hyperapi::TableDefinition::TableDefinition ( TableName  name,
std::vector< Column columns,
Persistence  persistence = Persistence::Permanent 
)
explicit

Creates a table definition with the given name and columns.

Parameters
nameThe name of the table.
columnsThe columns of the table.
persistenceThe persistence of the table.

Member Function Documentation

◆ addColumn() [1/2]

TableDefinition & hyperapi::TableDefinition::addColumn ( Column &&  c)
noexcept

Adds a column to the definition.

Parameters
cThe column to add.
Returns
*this, to allow call chaining.

◆ addColumn() [2/2]

TableDefinition & hyperapi::TableDefinition::addColumn ( const Column c)
noexcept

Adds a column to the definition.

Parameters
cThe column to add.
Returns
*this, to allow call chaining.

◆ getColumn()

const Column & hyperapi::TableDefinition::getColumn ( hyper_field_index_t  columnIndex) const

Returns the column at the given position.

Parameters
columnIndexThe index of the column
Returns
The column at the given position (staring with 0).
Precondition
0 <= columnIndex < getColumnCount()

◆ getColumnByName()

const Column * hyperapi::TableDefinition::getColumnByName ( const Name s) const
noexcept

Returns the column with the given name.

Parameters
sThe name of the column
Returns
The column with the given name or nullptr if no such column exists.

◆ getColumnCount()

size_t hyperapi::TableDefinition::getColumnCount ( ) const
inlinenoexcept

Returns the numbers of columns.

Definition at line 151 of file TableDefinition.hpp.

◆ getColumnPositionByName()

optional< hyper_field_index_t > hyperapi::TableDefinition::getColumnPositionByName ( const Name s) const
noexcept

Returns the position of the column with the given name.

Parameters
sThe name of the column
Returns
The position of the column with the given name if such column exists.

◆ getColumns()

const std::vector< Column > & hyperapi::TableDefinition::getColumns ( ) const
inlinenoexcept

Returns all columns.

Definition at line 124 of file TableDefinition.hpp.

◆ getPersistence()

Persistence hyperapi::TableDefinition::getPersistence ( ) const
inlinenoexcept

Returns the table persistence.

Definition at line 156 of file TableDefinition.hpp.

◆ getTableName()

const TableName & hyperapi::TableDefinition::getTableName ( ) const
inlinenoexcept

Returns the name of the table.

Examples
read_and_print_data_from_existing_hyper_file.cpp.

Definition at line 161 of file TableDefinition.hpp.

◆ setPersistence()

TableDefinition & hyperapi::TableDefinition::setPersistence ( Persistence  p)
noexcept

Sets the table's persistence.

Parameters
pThe new persistence
Returns
*this, to allow call chaining.

◆ setTableName()

TableDefinition & hyperapi::TableDefinition::setTableName ( TableName  n)
noexcept

Sets the table's name.

Parameters
nThe new name.
Returns
*this, to allow call chaining.

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