28 #ifndef GUM_LEARNING_IDB_INITILIALIZER_H 29 #define GUM_LEARNING_IDB_INITILIALIZER_H 34 #include <agrum/agrum.h> 35 #include <agrum/tools/database/DBCell.h> 36 #include <agrum/tools/database/DBRow.h> 115 template <
template <
typename >
class ALLOC >
127 using allocator_type = ALLOC< std::string >;
144 IDBInitializer(
const IDBInitializer< ALLOC >& from,
const allocator_type& alloc);
150 IDBInitializer(IDBInitializer< ALLOC >&& from,
const allocator_type& alloc);
170 const std::vector< std::string, ALLOC< std::string > >&
variableNames();
175 template <
template <
template <
typename >
class >
class DATABASE >
176 void fillDatabase(DATABASE< ALLOC >& database,
const bool retry_insertion =
false);
196 virtual std::vector< std::string, ALLOC< std::string > >
variableNames_() = 0;
200 virtual const std::vector< std::string, ALLOC< std::string > >&
currentStringRow_();
210 #ifndef DOXYGEN_SHOULD_SKIP_THIS 214 std::vector< std::string, ALLOC< std::string > > _var_names_;
222 bool _last_insertion_failed_{
false};
226 template <
template <
template <
typename >
class >
class DATABASE >
227 void _fillDatabaseFromStrings_(DATABASE< ALLOC >& database,
const bool retry_insertion);
230 template <
template <
template <
typename >
class >
class DATABASE >
231 void _fillDatabaseFromDBCells_(DATABASE< ALLOC >& database,
const bool retry_insertion);
241 #include <agrum/tools/database/IDBInitializer_tpl.h> const std::vector< std::string, ALLOC< std::string > > & variableNames()
returns the names of the variables in the input dataset
IDBInitializer(IDBInitializer< ALLOC > &&from)
move constructor
virtual std::vector< std::string, ALLOC< std::string > > variableNames_()=0
ask the child class for the names of the variables
virtual IDBInitializer< ALLOC > * clone(const allocator_type &alloc) const =0
virtual copy constructor with a given allocator
INLINE void emplace(Args &&... args)
allocator_type getAllocator() const
returns the allocator used
virtual bool nextRow_()=0
indicates whether there is a next row to read (and point on it)
IDBInitializer(const IDBInitializer< ALLOC > &from, const allocator_type &alloc)
copy constructor with a given allocator
virtual const DBRow< DBCell, ALLOC > & currentDBCellRow_()
asks the child class for the content of the current row using dbcells
IDBInitializer< ALLOC > & operator=(const IDBInitializer< ALLOC > &from)
copy operator
IDBInitializer(IDBInitializer< ALLOC > &&from, const allocator_type &alloc)
move constructor with a given allocator
void fillDatabase(DATABASE< ALLOC > &database, const bool retry_insertion=false)
fills the rows of the database table
InputType
the enumeration indicating the type of the data the IDBInitializer expects as input data ...
IDBInitializer< ALLOC > & operator=(IDBInitializer< ALLOC > &&from)
move operator
virtual const std::vector< std::string, ALLOC< std::string > > & currentStringRow_()
asks the child class for the content of the current row using strings
IDBInitializer(const InputType type, const allocator_type &alloc)
default constructor
std::size_t throwingColumn() const
This method indicates which column filling raised an exception, if any, during the execution of fillD...
IDBInitializer(const IDBInitializer< ALLOC > &from)
copy constructor
Database(const std::string &filename, const BayesNet< GUM_SCALAR > &bn, const std::vector< std::string > &missing_symbols)
virtual ~IDBInitializer()
destructor
The base class for initializing DatabaseTable and RawDatabaseTable instances from CSV files or SQL da...
virtual IDBInitializer< ALLOC > * clone() const =0
virtual copy constructor