Fawkes API  Fawkes Development Version
Skill.h
1 
2 /****************************************************************************
3  * BehaviorEngine -- Schema Skill
4  * (auto-generated, do not modify directly)
5  *
6  * Behavior Engine REST API.
7  * Visualize, monitor, and instruct the Skill Execution Run-Time of
8  * the Lua-based Behavior Engine.
9  *
10  * API Contact: Tim Niemueller <niemueller@kbsg.rwth-aachen.de>
11  * API Version: v1beta1
12  * API License: Apache 2.0
13  ****************************************************************************/
14 
15 #pragma once
16 
17 #define RAPIDJSON_HAS_STDSTRING 1
18 #include <rapidjson/fwd.h>
19 
20 #include <cstdint>
21 #include <memory>
22 #include <optional>
23 #include <string>
24 #include <vector>
25 
26 /** Skill representation for JSON transfer. */
27 class Skill
28 
29 {
30 public:
31  /** Constructor. */
32  Skill();
33  /** Constructor from JSON.
34  * @param json JSON string to initialize from
35  */
36  Skill(const std::string &json);
37  /** Constructor from JSON.
38  * @param v RapidJSON value object to initialize from.
39  */
40  Skill(const rapidjson::Value &v);
41 
42  /** Destructor. */
43  virtual ~Skill();
44 
45  /** Get version of implemented API.
46  * @return string representation of version
47  */
48  static std::string
50  {
51  return "v1beta1";
52  }
53 
54  /** Render object to JSON.
55  * @param pretty true to enable pretty printing (readable spacing)
56  * @return JSON string
57  */
58  virtual std::string to_json(bool pretty = false) const;
59  /** Render object to JSON.
60  * @param d RapidJSON document to retrieve allocator from
61  * @param v RapidJSON value to add data to
62  */
63  virtual void to_json_value(rapidjson::Document &d, rapidjson::Value &v) const;
64  /** Retrieve data from JSON string.
65  * @param json JSON representation suitable for this object.
66  * Will allow partial assignment and not validate automaticaly.
67  * @see validate()
68  */
69  virtual void from_json(const std::string &json);
70  /** Retrieve data from JSON string.
71  * @param v RapidJSON value suitable for this object.
72  * Will allow partial assignment and not validate automaticaly.
73  * @see validate()
74  */
75  virtual void from_json_value(const rapidjson::Value &v);
76 
77  /** Validate if all required fields have been set.
78  * @param subcall true if this is called from another class, e.g.,
79  * a sub-class or array holder. Will modify the kind of exception thrown.
80  * @exception std::vector<std::string> thrown if required information is
81  * missing and @p subcall is set to true. Contains a list of missing fields.
82  * @exception std::runtime_error informative message describing the missing
83  * fields
84  */
85  virtual void validate(bool subcall = false) const;
86 
87  // Schema: Skill
88 public:
89  /** Get kind value.
90  * @return kind value
91  */
92  std::optional<std::string>
93  kind() const
94  {
95  return kind_;
96  }
97 
98  /** Set kind value.
99  * @param kind new value
100  */
101  void
102  set_kind(const std::string &kind)
103  {
104  kind_ = kind;
105  }
106  /** Get apiVersion value.
107  * @return apiVersion value
108  */
109  std::optional<std::string>
110  apiVersion() const
111  {
112  return apiVersion_;
113  }
114 
115  /** Set apiVersion value.
116  * @param apiVersion new value
117  */
118  void
119  set_apiVersion(const std::string &apiVersion)
120  {
121  apiVersion_ = apiVersion;
122  }
123  /** Get name value.
124  * @return name value
125  */
126  std::optional<std::string>
127  name() const
128  {
129  return name_;
130  }
131 
132  /** Set name value.
133  * @param name new value
134  */
135  void
136  set_name(const std::string &name)
137  {
138  name_ = name;
139  }
140  /** Get graph value.
141  * @return graph value
142  */
143  std::optional<std::string>
144  graph() const
145  {
146  return graph_;
147  }
148 
149  /** Set graph value.
150  * @param graph new value
151  */
152  void
153  set_graph(const std::string &graph)
154  {
155  graph_ = graph;
156  }
157  /** The skill string is given only for the active skill.
158 
159  * @return skill-string value
160  */
161  std::optional<std::string>
162  skill_string() const
163  {
164  return skill_string_;
165  }
166 
167  /** Set skill-string value.
168  * @param skill_string new value
169  */
170  void
171  set_skill_string(const std::string &skill_string)
172  {
173  skill_string_ = skill_string;
174  }
175  /** An error is presented for the active skill if it has FAILED.
176 
177  * @return error value
178  */
179  std::optional<std::string>
180  error() const
181  {
182  return error_;
183  }
184 
185  /** Set error value.
186  * @param error new value
187  */
188  void
189  set_error(const std::string &error)
190  {
191  error_ = error;
192  }
193  /** Get msg_id value.
194  * @return msg_id value
195  */
196  std::optional<int64_t>
197  msg_id() const
198  {
199  return msg_id_;
200  }
201 
202  /** Set msg_id value.
203  * @param msg_id new value
204  */
205  void
206  set_msg_id(const int64_t &msg_id)
207  {
208  msg_id_ = msg_id;
209  }
210  /** Get exclusive_controller value.
211  * @return exclusive_controller value
212  */
213  std::optional<int64_t>
215  {
216  return exclusive_controller_;
217  }
218 
219  /** Set exclusive_controller value.
220  * @param exclusive_controller new value
221  */
222  void
224  {
225  exclusive_controller_ = exclusive_controller;
226  }
227  /** Get status value.
228  * @return status value
229  */
230  std::optional<std::string>
231  status() const
232  {
233  return status_;
234  }
235 
236  /** Set status value.
237  * @param status new value
238  */
239  void
240  set_status(const std::string &status)
241  {
242  status_ = status;
243  }
244 
245 private:
246  std::optional<std::string> kind_;
247  std::optional<std::string> apiVersion_;
248  std::optional<std::string> name_;
249  std::optional<std::string> graph_;
250  std::optional<std::string> skill_string_;
251  std::optional<std::string> error_;
252  std::optional<int64_t> msg_id_;
253  std::optional<int64_t> exclusive_controller_;
254  std::optional<std::string> status_;
255 };
Skill representation for JSON transfer.
Definition: Skill.h:29
std::optional< std::string > graph() const
Get graph value.
Definition: Skill.h:144
Skill()
Constructor.
Definition: Skill.cpp:24
void set_exclusive_controller(const int64_t &exclusive_controller)
Set exclusive_controller value.
Definition: Skill.h:223
virtual void validate(bool subcall=false) const
Validate if all required fields have been set.
Definition: Skill.cpp:158
std::optional< std::string > error() const
An error is presented for the active skill if it has FAILED.
Definition: Skill.h:180
std::optional< std::string > name() const
Get name value.
Definition: Skill.h:127
void set_graph(const std::string &graph)
Set graph value.
Definition: Skill.h:153
virtual void to_json_value(rapidjson::Document &d, rapidjson::Value &v) const
Render object to JSON.
Definition: Skill.cpp:62
std::optional< std::string > apiVersion() const
Get apiVersion value.
Definition: Skill.h:110
virtual std::string to_json(bool pretty=false) const
Render object to JSON.
Definition: Skill.cpp:43
std::optional< std::string > skill_string() const
The skill string is given only for the active skill.
Definition: Skill.h:162
void set_error(const std::string &error)
Set error value.
Definition: Skill.h:189
std::optional< std::string > status() const
Get status value.
Definition: Skill.h:231
virtual ~Skill()
Destructor.
Definition: Skill.cpp:38
void set_status(const std::string &status)
Set status value.
Definition: Skill.h:240
void set_kind(const std::string &kind)
Set kind value.
Definition: Skill.h:102
void set_skill_string(const std::string &skill_string)
Set skill-string value.
Definition: Skill.h:171
virtual void from_json(const std::string &json)
Retrieve data from JSON string.
Definition: Skill.cpp:117
void set_apiVersion(const std::string &apiVersion)
Set apiVersion value.
Definition: Skill.h:119
std::optional< int64_t > exclusive_controller() const
Get exclusive_controller value.
Definition: Skill.h:214
static std::string api_version()
Get version of implemented API.
Definition: Skill.h:49
std::optional< std::string > kind() const
Get kind value.
Definition: Skill.h:93
void set_msg_id(const int64_t &msg_id)
Set msg_id value.
Definition: Skill.h:206
std::optional< int64_t > msg_id() const
Get msg_id value.
Definition: Skill.h:197
void set_name(const std::string &name)
Set name value.
Definition: Skill.h:136
virtual void from_json_value(const rapidjson::Value &v)
Retrieve data from JSON string.
Definition: Skill.cpp:126