7 ///\brief Defines to help creating graph maps.
9 /// \addtogroup graphmapfactory
12 /** Creates the EdgeMapRegistry type an declare a mutable instance
15 #define CREATE_EDGE_MAP_REGISTRY \
16 typedef MapRegistry<Graph, Edge, EdgeIt> EdgeMapRegistry; \
17 mutable EdgeMapRegistry edge_maps;
19 /** Creates the NodeMapRegistry type an declare a mutable instance
22 #define CREATE_NODE_MAP_REGISTRY \
23 typedef MapRegistry<Graph, Node, NodeIt> NodeMapRegistry; \
24 mutable NodeMapRegistry node_maps;
26 /** Creates both map registries.
28 #define CREATE_MAP_REGISTRIES \
29 CREATE_NODE_MAP_REGISTRY \
30 CREATE_EDGE_MAP_REGISTRY
32 /** Creates a map from a template map. The import method is
33 * an overloading of the map type.
34 * The reason to use these macro is that the c++ does not support
35 * the template typedefs. If a future release of the c++
36 * supports this feature it should be fixed.
38 #define CREATE_NODE_MAP(DynMap) \
39 template <typename Value> \
40 class NodeMap : public DynMap<NodeMapRegistry, Value> { \
42 typedef DynMap<NodeMapRegistry, Value> Parent; \
44 NodeMap(const typename Parent::Graph& g) \
45 : Parent(g, g.node_maps) {} \
46 NodeMap(const typename Parent::Graph& g, const Value& v) \
47 : Parent(g, g.node_maps, v) {} \
48 NodeMap(const NodeMap& copy) : Parent(static_cast<const Parent&>(copy)) {} \
49 template <typename TT> \
50 NodeMap(const NodeMap<TT>& copy) \
51 : Parent(static_cast<const typename NodeMap<TT>::Parent&>(copy)) {} \
52 NodeMap& operator=(const NodeMap& copy) { \
53 Parent::operator=(static_cast<const Parent&>(copy));\
56 template <typename TT> \
57 NodeMap& operator=(const NodeMap<TT>& copy) { \
58 Parent::operator=(static_cast<const typename NodeMap<TT>::Parent&>(copy));\
63 /** Creates a map from a template map. The import method is
64 * an overloading of the map type.
65 * The reason to use these macro is that the c++ does not support
66 * the template typedefs. If a future release of the c++
67 * supports this feature it should be fixed.
69 #define CREATE_EDGE_MAP(DynMap) \
70 template <typename Value> \
71 class EdgeMap : public DynMap<EdgeMapRegistry, Value> { \
73 typedef DynMap<EdgeMapRegistry, Value> Parent; \
76 EdgeMap(const typename Parent::Graph& g) \
77 : Parent(g, g.edge_maps) {} \
78 EdgeMap(const typename Parent::Graph& g, const Value& v) \
79 : Parent(g, g.edge_maps, v) {} \
80 EdgeMap(const EdgeMap& copy) : Parent(static_cast<const Parent&>(copy)) {} \
81 template <typename TT> \
82 EdgeMap(const EdgeMap<TT>& copy) \
83 : Parent(static_cast<const typename EdgeMap<TT>::Parent&>(copy)) {} \
84 EdgeMap& operator=(const EdgeMap& copy) { \
85 Parent::operator=(static_cast<const Parent&>(copy));\
88 template <typename TT> \
89 EdgeMap& operator=(const EdgeMap<TT>& copy) { \
90 Parent::operator=(static_cast<const typename EdgeMap<TT>::Parent&>(copy));\
95 /** This macro creates both maps.
97 #define CREATE_MAPS(DynMap) \
98 CREATE_NODE_MAP(DynMap) \
99 CREATE_EDGE_MAP(DynMap)
101 /** This macro creates MapRegistry for Symmetric Edge Maps.
103 #define CREATE_SYM_EDGE_MAP_REGISTRY \
104 typedef SymEdgeIt<Graph, Edge, EdgeIt> SymEdgeIt; \
105 typedef MapRegistry<Graph, Edge, SymEdgeIt> SymEdgeMapRegistry; \
106 mutable SymEdgeMapRegistry sym_edge_maps;
109 /** Creates a map from a template map. The import method is
110 * an overloading of the map type.
111 * The reason to use these macro is that the c++ does not support
112 * the template typedefs. If a future release of the c++
113 * supports this feature it should be fixed.
115 #define CREATE_SYM_EDGE_MAP(DynMap) \
116 template <typename Value> \
117 class SymEdgeMap : public SymMap<DynMap, SymEdgeMapRegistry, Value> { \
119 typedef SymMap<DynMap, SymEdgeMapRegistry, Value> Parent; \
122 SymEdgeMap(const typename Parent::Graph& g) \
123 : Parent(g, g.sym_edge_maps) {} \
124 SymEdgeMap(const typename Parent::Graph& g, const Value& v) \
125 : Parent(g, g.sym_edge_maps, v) {} \
126 SymEdgeMap(const SymEdgeMap& copy) \
127 : Parent(static_cast<const Parent&>(copy)) {} \
128 template <typename TT> \
129 SymEdgeMap(const NodeMap<TT>& copy) \
130 : Parent(static_cast<const typename SymEdgeMap<TT>::Parent&>(copy)) {} \
131 SymEdgeMap& operator=(const SymEdgeMap& copy) { \
132 Parent::operator=(static_cast<const Parent&>(copy));\
135 template <typename TT> \
136 SymEdgeMap& operator=(const SymEdgeMap<TT>& copy) { \
137 Parent::operator=(static_cast<const typename SymEdgeMap<TT>::Parent&>(copy));\
142 /** This is a macro to import an node map into a graph class.
144 #define IMPORT_NODE_MAP(From, from, To, to) \
145 template <typename Value> \
146 class NodeMap : public From::template NodeMap<Value> { \
149 typedef typename From::template NodeMap<Value> Parent; \
151 NodeMap() : Parent() {} \
152 NodeMap(const To& to) \
153 : Parent(static_cast<const From&>(from)) { } \
154 NodeMap(const To& to, const Value& value) \
155 : Parent(static_cast<const From&>(from), value) { } \
156 NodeMap(const NodeMap& copy) \
157 : Parent(static_cast<const Parent&>(copy)) {} \
158 template <typename TT> \
159 NodeMap(const NodeMap<TT>& copy) \
160 : Parent(static_cast<const typename NodeMap<TT>::Parent&>(copy)) {} \
161 NodeMap& operator=(const NodeMap& copy) { \
162 Parent::operator=(static_cast<const Parent&>(copy)); \
165 template <typename TT> \
166 NodeMap& operator=(const NodeMap<TT>& copy) { \
167 Parent::operator=(static_cast<const typename NodeMap<TT>::Parent&>(copy));\
172 /** This is a macro to import an edge map into a graph class.
174 #define IMPORT_EDGE_MAP(From, from, To, to) \
175 template <typename Value> \
176 class EdgeMap : public From::template EdgeMap<Value> { \
179 typedef typename From::template EdgeMap<Value> Parent; \
181 EdgeMap() : Parent() {} \
182 EdgeMap(const To& to) \
183 : Parent(static_cast<const From&>(from)) { } \
184 EdgeMap(const To& to, const Value& value) \
185 : Parent(static_cast<const From&>(from), value) { } \
186 EdgeMap(const EdgeMap& copy) \
187 : Parent(static_cast<const Parent&>(copy)) {} \
188 template <typename TT> \
189 EdgeMap(const EdgeMap<TT>& copy) \
190 : Parent(static_cast<const typename EdgeMap<TT>::Parent&>(copy)) {} \
191 EdgeMap& operator=(const EdgeMap& copy) { \
192 Parent::operator=(static_cast<const Parent&>(copy)); \
195 template <typename TT> \
196 EdgeMap& operator=(const EdgeMap<TT>& copy) { \
197 Parent::operator=(static_cast<const typename EdgeMap<TT>::Parent&>(copy));\
202 #define KEEP_EDGE_MAP(From, To) \
203 IMPORT_EDGE_MAP(From, graph, To, graph)
206 #define KEEP_NODE_MAP(From, To) \
207 IMPORT_NODE_MAP(From, graph, To, graph)
209 /** This is a macro to keep the node and edge maps for a graph class.
211 #define KEEP_MAPS(From, To) \
212 KEEP_EDGE_MAP(From, To) \
213 KEEP_NODE_MAP(From, To)