Fawkes API  Fawkes Development Version
PlanAction.h
1 
2 /****************************************************************************
3  * ClipsExecutive -- Schema PlanAction
4  * (auto-generated, do not modify directly)
5  *
6  * CLIPS Executive REST API.
7  * Enables access to goals, plans, and all items in the domain model.
8  *
9  * API Contact: Tim Niemueller <niemueller@kbsg.rwth-aachen.de>
10  * API Version: v1beta1
11  * API License: Apache 2.0
12  ****************************************************************************/
13 
14 #pragma once
15 
16 #define RAPIDJSON_HAS_STDSTRING 1
17 #include "DomainEffect.h"
18 #include "DomainOperator.h"
19 #include "DomainPrecondition.h"
20 
21 #include <rapidjson/fwd.h>
22 
23 #include <cstdint>
24 #include <memory>
25 #include <optional>
26 #include <string>
27 #include <vector>
28 
29 /** PlanAction representation for JSON transfer. */
31 
32 {
33 public:
34  /** Constructor. */
35  PlanAction();
36  /** Constructor from JSON.
37  * @param json JSON string to initialize from
38  */
39  PlanAction(const std::string &json);
40  /** Constructor from JSON.
41  * @param v RapidJSON value object to initialize from.
42  */
43  PlanAction(const rapidjson::Value &v);
44 
45  /** Destructor. */
46  virtual ~PlanAction();
47 
48  /** Get version of implemented API.
49  * @return string representation of version
50  */
51  static std::string
53  {
54  return "v1beta1";
55  }
56 
57  /** Render object to JSON.
58  * @param pretty true to enable pretty printing (readable spacing)
59  * @return JSON string
60  */
61  virtual std::string to_json(bool pretty = false) const;
62  /** Render object to JSON.
63  * @param d RapidJSON document to retrieve allocator from
64  * @param v RapidJSON value to add data to
65  */
66  virtual void to_json_value(rapidjson::Document &d, rapidjson::Value &v) const;
67  /** Retrieve data from JSON string.
68  * @param json JSON representation suitable for this object.
69  * Will allow partial assignment and not validate automaticaly.
70  * @see validate()
71  */
72  virtual void from_json(const std::string &json);
73  /** Retrieve data from JSON string.
74  * @param v RapidJSON value suitable for this object.
75  * Will allow partial assignment and not validate automaticaly.
76  * @see validate()
77  */
78  virtual void from_json_value(const rapidjson::Value &v);
79 
80  /** Validate if all required fields have been set.
81  * @param subcall true if this is called from another class, e.g.,
82  * a sub-class or array holder. Will modify the kind of exception thrown.
83  * @exception std::vector<std::string> thrown if required information is
84  * missing and @p subcall is set to true. Contains a list of missing fields.
85  * @exception std::runtime_error informative message describing the missing
86  * fields
87  */
88  virtual void validate(bool subcall = false) const;
89 
90  // Schema: PlanAction
91 public:
92  /** Get kind value.
93  * @return kind value
94  */
95  std::optional<std::string>
96  kind() const
97  {
98  return kind_;
99  }
100 
101  /** Set kind value.
102  * @param kind new value
103  */
104  void
105  set_kind(const std::string &kind)
106  {
107  kind_ = kind;
108  }
109  /** Get apiVersion value.
110  * @return apiVersion value
111  */
112  std::optional<std::string>
113  apiVersion() const
114  {
115  return apiVersion_;
116  }
117 
118  /** Set apiVersion value.
119  * @param apiVersion new value
120  */
121  void
122  set_apiVersion(const std::string &apiVersion)
123  {
124  apiVersion_ = apiVersion;
125  }
126  /** Get id value.
127  * @return id value
128  */
129  std::optional<int64_t>
130  id() const
131  {
132  return id_;
133  }
134 
135  /** Set id value.
136  * @param id new value
137  */
138  void
139  set_id(const int64_t &id)
140  {
141  id_ = id;
142  }
143  /** Get operator-name value.
144  * @return operator-name value
145  */
146  std::optional<std::string>
148  {
149  return operator_name_;
150  }
151 
152  /** Set operator-name value.
153  * @param operator_name new value
154  */
155  void
156  set_operator_name(const std::string &operator_name)
157  {
158  operator_name_ = operator_name;
159  }
160  /** Get param-values value.
161  * @return param-values value
162  */
163  std::vector<std::string>
164  param_values() const
165  {
166  return param_values_;
167  }
168 
169  /** Set param-values value.
170  * @param param_values new value
171  */
172  void
173  set_param_values(const std::vector<std::string> &param_values)
174  {
175  param_values_ = param_values;
176  }
177  /** Add element to param-values array.
178  * @param param_values new value
179  */
180  void
181  addto_param_values(const std::string &&param_values)
182  {
183  param_values_.push_back(std::move(param_values));
184  }
185 
186  /** Add element to param-values array.
187  * The move-semantics version (std::move) should be preferred.
188  * @param param_values new value
189  */
190  void
191  addto_param_values(const std::string &param_values)
192  {
193  param_values_.push_back(param_values);
194  }
195  /** Get duration value.
196  * @return duration value
197  */
198  std::optional<float>
199  duration() const
200  {
201  return duration_;
202  }
203 
204  /** Set duration value.
205  * @param duration new value
206  */
207  void
208  set_duration(const float &duration)
209  {
210  duration_ = duration;
211  }
212  /** Get dispatch-time value.
213  * @return dispatch-time value
214  */
215  std::optional<float>
217  {
218  return dispatch_time_;
219  }
220 
221  /** Set dispatch-time value.
222  * @param dispatch_time new value
223  */
224  void
226  {
227  dispatch_time_ = dispatch_time;
228  }
229  /** Get state value.
230  * @return state value
231  */
232  std::optional<std::string>
233  state() const
234  {
235  return state_;
236  }
237 
238  /** Set state value.
239  * @param state new value
240  */
241  void
242  set_state(const std::string &state)
243  {
244  state_ = state;
245  }
246  /** Get executable value.
247  * @return executable value
248  */
249  std::optional<bool>
250  executable() const
251  {
252  return executable_;
253  }
254 
255  /** Set executable value.
256  * @param executable new value
257  */
258  void
260  {
261  executable_ = executable;
262  }
263  /** Get operator value.
264  * @return operator value
265  */
266  std::shared_ptr<DomainOperator>
267  _operator() const
268  {
269  return _operator_;
270  }
271 
272  /** Set operator value.
273  * @param _operator new value
274  */
275  void
276  set__operator(const std::shared_ptr<DomainOperator> &_operator)
277  {
278  _operator_ = _operator;
279  }
280  /** Get preconditions value.
281  * @return preconditions value
282  */
283  std::vector<std::shared_ptr<DomainPrecondition>>
285  {
286  return preconditions_;
287  }
288 
289  /** Set preconditions value.
290  * @param preconditions new value
291  */
292  void
293  set_preconditions(const std::vector<std::shared_ptr<DomainPrecondition>> &preconditions)
294  {
295  preconditions_ = preconditions;
296  }
297  /** Add element to preconditions array.
298  * @param preconditions new value
299  */
300  void
301  addto_preconditions(const std::shared_ptr<DomainPrecondition> &&preconditions)
302  {
303  preconditions_.push_back(std::move(preconditions));
304  }
305 
306  /** Add element to preconditions array.
307  * The move-semantics version (std::move) should be preferred.
308  * @param preconditions new value
309  */
310  void
311  addto_preconditions(const std::shared_ptr<DomainPrecondition> &preconditions)
312  {
313  preconditions_.push_back(preconditions);
314  }
315  /** Add element to preconditions array.
316  * @param preconditions new value
317  */
318  void
320  {
321  preconditions_.push_back(std::make_shared<DomainPrecondition>(std::move(preconditions)));
322  }
323  /** Get effects value.
324  * @return effects value
325  */
326  std::vector<std::shared_ptr<DomainEffect>>
327  effects() const
328  {
329  return effects_;
330  }
331 
332  /** Set effects value.
333  * @param effects new value
334  */
335  void
336  set_effects(const std::vector<std::shared_ptr<DomainEffect>> &effects)
337  {
338  effects_ = effects;
339  }
340  /** Add element to effects array.
341  * @param effects new value
342  */
343  void
344  addto_effects(const std::shared_ptr<DomainEffect> &&effects)
345  {
346  effects_.push_back(std::move(effects));
347  }
348 
349  /** Add element to effects array.
350  * The move-semantics version (std::move) should be preferred.
351  * @param effects new value
352  */
353  void
354  addto_effects(const std::shared_ptr<DomainEffect> &effects)
355  {
356  effects_.push_back(effects);
357  }
358  /** Add element to effects array.
359  * @param effects new value
360  */
361  void
363  {
364  effects_.push_back(std::make_shared<DomainEffect>(std::move(effects)));
365  }
366 
367 private:
368  std::optional<std::string> kind_;
369  std::optional<std::string> apiVersion_;
370  std::optional<int64_t> id_;
371  std::optional<std::string> operator_name_;
372  std::vector<std::string> param_values_;
373  std::optional<float> duration_;
374  std::optional<float> dispatch_time_;
375  std::optional<std::string> state_;
376  std::optional<bool> executable_;
377  std::shared_ptr<DomainOperator> _operator_;
378  std::vector<std::shared_ptr<DomainPrecondition>> preconditions_;
379  std::vector<std::shared_ptr<DomainEffect>> effects_;
380 };
PlanAction::duration
std::optional< float > duration() const
Get duration value.
Definition: PlanAction.h:199
PlanAction
PlanAction representation for JSON transfer.
Definition: PlanAction.h:32
PlanAction::set_id
void set_id(const int64_t &id)
Set id value.
Definition: PlanAction.h:139
PlanAction::addto_preconditions
void addto_preconditions(const std::shared_ptr< DomainPrecondition > &preconditions)
Add element to preconditions array.
Definition: PlanAction.h:311
PlanAction::set_dispatch_time
void set_dispatch_time(const float &dispatch_time)
Set dispatch-time value.
Definition: PlanAction.h:225
PlanAction::addto_param_values
void addto_param_values(const std::string &&param_values)
Add element to param-values array.
Definition: PlanAction.h:181
PlanAction::param_values
std::vector< std::string > param_values() const
Get param-values value.
Definition: PlanAction.h:164
DomainEffect
DomainEffect representation for JSON transfer.
Definition: DomainEffect.h:28
DomainPrecondition
DomainPrecondition representation for JSON transfer.
Definition: DomainPrecondition.h:28
PlanAction::addto_preconditions
void addto_preconditions(const std::shared_ptr< DomainPrecondition > &&preconditions)
Add element to preconditions array.
Definition: PlanAction.h:301
PlanAction::set_executable
void set_executable(const bool &executable)
Set executable value.
Definition: PlanAction.h:259
PlanAction::to_json_value
virtual void to_json_value(rapidjson::Document &d, rapidjson::Value &v) const
Render object to JSON.
Definition: PlanAction.cpp:61
PlanAction::state
std::optional< std::string > state() const
Get state value.
Definition: PlanAction.h:233
PlanAction::from_json
virtual void from_json(const std::string &json)
Retrieve data from JSON string.
Definition: PlanAction.cpp:140
PlanAction::set_duration
void set_duration(const float &duration)
Set duration value.
Definition: PlanAction.h:208
PlanAction::id
std::optional< int64_t > id() const
Get id value.
Definition: PlanAction.h:130
PlanAction::addto_effects
void addto_effects(const std::shared_ptr< DomainEffect > &effects)
Add element to effects array.
Definition: PlanAction.h:354
PlanAction::set_param_values
void set_param_values(const std::vector< std::string > &param_values)
Set param-values value.
Definition: PlanAction.h:173
PlanAction::set_effects
void set_effects(const std::vector< std::shared_ptr< DomainEffect >> &effects)
Set effects value.
Definition: PlanAction.h:336
PlanAction::_operator
std::shared_ptr< DomainOperator > _operator() const
Get operator value.
Definition: PlanAction.h:267
PlanAction::~PlanAction
virtual ~PlanAction()
Destructor.
Definition: PlanAction.cpp:37
PlanAction::addto_preconditions
void addto_preconditions(const DomainPrecondition &&preconditions)
Add element to preconditions array.
Definition: PlanAction.h:319
PlanAction::operator_name
std::optional< std::string > operator_name() const
Get operator-name value.
Definition: PlanAction.h:147
PlanAction::effects
std::vector< std::shared_ptr< DomainEffect > > effects() const
Get effects value.
Definition: PlanAction.h:327
PlanAction::set_preconditions
void set_preconditions(const std::vector< std::shared_ptr< DomainPrecondition >> &preconditions)
Set preconditions value.
Definition: PlanAction.h:293
PlanAction::addto_effects
void addto_effects(const std::shared_ptr< DomainEffect > &&effects)
Add element to effects array.
Definition: PlanAction.h:344
PlanAction::set_kind
void set_kind(const std::string &kind)
Set kind value.
Definition: PlanAction.h:105
PlanAction::set__operator
void set__operator(const std::shared_ptr< DomainOperator > &_operator)
Set operator value.
Definition: PlanAction.h:276
PlanAction::kind
std::optional< std::string > kind() const
Get kind value.
Definition: PlanAction.h:96
PlanAction::from_json_value
virtual void from_json_value(const rapidjson::Value &v)
Retrieve data from JSON string.
Definition: PlanAction.cpp:149
PlanAction::set_apiVersion
void set_apiVersion(const std::string &apiVersion)
Set apiVersion value.
Definition: PlanAction.h:122
PlanAction::to_json
virtual std::string to_json(bool pretty=false) const
Render object to JSON.
Definition: PlanAction.cpp:42
PlanAction::preconditions
std::vector< std::shared_ptr< DomainPrecondition > > preconditions() const
Get preconditions value.
Definition: PlanAction.h:284
PlanAction::PlanAction
PlanAction()
Constructor.
Definition: PlanAction.cpp:23
PlanAction::apiVersion
std::optional< std::string > apiVersion() const
Get apiVersion value.
Definition: PlanAction.h:113
PlanAction::addto_effects
void addto_effects(const DomainEffect &&effects)
Add element to effects array.
Definition: PlanAction.h:362
PlanAction::set_operator_name
void set_operator_name(const std::string &operator_name)
Set operator-name value.
Definition: PlanAction.h:156
PlanAction::api_version
static std::string api_version()
Get version of implemented API.
Definition: PlanAction.h:52
PlanAction::set_state
void set_state(const std::string &state)
Set state value.
Definition: PlanAction.h:242
PlanAction::executable
std::optional< bool > executable() const
Get executable value.
Definition: PlanAction.h:250
PlanAction::addto_param_values
void addto_param_values(const std::string &param_values)
Add element to param-values array.
Definition: PlanAction.h:191
PlanAction::dispatch_time
std::optional< float > dispatch_time() const
Get dispatch-time value.
Definition: PlanAction.h:216
PlanAction::validate
virtual void validate(bool subcall=false) const
Validate if all required fields have been set.
Definition: PlanAction.cpp:213