Skeleton for paths.
2 #ifndef SYM_MAP_FACTORY_H
3 #define SYM_MAP_FACTORY_H
7 template <typename Graph, typename Edge, typename EdgeIt>
8 class SymEdgeIt : public EdgeIt {
14 SymEdgeIt(const Graph& graph)
17 SymEdgeIt(Invalid invalid)
20 SymEdgeIt(const Graph& graph, Edge edge)
21 : EdgeIt(graph, edge) {}
23 SymEdgeIt& operator++() {
25 while ( n != -1 && (n & 1)) {
32 template <typename MapRegistry, template <typename> class MapFactory>
37 typedef typename MapRegistry::Graph Graph;
38 typedef typename MapRegistry::KeyType KeyType;
39 typedef typename MapRegistry::KeyIt KeyIt;
41 typedef typename MapRegistry::MapBase MapBase;
44 class Map : public MapFactory<MapRegistry>::template Map<V> {
46 typedef typename MapFactory<MapRegistry>::template Map<V> MapImpl;
53 Map(const Graph& g, MapRegistry& r) : MapImpl(g, r) {}
55 Map(const Graph& g, MapRegistry& r, const Value& v) : MapImpl(g, r, v) {}
57 Map(const Map& copy) : MapImpl(static_cast<const MapImpl&>(copy)) {}
59 template <typename CMap> Map(const CMap& copy) : MapImpl(copy) {}
61 Map& operator=(const Map& copy) {
62 MapImpl::operator=(static_cast<const MapImpl&>(copy));
66 template <typename CMap> Map& operator=(const CMap& copy) {
67 MapImpl::operator=(copy);
71 Value& operator[](const KeyType& key) {
72 int id = MapBase::getGraph()->id(key);
73 return MapImpl::operator[](id >> 1);
76 const Value& operator[](const KeyType& key) const {
77 int id = MapBase::getGraph()->id(key);
78 return MapImpl::operator[](id >> 1);
81 const Value& get(const KeyType& key) const {
82 int id = MapBase::getGraph()->id(key);
83 return MapImpl::operator[](id >> 1);
86 void set(const KeyType& key, const Value& val) {
87 int id = MapBase::getGraph()->id(key);
88 MapImpl::operator[](id >> 1) = val;
91 void add(const KeyType& key) {
92 int id = MapBase::getGraph()->id(key);
97 void erase(const KeyType& key) {
98 int id = MapBase::getGraph()->id(key);