Nicer and more documented graph_wrapper.h file.
These are only the first steps for making this file more beautiful.
5 ///\ingroup graphmapfactory
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 concrete factory type from a template map
33 * factory to use as node map factory.
35 #define CREATE_NODE_MAP_FACTORY(TemplateFactory) \
36 typedef TemplateFactory<NodeMapRegistry> NodeMapFactory;
38 /** Creates a concrete factory type from a template map
39 * factory to use as edge map factory.
41 #define CREATE_EDGE_MAP_FACTORY(TemplateFactory) \
42 typedef TemplateFactory<EdgeMapRegistry> EdgeMapFactory;
44 /** Creates both map factories.
46 #define CREATE_MAP_FACTORIES(TemplateFactory) \
47 CREATE_NODE_MAP_FACTORY(TemplateFactory) \
48 CREATE_EDGE_MAP_FACTORY(TemplateFactory)
50 /** Import a map from a concrete map factory. The import method is
51 * an overloading of the map type.
52 * The reason to use these macro is that the c++ does not support
53 * the template typedefs. If a future release of the c++
54 * supports this feature it should be fixed.
56 #define IMPORT_NODE_MAP(Factory) \
57 template <typename V> \
58 class NodeMap : public Factory::template Map<V> { \
59 typedef typename Factory::template Map<V> MapImpl; \
62 NodeMap(const Graph& g) : MapImpl(g, g.node_maps) {} \
63 NodeMap(const Graph& g, const V& v) : MapImpl(g, g.node_maps, v) {} \
64 NodeMap(const NodeMap& copy) : MapImpl(static_cast<const MapImpl&>(copy)) {} \
65 template <typename CMap> NodeMap(const CMap& copy) : MapImpl(copy) {} \
66 NodeMap& operator=(const NodeMap& copy) { \
67 MapImpl::operator=(static_cast<const MapImpl&>(copy));\
70 template <typename CMap> NodeMap& operator=(const CMap& copy) { \
71 MapImpl::operator=(copy);\
76 /** Import a map from a concrete map factory. The import method is
77 * an overloading of the map type.
78 * The reason to use these macro is that the c++ does not support
79 * the template typedefs. If a future release of the c++
80 * supports this feature it should be fixed.
82 #define IMPORT_EDGE_MAP(Factory) \
83 template <typename V> \
84 class EdgeMap : public Factory::template Map<V> { \
85 typedef typename Factory::template Map<V> MapImpl; \
88 EdgeMap(const Graph& g) : MapImpl(g, g.edge_maps) {} \
89 EdgeMap(const Graph& g, const V& v) : MapImpl(g, g.edge_maps, v) {} \
90 EdgeMap(const EdgeMap& copy) : MapImpl(static_cast<const MapImpl&>(copy)) {} \
91 template <typename CMap> EdgeMap(const CMap& copy) : MapImpl(copy) {} \
92 EdgeMap& operator=(const EdgeMap& copy) { \
93 MapImpl::operator=(static_cast<const MapImpl&>(copy));\
96 template <typename CMap> EdgeMap& operator=(const CMap& copy) { \
97 MapImpl::operator=(copy);\
102 /** This macro creates both map factories and imports both maps.
104 #define CREATE_MAPS(TemplateFactory) \
105 CREATE_MAP_FACTORIES(TemplateFactory) \
106 IMPORT_NODE_MAP(NodeMapFactory) \
107 IMPORT_EDGE_MAP(EdgeMapFactory)
109 /** This macro creates MapRegistry for Symmetric Edge Maps.
111 #define CREATE_SYM_EDGE_MAP_REGISTRY \
112 typedef SymEdgeIt<Graph, Edge, EdgeIt> SymEdgeIt; \
113 typedef MapRegistry<Graph, Edge, SymEdgeIt> SymEdgeMapRegistry; \
114 mutable EdgeMapRegistry sym_edge_maps;
116 /** Creates a concrete factory type from a template map
117 * factory to use as edge map factory.
119 #define CREATE_SYM_EDGE_MAP_FACTORY(TemplateFactory) \
120 typedef SymMapFactory<SymEdgeMapRegistry, TemplateFactory > \
123 /** Import a map from a concrete map factory. The import method is
124 * an overloading of the map type.
125 * The reason to use these macro is that the c++ does not support
126 * the template typedefs. If a future release of the c++
127 * supports this feature it should be fixed.
129 #define IMPORT_SYM_EDGE_MAP(Factory) \
130 template <typename V> \
131 class SymEdgeMap : public Factory::template Map<V> { \
132 typedef typename Factory::template Map<V> MapImpl; \
135 SymEdgeMap(const Graph& g) : MapImpl(g, g.sym_edge_maps) {} \
136 SymEdgeMap(const Graph& g, const V& v) : MapImpl(g, g.sym_edge_maps, v) {} \
137 SymEdgeMap(const SymEdgeMap& copy) \
138 : MapImpl(static_cast<const MapImpl&>(copy)) {} \
139 template <typename CMap> SymEdgeMap(const CMap& copy) : MapImpl(copy) {} \
140 SymEdgeMap& operator=(const SymEdgeMap& copy) { \
141 MapImpl::operator=(static_cast<const MapImpl&>(copy));\
144 template <typename CMap> SymEdgeMap& operator=(const CMap& copy) { \
145 MapImpl::operator=(copy);\
151 #define KEEP_NODE_MAP(GraphBase) \
152 template <typename V> class NodeMap \
153 : public GraphBase::template NodeMap<V> \
155 typedef typename GraphBase::template NodeMap<V> MapImpl; \
158 NodeMap() : MapImpl() {} \
160 NodeMap(const Graph& graph) \
161 : MapImpl(static_cast<const GraphBase&>(graph)) { } \
163 NodeMap(const Graph& graph, const Value& value) \
164 : MapImpl(static_cast<const GraphBase&>(graph), value) { } \
166 NodeMap(const NodeMap& copy) \
167 : MapImpl(static_cast<const MapImpl&>(copy)) {} \
169 template<typename CMap> \
170 NodeMap(const CMap& copy) \
173 NodeMap& operator=(const NodeMap& copy) { \
174 MapImpl::operator=(static_cast<const MapImpl&>(copy)); \
178 template <typename CMap> \
179 NodeMap& operator=(const CMap& copy) { \
180 MapImpl::operator=(copy); \
185 #define KEEP_EDGE_MAP(GraphBase) \
186 template <typename V> class EdgeMap \
187 : public GraphBase::template EdgeMap<V> \
189 typedef typename GraphBase::template EdgeMap<V> MapImpl; \
192 EdgeMap() : MapImpl() {} \
194 EdgeMap(const Graph& graph) \
195 : MapImpl(static_cast<const GraphBase&>(graph)) { } \
197 EdgeMap(const Graph& graph, const Value& value) \
198 : MapImpl(static_cast<const GraphBase&>(graph), value) { } \
200 EdgeMap(const EdgeMap& copy) \
201 : MapImpl(static_cast<const MapImpl&>(copy)) {} \
203 template<typename CMap> \
204 EdgeMap(const CMap& copy) \
207 EdgeMap& operator=(const EdgeMap& copy) { \
208 MapImpl::operator=(static_cast<const MapImpl&>(copy)); \
212 template <typename CMap> \
213 EdgeMap& operator=(const CMap& copy) { \
214 MapImpl::operator=(copy); \