![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
The base class for initializing DatabaseTable and RawDatabaseTable instances from CSV files or SQL databases. More...
#include <agrum/tools/database/IDBInitializer.h>
Public Member Functions | |
Constructors / Destructors | |
IDBInitializer (const InputType type, const allocator_type &alloc) | |
default constructor More... | |
IDBInitializer (const IDBInitializer< ALLOC > &from) | |
copy constructor More... | |
IDBInitializer (const IDBInitializer< ALLOC > &from, const allocator_type &alloc) | |
copy constructor with a given allocator More... | |
IDBInitializer (IDBInitializer< ALLOC > &&from) | |
move constructor More... | |
IDBInitializer (IDBInitializer< ALLOC > &&from, const allocator_type &alloc) | |
move constructor with a given allocator More... | |
virtual IDBInitializer< ALLOC > * | clone () const =0 |
virtual copy constructor More... | |
virtual IDBInitializer< ALLOC > * | clone (const allocator_type &alloc) const =0 |
virtual copy constructor with a given allocator More... | |
virtual | ~IDBInitializer () |
destructor More... | |
Accessors / Modifiers | |
const std::vector< std::string, ALLOC< std::string > > & | variableNames () |
returns the names of the variables in the input dataset More... | |
template<template< template< typename > class > class DATABASE> | |
void | fillDatabase (DATABASE< ALLOC > &database, const bool retry_insertion=false) |
fills the rows of the database table More... | |
std::size_t | throwingColumn () const |
This method indicates which column filling raised an exception, if any, during the execution of fillDatabase. More... | |
allocator_type | getAllocator () const |
returns the allocator used More... | |
Public Types | |
enum | InputType : char { InputType::STRING, InputType::DBCELL } |
the enumeration indicating the type of the data the IDBInitializer expects as input data More... | |
using | allocator_type = ALLOC< std::string > |
type for the allocators passed in arguments of methods More... | |
Protected Member Functions | |
IDBInitializer< ALLOC > & | operator= (const IDBInitializer< ALLOC > &from) |
copy operator More... | |
IDBInitializer< ALLOC > & | operator= (IDBInitializer< ALLOC > &&from) |
move operator More... | |
virtual std::vector< std::string, ALLOC< std::string > > | variableNames_ ()=0 |
ask the child class for the names of the variables More... | |
virtual const std::vector< std::string, ALLOC< std::string > > & | currentStringRow_ () |
asks the child class for the content of the current row using strings More... | |
virtual const DBRow< DBCell, ALLOC > & | currentDBCellRow_ () |
asks the child class for the content of the current row using dbcells More... | |
virtual bool | nextRow_ ()=0 |
indicates whether there is a next row to read (and point on it) More... | |
The base class for initializing DatabaseTable and RawDatabaseTable instances from CSV files or SQL databases.
Definition at line 116 of file IDBInitializer.h.
using gum::learning::IDBInitializer< ALLOC >::allocator_type = ALLOC< std::string > |
type for the allocators passed in arguments of methods
Definition at line 127 of file IDBInitializer.h.
|
strong |
the enumeration indicating the type of the data the IDBInitializer expects as input data
Enumerator | |
---|---|
STRING | |
DBCELL |
Definition at line 120 of file IDBInitializer.h.
gum::learning::IDBInitializer< ALLOC >::IDBInitializer | ( | const InputType | type, |
const allocator_type & | alloc | ||
) |
default constructor
type | indicates what type of data will be read by the IDBInitializer when it will try to fill the database. |
alloc | The allocator that will be used by all methods |
gum::learning::IDBInitializer< ALLOC >::IDBInitializer | ( | const IDBInitializer< ALLOC > & | from | ) |
copy constructor
gum::learning::IDBInitializer< ALLOC >::IDBInitializer | ( | const IDBInitializer< ALLOC > & | from, |
const allocator_type & | alloc | ||
) |
copy constructor with a given allocator
gum::learning::IDBInitializer< ALLOC >::IDBInitializer | ( | IDBInitializer< ALLOC > && | from | ) |
move constructor
gum::learning::IDBInitializer< ALLOC >::IDBInitializer | ( | IDBInitializer< ALLOC > && | from, |
const allocator_type & | alloc | ||
) |
move constructor with a given allocator
|
virtual |
destructor
|
pure virtual |
virtual copy constructor
Implemented in gum::learning::DBInitializerFromCSV< ALLOC >.
|
pure virtual |
virtual copy constructor with a given allocator
Implemented in gum::learning::DBInitializerFromCSV< ALLOC >.
|
protectedvirtual |
asks the child class for the content of the current row using dbcells
If the child class parses DBRows, this method should be overloaded
|
protectedvirtual |
asks the child class for the content of the current row using strings
If the child class parses strings, this method should be overloaded
Reimplemented in gum::learning::DBInitializerFromCSV< ALLOC >.
void gum::learning::IDBInitializer< ALLOC >::fillDatabase | ( | DATABASE< ALLOC > & | database, |
const bool | retry_insertion = false |
||
) |
fills the rows of the database table
This method may raise exceptions when trying to insert new rows into the database table. See Method insertRow() of the database table.
allocator_type gum::learning::IDBInitializer< ALLOC >::getAllocator | ( | ) | const |
returns the allocator used
|
protectedpure virtual |
indicates whether there is a next row to read (and point on it)
Implemented in gum::learning::DBInitializerFromCSV< ALLOC >.
|
protected |
copy operator
|
protected |
move operator
std::size_t gum::learning::IDBInitializer< ALLOC >::throwingColumn | ( | ) | const |
This method indicates which column filling raised an exception, if any, during the execution of fillDatabase.
const std::vector< std::string, ALLOC< std::string > >& gum::learning::IDBInitializer< ALLOC >::variableNames | ( | ) |
returns the names of the variables in the input dataset
|
protectedpure virtual |
ask the child class for the names of the variables
Implemented in gum::learning::DBInitializerFromCSV< ALLOC >.