diff -r 84e75e8f2fd2 -r 98adf9276de0 doc/maps.dox --- a/doc/maps.dox Sun Apr 04 09:16:35 2004 +0000 +++ b/doc/maps.dox Sun Apr 04 09:17:58 2004 +0000 @@ -1,10 +1,13 @@ /*! -\page maps How to write maps +\page maps How to write your own maps \section read-maps Readable Maps -It is quite easy to write your own readmap for the edges or nodes of a graph. +The readable maps are very frequently used as the input of the +algorithms. For this purpose the most straightforward is to use the +maps provided by Hugo's graph structres. Very often however, it is more +convenient and/or more efficient to write your own readable map. You can find some example below. @@ -14,14 +17,32 @@ struct MyMap { typedef double ValueType; - double operator[](Graph::EdgeIt e) const { return M_PI;} + double operator[](Graph::Edge e) const { return M_PI;} }; \endcode +An alternative way to define maps. For this, \c MapBase seems to +be a better name then \c NullMap + +\code +struct MyMap : public MapBase +{ + double operator[](Graph::Edge e) const { return M_PI;} +}; +\endcode + +Or if we had \c KeyType and \c ValueType + +\code +struct MyMap : public MapBase +{ + ValueType operator[](KeyType e) const { return M_PI;} +}; +\endcode + Here is a more complex example. It provides a length function which is obtained from a base length function modified by a potential difference. -\todo Please improve on the english. \code class MyLengthMap @@ -32,7 +53,7 @@ public: typedef double ValueType; - double operator[](Graph::EdgeIt e) const { + double operator[](Graph::Edge e) const { return ol.get(e)-pot.get(v)-pot.get(u); } @@ -41,5 +62,6 @@ }; \endcode +\todo Please improve on the english. \todo Don't we need \e to \e require a 'typedef xxx KeyType' tag, as well? */