HiPipe
0.7.0
C++17 data pipeline with Python bindings.
|
Container for multiple columns. More...
#include <hipipe/core/stream/batch_t.hpp>
Public Member Functions | |
template<typename Column > | |
std::unique_ptr< abstract_column > & | at () |
Retrieve the handle (unique pointer reference) to the given column. More... | |
template<typename Column > | |
Column::data_type & | extract () |
Extract a reference to the stored data of the given column. More... | |
template<typename Column > | |
const Column::data_type & | extract () const |
template<typename Column , typename... Args> | |
void | insert_or_assign (Args &&... args) |
Insert a new column to the batch or overwrite an existing one. More... | |
template<typename Column > | |
void | raw_insert_or_assign (std::unique_ptr< abstract_column > column_ptr) |
Insert a raw column handle to the batch or rewrite an existing one. More... | |
std::size_t | size () const |
Get the number of columns in the batch. | |
template<typename Column > | |
bool | contains () const |
Check whether the given column is present in the batch. More... | |
template<typename Column > | |
void | erase () |
Remove the given column from the batch. More... | |
std::size_t | batch_size () const |
Calculate the batch size. More... | |
batch | take (std::size_t n) |
Steal the given number of examples from all the columns and create a new batch of them. More... | |
void | push_back (batch rhs) |
Concatenate the columns from two batches. More... | |
Container for multiple columns.
This is the value type of the stream.
Definition at line 34 of file batch_t.hpp.
|
inline |
Retrieve the handle (unique pointer reference) to the given column.
Example:
Column | The column whose handle should be retrieved. |
std::runtime_error | If the batch does not contain the given column. |
Definition at line 83 of file batch_t.hpp.
|
inline |
Calculate the batch size.
If the batch contains no columns, returns zero.
std::runtime_error | If all the columns do not have the same size. |
Definition at line 204 of file batch_t.hpp.
|
inline |
Check whether the given column is present in the batch.
Column | The column to be checked. |
Definition at line 179 of file batch_t.hpp.
|
inline |
Remove the given column from the batch.
Column | The column to be removed. |
std::runtime_error | If the columns is not in the batch. |
Definition at line 191 of file batch_t.hpp.
|
inline |
Extract a reference to the stored data of the given column.
Example:
Column | The column whose data should be retrieved. |
std::runtime_error | If the batch does not contain the given column. |
Definition at line 104 of file batch_t.hpp.
|
inline |
Extract a const reference to the stored data of the given column.
This is the same as previous, but returns a const reference.
Definition at line 114 of file batch_t.hpp.
|
inline |
Insert a new column to the batch or overwrite an existing one.
The parameters of this function are forwarded to the constructor of the given column.
Example:
Column | The column to be inserted. |
args | The parameters that are forwarded to the constructor of the column. |
Definition at line 137 of file batch_t.hpp.
|
inline |
Concatenate the columns from two batches.
If some of the pushed columns is not in this batch, it is inserted as a new column.
The behaviour of this function is almost equivalent to calling column_base::push_back() of on all the columns.
rhs | The batch whose columns will be stolen and appended. |
Definition at line 242 of file batch_t.hpp.
|
inline |
Insert a raw column handle to the batch or rewrite an existing one.
This is particularly useful when a raw column handle is retrieved with the at() function and there is no need for creating a new column.
Example:
Column | The column to be inserted. |
column_ptr | The unique pointer to the column. |
Definition at line 162 of file batch_t.hpp.
|
inline |
Steal the given number of examples from all the columns and create a new batch of them.
The behaviour of this function is equivalent to calling column_base::take() of on all the columns.
n | The number of examples to steal. |
Definition at line 225 of file batch_t.hpp.