shill: Add uint64 properties
This is a fairly minimal addition, since we will only need
read-only derived types.
BUG=chromium-os:31584
TEST=New unit tests; list-devices on a real machine
Change-Id: I7b65224ae329443066f563b620b379f29006f8a0
Reviewed-on: https://gerrit.chromium.org/gerrit/27157
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
diff --git a/property_store.cc b/property_store.cc
index 933be70..36c3ce6 100644
--- a/property_store.cc
+++ b/property_store.cc
@@ -38,6 +38,7 @@
ContainsKey(uint8_properties_, prop) ||
ContainsKey(uint16_properties_, prop) ||
ContainsKey(uint32_properties_, prop) ||
+ ContainsKey(uint64_properties_, prop) ||
ContainsKey(rpc_identifier_properties_, prop) ||
ContainsKey(rpc_identifiers_properties_, prop));
}
@@ -97,6 +98,12 @@
return SetProperty(name, value, error, uint32_properties_, "a uint32");
}
+bool PropertyStore::SetUint64Property(const string &name,
+ uint64 value,
+ Error *error) {
+ return SetProperty(name, value, error, uint64_properties_, "a uint64");
+}
+
bool PropertyStore::SetRpcIdentifierProperty(const string &name,
const RpcIdentifier &value,
Error *error) {
@@ -129,6 +136,8 @@
uint16_properties_[name]->Clear(error);
} else if (ContainsKey(uint32_properties_, name)) {
uint32_properties_[name]->Clear(error);
+ } else if (ContainsKey(uint64_properties_, name)) {
+ uint64_properties_[name]->Clear(error);
} else if (ContainsKey(rpc_identifier_properties_, name)) {
rpc_identifier_properties_[name]->Clear(error);
} else if (ContainsKey(rpc_identifiers_properties_, name)) {
@@ -209,6 +218,11 @@
return ReadablePropertyConstIterator<uint32>(uint32_properties_);
}
+ReadablePropertyConstIterator<uint64> PropertyStore::GetUint64PropertiesIter()
+ const {
+ return ReadablePropertyConstIterator<uint64>(uint64_properties_);
+}
+
void PropertyStore::RegisterBool(const string &name, bool *prop) {
DCHECK(!Contains(name) || ContainsKey(bool_properties_, name))
<< "(Already registered " << name << ")";
@@ -477,6 +491,13 @@
uint16_properties_[name] = acc;
}
+void PropertyStore::RegisterDerivedUint64(const string &name,
+ const Uint64Accessor &acc) {
+ DCHECK(!Contains(name) || ContainsKey(uint64_properties_, name))
+ << "(Already registered " << name << ")";
+ uint64_properties_[name] = acc;
+}
+
// private methods
template <class V>