blob: 0559ea0554a931c6db605c06c9258532ce071d50 [file] [log] [blame]
[email protected]cf910da22012-02-15 04:21:081// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef DBUS_PROPERTY_H_
6#define DBUS_PROPERTY_H_
[email protected]cf910da22012-02-15 04:21:087
avi22437c692015-12-22 18:12:458#include <stdint.h>
9
[email protected]cf910da22012-02-15 04:21:0810#include <map>
11#include <string>
puthik0dd82b12016-10-06 05:03:0312#include <unordered_map>
dtapuska32d25452015-02-09 16:02:5513#include <utility>
14#include <vector>
[email protected]cf910da22012-02-15 04:21:0815
[email protected]cf910da22012-02-15 04:21:0816#include "base/bind.h"
17#include "base/callback.h"
avi22437c692015-12-22 18:12:4518#include "base/macros.h"
[email protected]e3024462012-11-05 01:56:1419#include "dbus/dbus_export.h"
[email protected]cf910da22012-02-15 04:21:0820#include "dbus/message.h"
21#include "dbus/object_proxy.h"
22
23// D-Bus objects frequently provide sets of properties accessed via a
24// standard interface of method calls and signals to obtain the current value,
25// set a new value and be notified of changes to the value. Unfortunately this
26// interface makes heavy use of variants and dictionaries of variants. The
27// classes defined here make dealing with properties in a type-safe manner
28// possible.
29//
30// Client implementation classes should define a Properties structure, deriving
31// from the PropertySet class defined here. This structure should contain a
32// member for each property defined as an instance of the Property<> class,
33// specifying the type to the template. Finally the structure should chain up
34// to the PropertySet constructor, and then call RegisterProperty() for each
35// property defined to associate them with their string name.
36//
37// Example:
38// class ExampleClient {
39// public:
40// struct Properties : public dbus::PropertySet {
41// dbus::Property<std::string> name;
avi22437c692015-12-22 18:12:4542// dbus::Property<uint16_t> version;
[email protected]cf910da22012-02-15 04:21:0843// dbus::Property<dbus::ObjectPath> parent;
44// dbus::Property<std::vector<std::string> > children;
45//
46// Properties(dbus::ObjectProxy* object_proxy,
[email protected]7375e8b22012-08-15 01:03:3047// const PropertyChangedCallback callback)
[email protected]992079e2012-02-17 16:50:4248// : dbus::PropertySet(object_proxy, "com.example.DBus", callback) {
[email protected]cf910da22012-02-15 04:21:0849// RegisterProperty("Name", &name);
50// RegisterProperty("Version", &version);
51// RegisterProperty("Parent", &parent);
52// RegisterProperty("Children", &children);
53// }
[email protected]992079e2012-02-17 16:50:4254// virtual ~Properties() {}
[email protected]cf910da22012-02-15 04:21:0855// };
56//
57// The Properties structure requires a pointer to the object proxy of the
58// actual object to track, and after construction should have signals
59// connected to that object and initial values set by calling ConnectSignals()
60// and GetAll(). The structure should not outlive the object proxy, so it
61// is recommended that the lifecycle of both be managed together.
62//
63// Example (continued):
64//
[email protected]992079e2012-02-17 16:50:4265// typedef std::map<std::pair<dbus::ObjectProxy*, Properties*> > Object;
66// typedef std::map<dbus::ObjectPath, Object> ObjectMap;
[email protected]cf910da22012-02-15 04:21:0867// ObjectMap object_map_;
68//
69// dbus::ObjectProxy* GetObjectProxy(const dbus::ObjectPath& object_path) {
70// return GetObject(object_path).first;
71// }
72//
73// Properties* GetProperties(const dbus::ObjectPath& object_path) {
74// return GetObject(object_path).second;
75// }
76//
77// Object GetObject(const dbus::ObjectPath& object_path) {
78// ObjectMap::iterator it = object_map_.find(object_path);
79// if (it != object_map_.end())
80// return it->second;
81//
82// dbus::ObjectProxy* object_proxy = bus->GetObjectProxy(...);
[email protected]992079e2012-02-17 16:50:4283// // connect signals, etc.
[email protected]cf910da22012-02-15 04:21:0884//
85// Properties* properties = new Properties(
86// object_proxy,
87// base::Bind(&PropertyChanged,
88// weak_ptr_factory_.GetWeakPtr(),
89// object_path));
90// properties->ConnectSignals();
91// properties->GetAll();
92//
[email protected]992079e2012-02-17 16:50:4293// Object object = std::make_pair(object_proxy, properties);
94// object_map_[object_path] = object;
95// return object;
[email protected]cf910da22012-02-15 04:21:0896// }
97// };
98//
99// This now allows code using the client implementation to access properties
100// in a type-safe manner, and assuming the PropertyChanged callback is
101// propogated up to observers, be notified of changes. A typical access of
102// the current value of the name property would be:
103//
104// ExampleClient::Properties* p = example_client->GetProperties(object_path);
105// std::string name = p->name.value();
106//
107// Normally these values are updated from signals emitted by the remote object,
108// in case an explicit round-trip is needed to obtain the current value, the
109// Get() method can be used and indicates whether or not the value update was
110// successful. The updated value can be obtained in the callback using the
111// value() method.
112//
113// p->children.Get(base::Bind(&OnGetChildren));
114//
115// A new value can be set using the Set() method, the callback indicates
116// success only; it is up to the remote object when (and indeed if) it updates
117// the property value, and whether it emits a signal or a Get() call is
118// required to obtain it.
119//
120// p->version.Set(20, base::Bind(&OnSetVersion))
121
122namespace dbus {
123
124// D-Bus Properties interface constants, declared here rather than
125// in property.cc because template methods use them.
126const char kPropertiesInterface[] = "org.freedesktop.DBus.Properties";
127const char kPropertiesGetAll[] = "GetAll";
128const char kPropertiesGet[] = "Get";
129const char kPropertiesSet[] = "Set";
130const char kPropertiesChanged[] = "PropertiesChanged";
131
132class PropertySet;
133
134// PropertyBase is an abstract base-class consisting of the parts of
135// the Property<> template that are not type-specific, such as the
136// associated PropertySet, property name, and the type-unsafe parts
137// used by PropertySet.
deratdce1abec2015-07-16 15:06:44138class CHROME_DBUS_EXPORT PropertyBase {
[email protected]cf910da22012-02-15 04:21:08139 public:
deratdce1abec2015-07-16 15:06:44140 PropertyBase();
141 virtual ~PropertyBase();
[email protected]cf910da22012-02-15 04:21:08142
143 // Initializes the |property_set| and property |name| so that method
144 // calls may be made from this class. This method is called by
[email protected]8a3eaffa2012-03-22 20:34:05145 // PropertySet::RegisterProperty() passing |this| for |property_set| so
146 // there should be no need to call it directly. If you do beware that
147 // no ownership or reference to |property_set| is taken so that object
148 // must outlive this one.
[email protected]cf910da22012-02-15 04:21:08149 void Init(PropertySet* property_set, const std::string& name);
150
151 // Retrieves the name of this property, this may be useful in observers
152 // to avoid specifying the name in more than once place, e.g.
153 //
154 // void Client::PropertyChanged(const dbus::ObjectPath& object_path,
155 // const std::string &property_name) {
156 // Properties& properties = GetProperties(object_path);
157 // if (property_name == properties.version.name()) {
158 // // Handle version property changing
159 // }
160 // }
[email protected]8a3eaffa2012-03-22 20:34:05161 const std::string& name() const { return name_; }
[email protected]cf910da22012-02-15 04:21:08162
jpawlowskied276542015-05-11 11:07:04163 // Returns true if property is valid, false otherwise.
164 bool is_valid() const { return is_valid_; }
165
166 // Allows to mark Property as valid or invalid.
167 void set_valid(bool is_valid) { is_valid_ = is_valid; }
168
[email protected]cf910da22012-02-15 04:21:08169 // Method used by PropertySet to retrieve the value from a MessageReader,
170 // no knowledge of the contained type is required, this method returns
171 // true if its expected type was found, false if not.
[email protected]091e0b62012-06-28 18:43:30172 // Implementation provided by specialization.
dtapuska32d25452015-02-09 16:02:55173 virtual bool PopValueFromReader(MessageReader* reader) = 0;
[email protected]cf910da22012-02-15 04:21:08174
[email protected]091e0b62012-06-28 18:43:30175 // Method used by PropertySet to append the set value to a MessageWriter,
176 // no knowledge of the contained type is required.
177 // Implementation provided by specialization.
178 virtual void AppendSetValueToWriter(MessageWriter* writer) = 0;
179
[email protected]7375e8b22012-08-15 01:03:30180 // Method used by test and stub implementations of dbus::PropertySet::Set
181 // to replace the property value with the set value without using a
182 // dbus::MessageReader.
183 virtual void ReplaceValueWithSetValue() = 0;
184
[email protected]cf910da22012-02-15 04:21:08185 protected:
186 // Retrieves the associated property set.
187 PropertySet* property_set() { return property_set_; }
188
189 private:
[email protected]8a3eaffa2012-03-22 20:34:05190 // Pointer to the PropertySet instance that this instance is a member of,
191 // no ownership is taken and |property_set_| must outlive this class.
[email protected]cf910da22012-02-15 04:21:08192 PropertySet* property_set_;
193
jpawlowskied276542015-05-11 11:07:04194 bool is_valid_;
195
[email protected]cf910da22012-02-15 04:21:08196 // Name of the property.
197 std::string name_;
198
199 DISALLOW_COPY_AND_ASSIGN(PropertyBase);
200};
201
202// PropertySet groups a collection of properties for a remote object
203// together into a single structure, fixing their types and name such
204// that calls made through it are type-safe.
205//
206// Clients always sub-class this to add the properties, and should always
207// provide a constructor that chains up to this and then calls
208// RegisterProperty() for each property defined.
209//
210// After creation, client code should call ConnectSignals() and most likely
211// GetAll() to seed initial values and update as changes occur.
[email protected]e3024462012-11-05 01:56:14212class CHROME_DBUS_EXPORT PropertySet {
[email protected]cf910da22012-02-15 04:21:08213 public:
214 // Callback for changes to cached values of properties, either notified
215 // via signal, or as a result of calls to Get() and GetAll(). The |name|
216 // argument specifies the name of the property changed.
217 typedef base::Callback<void(const std::string& name)> PropertyChangedCallback;
218
[email protected]8a3eaffa2012-03-22 20:34:05219 // Constructs a property set, where |object_proxy| specifies the proxy for
220 // the/ remote object that these properties are for, care should be taken to
[email protected]cf910da22012-02-15 04:21:08221 // ensure that this object does not outlive the lifetime of the proxy;
222 // |interface| specifies the D-Bus interface of these properties, and
223 // |property_changed_callback| specifies the callback for when properties
224 // are changed, this may be a NULL callback.
225 PropertySet(ObjectProxy* object_proxy, const std::string& interface,
[email protected]7375e8b22012-08-15 01:03:30226 const PropertyChangedCallback& property_changed_callback);
[email protected]cf910da22012-02-15 04:21:08227
228 // Destructor; we don't hold on to any references or memory that needs
229 // explicit clean-up, but clang thinks we might.
[email protected]8acfaf52012-02-17 01:01:18230 virtual ~PropertySet();
[email protected]cf910da22012-02-15 04:21:08231
232 // Registers a property, generally called from the subclass constructor;
233 // pass the |name| of the property as used in method calls and signals,
234 // and the pointer to the |property| member of the structure. This will
235 // call the PropertyBase::Init method.
236 void RegisterProperty(const std::string& name, PropertyBase* property);
237
[email protected]8a3eaffa2012-03-22 20:34:05238 // Connects property change notification signals to the object, generally
239 // called immediately after the object is created and before calls to other
240 // methods. Sub-classes may override to use different D-Bus signals.
241 virtual void ConnectSignals();
[email protected]cf910da22012-02-15 04:21:08242
243 // Methods connected by ConnectSignals() and called by dbus:: when
244 // a property is changed. Sub-classes may override if the property
245 // changed signal provides different arguments.
dtapuska32d25452015-02-09 16:02:55246 virtual void ChangedReceived(Signal* signal);
[email protected]cf910da22012-02-15 04:21:08247 virtual void ChangedConnected(const std::string& interface_name,
248 const std::string& signal_name,
249 bool success);
250
[email protected]091e0b62012-06-28 18:43:30251 // Callback for Get() method, |success| indicates whether or not the
252 // value could be retrived, if true the new value can be obtained by
253 // calling value() on the property.
254 typedef base::Callback<void(bool success)> GetCallback;
255
256 // Requests an updated value from the remote object for |property|
257 // incurring a round-trip. |callback| will be called when the new
258 // value is available. This may not be implemented by some interfaces,
259 // and may be overriden by sub-classes if interfaces use different
260 // method calls.
261 virtual void Get(PropertyBase* property, GetCallback callback);
262 virtual void OnGet(PropertyBase* property, GetCallback callback,
263 Response* response);
264
nywanga5523d02015-09-28 22:46:36265 // The synchronous version of Get().
266 // This should never be used on an interactive thread.
267 virtual bool GetAndBlock(PropertyBase* property);
268
[email protected]992079e2012-02-17 16:50:42269 // Queries the remote object for values of all properties and updates
[email protected]cf910da22012-02-15 04:21:08270 // initial values. Sub-classes may override to use a different D-Bus
271 // method, or if the remote object does not support retrieving all
272 // properties, either ignore or obtain each property value individually.
[email protected]8a3eaffa2012-03-22 20:34:05273 virtual void GetAll();
[email protected]cf910da22012-02-15 04:21:08274 virtual void OnGetAll(Response* response);
275
[email protected]091e0b62012-06-28 18:43:30276 // Callback for Set() method, |success| indicates whether or not the
277 // new property value was accepted by the remote object.
278 typedef base::Callback<void(bool success)> SetCallback;
279
280 // Requests that the remote object for |property| change the property to
281 // its new value. |callback| will be called to indicate the success or
282 // failure of the request, however the new value may not be available
283 // depending on the remote object. This method may be overridden by
284 // sub-classes if interfaces use different method calls.
285 virtual void Set(PropertyBase* property, SetCallback callback);
286 virtual void OnSet(PropertyBase* property, SetCallback callback,
287 Response* response);
288
nywanga5523d02015-09-28 22:46:36289 // The synchronous version of Set().
290 // This should never be used on an interactive thread.
291 virtual bool SetAndBlock(PropertyBase* property);
292
[email protected]cf910da22012-02-15 04:21:08293 // Update properties by reading an array of dictionary entries, each
294 // containing a string with the name and a variant with the value, from
[email protected]8a3eaffa2012-03-22 20:34:05295 // |message_reader|. Returns false if message is in incorrect format.
[email protected]cf910da22012-02-15 04:21:08296 bool UpdatePropertiesFromReader(MessageReader* reader);
297
298 // Updates a single property by reading a string with the name and a
299 // variant with the value from |message_reader|. Returns false if message
[email protected]8a3eaffa2012-03-22 20:34:05300 // is in incorrect format, or property type doesn't match.
[email protected]cf910da22012-02-15 04:21:08301 bool UpdatePropertyFromReader(MessageReader* reader);
302
303 // Calls the property changed callback passed to the constructor, used
304 // by sub-classes that do not call UpdatePropertiesFromReader() or
305 // UpdatePropertyFromReader(). Takes the |name| of the changed property.
306 void NotifyPropertyChanged(const std::string& name);
307
308 // Retrieves the object proxy this property set was initialized with,
309 // provided for sub-classes overriding methods that make D-Bus calls
[email protected]8a3eaffa2012-03-22 20:34:05310 // and for Property<>. Not permitted with const references to this class.
[email protected]cf910da22012-02-15 04:21:08311 ObjectProxy* object_proxy() { return object_proxy_; }
312
313 // Retrieves the interface of this property set.
[email protected]8a3eaffa2012-03-22 20:34:05314 const std::string& interface() const { return interface_; }
[email protected]cf910da22012-02-15 04:21:08315
316 protected:
317 // Get a weak pointer to this property set, provided so that sub-classes
318 // overriding methods that make D-Bus calls may use the existing (or
319 // override) callbacks without providing their own weak pointer factory.
320 base::WeakPtr<PropertySet> GetWeakPtr() {
321 return weak_ptr_factory_.GetWeakPtr();
322 }
323
324 private:
jpawlowskied276542015-05-11 11:07:04325 // Invalidates properties by reading an array of names, from
326 // |message_reader|. Returns false if message is in incorrect format.
327 bool InvalidatePropertiesFromReader(MessageReader* reader);
328
[email protected]8a3eaffa2012-03-22 20:34:05329 // Pointer to object proxy for making method calls, no ownership is taken
330 // so this must outlive this class.
[email protected]cf910da22012-02-15 04:21:08331 ObjectProxy* object_proxy_;
332
333 // Interface of property, e.g. "org.chromium.ExampleService", this is
334 // distinct from the interface of the method call itself which is the
335 // general D-Bus Properties interface "org.freedesktop.DBus.Properties".
336 std::string interface_;
337
338 // Callback for property changes.
339 PropertyChangedCallback property_changed_callback_;
340
341 // Map of properties (as PropertyBase*) defined in the structure to
342 // names as used in D-Bus method calls and signals. The base pointer
343 // restricts property access via this map to type-unsafe and non-specific
344 // actions only.
345 typedef std::map<const std::string, PropertyBase*> PropertiesMap;
346 PropertiesMap properties_map_;
347
348 // Weak pointer factory as D-Bus callbacks may last longer than these
349 // objects.
350 base::WeakPtrFactory<PropertySet> weak_ptr_factory_;
351
352 DISALLOW_COPY_AND_ASSIGN(PropertySet);
353};
354
355// Property template, this defines the type-specific and type-safe methods
356// of properties that can be accessed as members of a PropertySet structure.
357//
358// Properties provide a cached value that has an initial sensible default
359// until the reply to PropertySet::GetAll() is retrieved and is updated by
[email protected]091e0b62012-06-28 18:43:30360// all calls to that method, PropertySet::Get() and property changed signals
361// also handled by PropertySet. It can be obtained by calling value() on the
[email protected]cf910da22012-02-15 04:21:08362// property.
363//
364// It is recommended that this cached value be used where necessary, with
365// code using PropertySet::PropertyChangedCallback to be notified of changes,
366// rather than incurring a round-trip to the remote object for each property
367// access.
368//
369// Where a round-trip is necessary, the Get() method is provided. And to
[email protected]091e0b62012-06-28 18:43:30370// update the remote object value, the Set() method is also provided; these
371// both simply call methods on PropertySet.
[email protected]cf910da22012-02-15 04:21:08372//
373// Handling of particular D-Bus types is performed via specialization,
[email protected]091e0b62012-06-28 18:43:30374// typically the PopValueFromReader() and AppendSetValueToWriter() methods
375// will need to be provided, and in rare cases a constructor to provide a
376// default value. Specializations for basic D-Bus types, strings, object
377// paths and arrays are provided for you.
[email protected]cf910da22012-02-15 04:21:08378template <class T>
[email protected]3abb2ec2014-06-27 08:10:43379class CHROME_DBUS_EXPORT Property : public PropertyBase {
[email protected]cf910da22012-02-15 04:21:08380 public:
[email protected]091e0b62012-06-28 18:43:30381 Property() {}
deratdce1abec2015-07-16 15:06:44382 ~Property() override {}
[email protected]cf910da22012-02-15 04:21:08383
384 // Retrieves the cached value.
[email protected]4a7b35d2012-02-17 07:46:34385 const T& value() const { return value_; }
[email protected]cf910da22012-02-15 04:21:08386
387 // Requests an updated value from the remote object incurring a
388 // round-trip. |callback| will be called when the new value is available.
[email protected]091e0b62012-06-28 18:43:30389 // This may not be implemented by some interfaces.
390 virtual void Get(dbus::PropertySet::GetCallback callback) {
391 property_set()->Get(this, callback);
[email protected]cf910da22012-02-15 04:21:08392 }
393
nywanga5523d02015-09-28 22:46:36394 // The synchronous version of Get().
395 // This should never be used on an interactive thread.
396 virtual bool GetAndBlock() {
397 return property_set()->GetAndBlock(this);
398 }
399
[email protected]cf910da22012-02-15 04:21:08400 // Requests that the remote object change the property value to |value|,
401 // |callback| will be called to indicate the success or failure of the
402 // request, however the new value may not be available depending on the
[email protected]091e0b62012-06-28 18:43:30403 // remote object.
404 virtual void Set(const T& value, dbus::PropertySet::SetCallback callback) {
405 set_value_ = value;
406 property_set()->Set(this, callback);
[email protected]cf910da22012-02-15 04:21:08407 }
408
nywanga5523d02015-09-28 22:46:36409 // The synchronous version of Set().
410 // This should never be used on an interactive thread.
nywang8dbb26e2015-09-23 00:06:40411 virtual bool SetAndBlock(const T& value) {
412 set_value_ = value;
413 return property_set()->SetAndBlock(this);
414 }
415
[email protected]091e0b62012-06-28 18:43:30416 // Method used by PropertySet to retrieve the value from a MessageReader,
417 // no knowledge of the contained type is required, this method returns
418 // true if its expected type was found, false if not.
dtapuska32d25452015-02-09 16:02:55419 bool PopValueFromReader(MessageReader* reader) override;
[email protected]cf910da22012-02-15 04:21:08420
[email protected]091e0b62012-06-28 18:43:30421 // Method used by PropertySet to append the set value to a MessageWriter,
422 // no knowledge of the contained type is required.
[email protected]72bbacc2012-03-21 23:43:45423 // Implementation provided by specialization.
dmichael8870f992014-12-19 20:52:31424 void AppendSetValueToWriter(MessageWriter* writer) override;
[email protected]cf910da22012-02-15 04:21:08425
[email protected]7375e8b22012-08-15 01:03:30426 // Method used by test and stub implementations of dbus::PropertySet::Set
427 // to replace the property value with the set value without using a
428 // dbus::MessageReader.
dmichael8870f992014-12-19 20:52:31429 void ReplaceValueWithSetValue() override {
[email protected]57182ec2013-04-24 01:41:54430 value_ = set_value_;
431 property_set()->NotifyPropertyChanged(name());
432 }
[email protected]7375e8b22012-08-15 01:03:30433
434 // Method used by test and stub implementations to directly set the
435 // value of a property.
[email protected]57182ec2013-04-24 01:41:54436 void ReplaceValue(const T& value) {
437 value_ = value;
438 property_set()->NotifyPropertyChanged(name());
439 }
[email protected]7375e8b22012-08-15 01:03:30440
dtapuska32d25452015-02-09 16:02:55441 // Method used by test and stub implementations to directly set the
442 // |set_value_| of a property.
443 void ReplaceSetValueForTesting(const T& value) { set_value_ = value; }
444
[email protected]cf910da22012-02-15 04:21:08445 private:
446 // Current cached value of the property.
447 T value_;
448
[email protected]091e0b62012-06-28 18:43:30449 // Replacement value of the property.
450 T set_value_;
[email protected]cf910da22012-02-15 04:21:08451};
452
dchengfc6e23042015-09-18 18:29:06453// Clang and GCC don't agree on how attributes should work for explicitly
454// instantiated templates. GCC ignores attributes on explicit instantiations
455// (and emits a warning) while Clang requires the visiblity attribute on the
456// explicit instantiations for them to be visible to other compilation units.
457// Hopefully clang and GCC agree one day, and this can be cleaned up:
458// https://llvm.org/bugs/show_bug.cgi?id=24815
459#pragma GCC diagnostic push
460#pragma GCC diagnostic ignored "-Wattributes"
spang95f15872015-09-14 17:49:40461
dtapuska32d25452015-02-09 16:02:55462template <>
avi22437c692015-12-22 18:12:45463CHROME_DBUS_EXPORT Property<uint8_t>::Property();
dchengfc6e23042015-09-18 18:29:06464template <>
avi22437c692015-12-22 18:12:45465CHROME_DBUS_EXPORT bool Property<uint8_t>::PopValueFromReader(
dtapuska32d25452015-02-09 16:02:55466 MessageReader* reader);
467template <>
avi22437c692015-12-22 18:12:45468CHROME_DBUS_EXPORT void Property<uint8_t>::AppendSetValueToWriter(
dtapuska32d25452015-02-09 16:02:55469 MessageWriter* writer);
avi22437c692015-12-22 18:12:45470extern template class CHROME_DBUS_EXPORT Property<uint8_t>;
dtapuska32d25452015-02-09 16:02:55471
472template <>
dchengfc6e23042015-09-18 18:29:06473CHROME_DBUS_EXPORT Property<bool>::Property();
474template <>
475CHROME_DBUS_EXPORT bool Property<bool>::PopValueFromReader(
476 MessageReader* reader);
477template <>
478CHROME_DBUS_EXPORT void Property<bool>::AppendSetValueToWriter(
479 MessageWriter* writer);
480extern template class CHROME_DBUS_EXPORT Property<bool>;
481
482template <>
avi22437c692015-12-22 18:12:45483CHROME_DBUS_EXPORT Property<int16_t>::Property();
dchengfc6e23042015-09-18 18:29:06484template <>
avi22437c692015-12-22 18:12:45485CHROME_DBUS_EXPORT bool Property<int16_t>::PopValueFromReader(
dchengfc6e23042015-09-18 18:29:06486 MessageReader* reader);
487template <>
avi22437c692015-12-22 18:12:45488CHROME_DBUS_EXPORT void Property<int16_t>::AppendSetValueToWriter(
dchengfc6e23042015-09-18 18:29:06489 MessageWriter* writer);
avi22437c692015-12-22 18:12:45490extern template class CHROME_DBUS_EXPORT Property<int16_t>;
dchengfc6e23042015-09-18 18:29:06491
492template <>
avi22437c692015-12-22 18:12:45493CHROME_DBUS_EXPORT Property<uint16_t>::Property();
dchengfc6e23042015-09-18 18:29:06494template <>
avi22437c692015-12-22 18:12:45495CHROME_DBUS_EXPORT bool Property<uint16_t>::PopValueFromReader(
dchengfc6e23042015-09-18 18:29:06496 MessageReader* reader);
497template <>
avi22437c692015-12-22 18:12:45498CHROME_DBUS_EXPORT void Property<uint16_t>::AppendSetValueToWriter(
dchengfc6e23042015-09-18 18:29:06499 MessageWriter* writer);
avi22437c692015-12-22 18:12:45500extern template class CHROME_DBUS_EXPORT Property<uint16_t>;
dchengfc6e23042015-09-18 18:29:06501
502template <>
avi22437c692015-12-22 18:12:45503CHROME_DBUS_EXPORT Property<int32_t>::Property();
dchengfc6e23042015-09-18 18:29:06504template <>
avi22437c692015-12-22 18:12:45505CHROME_DBUS_EXPORT bool Property<int32_t>::PopValueFromReader(
dchengfc6e23042015-09-18 18:29:06506 MessageReader* reader);
507template <>
avi22437c692015-12-22 18:12:45508CHROME_DBUS_EXPORT void Property<int32_t>::AppendSetValueToWriter(
dchengfc6e23042015-09-18 18:29:06509 MessageWriter* writer);
avi22437c692015-12-22 18:12:45510extern template class CHROME_DBUS_EXPORT Property<int32_t>;
dchengfc6e23042015-09-18 18:29:06511
512template <>
avi22437c692015-12-22 18:12:45513CHROME_DBUS_EXPORT Property<uint32_t>::Property();
dchengfc6e23042015-09-18 18:29:06514template <>
avi22437c692015-12-22 18:12:45515CHROME_DBUS_EXPORT bool Property<uint32_t>::PopValueFromReader(
dchengfc6e23042015-09-18 18:29:06516 MessageReader* reader);
517template <>
avi22437c692015-12-22 18:12:45518CHROME_DBUS_EXPORT void Property<uint32_t>::AppendSetValueToWriter(
dchengfc6e23042015-09-18 18:29:06519 MessageWriter* writer);
avi22437c692015-12-22 18:12:45520extern template class CHROME_DBUS_EXPORT Property<uint32_t>;
dchengfc6e23042015-09-18 18:29:06521
522template <>
avi22437c692015-12-22 18:12:45523CHROME_DBUS_EXPORT Property<int64_t>::Property();
dchengfc6e23042015-09-18 18:29:06524template <>
avi22437c692015-12-22 18:12:45525CHROME_DBUS_EXPORT bool Property<int64_t>::PopValueFromReader(
dchengfc6e23042015-09-18 18:29:06526 MessageReader* reader);
527template <>
avi22437c692015-12-22 18:12:45528CHROME_DBUS_EXPORT void Property<int64_t>::AppendSetValueToWriter(
dchengfc6e23042015-09-18 18:29:06529 MessageWriter* writer);
avi22437c692015-12-22 18:12:45530extern template class CHROME_DBUS_EXPORT Property<int64_t>;
dchengfc6e23042015-09-18 18:29:06531
532template <>
avi22437c692015-12-22 18:12:45533CHROME_DBUS_EXPORT Property<uint64_t>::Property();
dchengfc6e23042015-09-18 18:29:06534template <>
avi22437c692015-12-22 18:12:45535CHROME_DBUS_EXPORT bool Property<uint64_t>::PopValueFromReader(
dchengfc6e23042015-09-18 18:29:06536 MessageReader* reader);
537template <>
avi22437c692015-12-22 18:12:45538CHROME_DBUS_EXPORT void Property<uint64_t>::AppendSetValueToWriter(
dchengfc6e23042015-09-18 18:29:06539 MessageWriter* writer);
avi22437c692015-12-22 18:12:45540extern template class CHROME_DBUS_EXPORT Property<uint64_t>;
dchengfc6e23042015-09-18 18:29:06541
542template <>
543CHROME_DBUS_EXPORT Property<double>::Property();
544template <>
545CHROME_DBUS_EXPORT bool Property<double>::PopValueFromReader(
546 MessageReader* reader);
547template <>
548CHROME_DBUS_EXPORT void Property<double>::AppendSetValueToWriter(
549 MessageWriter* writer);
550extern template class CHROME_DBUS_EXPORT Property<double>;
551
552template <>
553CHROME_DBUS_EXPORT bool Property<std::string>::PopValueFromReader(
554 MessageReader* reader);
555template <>
556CHROME_DBUS_EXPORT void Property<std::string>::AppendSetValueToWriter(
557 MessageWriter* writer);
558extern template class CHROME_DBUS_EXPORT Property<std::string>;
559
560template <>
561CHROME_DBUS_EXPORT bool Property<ObjectPath>::PopValueFromReader(
562 MessageReader* reader);
563template <>
564CHROME_DBUS_EXPORT void Property<ObjectPath>::AppendSetValueToWriter(
565 MessageWriter* writer);
566extern template class CHROME_DBUS_EXPORT Property<ObjectPath>;
567
568template <>
569CHROME_DBUS_EXPORT bool Property<std::vector<std::string>>::PopValueFromReader(
570 MessageReader* reader);
571template <>
572CHROME_DBUS_EXPORT void Property<
573 std::vector<std::string>>::AppendSetValueToWriter(MessageWriter* writer);
574extern template class CHROME_DBUS_EXPORT Property<std::vector<std::string>>;
575
576template <>
577CHROME_DBUS_EXPORT bool Property<std::vector<ObjectPath>>::PopValueFromReader(
578 MessageReader* reader);
579template <>
580CHROME_DBUS_EXPORT void Property<
581 std::vector<ObjectPath>>::AppendSetValueToWriter(MessageWriter* writer);
582extern template class CHROME_DBUS_EXPORT Property<std::vector<ObjectPath>>;
583
584template <>
avi22437c692015-12-22 18:12:45585CHROME_DBUS_EXPORT bool Property<std::vector<uint8_t>>::PopValueFromReader(
dchengfc6e23042015-09-18 18:29:06586 MessageReader* reader);
587template <>
avi22437c692015-12-22 18:12:45588CHROME_DBUS_EXPORT void Property<std::vector<uint8_t>>::AppendSetValueToWriter(
dchengfc6e23042015-09-18 18:29:06589 MessageWriter* writer);
avi22437c692015-12-22 18:12:45590extern template class CHROME_DBUS_EXPORT Property<std::vector<uint8_t>>;
dchengfc6e23042015-09-18 18:29:06591
592template <>
593CHROME_DBUS_EXPORT bool
594Property<std::map<std::string, std::string>>::PopValueFromReader(
595 MessageReader* reader);
596template <>
597CHROME_DBUS_EXPORT void
598Property<std::map<std::string, std::string>>::AppendSetValueToWriter(
599 MessageWriter* writer);
600extern template class CHROME_DBUS_EXPORT
601 Property<std::map<std::string, std::string>>;
602
603template <>
604CHROME_DBUS_EXPORT bool
605Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>::
dtapuska32d25452015-02-09 16:02:55606 PopValueFromReader(MessageReader* reader);
607template <>
dchengfc6e23042015-09-18 18:29:06608CHROME_DBUS_EXPORT void
609Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>::
dtapuska32d25452015-02-09 16:02:55610 AppendSetValueToWriter(MessageWriter* writer);
dchengfc6e23042015-09-18 18:29:06611extern template class CHROME_DBUS_EXPORT
612 Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>;
613
puthik0dd82b12016-10-06 05:03:03614template <>
615CHROME_DBUS_EXPORT bool
616Property<std::unordered_map<std::string, std::vector<uint8_t>>>::
617 PopValueFromReader(MessageReader* reader);
618template <>
619CHROME_DBUS_EXPORT void
620Property<std::unordered_map<std::string, std::vector<uint8_t>>>::
621 AppendSetValueToWriter(MessageWriter* writer);
622extern template class CHROME_DBUS_EXPORT
623 Property<std::unordered_map<std::string, std::vector<uint8_t>>>;
624
puthik23399e452016-11-04 19:38:17625template <>
626CHROME_DBUS_EXPORT bool
627Property<std::unordered_map<uint16_t, std::vector<uint8_t>>>::
628 PopValueFromReader(MessageReader* reader);
629template <>
630CHROME_DBUS_EXPORT void
631Property<std::unordered_map<uint16_t, std::vector<uint8_t>>>::
632 AppendSetValueToWriter(MessageWriter* writer);
633extern template class CHROME_DBUS_EXPORT
634 Property<std::unordered_map<uint16_t, std::vector<uint8_t>>>;
635
dchengfc6e23042015-09-18 18:29:06636#pragma GCC diagnostic pop
dtapuska32d25452015-02-09 16:02:55637
[email protected]cf910da22012-02-15 04:21:08638} // namespace dbus
639
640#endif // DBUS_PROPERTY_H_