[Lemon-commits] [lemon_svn] alpar: r1756 - hugo/trunk/src/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:47:22 CET 2006
Author: alpar
Date: Thu Apr 7 13:30:12 2005
New Revision: 1756
Modified:
hugo/trunk/src/lemon/maps.h
hugo/trunk/src/lemon/xy.h
Log:
- XMap and YMap added
- Spell checking
Modified: hugo/trunk/src/lemon/maps.h
==============================================================================
--- hugo/trunk/src/lemon/maps.h (original)
+++ hugo/trunk/src/lemon/maps.h Thu Apr 7 13:30:12 2005
@@ -742,7 +742,7 @@
///parameters and each write request will be passed to both of them.
///If \c M1 is also \ref concept::ReadMap "readable",
///then the read operations will return the
- ///corresponding values \c M1.
+ ///corresponding values of \c M1.
///
///The \c Key and \c Value will be inherited from \c M1.
///The \c Key and \c Value of M2 must be convertible from those of \c M1.
Modified: hugo/trunk/src/lemon/xy.h
==============================================================================
--- hugo/trunk/src/lemon/xy.h (original)
+++ hugo/trunk/src/lemon/xy.h Thu Apr 7 13:30:12 2005
@@ -325,6 +325,121 @@
};//class Boundingbox
+ ///Map of x-coordinates of an xy<>-map
+
+ ///\ingroup maps
+ ///
+ template<class M>
+ class XMap
+ {
+ M &_map;
+ public:
+ typedef typename M::Value::Value Value;
+ typedef typename M::Key Key;
+ ///\e
+ XMap(M &map) : _map(map) {}
+ Value operator[](Key k) const {return _map[k].x;}
+ Value set(Key k,Value v) {_map.set(k,typename M::Value(v,_map[k].y));}
+ };
+
+ ///Returns an \ref XMap class
+
+ ///This function just returns an \ref XMap class.
+ ///
+ ///\ingroup maps
+ ///\relates XMap
+ template<class M>
+ inline XMap<M> xMap(M &m)
+ {
+ return XMap<M>(m);
+ }
+
+ ///Constant (read only) version of \ref XMap
+
+ ///\ingroup maps
+ ///
+ template<class M>
+ class ConstXMap
+ {
+ const M &_map;
+ public:
+ typedef typename M::Value::Value Value;
+ typedef typename M::Key Key;
+ ///\e
+ ConstXMap(const M &map) : _map(map) {}
+ Value operator[](Key k) const {return _map[k].x;}
+ };
+
+ ///Returns a \ref ConstXMap class
+
+ ///This function just returns an \ref ConstXMap class.
+ ///
+ ///\ingroup maps
+ ///\relates ConstXMap
+ template<class M>
+ inline ConstXMap<M> xMap(const M &m)
+ {
+ return ConstXMap<M>(m);
+ }
+
+ ///Map of y-coordinates of an xy<>-map
+
+ ///\ingroup maps
+ ///
+ template<class M>
+ class YMap
+ {
+ M &_map;
+ public:
+ typedef typename M::Value::Value Value;
+ typedef typename M::Key Key;
+ ///\e
+ YMap(M &map) : _map(map) {}
+ Value operator[](Key k) const {return _map[k].y;}
+ Value set(Key k,Value v) {_map.set(k,typename M::Value(_map[k].x,v));}
+ };
+
+ ///Returns an \ref YMap class
+
+ ///This function just returns an \ref YMap class.
+ ///
+ ///\ingroup maps
+ ///\relates YMap
+ template<class M>
+ inline YMap<M> yMap(M &m)
+ {
+ return YMap<M>(m);
+ }
+
+ ///Constant (read only) version of \ref YMap
+
+ ///\ingroup maps
+ ///
+ template<class M>
+ class ConstYMap
+ {
+ const M &_map;
+ public:
+ typedef typename M::Value::Value Value;
+ typedef typename M::Key Key;
+ ///\e
+ ConstYMap(const M &map) : _map(map) {}
+ Value operator[](Key k) const {return _map[k].y;}
+ };
+
+ ///Returns a \ref ConstYMap class
+
+ ///This function just returns an \ref ConstYMap class.
+ ///
+ ///\ingroup maps
+ ///\relates ConstYMap
+ template<class M>
+ inline ConstYMap<M> yMap(const M &m)
+ {
+ return ConstYMap<M>(m);
+ }
+
+
/// @}
More information about the Lemon-commits
mailing list