buffet: Add command queue and command basic command dispatch mechanism

Added a skeleton CommandQueue class that would hold all the incoming
command instances from local and cloud GCD clients. For now, both
CommandQueue and CommandInstance are simple classes that encapsulate
the command instances received by buffet.

In following CLs, I'll add methods to parse command instance JSON
objects and provide D-Bus serlialization and dispatch to command
handlers (daemons).

BUG=chromium:396713
TEST=USE=buffet P2_TEST_FILTER="buffet::*" FEATURES=test emerge-link platform2

Change-Id: I7ab6bb0778a6320dc75d2a3c9b2a774ea5329054
Reviewed-on: https://chromium-review.googlesource.com/211412
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/commands/command_instance.h b/buffet/commands/command_instance.h
new file mode 100644
index 0000000..0028c88
--- /dev/null
+++ b/buffet/commands/command_instance.h
@@ -0,0 +1,52 @@
+// Copyright 2014 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BUFFET_COMMANDS_COMMAND_INSTANCE_H_
+#define BUFFET_COMMANDS_COMMAND_INSTANCE_H_
+
+#include <map>
+#include <memory>
+#include <string>
+
+#include <base/basictypes.h>
+
+#include "buffet/commands/prop_values.h"
+#include "buffet/commands/schema_utils.h"
+
+namespace buffet {
+
+class CommandInstance final {
+ public:
+  // Construct a command instance given the full command |name| which must
+  // be in format "<package_name>.<command_name>", a command |category| and
+  // a list of parameters and their values specified in |parameters|.
+  CommandInstance(const std::string& name, const std::string& category,
+                  const native_types::Object& parameters);
+
+  // Returns the full name of the command.
+  const std::string& GetName() const { return name_; }
+  // Returns the command category.
+  const std::string& GetCategory() const { return category_; }
+  // Returns the command parameters and their values.
+  const native_types::Object& GetParameters() const { return parameters_; }
+  // Finds a command parameter value by parameter |name|. If the parameter
+  // with given name does not exist, returns null shared_ptr.
+  std::shared_ptr<const PropValue> FindParameter(const std::string& name) const;
+
+ private:
+  // Full command name as "<package_name>.<command_name>".
+  std::string name_;
+  // Command category. See comments for CommandDefinitions::LoadCommands for the
+  // detailed description of what command categories are and what they are used
+  // for.
+  std::string category_;
+  // Command parameters and their values.
+  native_types::Object parameters_;
+
+  DISALLOW_COPY_AND_ASSIGN(CommandInstance);
+};
+
+}  // namespace buffet
+
+#endif  // BUFFET_COMMANDS_COMMAND_INSTANCE_H_