![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
The base class for all database handlers. More...
#include <agrum/tools/database/DBHandler.h>
Public Member Functions | |
Accessors / Modifiers | |
virtual std::size_t | size () const =0 |
returns the number of rows managed by the handler More... | |
virtual std::size_t | DBSize () const =0 |
the number of rows in the whole database More... | |
virtual const_reference | rowSafe () const =0 |
returns the current row of the database (safe version) More... | |
virtual reference | rowSafe ()=0 |
returns the current row of the database (safe version) More... | |
virtual const_reference | row () const =0 |
returns the current row pointed to by the handler (unsafe version) More... | |
virtual reference | row ()=0 |
returns the current row pointed to by the handler (unsafe version) More... | |
virtual void | nextRow ()=0 |
go to the next row in the database More... | |
virtual std::size_t | numRow () const =0 |
number of row the handler points to (from the beginning of the area) More... | |
virtual bool | hasRows () const =0 |
indicates wether there are still rows to parse in the database More... | |
virtual void | reset ()=0 |
puts the handler to the beginning of the database area it handles More... | |
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 More... | |
virtual std::pair< std::size_t, std::size_t > | range () const =0 |
returns the current range of rows of the handler More... | |
virtual const DBVector< std::string > & | variableNames () const =0 |
returns the names of the variables corresponding to the rows More... | |
virtual std::size_t | nbVariables () const =0 |
returns the number of variables (columns) of the database More... | |
Public Types | |
template<typename TX_DATA > | |
using | DBVector = std::vector< TX_DATA, ALLOC< TX_DATA > > |
the type for the allocated vectors in IDatabases More... | |
using | iterator_category = std::random_access_iterator_tag |
Types for STL compliance. More... | |
using | value_type = DBRow< T_DATA, ALLOC > |
Types for STL compliance. More... | |
using | reference = value_type & |
Types for STL compliance. More... | |
using | const_reference = const value_type & |
Types for STL compliance. More... | |
using | pointer = value_type * |
Types for STL compliance. More... | |
using | const_pointer = const value_type * |
Types for STL compliance. More... | |
using | size_type = std::size_t |
Types for STL compliance. More... | |
using | difference_type = std::ptrdiff_t |
Types for STL compliance. More... | |
using | allocator_type = ALLOC< void > |
Types for STL compliance. More... | |
The base class for all database handlers.
Here is an example of how to use this class, illustrated on handlers for a RawDatabaseTable:
Definition at line 119 of file DBHandler.h.
using gum::learning::DBHandler< T_DATA, ALLOC >::allocator_type = ALLOC< void > |
Types for STL compliance.
Definition at line 131 of file DBHandler.h.
using gum::learning::DBHandler< T_DATA, ALLOC >::const_pointer = const value_type* |
Types for STL compliance.
Definition at line 128 of file DBHandler.h.
using gum::learning::DBHandler< T_DATA, ALLOC >::const_reference = const value_type& |
Types for STL compliance.
Definition at line 126 of file DBHandler.h.
using gum::learning::DBHandler< T_DATA, ALLOC >::DBVector = std::vector< TX_DATA, ALLOC< TX_DATA > > |
the type for the allocated vectors in IDatabases
Definition at line 136 of file DBHandler.h.
using gum::learning::DBHandler< T_DATA, ALLOC >::difference_type = std::ptrdiff_t |
Types for STL compliance.
Definition at line 130 of file DBHandler.h.
using gum::learning::DBHandler< T_DATA, ALLOC >::iterator_category = std::random_access_iterator_tag |
Types for STL compliance.
Definition at line 123 of file DBHandler.h.
using gum::learning::DBHandler< T_DATA, ALLOC >::pointer = value_type* |
Types for STL compliance.
Definition at line 127 of file DBHandler.h.
using gum::learning::DBHandler< T_DATA, ALLOC >::reference = value_type& |
Types for STL compliance.
Definition at line 125 of file DBHandler.h.
using gum::learning::DBHandler< T_DATA, ALLOC >::size_type = std::size_t |
Types for STL compliance.
Definition at line 129 of file DBHandler.h.
using gum::learning::DBHandler< T_DATA, ALLOC >::value_type = DBRow< T_DATA, ALLOC > |
Types for STL compliance.
Definition at line 124 of file DBHandler.h.
|
pure virtual |
the number of rows in the whole database
Implemented in gum::learning::IDatabaseTable< T_DATA, ALLOC >::Handler.
|
pure virtual |
indicates wether there are still rows to parse in the database
Remember that the handler manages only a specified area of the database, so the method just indicates whether there still remains rows in the area.
Implemented in gum::learning::IDatabaseTable< T_DATA, ALLOC >::Handler.
|
pure virtual |
returns the number of variables (columns) of the database
Implemented in gum::learning::IDatabaseTable< T_DATA, ALLOC >::Handler.
|
pure virtual |
go to the next row in the database
Implemented in gum::learning::IDatabaseTable< T_DATA, ALLOC >::Handler.
|
pure virtual |
number of row the handler points to (from the beginning of the area)
This method assigns 0 to the first row in the area handled by the handler. So the number returned is the number of rows between the currently pointed one to the beginning of the area handled.
Implemented in gum::learning::IDatabaseTable< T_DATA, ALLOC >::Handler.
|
pure virtual |
returns the current range of rows of the handler
The range returned is of type [begin,end), i.e., the first row of the range managed by the DBHandler has index begin in the whole database, and the last row of the range has index end-1 in the whole database. The endth row is therefore the first one outside the range.
Implemented in gum::learning::IDatabaseTable< T_DATA, ALLOC >::Handler.
|
pure virtual |
puts the handler to the beginning of the database area it handles
Implemented in gum::learning::IDatabaseTable< T_DATA, ALLOC >::Handler.
|
pure virtual |
returns the current row pointed to by the handler (unsafe version)
Implemented in gum::learning::IDatabaseTable< T_DATA, ALLOC >::Handler.
|
pure virtual |
returns the current row pointed to by the handler (unsafe version)
Implemented in gum::learning::IDatabaseTable< T_DATA, ALLOC >::Handler.
|
pure virtual |
returns the current row of the database (safe version)
OutOfBounds | is raised if the handler points outside of its area |
Implemented in gum::learning::IDatabaseTable< T_DATA, ALLOC >::Handler.
|
pure virtual |
returns the current row of the database (safe version)
OutOfBounds | is raised if the handler points outside of its area |
Implemented in gum::learning::IDatabaseTable< T_DATA, ALLOC >::Handler.
|
pure virtual |
sets the range of rows in the database that the handler will parse
The range provided in arguments specifies that area [begin,end) is the one managed by the DBHandler, i.e., the first row of the area has index begin in the whole database, and the last row of the area has index end-1 in the whole database. The endth row is the first one outside the area.
begin | the number of the row in the whole database that will be the first one in the area managed by the DBHandler. |
end | the number of the row in the whole database from which the DBHandler considers it is outside of its area. |
Implemented in gum::learning::IDatabaseTable< T_DATA, ALLOC >::Handler.
|
pure virtual |
returns the number of rows managed by the handler
A handler needs not necessarily handle all the rows of the database. For instance, RecordCounters cut the database into several pieces and assign each piece to a handler. Then each handler is used in parallel to perform countings only on a subset of the database
Implemented in gum::learning::IDatabaseTable< T_DATA, ALLOC >::Handler.
|
pure virtual |
returns the names of the variables corresponding to the rows
Implemented in gum::learning::IDatabaseTable< T_DATA, ALLOC >::Handler.