#include <wipal/tool/mapping.hh>
Load the mapping from the file at creation when the file exists. Store it at deletion so it could be used later, or loaded in a database using a LOAD DATA INFILE SQL command.
Factory
parameter. Public Member Functions | |
mapping (const std::string &, const Factory &factory=Factory()) | |
const Value & | operator[] (const Key &) |
operator std::ostream & () | |
template<class T> | |
std::ostream & | operator<< (const T &) |
Protected Member Functions | |
void | load (std::istream &) |
tool::mapping< K, V, F >::mapping | ( | const std::string & | filename, | |
const F & | factory = Factory () | |||
) | [inline] |
Construct the mapping given the database file's name.
const V & tool::mapping< K, V, F >::operator[] | ( | const K & | a | ) | [inline] |
Retrieve the value of a corresponding key.
When the key already exists in the mapping, just return its value. Else, insert the (key, value) pair according to the Factory
template parameter.
void tool::mapping< K, V, F >::load | ( | std::istream & | in | ) | [inline, protected] |
Load a mapping from an std::istream
.
tool::datafile::operator std::ostream & | ( | ) | [inline, inherited] |
Retrieve the underlying C++ stream.
std::ostream & tool::datafile::operator<< | ( | const T & | data | ) | [inline, inherited] |
Formatted output.