27 #ifndef GUM_LEARNING_DB_HANDLER_H 28 #define GUM_LEARNING_DB_HANDLER_H 36 #include <agrum/agrum.h> 37 #include <agrum/tools/database/DBRow.h> 118 template <
typename T_DATA,
template <
typename >
class ALLOC = std::allocator >
123 using iterator_category = std::random_access_iterator_tag;
129 using size_type = std::size_t;
130 using difference_type = std::ptrdiff_t;
131 using allocator_type = ALLOC<
void >;
135 template <
typename TX_DATA >
136 using DBVector = std::vector< TX_DATA, ALLOC< TX_DATA > >;
150 virtual std::size_t
size()
const = 0;
153 virtual std::size_t
DBSize()
const = 0;
190 virtual std::size_t
numRow()
const = 0;
196 virtual bool hasRows()
const = 0;
199 virtual void reset() = 0;
211 virtual void setRange(std::size_t begin, std::size_t end) = 0;
218 virtual std::pair< std::size_t, std::size_t >
range()
const = 0;
229 #ifndef DOXYGEN_SHOULD_SKIP_THIS 233 static constexpr int cache_size_{128};
236 char align_[cache_size_];
virtual void setRange(std::size_t begin, std::size_t end)=0
sets the range of rows in the database that the handler will parse
INLINE void emplace(Args &&... args)
virtual std::size_t nbVariables() const =0
returns the number of variables (columns) of the database
virtual void nextRow()=0
go to the next row in the database
virtual reference rowSafe()=0
returns the current row of the database (safe version)
The base class for all database handlers.
virtual std::size_t size() const =0
returns the number of rows managed by the handler
virtual bool hasRows() const =0
indicates wether there are still rows to parse in the database
virtual const DBVector< std::string > & variableNames() const =0
returns the names of the variables corresponding to the rows
virtual const_reference rowSafe() const =0
returns the current row of the database (safe version)
virtual reference row()=0
returns the current row pointed to by the handler (unsafe version)
virtual void reset()=0
puts the handler to the beginning of the database area it handles
virtual std::size_t numRow() const =0
number of row the handler points to (from the beginning of the area)
virtual std::size_t DBSize() const =0
the number of rows in the whole database
virtual std::pair< std::size_t, std::size_t > range() const =0
returns the current range of rows of the handler
Database(const std::string &filename, const BayesNet< GUM_SCALAR > &bn, const std::vector< std::string > &missing_symbols)
virtual const_reference row() const =0
returns the current row pointed to by the handler (unsafe version)