tool::mapping< Key, Value, Factory > Struct Template Reference

Mapping from designed to be stored into a database file. More...

#include <wipal/tool/mapping.hh>

Inheritance diagram for tool::mapping< Key, Value, Factory >:

tool::datafile

List of all members.

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 &)


Detailed Description

template<class Key, class Value, class Factory>
struct tool::mapping< Key, Value, Factory >

Mapping from designed to be stored into a database file.

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.

See also:
addr_mapping
FIXME: Document the Factory parameter.

Constructor & Destructor Documentation

template<class Key , class Value , class Factory >
tool::mapping< Key, Value, Factory >::mapping ( const std::string &  ,
const Factory &  factory = Factory() 
)

Construct the mapping given the database file's name.


Member Function Documentation

template<class K , class V , class F >
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.

template<class T >
std::ostream & tool::datafile::operator<< ( const T &  data  )  [inline, inherited]

Formatted output.

template<class Key , class Value , class Factory >
const Value& tool::mapping< Key, Value, Factory >::operator[] ( const Key &   ) 

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.


The documentation for this struct was generated from the following files:

Generated on Wed Apr 22 22:52:43 2009 for wipal by  doxygen 1.5.8