[shill] Use composition instead of inheritance with PropertyStore

Instead of having Device, Manager, etc all inherit from PropertyStore
and have it be difficult to follow the getting/setting property code,
have each include a PropertyStore as a data member.  Provide an
accessor so that RPC adaptor classes can get and set properties
directly and continue to handle any necessary type conversion
themselves.

BUG=None
TEST=unit tests

Change-Id: I34781bde4de0e152550ca636e28d472abde756af
Reviewed-on: http://gerrit.chromium.org/gerrit/3616
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
diff --git a/ipconfig.cc b/ipconfig.cc
index b8c55d7..913890b 100644
--- a/ipconfig.cc
+++ b/ipconfig.cc
@@ -5,7 +5,6 @@
 #include "shill/ipconfig.h"
 
 #include <base/logging.h>
-#include <base/stl_util-inl.h>
 #include <chromeos/dbus/service_constants.h>
 
 #include "shill/adaptor_interfaces.h"
@@ -19,17 +18,21 @@
   // Address might be R/O or not, depending on the type of IPconfig, so
   // we'll leave this up to the subclasses.
   // Register(Const?)String(flimflam::kAddressProperty, &properties_.address);
-  RegisterString(flimflam::kBroadcastProperty, &properties_.broadcast_address);
-  RegisterString(flimflam::kDomainNameProperty, &properties_.domain_name);
-  RegisterString(flimflam::kGatewayProperty, &properties_.gateway);
-  RegisterConstString(flimflam::kMethodProperty, &properties_.method);
-  RegisterInt32(flimflam::kMtuProperty, &properties_.mtu);
-  RegisterStrings(flimflam::kNameServersProperty, &properties_.dns_servers);
-  RegisterString(flimflam::kPeerAddressProperty, &properties_.peer_address);
-  RegisterInt32(flimflam::kPrefixlenProperty, &properties_.subnet_cidr);
+  store_.RegisterString(flimflam::kBroadcastProperty,
+                        &properties_.broadcast_address);
+  store_.RegisterString(flimflam::kDomainNameProperty,
+                        &properties_.domain_name);
+  store_.RegisterString(flimflam::kGatewayProperty, &properties_.gateway);
+  store_.RegisterConstString(flimflam::kMethodProperty, &properties_.method);
+  store_.RegisterInt32(flimflam::kMtuProperty, &properties_.mtu);
+  store_.RegisterStrings(flimflam::kNameServersProperty,
+                         &properties_.dns_servers);
+  store_.RegisterString(flimflam::kPeerAddressProperty,
+                        &properties_.peer_address);
+  store_.RegisterInt32(flimflam::kPrefixlenProperty, &properties_.subnet_cidr);
   // TODO(cmasone): Does anyone use this?
-  // RegisterStrings(flimflam::kSearchDomainsProperty,
-  //                 &properties_.domain_search);
+  // store_.RegisterStrings(flimflam::kSearchDomainsProperty,
+  //                        &properties_.domain_search);
   VLOG(2) << __func__ << " device: " << device_name;
 }
 
@@ -53,28 +56,6 @@
   return false;
 }
 
-bool IPConfig::SetInt32Property(const std::string& name,
-                                int32 value,
-                                Error *error) {
-  VLOG(2) << "Setting " << name << " as an int32.";
-  bool set = (ContainsKey(int32_properties_, name) &&
-              int32_properties_[name]->Set(value));
-  if (!set && error)
-    error->Populate(Error::kInvalidArguments, name + " is not a R/W int32.");
-  return set;
-}
-
-bool IPConfig::SetStringProperty(const string& name,
-                                 const string& value,
-                                 Error *error) {
-  VLOG(2) << "Setting " << name << " as a string.";
-  bool set = (ContainsKey(string_properties_, name) &&
-              string_properties_[name]->Set(value));
-  if (!set && error)
-    error->Populate(Error::kInvalidArguments, name + " is not a R/W string.");
-  return set;
-}
-
 void IPConfig::UpdateProperties(const Properties &properties, bool success) {
   properties_ = properties;
   if (update_callback_.get()) {