mukesh agrawal | 4d0401c | 2012-01-06 16:05:31 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Ben Chan | c45688b | 2014-07-02 23:50:45 -0700 | [diff] [blame] | 5 | #ifndef SHILL_PROPERTY_STORE_H_ |
| 6 | #define SHILL_PROPERTY_STORE_H_ |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 7 | |
| 8 | #include <map> |
| 9 | #include <string> |
| 10 | #include <vector> |
| 11 | |
| 12 | #include <base/basictypes.h> |
mukesh agrawal | bebf1b8 | 2013-04-23 15:06:33 -0700 | [diff] [blame] | 13 | #include <base/callback.h> |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 14 | |
| 15 | #include "shill/accessor_interface.h" |
Chris Masone | a8a2c25 | 2011-06-27 22:16:30 -0700 | [diff] [blame] | 16 | #include "shill/property_iterator.h" |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 17 | |
| 18 | namespace shill { |
| 19 | |
| 20 | class Error; |
| 21 | |
| 22 | class PropertyStore { |
| 23 | public: |
mukesh agrawal | bebf1b8 | 2013-04-23 15:06:33 -0700 | [diff] [blame] | 24 | typedef base::Callback<void(const std::string &)> PropertyChangeCallback; |
Chris Masone | 27c4aa5 | 2011-07-02 13:10:14 -0700 | [diff] [blame] | 25 | PropertyStore(); |
mukesh agrawal | bebf1b8 | 2013-04-23 15:06:33 -0700 | [diff] [blame] | 26 | explicit PropertyStore(PropertyChangeCallback property_change_callback); |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 27 | virtual ~PropertyStore(); |
| 28 | |
mukesh agrawal | de29fa8 | 2011-09-16 16:16:36 -0700 | [diff] [blame] | 29 | virtual bool Contains(const std::string& property) const; |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 30 | |
Paul Stewart | e6e8e49 | 2013-01-17 11:00:50 -0800 | [diff] [blame] | 31 | // Methods to allow the getting of properties stored in the referenced |
| 32 | // |store_| by name. Upon success, these methods return true and return the |
| 33 | // property value in |value|. Upon failure, they return false and |
| 34 | // leave |value| untouched. |
| 35 | bool GetBoolProperty(const std::string &name, bool *value, |
| 36 | Error *error) const; |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 37 | bool GetInt16Property(const std::string &name, int16_t *value, |
Paul Stewart | e6e8e49 | 2013-01-17 11:00:50 -0800 | [diff] [blame] | 38 | Error *error) const; |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 39 | bool GetInt32Property(const std::string &name, int32_t *value, |
Paul Stewart | e6e8e49 | 2013-01-17 11:00:50 -0800 | [diff] [blame] | 40 | Error *error) const; |
| 41 | bool GetKeyValueStoreProperty(const std::string &name, KeyValueStore *value, |
| 42 | Error *error) const; |
| 43 | bool GetStringProperty(const std::string &name, std::string *value, |
| 44 | Error *error) const; |
| 45 | bool GetStringmapProperty(const std::string &name, Stringmap *values, |
| 46 | Error *error) const; |
| 47 | bool GetStringmapsProperty(const std::string &name, Stringmaps *values, |
| 48 | Error *error) const; |
| 49 | bool GetStringsProperty(const std::string &name, Strings *values, |
| 50 | Error *error) const; |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 51 | bool GetUint8Property(const std::string &name, uint8_t *value, |
Paul Stewart | e6e8e49 | 2013-01-17 11:00:50 -0800 | [diff] [blame] | 52 | Error *error) const; |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 53 | bool GetUint16Property(const std::string &name, uint16_t *value, |
Paul Stewart | e6e8e49 | 2013-01-17 11:00:50 -0800 | [diff] [blame] | 54 | Error *error) const; |
mukesh agrawal | e7c7e65 | 2013-06-18 17:19:39 -0700 | [diff] [blame] | 55 | bool GetUint16sProperty(const std::string &name, Uint16s *value, |
| 56 | Error *error) const; |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 57 | bool GetUint32Property(const std::string &name, uint32_t *value, |
Paul Stewart | e6e8e49 | 2013-01-17 11:00:50 -0800 | [diff] [blame] | 58 | Error *error) const; |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 59 | bool GetUint64Property(const std::string &name, uint64_t *value, |
Paul Stewart | e6e8e49 | 2013-01-17 11:00:50 -0800 | [diff] [blame] | 60 | Error *error) const; |
| 61 | bool GetRpcIdentifierProperty(const std::string &name, RpcIdentifier *value, |
| 62 | Error *error) const; |
| 63 | |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 64 | // Methods to allow the setting, by name, of properties stored in this object. |
| 65 | // The property names are declared in chromeos/dbus/service_constants.h, |
| 66 | // so that they may be shared with libcros. |
mukesh agrawal | bebf1b8 | 2013-04-23 15:06:33 -0700 | [diff] [blame] | 67 | // If the property is successfully changed, these methods return true, |
| 68 | // and leave |error| untouched. |
| 69 | // If the property is unchanged because it already has the desired value, |
| 70 | // these methods return false, and leave |error| untouched. |
| 71 | // If the property change fails, these methods return false, and update |
| 72 | // |error|. However, updating |error| is skipped if |error| is NULL. |
mukesh agrawal | 66b0aca | 2012-01-30 15:28:28 -0800 | [diff] [blame] | 73 | virtual bool SetBoolProperty(const std::string &name, |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 74 | bool value, |
| 75 | Error *error); |
| 76 | |
mukesh agrawal | 66b0aca | 2012-01-30 15:28:28 -0800 | [diff] [blame] | 77 | virtual bool SetInt16Property(const std::string &name, |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 78 | int16_t value, |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 79 | Error *error); |
| 80 | |
mukesh agrawal | 66b0aca | 2012-01-30 15:28:28 -0800 | [diff] [blame] | 81 | virtual bool SetInt32Property(const std::string &name, |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 82 | int32_t value, |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 83 | Error *error); |
| 84 | |
mukesh agrawal | 66b0aca | 2012-01-30 15:28:28 -0800 | [diff] [blame] | 85 | virtual bool SetStringProperty(const std::string &name, |
| 86 | const std::string &value, |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 87 | Error *error); |
| 88 | |
| 89 | virtual bool SetStringmapProperty( |
mukesh agrawal | 66b0aca | 2012-01-30 15:28:28 -0800 | [diff] [blame] | 90 | const std::string &name, |
| 91 | const std::map<std::string, std::string> &values, |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 92 | Error *error); |
| 93 | |
mukesh agrawal | bebf1b8 | 2013-04-23 15:06:33 -0700 | [diff] [blame] | 94 | virtual bool SetStringmapsProperty( |
| 95 | const std::string &name, |
| 96 | const std::vector<std::map<std::string, std::string> > &values, |
| 97 | Error *error); |
| 98 | |
mukesh agrawal | 66b0aca | 2012-01-30 15:28:28 -0800 | [diff] [blame] | 99 | virtual bool SetStringsProperty(const std::string &name, |
| 100 | const std::vector<std::string> &values, |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 101 | Error *error); |
| 102 | |
mukesh agrawal | 66b0aca | 2012-01-30 15:28:28 -0800 | [diff] [blame] | 103 | virtual bool SetUint8Property(const std::string &name, |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 104 | uint8_t value, |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 105 | Error *error); |
| 106 | |
mukesh agrawal | 66b0aca | 2012-01-30 15:28:28 -0800 | [diff] [blame] | 107 | virtual bool SetUint16Property(const std::string &name, |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 108 | uint16_t value, |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 109 | Error *error); |
| 110 | |
mukesh agrawal | e7c7e65 | 2013-06-18 17:19:39 -0700 | [diff] [blame] | 111 | virtual bool SetUint16sProperty(const std::string &name, |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 112 | const std::vector<uint16_t> &value, |
mukesh agrawal | e7c7e65 | 2013-06-18 17:19:39 -0700 | [diff] [blame] | 113 | Error *error); |
| 114 | |
mukesh agrawal | 66b0aca | 2012-01-30 15:28:28 -0800 | [diff] [blame] | 115 | virtual bool SetUint32Property(const std::string &name, |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 116 | uint32_t value, |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 117 | Error *error); |
| 118 | |
Paul Stewart | e18c33b | 2012-07-10 20:48:44 -0700 | [diff] [blame] | 119 | virtual bool SetUint64Property(const std::string &name, |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 120 | uint64_t value, |
Paul Stewart | e18c33b | 2012-07-10 20:48:44 -0700 | [diff] [blame] | 121 | Error *error); |
| 122 | |
Jason Glasgow | acdc11f | 2012-03-30 14:12:22 -0400 | [diff] [blame] | 123 | virtual bool SetRpcIdentifierProperty(const std::string &name, |
| 124 | const RpcIdentifier &value, |
| 125 | Error *error); |
| 126 | |
mukesh agrawal | 4d260da | 2012-01-30 11:53:52 -0800 | [diff] [blame] | 127 | // Clearing a property resets it to its "factory" value. This value |
| 128 | // is generally the value that it (the property) had when it was |
| 129 | // registered with PropertyStore. |
| 130 | // |
| 131 | // The exception to this rule is write-only derived properties. For |
| 132 | // such properties, the property owner explicitly provides a |
| 133 | // "factory" value at registration time. This is necessary because |
| 134 | // PropertyStore can't read the current value at registration time. |
| 135 | // |
| 136 | // |name| is the key used to access the property. If the property |
| 137 | // cannot be cleared, |error| is set, and the method returns false. |
Alex Vakulenko | 8a53229 | 2014-06-16 17:18:44 -0700 | [diff] [blame] | 138 | // Otherwise, |error| is unchanged, and the method returns true. |
mukesh agrawal | 4d260da | 2012-01-30 11:53:52 -0800 | [diff] [blame] | 139 | virtual bool ClearProperty(const std::string &name, Error *error); |
| 140 | |
mukesh agrawal | ffa3d04 | 2011-10-06 15:26:10 -0700 | [diff] [blame] | 141 | // Accessors for iterators over property maps. Useful for dumping all |
| 142 | // properties. |
Gaurav Shah | 1b7a616 | 2011-11-09 11:41:01 -0800 | [diff] [blame] | 143 | ReadablePropertyConstIterator<bool> GetBoolPropertiesIter() const; |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 144 | ReadablePropertyConstIterator<int16_t> GetInt16PropertiesIter() const; |
| 145 | ReadablePropertyConstIterator<int32_t> GetInt32PropertiesIter() const; |
Alex Vakulenko | 8a53229 | 2014-06-16 17:18:44 -0700 | [diff] [blame] | 146 | ReadablePropertyConstIterator<KeyValueStore> |
| 147 | GetKeyValueStorePropertiesIter() const; |
| 148 | ReadablePropertyConstIterator<RpcIdentifier> |
| 149 | GetRpcIdentifierPropertiesIter() const; |
| 150 | ReadablePropertyConstIterator<RpcIdentifiers> |
| 151 | GetRpcIdentifiersPropertiesIter() const; |
Gaurav Shah | 1b7a616 | 2011-11-09 11:41:01 -0800 | [diff] [blame] | 152 | ReadablePropertyConstIterator<std::string> GetStringPropertiesIter() const; |
| 153 | ReadablePropertyConstIterator<Stringmap> GetStringmapPropertiesIter() const; |
| 154 | ReadablePropertyConstIterator<Stringmaps> GetStringmapsPropertiesIter() const; |
Gaurav Shah | 1b7a616 | 2011-11-09 11:41:01 -0800 | [diff] [blame] | 155 | ReadablePropertyConstIterator<Strings> GetStringsPropertiesIter() const; |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 156 | ReadablePropertyConstIterator<uint8_t> GetUint8PropertiesIter() const; |
| 157 | ReadablePropertyConstIterator<uint16_t> GetUint16PropertiesIter() const; |
mukesh agrawal | e7c7e65 | 2013-06-18 17:19:39 -0700 | [diff] [blame] | 158 | ReadablePropertyConstIterator<Uint16s> GetUint16sPropertiesIter() const; |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 159 | ReadablePropertyConstIterator<uint32_t> GetUint32PropertiesIter() const; |
| 160 | ReadablePropertyConstIterator<uint64_t> GetUint64PropertiesIter() const; |
Chris Masone | a8a2c25 | 2011-06-27 22:16:30 -0700 | [diff] [blame] | 161 | |
mukesh agrawal | 4d260da | 2012-01-30 11:53:52 -0800 | [diff] [blame] | 162 | // Methods for registering a property. |
| 163 | // |
| 164 | // It is permitted to re-register a property (in which case the old |
| 165 | // binding is forgotten). However, the newly bound object must be of |
| 166 | // the same type. |
| 167 | // |
| 168 | // Note that types do not encode read-write permission. Hence, it |
| 169 | // is possible to change permissions by rebinding a property to the |
| 170 | // same object. |
| 171 | // |
| 172 | // (Corollary of the rebinding-to-same-type restriction: a |
| 173 | // PropertyStore cannot hold two properties of the same name, but |
| 174 | // differing types.) |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 175 | void RegisterBool(const std::string &name, bool *prop); |
| 176 | void RegisterConstBool(const std::string &name, const bool *prop); |
Gaurav Shah | 1b7a616 | 2011-11-09 11:41:01 -0800 | [diff] [blame] | 177 | void RegisterWriteOnlyBool(const std::string &name, bool *prop); |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 178 | void RegisterInt16(const std::string &name, int16_t *prop); |
| 179 | void RegisterConstInt16(const std::string &name, const int16_t *prop); |
| 180 | void RegisterWriteOnlyInt16(const std::string &name, int16_t *prop); |
| 181 | void RegisterInt32(const std::string &name, int32_t *prop); |
| 182 | void RegisterConstInt32(const std::string &name, const int32_t *prop); |
| 183 | void RegisterWriteOnlyInt32(const std::string &name, int32_t *prop); |
| 184 | void RegisterUint32(const std::string &name, uint32_t *prop); |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 185 | void RegisterString(const std::string &name, std::string *prop); |
| 186 | void RegisterConstString(const std::string &name, const std::string *prop); |
Gaurav Shah | 1b7a616 | 2011-11-09 11:41:01 -0800 | [diff] [blame] | 187 | void RegisterWriteOnlyString(const std::string &name, std::string *prop); |
Chris Masone | 43b48a1 | 2011-07-01 13:37:07 -0700 | [diff] [blame] | 188 | void RegisterStringmap(const std::string &name, Stringmap *prop); |
| 189 | void RegisterConstStringmap(const std::string &name, const Stringmap *prop); |
Gaurav Shah | 1b7a616 | 2011-11-09 11:41:01 -0800 | [diff] [blame] | 190 | void RegisterWriteOnlyStringmap(const std::string &name, Stringmap *prop); |
Darin Petkov | c086531 | 2011-09-16 15:31:20 -0700 | [diff] [blame] | 191 | void RegisterStringmaps(const std::string &name, Stringmaps *prop); |
| 192 | void RegisterConstStringmaps(const std::string &name, const Stringmaps *prop); |
Gaurav Shah | 1b7a616 | 2011-11-09 11:41:01 -0800 | [diff] [blame] | 193 | void RegisterWriteOnlyStringmaps(const std::string &name, Stringmaps *prop); |
Chris Masone | 43b48a1 | 2011-07-01 13:37:07 -0700 | [diff] [blame] | 194 | void RegisterStrings(const std::string &name, Strings *prop); |
Chris Masone | 889666b | 2011-07-03 12:58:50 -0700 | [diff] [blame] | 195 | void RegisterConstStrings(const std::string &name, const Strings *prop); |
Gaurav Shah | 1b7a616 | 2011-11-09 11:41:01 -0800 | [diff] [blame] | 196 | void RegisterWriteOnlyStrings(const std::string &name, Strings *prop); |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 197 | void RegisterUint8(const std::string &name, uint8_t *prop); |
| 198 | void RegisterConstUint8(const std::string &name, const uint8_t *prop); |
| 199 | void RegisterWriteOnlyUint8(const std::string &name, uint8_t *prop); |
| 200 | void RegisterUint16(const std::string &name, uint16_t *prop); |
mukesh agrawal | e7c7e65 | 2013-06-18 17:19:39 -0700 | [diff] [blame] | 201 | void RegisterUint16s(const std::string &name, Uint16s *prop); |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 202 | void RegisterConstUint16(const std::string &name, const uint16_t *prop); |
mukesh agrawal | e7c7e65 | 2013-06-18 17:19:39 -0700 | [diff] [blame] | 203 | void RegisterConstUint16s(const std::string &name, const Uint16s *prop); |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame^] | 204 | void RegisterWriteOnlyUint16(const std::string &name, uint16_t *prop); |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 205 | |
Chris Masone | 27c4aa5 | 2011-07-02 13:10:14 -0700 | [diff] [blame] | 206 | void RegisterDerivedBool(const std::string &name, |
| 207 | const BoolAccessor &accessor); |
mukesh agrawal | 4d0401c | 2012-01-06 16:05:31 -0800 | [diff] [blame] | 208 | void RegisterDerivedInt32(const std::string &name, |
| 209 | const Int32Accessor &accessor); |
Darin Petkov | 63138a9 | 2012-02-06 14:09:15 +0100 | [diff] [blame] | 210 | void RegisterDerivedKeyValueStore(const std::string &name, |
| 211 | const KeyValueStoreAccessor &accessor); |
Jason Glasgow | acdc11f | 2012-03-30 14:12:22 -0400 | [diff] [blame] | 212 | void RegisterDerivedRpcIdentifier(const std::string &name, |
| 213 | const RpcIdentifierAccessor &acc); |
mukesh agrawal | 2366eed | 2012-03-20 18:21:50 -0700 | [diff] [blame] | 214 | void RegisterDerivedRpcIdentifiers(const std::string &name, |
| 215 | const RpcIdentifiersAccessor &accessor); |
Chris Masone | 27c4aa5 | 2011-07-02 13:10:14 -0700 | [diff] [blame] | 216 | void RegisterDerivedString(const std::string &name, |
| 217 | const StringAccessor &accessor); |
Eric Shienbrood | 30bc0ec | 2012-03-21 18:19:46 -0400 | [diff] [blame] | 218 | void RegisterDerivedStringmap(const std::string &name, |
| 219 | const StringmapAccessor &accessor); |
Chris Masone | 889666b | 2011-07-03 12:58:50 -0700 | [diff] [blame] | 220 | void RegisterDerivedStringmaps(const std::string &name, |
| 221 | const StringmapsAccessor &accessor); |
Chris Masone | 27c4aa5 | 2011-07-02 13:10:14 -0700 | [diff] [blame] | 222 | void RegisterDerivedStrings(const std::string &name, |
| 223 | const StringsAccessor &accessor); |
Paul Stewart | be5f5b3 | 2011-12-07 17:11:11 -0800 | [diff] [blame] | 224 | void RegisterDerivedUint16(const std::string &name, |
| 225 | const Uint16Accessor &accessor); |
Paul Stewart | e18c33b | 2012-07-10 20:48:44 -0700 | [diff] [blame] | 226 | void RegisterDerivedUint64(const std::string &name, |
| 227 | const Uint64Accessor &accessor); |
Chris Masone | 27c4aa5 | 2011-07-02 13:10:14 -0700 | [diff] [blame] | 228 | |
| 229 | private: |
mukesh agrawal | ffa3d04 | 2011-10-06 15:26:10 -0700 | [diff] [blame] | 230 | template <class V> |
Paul Stewart | e6e8e49 | 2013-01-17 11:00:50 -0800 | [diff] [blame] | 231 | bool GetProperty( |
| 232 | const std::string &name, |
| 233 | V *value, |
| 234 | Error *error, |
Alex Vakulenko | 8a53229 | 2014-06-16 17:18:44 -0700 | [diff] [blame] | 235 | const std::map< std::string, std::shared_ptr< |
Paul Stewart | e6e8e49 | 2013-01-17 11:00:50 -0800 | [diff] [blame] | 236 | AccessorInterface<V> > > &collection, |
| 237 | const std::string &value_type_english) const; |
| 238 | |
| 239 | template <class V> |
mukesh agrawal | ffa3d04 | 2011-10-06 15:26:10 -0700 | [diff] [blame] | 240 | bool SetProperty( |
| 241 | const std::string &name, |
| 242 | const V &value, |
| 243 | Error *error, |
Alex Vakulenko | 8a53229 | 2014-06-16 17:18:44 -0700 | [diff] [blame] | 244 | std::map< std::string, std::shared_ptr< AccessorInterface<V> > > *, |
mukesh agrawal | ffa3d04 | 2011-10-06 15:26:10 -0700 | [diff] [blame] | 245 | const std::string &value_type_english); |
| 246 | |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 247 | // These are std::maps instead of something cooler because the common |
| 248 | // operation is iterating through them and returning all properties. |
| 249 | std::map<std::string, BoolAccessor> bool_properties_; |
| 250 | std::map<std::string, Int16Accessor> int16_properties_; |
| 251 | std::map<std::string, Int32Accessor> int32_properties_; |
Darin Petkov | 63138a9 | 2012-02-06 14:09:15 +0100 | [diff] [blame] | 252 | std::map<std::string, KeyValueStoreAccessor> key_value_store_properties_; |
Jason Glasgow | acdc11f | 2012-03-30 14:12:22 -0400 | [diff] [blame] | 253 | std::map<std::string, RpcIdentifierAccessor> rpc_identifier_properties_; |
mukesh agrawal | 2366eed | 2012-03-20 18:21:50 -0700 | [diff] [blame] | 254 | std::map<std::string, RpcIdentifiersAccessor> rpc_identifiers_properties_; |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 255 | std::map<std::string, StringAccessor> string_properties_; |
| 256 | std::map<std::string, StringmapAccessor> stringmap_properties_; |
Chris Masone | 889666b | 2011-07-03 12:58:50 -0700 | [diff] [blame] | 257 | std::map<std::string, StringmapsAccessor> stringmaps_properties_; |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 258 | std::map<std::string, StringsAccessor> strings_properties_; |
| 259 | std::map<std::string, Uint8Accessor> uint8_properties_; |
| 260 | std::map<std::string, Uint16Accessor> uint16_properties_; |
mukesh agrawal | e7c7e65 | 2013-06-18 17:19:39 -0700 | [diff] [blame] | 261 | std::map<std::string, Uint16sAccessor> uint16s_properties_; |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 262 | std::map<std::string, Uint32Accessor> uint32_properties_; |
Paul Stewart | e18c33b | 2012-07-10 20:48:44 -0700 | [diff] [blame] | 263 | std::map<std::string, Uint64Accessor> uint64_properties_; |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 264 | |
mukesh agrawal | bebf1b8 | 2013-04-23 15:06:33 -0700 | [diff] [blame] | 265 | PropertyChangeCallback property_changed_callback_; |
| 266 | |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 267 | DISALLOW_COPY_AND_ASSIGN(PropertyStore); |
| 268 | }; |
| 269 | |
| 270 | } // namespace shill |
| 271 | |
Ben Chan | c45688b | 2014-07-02 23:50:45 -0700 | [diff] [blame] | 272 | #endif // SHILL_PROPERTY_STORE_H_ |