blob: a7b793aa2735c2347797949d962a27c086bc7e90 [file] [log] [blame]
Alex Vakulenko7c36b672014-07-16 14:50:58 -07001// Copyright 2014 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef BUFFET_COMMANDS_COMMAND_DEFINITION_H_
6#define BUFFET_COMMANDS_COMMAND_DEFINITION_H_
7
8#include <memory>
9#include <string>
10
Alex Vakulenko132617a2014-09-04 08:59:43 -070011#include <base/macros.h>
Alex Vakulenko7c36b672014-07-16 14:50:58 -070012
13#include "buffet/commands/object_schema.h"
14
15namespace buffet {
16
17// A simple GCD command definition. This class contains the command category
18// and a full object schema describing the command parameter types and
19// constraints. See comments for CommandDefinitions::LoadCommands for the
20// detailed description of what command categories are and what they are used
21// for.
22class CommandDefinition {
23 public:
24 CommandDefinition(const std::string& category,
Anton Muhin71fb9d52014-11-21 22:22:39 +040025 const std::shared_ptr<const ObjectSchema>& parameters,
26 const std::shared_ptr<const ObjectSchema>& results);
Alex Vakulenko7c36b672014-07-16 14:50:58 -070027
28 // Gets the category this command belongs to.
29 const std::string& GetCategory() const { return category_; }
30 // Gets the object schema for command parameters.
31 const std::shared_ptr<const ObjectSchema>& GetParameters() const {
32 return parameters_;
33 }
Anton Muhin71fb9d52014-11-21 22:22:39 +040034 // Gets the object schema for command results.
35 const std::shared_ptr<const ObjectSchema>& GetResults() const {
36 return results_;
37 }
Alex Vakulenko7c36b672014-07-16 14:50:58 -070038
39 private:
40 std::string category_; // Cmd category. Could be "powerd" for "base.reboot".
Anton Muhin71fb9d52014-11-21 22:22:39 +040041 std::shared_ptr<const ObjectSchema> parameters_; // Command parameters def.
42 std::shared_ptr<const ObjectSchema> results_; // Command results def.
Alex Vakulenko7c36b672014-07-16 14:50:58 -070043 DISALLOW_COPY_AND_ASSIGN(CommandDefinition);
44};
45
46} // namespace buffet
47
48#endif // BUFFET_COMMANDS_COMMAND_DEFINITION_H_