![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
The class for storing a record in a database. More...
#include <agrum/base/database/DBRow.h>
Public Member Functions | |
Constructors / Destructors | |
| DBRow () | |
| default constructor | |
| DBRow (const std::size_t size, const double weight=1.0) | |
| constructs a row of a given size with missing values | |
| DBRow (const std::size_t size, const T_DATA default_value, const double weight) | |
| constructor with a given size for the row | |
| DBRow (std::initializer_list< T_DATA > list, const double weight=1.0) | |
| initializer list constructor | |
| DBRow (const std::vector< T_DATA > &cells, const double weight=1.0) | |
| initializer from a vector of cells | |
| DBRow (std::vector< T_DATA > &&cells, const double weight=1.0) | |
| initializer with a move from a vector of cells | |
| DBRow (const DBRow< T_DATA > &from) | |
| copy constructor | |
| DBRow (DBRow< T_DATA > &&from) | |
| move constructor | |
| DBRow< T_DATA > * | clone () const |
| virtual copy constructor | |
| ~DBRow () | |
| destructor | |
Operators | |
| DBRow< T_DATA > & | operator= (const DBRow< T_DATA > &from) |
| copy operator | |
| DBRow< T_DATA > & | operator= (DBRow< T_DATA > &&from) |
| move operator | |
| T_DATA & | operator[] (const std::size_t i) |
| returns the ith content of the row | |
| const T_DATA & | operator[] (const std::size_t i) const |
| returns the ith content of the row | |
Accessors / Modifiers | |
| const std::vector< T_DATA > & | row () const noexcept |
| returns the current row (without the weight) | |
| std::vector< T_DATA > & | row () noexcept |
| returns the current row (without the weight) | |
| const double & | weight () const noexcept |
| returns the weight assigned to the DBRow | |
| double & | weight () noexcept |
| returns the weight assigned to the DBRow | |
| void | setRow (const std::vector< T_DATA > &new_row) |
| sets a new row (without changing the weight) | |
| void | setRow (std::vector< T_DATA > &&new_row) |
| sets a new row (without changing the weight) | |
| void | setWeight (const double new_weight) |
| sets a new weight | |
| std::size_t | size () const noexcept |
| returns the number of elements in the row | |
| void | resize (const std::size_t new_size) |
| resize a given row, i.e., its number of elements | |
| void | reserve (const std::size_t new_size) |
| reserve a size for the elements of a given row | |
| void | pushBack (const T_DATA &elt) |
| adds a new element at the end of the row | |
| void | pushBack (T_DATA &&elt) |
| adds a new element at the end of the row | |
Protected Attributes | |
| std::vector< T_DATA > | row_ |
| the row itself | |
| double | weight_ {1.0f} |
| the weight of the row | |
The class for storing a record in a database.
Learning algorithms use DatabaseTable instances as their input data. Those are represented essentially as vectors of DBRow instances. Each DBRow is encoded as a vector of elements plus a weight (which is a double). To be quite general, the types of the elements stored into the DBRow are specified as template parameters of the DBRow.
| gum::learning::DBRow< T_DATA >::DBRow | ( | ) |
default constructor
| gum::learning::DBRow< T_DATA >::DBRow | ( | const std::size_t | size, |
| const double | weight = 1.0 ) |
constructs a row of a given size with missing values
| gum::learning::DBRow< T_DATA >::DBRow | ( | const std::size_t | size, |
| const T_DATA | default_value, | ||
| const double | weight ) |
constructor with a given size for the row
| gum::learning::DBRow< T_DATA >::DBRow | ( | std::initializer_list< T_DATA > | list, |
| const double | weight = 1.0 ) |
initializer list constructor
| gum::learning::DBRow< T_DATA >::DBRow | ( | const std::vector< T_DATA > & | cells, |
| const double | weight = 1.0 ) |
initializer from a vector of cells
| gum::learning::DBRow< T_DATA >::DBRow | ( | std::vector< T_DATA > && | cells, |
| const double | weight = 1.0 ) |
initializer with a move from a vector of cells
| gum::learning::DBRow< T_DATA >::DBRow | ( | const DBRow< T_DATA > & | from | ) |
copy constructor
| gum::learning::DBRow< T_DATA >::DBRow | ( | DBRow< T_DATA > && | from | ) |
move constructor
| gum::learning::DBRow< T_DATA >::~DBRow | ( | ) |
destructor
| DBRow< T_DATA > * gum::learning::DBRow< T_DATA >::clone | ( | ) | const |
virtual copy constructor
| DBRow< T_DATA > & gum::learning::DBRow< T_DATA >::operator= | ( | const DBRow< T_DATA > & | from | ) |
copy operator
| DBRow< T_DATA > & gum::learning::DBRow< T_DATA >::operator= | ( | DBRow< T_DATA > && | from | ) |
move operator
| T_DATA & gum::learning::DBRow< T_DATA >::operator[] | ( | const std::size_t | i | ) |
returns the ith content of the row
| const T_DATA & gum::learning::DBRow< T_DATA >::operator[] | ( | const std::size_t | i | ) | const |
returns the ith content of the row
| void gum::learning::DBRow< T_DATA >::pushBack | ( | const T_DATA & | elt | ) |
adds a new element at the end of the row
| void gum::learning::DBRow< T_DATA >::pushBack | ( | T_DATA && | elt | ) |
adds a new element at the end of the row
| void gum::learning::DBRow< T_DATA >::reserve | ( | const std::size_t | new_size | ) |
reserve a size for the elements of a given row
| void gum::learning::DBRow< T_DATA >::resize | ( | const std::size_t | new_size | ) |
resize a given row, i.e., its number of elements
|
noexcept |
returns the current row (without the weight)
|
noexcept |
returns the current row (without the weight)
| void gum::learning::DBRow< T_DATA >::setRow | ( | const std::vector< T_DATA > & | new_row | ) |
sets a new row (without changing the weight)
| void gum::learning::DBRow< T_DATA >::setRow | ( | std::vector< T_DATA > && | new_row | ) |
sets a new row (without changing the weight)
| void gum::learning::DBRow< T_DATA >::setWeight | ( | const double | new_weight | ) |
sets a new weight
|
noexcept |
returns the number of elements in the row
|
noexcept |
returns the weight assigned to the DBRow
|
noexcept |
returns the weight assigned to the DBRow
|
protected |
|
protected |