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; \
43 NodeMap(const typename Parent::Graph& g) \
44 : Parent(g, g.node_maps) {} \
45 NodeMap(const typename Parent::Graph& g, const Value& v) \
46 : Parent(g, g.node_maps, v) {} \
47 NodeMap(const NodeMap& copy) : Parent(static_cast<const Parent&>(copy)) {} \
48 template <typename TT> \
49 NodeMap(const NodeMap<TT>& copy) \
50 : Parent(static_cast<const typename NodeMap<TT>::Parent&>(copy)) {} \
51 NodeMap& operator=(const NodeMap& copy) { \
52 Parent::operator=(static_cast<const Parent&>(copy));\
55 template <typename TT> \
56 NodeMap& operator=(const NodeMap<TT>& copy) { \
57 Parent::operator=(static_cast<const typename NodeMap<TT>::Parent&>(copy));\
62 /** Creates a map from a template map. The import method is
63 * an overloading of the map type.
64 * The reason to use these macro is that the c++ does not support
65 * the template typedefs. If a future release of the c++
66 * supports this feature it should be fixed.
68 #define CREATE_EDGE_MAP(DynMap) \
69 template <typename Value> \
70 class EdgeMap : public DynMap<EdgeMapRegistry, Value> { \
72 typedef DynMap<EdgeMapRegistry, Value> Parent; \
74 EdgeMap(const typename Parent::Graph& g) \
75 : Parent(g, g.edge_maps) {} \
76 EdgeMap(const typename Parent::Graph& g, const Value& v) \
77 : Parent(g, g.edge_maps, v) {} \
78 EdgeMap(const EdgeMap& copy) : Parent(static_cast<const Parent&>(copy)) {} \
79 template <typename TT> \
80 EdgeMap(const EdgeMap<TT>& copy) \
81 : Parent(static_cast<const typename EdgeMap<TT>::Parent&>(copy)) {} \
82 EdgeMap& operator=(const EdgeMap& copy) { \
83 Parent::operator=(static_cast<const Parent&>(copy));\
86 template <typename TT> \
87 EdgeMap& operator=(const EdgeMap<TT>& copy) { \
88 Parent::operator=(static_cast<const typename EdgeMap<TT>::Parent&>(copy));\
93 /** This macro creates both maps.
95 #define CREATE_MAPS(DynMap) \
96 CREATE_NODE_MAP(DynMap) \
97 CREATE_EDGE_MAP(DynMap)
99 /** This macro creates MapRegistry for Symmetric Edge Maps.
101 #define CREATE_SYM_EDGE_MAP_REGISTRY \
102 typedef SymEdgeIt<Graph, Edge, EdgeIt> SymEdgeIt; \
103 typedef MapRegistry<Graph, Edge, SymEdgeIt> SymEdgeMapRegistry; \
104 mutable SymEdgeMapRegistry sym_edge_maps;
107 /** Creates a map from a template map. The import method is
108 * an overloading of the map type.
109 * The reason to use these macro is that the c++ does not support
110 * the template typedefs. If a future release of the c++
111 * supports this feature it should be fixed.
113 #define CREATE_SYM_EDGE_MAP(DynMap) \
114 template <typename Value> \
115 class SymEdgeMap : public SymMap<DynMap, SymEdgeMapRegistry, Value> { \
117 typedef SymMap<DynMap, SymEdgeMapRegistry, Value> Parent; \
119 SymEdgeMap(const typename Parent::Graph& g) \
120 : Parent(g, g.sym_edge_maps) {} \
121 SymEdgeMap(const typename Parent::Graph& g, const Value& v) \
122 : Parent(g, g.sym_edge_maps, v) {} \
123 SymEdgeMap(const SymEdgeMap& copy) \
124 : Parent(static_cast<const Parent&>(copy)) {} \
125 template <typename TT> \
126 SymEdgeMap(const NodeMap<TT>& copy) \
127 : Parent(static_cast<const typename SymEdgeMap<TT>::Parent&>(copy)) {} \
128 SymEdgeMap& operator=(const SymEdgeMap& copy) { \
129 Parent::operator=(static_cast<const Parent&>(copy));\
132 template <typename TT> \
133 SymEdgeMap& operator=(const SymEdgeMap<TT>& copy) { \
134 Parent::operator=(static_cast<const typename SymEdgeMap<TT>::Parent&>(copy));\
139 /** This is a macro to import an node map into a graph class.
141 #define IMPORT_NODE_MAP(From, from, To, to) \
142 template <typename Value> \
143 class NodeMap : public From::template NodeMap<Value> { \
146 typedef typename From::template NodeMap<Value> Parent; \
148 NodeMap(const To& to) \
149 : Parent(static_cast<const From&>(from)) { } \
150 NodeMap(const To& to, const Value& value) \
151 : Parent(static_cast<const From&>(from), value) { } \
152 NodeMap(const NodeMap& copy) \
153 : Parent(static_cast<const Parent&>(copy)) {} \
154 template <typename TT> \
155 NodeMap(const NodeMap<TT>& copy) \
156 : Parent(static_cast<const typename NodeMap<TT>::Parent&>(copy)) {} \
157 NodeMap& operator=(const NodeMap& copy) { \
158 Parent::operator=(static_cast<const Parent&>(copy)); \
161 template <typename TT> \
162 NodeMap& operator=(const NodeMap<TT>& copy) { \
163 Parent::operator=(static_cast<const typename NodeMap<TT>::Parent&>(copy));\
168 /** This is a macro to import an edge map into a graph class.
170 #define IMPORT_EDGE_MAP(From, from, To, to) \
171 template <typename Value> \
172 class EdgeMap : public From::template EdgeMap<Value> { \
175 typedef typename From::template EdgeMap<Value> Parent; \
177 EdgeMap(const To& to) \
178 : Parent(static_cast<const From&>(from)) { } \
179 EdgeMap(const To& to, const Value& value) \
180 : Parent(static_cast<const From&>(from), value) { } \
181 EdgeMap(const EdgeMap& copy) \
182 : Parent(static_cast<const Parent&>(copy)) {} \
183 template <typename TT> \
184 EdgeMap(const EdgeMap<TT>& copy) \
185 : Parent(static_cast<const typename EdgeMap<TT>::Parent&>(copy)) {} \
186 EdgeMap& operator=(const EdgeMap& copy) { \
187 Parent::operator=(static_cast<const Parent&>(copy)); \
190 template <typename TT> \
191 EdgeMap& operator=(const EdgeMap<TT>& copy) { \
192 Parent::operator=(static_cast<const typename EdgeMap<TT>::Parent&>(copy));\
197 #define KEEP_EDGE_MAP(From, To) \
198 IMPORT_EDGE_MAP(From, graph, To, graph)
201 #define KEEP_NODE_MAP(From, To) \
202 IMPORT_NODE_MAP(From, graph, To, graph)
204 /** This is a macro to keep the node and edge maps for a graph class.
206 #define KEEP_MAPS(From, To) \
207 KEEP_EDGE_MAP(From, To) \
208 KEEP_NODE_MAP(From, To)