8 namespace hugo { |
8 namespace hugo { |
9 |
9 |
10 /// The namespace of HUGOlib concepts and concept checking classes |
10 /// The namespace of HUGOlib concepts and concept checking classes |
11 namespace skeleton { |
11 namespace skeleton { |
12 |
12 |
13 /// Null map concept |
|
14 template<typename K, typename T> |
|
15 class NullMap |
|
16 { |
|
17 public: |
|
18 /// Map's key type. |
|
19 typedef K KeyType; |
|
20 /// Map's value type. (The type of objects associated with the keys). |
|
21 typedef T ValueType; |
|
22 |
|
23 /// Facility to define a map with an other value type |
|
24 template<typename T1> |
|
25 struct rebind { |
|
26 /// The type of a map with the given value type |
|
27 typedef NullMap<K,T1> other; |
|
28 }; |
|
29 |
|
30 NullMap() {} |
|
31 }; |
|
32 |
|
33 /// Readable map concept |
13 /// Readable map concept |
34 template<typename K, typename T> |
14 template<typename K, typename T> |
35 class ReadableMap : public NullMap<K,T> |
15 class ReadableMap |
36 { |
16 { |
37 public: |
17 public: |
38 /// Map's key type. |
18 /// Map's key type. |
39 typedef K KeyType; |
19 typedef K KeyType; |
40 /// Map's value type. (The type of objects associated with the keys). |
20 /// Map's value type. (The type of objects associated with the keys). |
46 /// Copy contsructor. (optional) |
26 /// Copy contsructor. (optional) |
47 ReadableMap(const ReadableMap&) {} |
27 ReadableMap(const ReadableMap&) {} |
48 /// Assignment operator. (optional) |
28 /// Assignment operator. (optional) |
49 ReadableMap& operator=(const ReadableMap&) {return *this;} |
29 ReadableMap& operator=(const ReadableMap&) {return *this;} |
50 |
30 |
51 /// Facility to define a map with an other value type (optional) |
|
52 template<typename T1> |
|
53 struct rebind { |
|
54 /// The type of a map with the given value type |
|
55 typedef ReadableMap<K,T1> other; |
|
56 }; |
|
57 /// @brief Constructor that copies all keys from the other map and |
|
58 /// assigns to them a default value (optional) |
|
59 template<typename T1> |
|
60 ReadableMap(const ReadableMap<K,T1> &map, const T1 &v) {} |
|
61 |
|
62 ReadableMap() {} |
31 ReadableMap() {} |
63 }; |
32 }; |
64 |
33 |
65 |
34 |
66 /// Writable map concept |
35 /// Writable map concept |
67 template<typename K, typename T> |
36 template<typename K, typename T> |
68 class WritableMap : public NullMap<K,T> |
37 class WritableMap |
69 { |
38 { |
70 public: |
39 public: |
71 /// Map's key type. |
40 /// Map's key type. |
72 typedef K KeyType; |
41 typedef K KeyType; |
73 /// Map's value type. (The type of objects associated with the keys). |
42 /// Map's value type. (The type of objects associated with the keys). |
74 typedef T ValueType; |
43 typedef T ValueType; |
75 |
44 |
76 /// Sets the value associated with a key. |
45 /// Sets the value associated with a key. |
77 void set(const KeyType &k,const ValueType &t) {} |
46 void set(const KeyType &k,const ValueType &t) {} |
78 |
|
79 /// Copy contsructor. (optional) |
|
80 WritableMap(const WritableMap&) {} |
|
81 /// Assignment operator. (optional) |
|
82 WritableMap& operator=(const WritableMap&) {return *this;} |
|
83 |
|
84 /// Facility to define a map with an other value type (optional) |
|
85 template<typename T1> |
|
86 struct rebind { |
|
87 /// The type of a map with the given value type |
|
88 typedef WritableMap<K,T1> other; |
|
89 }; |
|
90 /// @brief Constructor that copies all keys from the other map and |
|
91 /// assigns to them a default value (optional) |
|
92 template<typename T1> |
|
93 WritableMap(const WritableMap<K,T1> &map, const T1 &v) {} |
|
94 |
47 |
95 WritableMap() {} |
48 WritableMap() {} |
96 }; |
49 }; |
97 |
50 |
98 ///Read/Writeable map concept |
51 ///Read/Writeable map concept |