buffet: Change shared ownership of types/values to exclusive

In order to support array types in Buffet's type system, PropValue
must maintain a strong reference to the underlying PropType since
the array elements will have their own type reference and the current
implementation of using raw pointer for this isn't going to work.
In order to resolve this I had to make a lot of changes to the object
ownership inside Buffet's type system. I made it possible for both
PropType and PropValue to make a deep copy of itself using their
Clone() methods. Because of this now it is possible to have exclusive
ownership of objects and I got rid of most of shared pointer usage in
ObjectSchema, PropType and PropValue.

BUG=brillo:107
TEST=`FEATURES=test emerge-link buffet`

Change-Id: I02de455dfd40d4833041b63cbb80bcb00293b5a9
Reviewed-on: https://chromium-review.googlesource.com/261336
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Trybot-Ready: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/commands/command_definition.h b/buffet/commands/command_definition.h
index a7b793a..0cc09b5 100644
--- a/buffet/commands/command_definition.h
+++ b/buffet/commands/command_definition.h
@@ -22,24 +22,20 @@
 class CommandDefinition {
  public:
   CommandDefinition(const std::string& category,
-                    const std::shared_ptr<const ObjectSchema>& parameters,
-                    const std::shared_ptr<const ObjectSchema>& results);
+                    std::unique_ptr<const ObjectSchema> parameters,
+                    std::unique_ptr<const ObjectSchema> results);
 
   // Gets the category this command belongs to.
   const std::string& GetCategory() const { return category_; }
   // Gets the object schema for command parameters.
-  const std::shared_ptr<const ObjectSchema>& GetParameters() const {
-    return parameters_;
-  }
+  const ObjectSchema* GetParameters() const { return parameters_.get(); }
   // Gets the object schema for command results.
-  const std::shared_ptr<const ObjectSchema>& GetResults() const {
-    return results_;
-  }
+  const ObjectSchema* GetResults() const { return results_.get(); }
 
  private:
   std::string category_;  // Cmd category. Could be "powerd" for "base.reboot".
-  std::shared_ptr<const ObjectSchema> parameters_;  // Command parameters def.
-  std::shared_ptr<const ObjectSchema> results_;  // Command results def.
+  std::unique_ptr<const ObjectSchema> parameters_;  // Command parameters def.
+  std::unique_ptr<const ObjectSchema> results_;  // Command results def.
   DISALLOW_COPY_AND_ASSIGN(CommandDefinition);
 };