src/hugo/map_defines.h
changeset 891 74589d20dbc3
parent 877 66dd225ca128
child 897 ef09eee53b09
     1.1 --- a/src/hugo/map_defines.h	Mon Sep 20 17:53:33 2004 +0000
     1.2 +++ b/src/hugo/map_defines.h	Mon Sep 20 22:57:48 2004 +0000
     1.3 @@ -38,21 +38,24 @@
     1.4  #define CREATE_NODE_MAP(DynMap) \
     1.5  template <typename Value> \
     1.6  class NodeMap : public DynMap<NodeMapRegistry, Value> { \
     1.7 -typedef DynMap<NodeMapRegistry, Value> MapImpl; \
     1.8  public: \
     1.9 +typedef DynMap<NodeMapRegistry, Value> Parent; \
    1.10  NodeMap() {} \
    1.11 -NodeMap(const typename MapImpl::Graph& g) \
    1.12 -  : MapImpl(g, g.node_maps) {} \
    1.13 -NodeMap(const typename MapImpl::Graph& g, const Value& v) \
    1.14 -  : MapImpl(g, g.node_maps, v) {} \
    1.15 -NodeMap(const NodeMap& copy) : MapImpl(static_cast<const MapImpl&>(copy)) {} \
    1.16 -template <typename CMap> NodeMap(const CMap& copy) : MapImpl(copy) {} \
    1.17 +NodeMap(const typename Parent::Graph& g) \
    1.18 +  : Parent(g, g.node_maps) {} \
    1.19 +NodeMap(const typename Parent::Graph& g, const Value& v) \
    1.20 +  : Parent(g, g.node_maps, v) {} \
    1.21 +NodeMap(const NodeMap& copy) : Parent(static_cast<const Parent&>(copy)) {} \
    1.22 +template <typename TT> \
    1.23 +NodeMap(const NodeMap<TT>& copy) \
    1.24 +  : Parent(static_cast<const typename NodeMap<TT>::Parent&>(copy)) {} \
    1.25  NodeMap& operator=(const NodeMap& copy) { \
    1.26 -  MapImpl::operator=(static_cast<const MapImpl&>(copy));\
    1.27 +  Parent::operator=(static_cast<const Parent&>(copy));\
    1.28    return *this; \
    1.29  } \
    1.30 -template <typename CMap> NodeMap& operator=(const CMap& copy) { \
    1.31 -  MapImpl::operator=(copy);\
    1.32 +template <typename TT> \
    1.33 +NodeMap& operator=(const NodeMap<TT>& copy) { \
    1.34 +  Parent::operator=(static_cast<const typename NodeMap<TT>::Parent&>(copy));\
    1.35    return *this; \
    1.36  } \
    1.37  };
    1.38 @@ -66,21 +69,25 @@
    1.39  #define CREATE_EDGE_MAP(DynMap) \
    1.40  template <typename Value> \
    1.41  class EdgeMap : public DynMap<EdgeMapRegistry, Value> { \
    1.42 -typedef DynMap<EdgeMapRegistry, Value> MapImpl; \
    1.43  public: \
    1.44 +typedef DynMap<EdgeMapRegistry, Value> Parent; \
    1.45 +\
    1.46  EdgeMap() {} \
    1.47 -EdgeMap(const typename MapImpl::Graph& g) \
    1.48 -  : MapImpl(g, g.edge_maps) {} \
    1.49 -EdgeMap(const typename MapImpl::Graph& g, const Value& v) \
    1.50 -  : MapImpl(g, g.edge_maps, v) {} \
    1.51 -EdgeMap(const EdgeMap& copy) : MapImpl(static_cast<const MapImpl&>(copy)) {} \
    1.52 -template <typename CMap> EdgeMap(const CMap& copy) : MapImpl(copy) {} \
    1.53 +EdgeMap(const typename Parent::Graph& g) \
    1.54 +  : Parent(g, g.edge_maps) {} \
    1.55 +EdgeMap(const typename Parent::Graph& g, const Value& v) \
    1.56 +  : Parent(g, g.edge_maps, v) {} \
    1.57 +EdgeMap(const EdgeMap& copy) : Parent(static_cast<const Parent&>(copy)) {} \
    1.58 +template <typename TT> \
    1.59 +EdgeMap(const EdgeMap<TT>& copy) \
    1.60 +  : Parent(static_cast<const typename EdgeMap<TT>::Parent&>(copy)) {} \
    1.61  EdgeMap& operator=(const EdgeMap& copy) { \
    1.62 -  MapImpl::operator=(static_cast<const MapImpl&>(copy));\
    1.63 +  Parent::operator=(static_cast<const Parent&>(copy));\
    1.64    return *this; \
    1.65  } \
    1.66 -template <typename CMap> EdgeMap& operator=(const CMap& copy) { \
    1.67 -  MapImpl::operator=(copy);\
    1.68 +template <typename TT> \
    1.69 +EdgeMap& operator=(const EdgeMap<TT>& copy) { \
    1.70 +  Parent::operator=(static_cast<const typename EdgeMap<TT>::Parent&>(copy));\
    1.71    return *this; \
    1.72  } \
    1.73  };
    1.74 @@ -108,101 +115,88 @@
    1.75  #define CREATE_SYM_EDGE_MAP(DynMap) \
    1.76  template <typename Value> \
    1.77  class SymEdgeMap : public SymMap<DynMap, SymEdgeMapRegistry, Value> { \
    1.78 -  typedef SymMap<DynMap, SymEdgeMapRegistry, Value> MapImpl; \
    1.79 - public: \
    1.80 +public: \
    1.81 +typedef SymMap<DynMap, SymEdgeMapRegistry, Value> Parent; \
    1.82  \
    1.83 -  SymEdgeMap() {} \
    1.84 -\
    1.85 -  SymEdgeMap(const typename MapImpl::Graph& g) \
    1.86 -    : MapImpl(g, g.sym_edge_maps) {} \
    1.87 -\
    1.88 -  SymEdgeMap(const typename MapImpl::Graph& g, const Value& v) \
    1.89 -    : MapImpl(g, g.sym_edge_maps, v) {} \
    1.90 -\
    1.91 -  SymEdgeMap(const SymEdgeMap& copy) \
    1.92 -    : MapImpl(static_cast<const MapImpl&>(copy)) {} \
    1.93 -\
    1.94 -  template <typename CMap> SymEdgeMap(const CMap& copy) : MapImpl(copy) {} \
    1.95 -  SymEdgeMap& operator=(const SymEdgeMap& copy) { \
    1.96 -    MapImpl::operator=(static_cast<const MapImpl&>(copy));\
    1.97 -    return *this; \
    1.98 -  } \
    1.99 -\
   1.100 -  template <typename CMap> SymEdgeMap& operator=(const CMap& copy) { \
   1.101 -    MapImpl::operator=(copy);\
   1.102 -    return *this; \
   1.103 -  } \
   1.104 +SymEdgeMap() {} \
   1.105 +SymEdgeMap(const typename Parent::Graph& g) \
   1.106 +  : Parent(g, g.sym_edge_maps) {} \
   1.107 +SymEdgeMap(const typename Parent::Graph& g, const Value& v) \
   1.108 +  : Parent(g, g.sym_edge_maps, v) {} \
   1.109 +SymEdgeMap(const SymEdgeMap& copy) \
   1.110 +  : Parent(static_cast<const Parent&>(copy)) {} \
   1.111 +template <typename TT> \
   1.112 +SymEdgeMap(const NodeMap<TT>& copy) \
   1.113 +  : Parent(static_cast<const typename SymEdgeMap<TT>::Parent&>(copy)) {} \
   1.114 +SymEdgeMap& operator=(const SymEdgeMap& copy) { \
   1.115 +  Parent::operator=(static_cast<const Parent&>(copy));\
   1.116 +  return *this; \
   1.117 +} \
   1.118 +template <typename TT> \
   1.119 +SymEdgeMap& operator=(const SymEdgeMap<TT>& copy) { \
   1.120 +  Parent::operator=(static_cast<const typename SymEdgeMap<TT>::Parent&>(copy));\
   1.121 +  return *this; \
   1.122 +} \
   1.123  };
   1.124  
   1.125 -
   1.126  /** This is a macro to import an node map into a graph class.
   1.127   */
   1.128  #define IMPORT_NODE_MAP(From, from, To, to) \
   1.129  template <typename Value> \
   1.130 -class NodeMap \
   1.131 -  : public From::template NodeMap<Value> { \
   1.132 -  typedef typename From::template NodeMap<Value> MapImpl; \
   1.133 - public: \
   1.134 -   NodeMap() : MapImpl() {} \
   1.135 +class NodeMap : public From::template NodeMap<Value> { \
   1.136  \
   1.137 -   NodeMap(const To& to) \
   1.138 -     : MapImpl(static_cast<const From&>(from)) { } \
   1.139 +public: \
   1.140 +typedef typename From::template NodeMap<Value> Parent; \
   1.141  \
   1.142 -   NodeMap(const To& to, const Value& value) \
   1.143 -     : MapImpl(static_cast<const From&>(from), value) { } \
   1.144 -\
   1.145 -   NodeMap(const NodeMap& copy) \
   1.146 -     : MapImpl(static_cast<const MapImpl&>(copy)) {} \
   1.147 -\
   1.148 -   template<typename CMap> \
   1.149 -   NodeMap(const CMap& copy) \
   1.150 -     : MapImpl(copy) {} \
   1.151 -\
   1.152 -   NodeMap& operator=(const NodeMap& copy) { \
   1.153 -     MapImpl::operator=(static_cast<const MapImpl&>(copy)); \
   1.154 -     return *this; \
   1.155 -   } \
   1.156 -\
   1.157 -   template <typename CMap> \
   1.158 -   NodeMap& operator=(const CMap& copy) { \
   1.159 -     MapImpl::operator=(copy); \
   1.160 -     return *this; \
   1.161 -   } \
   1.162 +NodeMap() : Parent() {} \
   1.163 +NodeMap(const To& to) \
   1.164 +  : Parent(static_cast<const From&>(from)) { } \
   1.165 +NodeMap(const To& to, const Value& value) \
   1.166 +  : Parent(static_cast<const From&>(from), value) { } \
   1.167 +NodeMap(const NodeMap& copy) \
   1.168 +  : Parent(static_cast<const Parent&>(copy)) {} \
   1.169 +template <typename TT> \
   1.170 +NodeMap(const NodeMap<TT>& copy) \
   1.171 +  : Parent(static_cast<const typename NodeMap<TT>::Parent&>(copy)) {} \
   1.172 +NodeMap& operator=(const NodeMap& copy) { \
   1.173 +  Parent::operator=(static_cast<const Parent&>(copy)); \
   1.174 +  return *this; \
   1.175 +} \
   1.176 +template <typename TT> \
   1.177 +NodeMap& operator=(const NodeMap<TT>& copy) { \
   1.178 +  Parent::operator=(static_cast<const typename NodeMap<TT>::Parent&>(copy));\
   1.179 +  return *this; \
   1.180 +} \
   1.181  };
   1.182  
   1.183  /** This is a macro to import an edge map into a graph class.
   1.184   */
   1.185  #define IMPORT_EDGE_MAP(From, from, To, to) \
   1.186  template <typename Value> \
   1.187 -class EdgeMap \
   1.188 -  : public From::template EdgeMap<Value> { \
   1.189 -  typedef typename From::template EdgeMap<Value> MapImpl; \
   1.190 - public: \
   1.191 -   EdgeMap() : MapImpl() {} \
   1.192 +class EdgeMap : public From::template EdgeMap<Value> { \
   1.193  \
   1.194 -   EdgeMap(const To& to) \
   1.195 -     : MapImpl(static_cast<const From&>(from)) { } \
   1.196 +public: \
   1.197 +typedef typename From::template EdgeMap<Value> Parent; \
   1.198  \
   1.199 -   EdgeMap(const To& to, const Value& value) \
   1.200 -     : MapImpl(static_cast<const From&>(from), value) { } \
   1.201 -\
   1.202 -   EdgeMap(const EdgeMap& copy) \
   1.203 -     : MapImpl(static_cast<const MapImpl&>(copy)) {} \
   1.204 -\
   1.205 -   template<typename CMap> \
   1.206 -   EdgeMap(const CMap& copy) \
   1.207 -     : MapImpl(copy) {} \
   1.208 -\
   1.209 -   EdgeMap& operator=(const EdgeMap& copy) { \
   1.210 -     MapImpl::operator=(static_cast<const MapImpl&>(copy)); \
   1.211 -     return *this; \
   1.212 -   } \
   1.213 -\
   1.214 -   template <typename CMap> \
   1.215 -   EdgeMap& operator=(const CMap& copy) { \
   1.216 -     MapImpl::operator=(copy); \
   1.217 -     return *this; \
   1.218 -   } \
   1.219 +EdgeMap() : Parent() {} \
   1.220 +EdgeMap(const To& to) \
   1.221 +  : Parent(static_cast<const From&>(from)) { } \
   1.222 +EdgeMap(const To& to, const Value& value) \
   1.223 +  : Parent(static_cast<const From&>(from), value) { } \
   1.224 +EdgeMap(const EdgeMap& copy) \
   1.225 +  : Parent(static_cast<const Parent&>(copy)) {} \
   1.226 +template <typename TT> \
   1.227 +EdgeMap(const EdgeMap<TT>& copy) \
   1.228 +  : Parent(static_cast<const typename EdgeMap<TT>::Parent&>(copy)) {} \
   1.229 +EdgeMap& operator=(const EdgeMap& copy) { \
   1.230 +  Parent::operator=(static_cast<const Parent&>(copy)); \
   1.231 +  return *this; \
   1.232 +} \
   1.233 +template <typename TT> \
   1.234 +EdgeMap& operator=(const EdgeMap<TT>& copy) { \
   1.235 +  Parent::operator=(static_cast<const typename EdgeMap<TT>::Parent&>(copy));\
   1.236 +  return *this; \
   1.237 +} \
   1.238  };
   1.239  
   1.240  #define KEEP_EDGE_MAP(From, To) \