Reserve is resolved.
6 #include <hugo/array_map.h>
7 #include <hugo/vector_map.h>
11 ///\brief Graph maps that construates and destruates
12 ///their elements dynamically.
16 /// \addtogroup graphmaps
19 /** The ArrayMap template class is graph map structure what
20 * automatically updates the map when a key is added to or erased from
21 * the map. This map uses the VectorMap if the ValueType is a primitive
22 * type and the ArrayMap for the other cases.
24 * The template parameter is the MapRegistry that the maps
25 * will belong to and the ValueType.
29 /** Macro to implement the DefaultMap.
31 #define DEFAULT_MAP_BODY(DynMap, Value) \
33 typedef DynMap<MapRegistry, Value> MapImpl; \
37 typedef typename MapRegistry::Graph Graph; \
39 DefaultMap() : MapImpl() {} \
41 DefaultMap(const Graph& g, MapRegistry& r) : MapImpl(g, r) {} \
43 DefaultMap(const Graph& g, MapRegistry& r, const Value& v) \
44 : MapImpl(g, r, v) {} \
46 DefaultMap(const DefaultMap& copy) \
47 : MapImpl(static_cast<const MapImpl&>(copy)) {} \
49 template <typename CMap> DefaultMap(const CMap& copy) : MapImpl(copy) {} \
51 DefaultMap& operator=(const DefaultMap& copy) { \
52 MapImpl::operator=(static_cast<const MapImpl&>(copy)); \
56 template <typename CMap> DefaultMap& operator=(const CMap& copy) { \
57 MapImpl::operator=(copy); \
64 template <typename MapRegistry, typename Type>
65 class DefaultMap : public ArrayMap<MapRegistry, Type>
66 DEFAULT_MAP_BODY(ArrayMap, Type);
68 template <typename MapRegistry>
69 class DefaultMap<MapRegistry, bool>
70 : public VectorMap<MapRegistry, bool>
71 DEFAULT_MAP_BODY(VectorMap, bool);
73 template <typename MapRegistry>
74 class DefaultMap<MapRegistry, char>
75 : public VectorMap<MapRegistry, char>
76 DEFAULT_MAP_BODY(VectorMap, char);
78 template <typename MapRegistry>
79 class DefaultMap<MapRegistry, int>
80 : public VectorMap<MapRegistry, int>
81 DEFAULT_MAP_BODY(VectorMap, int);
83 template <typename MapRegistry>
84 class DefaultMap<MapRegistry, short>
85 : public VectorMap<MapRegistry, short>
86 DEFAULT_MAP_BODY(VectorMap, short);
88 template <typename MapRegistry>
89 class DefaultMap<MapRegistry, long>
90 : public VectorMap<MapRegistry, long>
91 DEFAULT_MAP_BODY(VectorMap, long);
93 template <typename MapRegistry>
94 class DefaultMap<MapRegistry, float>
95 : public VectorMap<MapRegistry, float>
96 DEFAULT_MAP_BODY(VectorMap, float);
98 template <typename MapRegistry>
99 class DefaultMap<MapRegistry, double>
100 : public VectorMap<MapRegistry, double>
101 DEFAULT_MAP_BODY(VectorMap, double);
103 template <typename MapRegistry>
104 class DefaultMap<MapRegistry, long double>
105 : public VectorMap<MapRegistry, long double>
106 DEFAULT_MAP_BODY(VectorMap, long double);
108 template <typename MapRegistry, typename Type>
109 class DefaultMap<MapRegistry, Type*>
110 : public VectorMap<MapRegistry, Type*>
111 DEFAULT_MAP_BODY(VectorMap, Type*);