buffet: Provide results definition in command definition.
That allows us to provide typed results for supported commands.
BUG=chromium:435607
TEST=cros_workon_make --test buffet
Change-Id: I61b5a5b294b4d869366c821adf1ef7f6db31c7ea
Reviewed-on: https://chromium-review.googlesource.com/231322
Reviewed-by: Anton Muhin <antonm@chromium.org>
Commit-Queue: Anton Muhin <antonm@chromium.org>
Tested-by: Anton Muhin <antonm@chromium.org>
diff --git a/buffet/commands/command_definition.h b/buffet/commands/command_definition.h
index f02cf48..a7b793a 100644
--- a/buffet/commands/command_definition.h
+++ b/buffet/commands/command_definition.h
@@ -22,7 +22,8 @@
class CommandDefinition {
public:
CommandDefinition(const std::string& category,
- const std::shared_ptr<const ObjectSchema>& parameters);
+ const std::shared_ptr<const ObjectSchema>& parameters,
+ const std::shared_ptr<const ObjectSchema>& results);
// Gets the category this command belongs to.
const std::string& GetCategory() const { return category_; }
@@ -30,10 +31,15 @@
const std::shared_ptr<const ObjectSchema>& GetParameters() const {
return parameters_;
}
+ // Gets the object schema for command results.
+ const std::shared_ptr<const ObjectSchema>& GetResults() const {
+ return results_;
+ }
private:
std::string category_; // Cmd category. Could be "powerd" for "base.reboot".
- std::shared_ptr<const ObjectSchema> parameters_; // Command parameter def.
+ std::shared_ptr<const ObjectSchema> parameters_; // Command parameters def.
+ std::shared_ptr<const ObjectSchema> results_; // Command results def.
DISALLOW_COPY_AND_ASSIGN(CommandDefinition);
};