src/lemon/map_defines.h
changeset 1004 b94037830dc8
parent 937 d4e911acef3d
equal deleted inserted replaced
1:207d61306f02 2:c9c5b71db93e
    49  *  The reason to use these macro is that the c++ does not support
    49  *  The reason to use these macro is that the c++ does not support
    50  *  the template typedefs. If a future release of the c++ 
    50  *  the template typedefs. If a future release of the c++ 
    51  *  supports this feature it should be fixed.
    51  *  supports this feature it should be fixed.
    52  */
    52  */
    53 #define CREATE_NODE_MAP(DynMap) \
    53 #define CREATE_NODE_MAP(DynMap) \
    54 template <typename Value> \
    54 template <typename _Value> \
    55 class NodeMap : public DynMap<NodeMapRegistry, Value> { \
    55 class NodeMap : public DynMap<NodeMapRegistry, _Value> { \
    56 public: \
    56 public: \
    57 typedef DynMap<NodeMapRegistry, Value> Parent; \
    57 typedef DynMap<NodeMapRegistry, _Value> Parent; \
    58 NodeMap(const typename Parent::Graph& g) \
    58 NodeMap(const typename Parent::Graph& g) \
    59   : Parent(g, g.node_maps) {} \
    59   : Parent(g, g.node_maps) {} \
    60 NodeMap(const typename Parent::Graph& g, const Value& v) \
    60 NodeMap(const typename Parent::Graph& g, const _Value& v) \
    61   : Parent(g, g.node_maps, v) {} \
    61   : Parent(g, g.node_maps, v) {} \
    62 NodeMap(const NodeMap& copy) : Parent(static_cast<const Parent&>(copy)) {} \
    62 NodeMap(const NodeMap& copy) : Parent(static_cast<const Parent&>(copy)) {} \
    63 template <typename TT> \
    63 template <typename TT> \
    64 NodeMap(const NodeMap<TT>& copy) \
    64 NodeMap(const NodeMap<TT>& copy) \
    65   : Parent(static_cast<const typename NodeMap<TT>::Parent&>(copy)) {} \
    65   : Parent(static_cast<const typename NodeMap<TT>::Parent&>(copy)) {} \
    79  *  The reason to use these macro is that the c++ does not support
    79  *  The reason to use these macro is that the c++ does not support
    80  *  the template typedefs. If a future release of the c++ 
    80  *  the template typedefs. If a future release of the c++ 
    81  *  supports this feature it should be fixed.
    81  *  supports this feature it should be fixed.
    82  */
    82  */
    83 #define CREATE_EDGE_MAP(DynMap) \
    83 #define CREATE_EDGE_MAP(DynMap) \
    84 template <typename Value> \
    84 template <typename _Value> \
    85 class EdgeMap : public DynMap<EdgeMapRegistry, Value> { \
    85 class EdgeMap : public DynMap<EdgeMapRegistry, _Value> { \
    86 public: \
    86 public: \
    87 typedef DynMap<EdgeMapRegistry, Value> Parent; \
    87 typedef DynMap<EdgeMapRegistry, _Value> Parent; \
    88 \
    88 \
    89 EdgeMap(const typename Parent::Graph& g) \
    89 EdgeMap(const typename Parent::Graph& g) \
    90   : Parent(g, g.edge_maps) {} \
    90   : Parent(g, g.edge_maps) {} \
    91 EdgeMap(const typename Parent::Graph& g, const Value& v) \
    91 EdgeMap(const typename Parent::Graph& g, const _Value& v) \
    92   : Parent(g, g.edge_maps, v) {} \
    92   : Parent(g, g.edge_maps, v) {} \
    93 EdgeMap(const EdgeMap& copy) : Parent(static_cast<const Parent&>(copy)) {} \
    93 EdgeMap(const EdgeMap& copy) : Parent(static_cast<const Parent&>(copy)) {} \
    94 template <typename TT> \
    94 template <typename TT> \
    95 EdgeMap(const EdgeMap<TT>& copy) \
    95 EdgeMap(const EdgeMap<TT>& copy) \
    96   : Parent(static_cast<const typename EdgeMap<TT>::Parent&>(copy)) {} \
    96   : Parent(static_cast<const typename EdgeMap<TT>::Parent&>(copy)) {} \
   123  *  The reason to use these macro is that the c++ does not support
   123  *  The reason to use these macro is that the c++ does not support
   124  *  the template typedefs. If a future release of the c++ 
   124  *  the template typedefs. If a future release of the c++ 
   125  *  supports this feature it should be fixed.
   125  *  supports this feature it should be fixed.
   126  */
   126  */
   127 #define CREATE_SYM_EDGE_MAP(DynMap) \
   127 #define CREATE_SYM_EDGE_MAP(DynMap) \
   128 template <typename Value> \
   128 template <typename _Value> \
   129 class SymEdgeMap : public DynMap<SymEdgeMapRegistry, Value> { \
   129 class SymEdgeMap : public DynMap<SymEdgeMapRegistry, _Value> { \
   130 public: \
   130 public: \
   131 typedef DynMap<SymEdgeMapRegistry, Value> Parent; \
   131 typedef DynMap<SymEdgeMapRegistry, _Value> Parent; \
   132 \
   132 \
   133 SymEdgeMap(const typename Parent::Graph& g) \
   133 SymEdgeMap(const typename Parent::Graph& g) \
   134   : Parent(g, g.sym_edge_maps) {} \
   134   : Parent(g, g.sym_edge_maps) {} \
   135 SymEdgeMap(const typename Parent::Graph& g, const Value& v) \
   135 SymEdgeMap(const typename Parent::Graph& g, const _Value& v) \
   136   : Parent(g, g.sym_edge_maps, v) {} \
   136   : Parent(g, g.sym_edge_maps, v) {} \
   137 SymEdgeMap(const SymEdgeMap& copy) \
   137 SymEdgeMap(const SymEdgeMap& copy) \
   138   : Parent(static_cast<const Parent&>(copy)) {} \
   138   : Parent(static_cast<const Parent&>(copy)) {} \
   139 template <typename TT> \
   139 template <typename TT> \
   140 SymEdgeMap(const NodeMap<TT>& copy) \
   140 SymEdgeMap(const NodeMap<TT>& copy) \
   151 };
   151 };
   152 
   152 
   153 /** This is a macro to import an node map into a graph class.
   153 /** This is a macro to import an node map into a graph class.
   154  */
   154  */
   155 #define IMPORT_NODE_MAP(From, from, To, to) \
   155 #define IMPORT_NODE_MAP(From, from, To, to) \
   156 template <typename Value> \
   156 template <typename _Value> \
   157 class NodeMap : public From::template NodeMap<Value> { \
   157 class NodeMap : public From::template NodeMap<_Value> { \
   158 \
   158 \
   159 public: \
   159 public: \
   160 typedef typename From::template NodeMap<Value> Parent; \
   160 typedef typename From::template NodeMap<_Value> Parent; \
   161 \
   161 \
   162 NodeMap(const To& to) \
   162 NodeMap(const To& to) \
   163   : Parent(static_cast<const From&>(from)) { } \
   163   : Parent(static_cast<const From&>(from)) { } \
   164 NodeMap(const To& to, const Value& value) \
   164 NodeMap(const To& to, const _Value& value) \
   165   : Parent(static_cast<const From&>(from), value) { } \
   165   : Parent(static_cast<const From&>(from), value) { } \
   166 NodeMap(const NodeMap& copy) \
   166 NodeMap(const NodeMap& copy) \
   167   : Parent(static_cast<const Parent&>(copy)) {} \
   167   : Parent(static_cast<const Parent&>(copy)) {} \
   168 template <typename TT> \
   168 template <typename TT> \
   169 NodeMap(const NodeMap<TT>& copy) \
   169 NodeMap(const NodeMap<TT>& copy) \
   180 };
   180 };
   181 
   181 
   182 /** This is a macro to import an edge map into a graph class.
   182 /** This is a macro to import an edge map into a graph class.
   183  */
   183  */
   184 #define IMPORT_EDGE_MAP(From, from, To, to) \
   184 #define IMPORT_EDGE_MAP(From, from, To, to) \
   185 template <typename Value> \
   185 template <typename _Value> \
   186 class EdgeMap : public From::template EdgeMap<Value> { \
   186 class EdgeMap : public From::template EdgeMap<_Value> { \
   187 \
   187 \
   188 public: \
   188 public: \
   189 typedef typename From::template EdgeMap<Value> Parent; \
   189 typedef typename From::template EdgeMap<_Value> Parent; \
   190 \
   190 \
   191 EdgeMap(const To& to) \
   191 EdgeMap(const To& to) \
   192   : Parent(static_cast<const From&>(from)) { } \
   192   : Parent(static_cast<const From&>(from)) { } \
   193 EdgeMap(const To& to, const Value& value) \
   193 EdgeMap(const To& to, const _Value& value) \
   194   : Parent(static_cast<const From&>(from), value) { } \
   194   : Parent(static_cast<const From&>(from), value) { } \
   195 EdgeMap(const EdgeMap& copy) \
   195 EdgeMap(const EdgeMap& copy) \
   196   : Parent(static_cast<const Parent&>(copy)) {} \
   196   : Parent(static_cast<const Parent&>(copy)) {} \
   197 template <typename TT> \
   197 template <typename TT> \
   198 EdgeMap(const EdgeMap<TT>& copy) \
   198 EdgeMap(const EdgeMap<TT>& copy) \