![]() |
aGrUM
0.16.0
|
the safe handler of the tabular databases More...
#include <agrum/learning/IDatabaseTable.h>
Public Member Functions | |
Constructors / Destructors | |
HandlerSafe (const IDatabaseTable< T_DATA, ALLOC > &db) | |
default constructor More... | |
HandlerSafe (const HandlerSafe &h) | |
copy constructor More... | |
HandlerSafe (HandlerSafe &&h) | |
move constructor More... | |
virtual | ~HandlerSafe () |
destructor More... | |
Operators | |
virtual HandlerSafe & | operator= (const HandlerSafe &) |
copy operator More... | |
virtual HandlerSafe & | operator= (const Handler &) |
copy operator More... | |
virtual HandlerSafe & | operator= (HandlerSafe &&) |
move operator More... | |
virtual HandlerSafe & | operator= (Handler &&) |
move operator More... | |
Operators | |
virtual Handler & | operator++ () final |
makes the operator point to the next row in the database More... | |
virtual Handler & | operator-- () final |
makes the operator point to the previous row in the database More... | |
virtual Handler & | operator+= (const std::size_t i) final |
advances the handler by i rows in the database More... | |
virtual Handler & | operator-= (const std::size_t i) final |
moves back the handler by i rows in the database More... | |
virtual bool | operator== (const Handler &handler) const final |
checks whether two handlers point to the same row in the database More... | |
virtual bool | operator!= (const Handler &handler) const final |
checks whether two handlers point to different rows in the database More... | |
virtual const_reference | operator* () const final |
returns the current row pointed to by the handler (unsafe version) More... | |
virtual const_pointer | operator-> () const final |
Dereferences the value pointed to by the handler (unsafe version) More... | |
Accessors / Modifiers | |
virtual std::size_t | size () const final |
returns the number of rows managed by the handler More... | |
virtual std::size_t | DBSize () const final |
returns the number of rows of the whole database More... | |
virtual const_reference | rowSafe () const final |
returns the current row pointed to by the handler (safe version) More... | |
virtual reference | rowSafe () final |
returns the current row pointed to by the handler (safe version) More... | |
virtual const_reference | row () const final |
returns the current row pointed to by the handler (unsafe version) More... | |
virtual reference | row () final |
returns the current row pointed to by the handler (unsafe version) More... | |
virtual void | nextRow () final |
makes the handler point to the next row, equivalent to operator++ More... | |
virtual std::size_t | numRow () const final |
the number of the current row (0 = the 1st row managed by the handler) More... | |
virtual bool | hasRows () const final |
indicates whether the handler has reached its end or not More... | |
virtual void | reset () final |
puts the handler to the beginning of the database's area it handles More... | |
virtual Handler | begin () const |
returns a new handler that points to the beginning of the database's area of the current handler More... | |
virtual Handler | end () const |
returns a new handler that points to the end of the database's area of the current handler More... | |
virtual void | setRange (std::size_t begin, std::size_t end) final |
sets the area in the database the handler will handle More... | |
virtual std::pair< std::size_t, std::size_t > | range () const final |
returns the current range of the handler [begin,end) More... | |
virtual const DBVector< std::string > & | variableNames () const final |
returns the names of the variables More... | |
virtual std::size_t | nbVariables () const final |
returns the number of variables (columns) of the database More... | |
virtual const IDatabaseTable< T_DATA, ALLOC > & | database () const |
returns a pointer on the database More... | |
Public Types | |
template<typename TX_DATA > | |
using | DBVector = std::vector< TX_DATA, ALLOC< TX_DATA > > |
template<typename TX_DATA > | |
using | Row = DBRow< TX_DATA, ALLOC > |
template<typename TX_DATA > | |
using | Matrix = std::vector< DBRow< TX_DATA, ALLOC >, ALLOC< DBRow< TX_DATA, ALLOC > > > |
using | iterator_category = std::random_access_iterator_tag |
Types for STL compliance. More... | |
using | value_type = typename Handler::value_type |
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 | difference_type = std::ptrdiff_t |
Types for STL compliance. More... | |
using | allocator_type = ALLOC< T_DATA > |
Types for STL compliance. More... | |
using | size_type = std::size_t |
Types for STL compliance. More... | |
the safe handler of the tabular databases
The IDatabaseTable class is provided with two types of handlers: unsafe handlers and safe ones. Compared to the former, the safe handlers incur a small overhead during their creation. But safe handlers are informed by their associated database when the structure of this one changes, i.e., when the number of rows/columns changes or when rows are added/removed, whereas unsafe handlers are not aware of such changes. For databases that are not affected by this kind of change, unsafe handlers should be used instead of safe ones because they are slightly faster. Both types of handlers are designed to be created in parallel by several threads.
Here is an example of how to use this class, illustrated on handlers for a RawDatabaseTable:
Definition at line 693 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::HandlerSafe::allocator_type = ALLOC< T_DATA > |
Types for STL compliance.
Definition at line 704 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::HandlerSafe::const_pointer = const value_type* |
Types for STL compliance.
Definition at line 702 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::HandlerSafe::const_reference = const value_type& |
Types for STL compliance.
Definition at line 700 of file IDatabaseTable.h.
|
inherited |
Definition at line 390 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::HandlerSafe::difference_type = std::ptrdiff_t |
Types for STL compliance.
Definition at line 703 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::HandlerSafe::iterator_category = std::random_access_iterator_tag |
Types for STL compliance.
Definition at line 697 of file IDatabaseTable.h.
|
inherited |
Definition at line 397 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::HandlerSafe::pointer = value_type* |
Types for STL compliance.
Definition at line 701 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::HandlerSafe::reference = value_type& |
Types for STL compliance.
Definition at line 699 of file IDatabaseTable.h.
|
inherited |
Definition at line 393 of file IDatabaseTable.h.
|
inherited |
Types for STL compliance.
Definition at line 131 of file DBHandler.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::HandlerSafe::value_type = typename Handler::value_type |
Types for STL compliance.
Definition at line 698 of file IDatabaseTable.h.
gum::learning::IDatabaseTable< T_DATA, ALLOC >::HandlerSafe::HandlerSafe | ( | const IDatabaseTable< T_DATA, ALLOC > & | db | ) |
default constructor
db | the database on which the handler will point to. By default, the range of the handler is the whole database. |
gum::learning::IDatabaseTable< T_DATA, ALLOC >::HandlerSafe::HandlerSafe | ( | const HandlerSafe & | h | ) |
copy constructor
gum::learning::IDatabaseTable< T_DATA, ALLOC >::HandlerSafe::HandlerSafe | ( | HandlerSafe && | h | ) |
move constructor
|
virtual |
destructor
|
virtualinherited |
returns a new handler that points to the beginning of the database's area of the current handler
|
virtualinherited |
returns a pointer on the database
NullElement | is raised if the handler does not point toward any database. |
|
finalvirtualinherited |
returns the number of rows of the whole database
Implements gum::learning::DBHandler< T_DATA, ALLOC >.
|
virtualinherited |
returns a new handler that points to the end of the database's area of the current handler
|
finalvirtualinherited |
indicates whether the handler has reached its end or not
Implements gum::learning::DBHandler< T_DATA, ALLOC >.
|
finalvirtualinherited |
returns the number of variables (columns) of the database
Implements gum::learning::DBHandler< T_DATA, ALLOC >.
|
finalvirtualinherited |
makes the handler point to the next row, equivalent to operator++
Implements gum::learning::DBHandler< T_DATA, ALLOC >.
|
finalvirtualinherited |
the number of the current row (0 = the 1st row managed by the handler)
Implements gum::learning::DBHandler< T_DATA, ALLOC >.
|
finalvirtualinherited |
checks whether two handlers point to different rows in the database
|
finalvirtualinherited |
returns the current row pointed to by the handler (unsafe version)
|
finalvirtualinherited |
makes the operator point to the next row in the database
if the pointer has already reached the end of the area managed by the handler, nothing happens. In particular, no exception is raised
|
finalvirtualinherited |
advances the handler by i rows in the database
if, applying this move would make the handler reach the end of the area managed by the handler, then the handler is kept at the end of the area, i.e., after the last element of the area.
|
finalvirtualinherited |
makes the operator point to the previous row in the database
if the pointer is already at the beginning of the area managed by the handler, nothing happens. In particular, no exception is raised
|
finalvirtualinherited |
moves back the handler by i rows in the database
if, applying this move would make the handler reach the beginning of the area managed by the handler, then the handler is kept at the beginning of the area, i.e., at the first element of the area.
|
finalvirtualinherited |
Dereferences the value pointed to by the handler (unsafe version)
|
virtual |
copy operator
|
virtual |
copy operator
Reimplemented from gum::learning::IDatabaseTable< T_DATA, ALLOC >::Handler.
|
virtual |
move operator
|
virtual |
move operator
Reimplemented from gum::learning::IDatabaseTable< T_DATA, ALLOC >::Handler.
|
finalvirtualinherited |
checks whether two handlers point to the same row in the database
|
finalvirtualinherited |
returns the current range of the handler [begin,end)
Implements gum::learning::DBHandler< T_DATA, ALLOC >.
|
finalvirtualinherited |
puts the handler to the beginning of the database's area it handles
Implements gum::learning::DBHandler< T_DATA, ALLOC >.
|
finalvirtualinherited |
returns the current row pointed to by the handler (unsafe version)
Implements gum::learning::DBHandler< T_DATA, ALLOC >.
|
finalvirtualinherited |
returns the current row pointed to by the handler (unsafe version)
Implements gum::learning::DBHandler< T_DATA, ALLOC >.
|
finalvirtualinherited |
returns the current row pointed to by the handler (safe version)
OutOfBounds | if the handler points to the end of its area |
Implements gum::learning::DBHandler< T_DATA, ALLOC >.
|
finalvirtualinherited |
returns the current row pointed to by the handler (safe version)
OutOfBounds | if the handler points to the end of its area |
Implements gum::learning::DBHandler< T_DATA, ALLOC >.
|
finalvirtualinherited |
sets the area in the database the handler will handle
In addition to setting the area that will be parsed by the handler, this method makes the handler point to the beginning of the area.
begin | the first row to be handled |
end | the handler handles rows in interval [begin,end). Thus, the endth row is not included in the set of rows handled. |
NullElement | is raised if the handler does not point to any database |
SizeError | is raised if end is greater than the number of rows of the database |
Implements gum::learning::DBHandler< T_DATA, ALLOC >.
|
finalvirtualinherited |
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 their subset of the database. The size reported by method "size" is therefore the number of rows managed by the handler. If you wish to retrieve the size of the whole database, then use method DBSize instead.
Implements gum::learning::DBHandler< T_DATA, ALLOC >.
|
finalvirtualinherited |
returns the names of the variables
Implements gum::learning::DBHandler< T_DATA, ALLOC >.