![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
The class for storing a record in a database. More...
#include <agrum/tools/database/DBRow.h>
Public Member Functions | |
Constructors / Destructors | |
DBRow () | |
default constructor More... | |
DBRow (const ALLOC< T_DATA > &alloc) | |
default constructor with specific allocator More... | |
DBRow (const std::size_t size, const double weight=1.0, const ALLOC< T_DATA > &alloc=ALLOC< T_DATA >()) | |
constructs a row of a given size with missing values More... | |
DBRow (const std::size_t size, const T_DATA default_value, const double weight, const ALLOC< T_DATA > &alloc=ALLOC< T_DATA >()) | |
constructor with a given size for the row More... | |
DBRow (std::initializer_list< T_DATA > list, const double weight=1.0, const ALLOC< T_DATA > &alloc=ALLOC< T_DATA >()) | |
initializer list constructor More... | |
template<template< typename > class OTHER_ALLOC> | |
DBRow (const std::vector< T_DATA, OTHER_ALLOC< T_DATA > > &cells, const double weight=1.0, const ALLOC< T_DATA > &alloc=ALLOC< T_DATA >()) | |
initializer from a vector of cells More... | |
DBRow (std::vector< T_DATA, ALLOC< T_DATA > > &&cells, const double weight=1.0, const ALLOC< T_DATA > &alloc=ALLOC< T_DATA >()) | |
initializer with a move from a vector of cells More... | |
DBRow (const DBRow< T_DATA, ALLOC > &from) | |
copy constructor More... | |
DBRow (const DBRow< T_DATA, ALLOC > &from, const ALLOC< T_DATA > &alloc) | |
copy constructor with a given allocator More... | |
DBRow (DBRow< T_DATA, ALLOC > &&from) | |
move constructor More... | |
DBRow (DBRow< T_DATA, ALLOC > &&from, const ALLOC< T_DATA > &alloc) | |
move constructor with a given allocator More... | |
DBRow< T_DATA, ALLOC > * | clone () const |
virtual copy constructor More... | |
DBRow< T_DATA, ALLOC > * | clone (const ALLOC< T_DATA > &alloc) const |
virtual copy constructor with a given allocator More... | |
~DBRow () | |
destructor More... | |
Operators | |
DBRow< T_DATA, ALLOC > & | operator= (const DBRow< T_DATA, ALLOC > &from) |
copy operator More... | |
DBRow< T_DATA, ALLOC > & | operator= (DBRow< T_DATA, ALLOC > &&from) |
move operator More... | |
T_DATA & | operator[] (const std::size_t i) |
returns the ith content of the row More... | |
const T_DATA & | operator[] (const std::size_t i) const |
returns the ith content of the row More... | |
Accessors / Modifiers | |
const std::vector< T_DATA, ALLOC< T_DATA > > & | row () const noexcept |
returns the current row (without the weight) More... | |
std::vector< T_DATA, ALLOC< T_DATA > > & | row () noexcept |
returns the current row (without the weight) More... | |
const double & | weight () const noexcept |
returns the weight assigned to the DBRow More... | |
double & | weight () noexcept |
returns the weight assigned to the DBRow More... | |
template<template< typename > class OTHER_ALLOC> | |
void | setRow (const std::vector< T_DATA, OTHER_ALLOC< T_DATA > > &new_row) |
sets a new row (without changing the weight) More... | |
void | setRow (std::vector< T_DATA, ALLOC< T_DATA > > &&new_row) |
sets a new row (without changing the weight) More... | |
void | setWeight (const double new_weight) |
sets a new weight More... | |
std::size_t | size () const noexcept |
returns the number of elements in the row More... | |
void | resize (const std::size_t new_size) |
resize a given row, i.e., its number of elements More... | |
void | reserve (const std::size_t new_size) |
reserve a size for the elements of a given row More... | |
void | pushBack (const T_DATA &elt) |
adds a new element at the end of the row More... | |
void | pushBack (T_DATA &&elt) |
adds a new element at the end of the row More... | |
ALLOC< T_DATA > | getAllocator () const |
returns the allocator used by the DBRow More... | |
Public Types | |
using | allocator_type = ALLOC< T_DATA > |
Protected Attributes | |
std::vector< T_DATA, ALLOC< T_DATA > > | row_ |
the row itself More... | |
double | weight_ {1.0f} |
the weight of the row More... | |
Friends | |
template<typename TX_DATA , template< typename > class OTHER_ALLOC> | |
class | DBRow |
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.
using gum::learning::DBRow< T_DATA, ALLOC >::allocator_type = ALLOC< T_DATA > |
gum::learning::DBRow< T_DATA, ALLOC >::DBRow | ( | ) |
default constructor
gum::learning::DBRow< T_DATA, ALLOC >::DBRow | ( | const ALLOC< T_DATA > & | alloc | ) |
default constructor with specific allocator
gum::learning::DBRow< T_DATA, ALLOC >::DBRow | ( | const std::size_t | size, |
const double | weight = 1.0 , |
||
const ALLOC< T_DATA > & | alloc = ALLOC< T_DATA >() |
||
) |
constructs a row of a given size with missing values
gum::learning::DBRow< T_DATA, ALLOC >::DBRow | ( | const std::size_t | size, |
const T_DATA | default_value, | ||
const double | weight, | ||
const ALLOC< T_DATA > & | alloc = ALLOC< T_DATA >() |
||
) |
constructor with a given size for the row
gum::learning::DBRow< T_DATA, ALLOC >::DBRow | ( | std::initializer_list< T_DATA > | list, |
const double | weight = 1.0 , |
||
const ALLOC< T_DATA > & | alloc = ALLOC< T_DATA >() |
||
) |
initializer list constructor
gum::learning::DBRow< T_DATA, ALLOC >::DBRow | ( | const std::vector< T_DATA, OTHER_ALLOC< T_DATA > > & | cells, |
const double | weight = 1.0 , |
||
const ALLOC< T_DATA > & | alloc = ALLOC< T_DATA >() |
||
) |
initializer from a vector of cells
gum::learning::DBRow< T_DATA, ALLOC >::DBRow | ( | std::vector< T_DATA, ALLOC< T_DATA > > && | cells, |
const double | weight = 1.0 , |
||
const ALLOC< T_DATA > & | alloc = ALLOC< T_DATA >() |
||
) |
initializer with a move from a vector of cells
gum::learning::DBRow< T_DATA, ALLOC >::DBRow | ( | const DBRow< T_DATA, ALLOC > & | from | ) |
copy constructor
gum::learning::DBRow< T_DATA, ALLOC >::DBRow | ( | const DBRow< T_DATA, ALLOC > & | from, |
const ALLOC< T_DATA > & | alloc | ||
) |
copy constructor with a given allocator
gum::learning::DBRow< T_DATA, ALLOC >::DBRow | ( | DBRow< T_DATA, ALLOC > && | from | ) |
move constructor
gum::learning::DBRow< T_DATA, ALLOC >::DBRow | ( | DBRow< T_DATA, ALLOC > && | from, |
const ALLOC< T_DATA > & | alloc | ||
) |
move constructor with a given allocator
gum::learning::DBRow< T_DATA, ALLOC >::~DBRow | ( | ) |
destructor
DBRow< T_DATA, ALLOC >* gum::learning::DBRow< T_DATA, ALLOC >::clone | ( | ) | const |
virtual copy constructor
DBRow< T_DATA, ALLOC >* gum::learning::DBRow< T_DATA, ALLOC >::clone | ( | const ALLOC< T_DATA > & | alloc | ) | const |
virtual copy constructor with a given allocator
ALLOC< T_DATA > gum::learning::DBRow< T_DATA, ALLOC >::getAllocator | ( | ) | const |
returns the allocator used by the DBRow
DBRow< T_DATA, ALLOC >& gum::learning::DBRow< T_DATA, ALLOC >::operator= | ( | const DBRow< T_DATA, ALLOC > & | from | ) |
copy operator
DBRow< T_DATA, ALLOC >& gum::learning::DBRow< T_DATA, ALLOC >::operator= | ( | DBRow< T_DATA, ALLOC > && | from | ) |
move operator
T_DATA& gum::learning::DBRow< T_DATA, ALLOC >::operator[] | ( | const std::size_t | i | ) |
returns the ith content of the row
const T_DATA& gum::learning::DBRow< T_DATA, ALLOC >::operator[] | ( | const std::size_t | i | ) | const |
returns the ith content of the row
void gum::learning::DBRow< T_DATA, ALLOC >::pushBack | ( | const T_DATA & | elt | ) |
adds a new element at the end of the row
void gum::learning::DBRow< T_DATA, ALLOC >::pushBack | ( | T_DATA && | elt | ) |
adds a new element at the end of the row
void gum::learning::DBRow< T_DATA, ALLOC >::reserve | ( | const std::size_t | new_size | ) |
reserve a size for the elements of a given row
void gum::learning::DBRow< T_DATA, ALLOC >::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, ALLOC >::setRow | ( | const std::vector< T_DATA, OTHER_ALLOC< T_DATA > > & | new_row | ) |
sets a new row (without changing the weight)
void gum::learning::DBRow< T_DATA, ALLOC >::setRow | ( | std::vector< T_DATA, ALLOC< T_DATA > > && | new_row | ) |
sets a new row (without changing the weight)
void gum::learning::DBRow< T_DATA, ALLOC >::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
|
friend |
|
protected |
|
protected |