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 "GroundedFormula.h"
20#include "PDDLGrounding.h"
21
22#include <rapidjson/fwd.h>
23
24#include <cstdint>
25#include <memory>
26#include <optional>
27#include <string>
28#include <vector>
29
30/** PlanAction representation for JSON transfer. */
32{
33public:
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
91public:
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>
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
157 {
158 operator_name_ = operator_name;
159 }
160 /** Get param-values value.
161 * @return param-values value
162 */
163 std::vector<std::string>
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
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>
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 precondition value.
281 * @return precondition value
282 */
283 std::shared_ptr<PDDLGrounding>
285 {
286 return precondition_;
287 }
288
289 /** Set precondition value.
290 * @param precondition new value
291 */
292 void
293 set_precondition(const std::shared_ptr<PDDLGrounding> &precondition)
294 {
295 precondition_ = precondition;
296 }
297 /** Get effects value.
298 * @return effects value
299 */
300 std::vector<std::shared_ptr<DomainEffect>>
301 effects() const
302 {
303 return effects_;
304 }
305
306 /** Set effects value.
307 * @param effects new value
308 */
309 void
310 set_effects(const std::vector<std::shared_ptr<DomainEffect>> &effects)
311 {
312 effects_ = effects;
313 }
314 /** Add element to effects array.
315 * @param effects new value
316 */
317 void
318 addto_effects(const std::shared_ptr<DomainEffect> &&effects)
319 {
320 effects_.push_back(std::move(effects));
321 }
322
323 /** Add element to effects array.
324 * The move-semantics version (std::move) should be preferred.
325 * @param effects new value
326 */
327 void
328 addto_effects(const std::shared_ptr<DomainEffect> &effects)
329 {
330 effects_.push_back(effects);
331 }
332 /** Add element to effects array.
333 * @param effects new value
334 */
335 void
337 {
338 effects_.push_back(std::make_shared<DomainEffect>(std::move(effects)));
339 }
340 /** Get preconditions value.
341 * @return preconditions value
342 */
343 std::shared_ptr<GroundedFormula>
345 {
346 return preconditions_;
347 }
348
349 /** Set preconditions value.
350 * @param preconditions new value
351 */
352 void
353 set_preconditions(const std::shared_ptr<GroundedFormula> &preconditions)
354 {
355 preconditions_ = preconditions;
356 }
357
358private:
359 std::optional<std::string> kind_;
360 std::optional<std::string> apiVersion_;
361 std::optional<int64_t> id_;
362 std::optional<std::string> operator_name_;
363 std::vector<std::string> param_values_;
364 std::optional<float> duration_;
365 std::optional<float> dispatch_time_;
366 std::optional<std::string> state_;
367 std::optional<bool> executable_;
368 std::shared_ptr<DomainOperator> _operator_;
369 std::shared_ptr<PDDLGrounding> precondition_;
370 std::vector<std::shared_ptr<DomainEffect>> effects_;
371 std::shared_ptr<GroundedFormula> preconditions_;
372};
DomainEffect representation for JSON transfer.
Definition: DomainEffect.h:28
PlanAction representation for JSON transfer.
Definition: PlanAction.h:32
std::optional< std::string > kind() const
Get kind value.
Definition: PlanAction.h:96
void set_duration(const float &duration)
Set duration value.
Definition: PlanAction.h:208
std::shared_ptr< PDDLGrounding > precondition() const
Get precondition value.
Definition: PlanAction.h:284
void set_kind(const std::string &kind)
Set kind value.
Definition: PlanAction.h:105
void set_effects(const std::vector< std::shared_ptr< DomainEffect > > &effects)
Set effects value.
Definition: PlanAction.h:310
void addto_param_values(const std::string &&param_values)
Add element to param-values array.
Definition: PlanAction.h:181
std::optional< std::string > state() const
Get state value.
Definition: PlanAction.h:233
virtual ~PlanAction()
Destructor.
Definition: PlanAction.cpp:38
std::shared_ptr< GroundedFormula > preconditions() const
Get preconditions value.
Definition: PlanAction.h:344
std::optional< std::string > operator_name() const
Get operator-name value.
Definition: PlanAction.h:147
void addto_param_values(const std::string &param_values)
Add element to param-values array.
Definition: PlanAction.h:191
void set_state(const std::string &state)
Set state value.
Definition: PlanAction.h:242
void addto_effects(const DomainEffect &&effects)
Add element to effects array.
Definition: PlanAction.h:336
void addto_effects(const std::shared_ptr< DomainEffect > &&effects)
Add element to effects array.
Definition: PlanAction.h:318
void set_param_values(const std::vector< std::string > &param_values)
Set param-values value.
Definition: PlanAction.h:173
std::optional< int64_t > id() const
Get id value.
Definition: PlanAction.h:130
PlanAction()
Constructor.
Definition: PlanAction.cpp:24
std::optional< float > duration() const
Get duration value.
Definition: PlanAction.h:199
std::shared_ptr< DomainOperator > _operator() const
Get operator value.
Definition: PlanAction.h:267
void set_precondition(const std::shared_ptr< PDDLGrounding > &precondition)
Set precondition value.
Definition: PlanAction.h:293
virtual void from_json(const std::string &json)
Retrieve data from JSON string.
Definition: PlanAction.cpp:143
virtual std::string to_json(bool pretty=false) const
Render object to JSON.
Definition: PlanAction.cpp:43
void set_dispatch_time(const float &dispatch_time)
Set dispatch-time value.
Definition: PlanAction.h:225
std::optional< std::string > apiVersion() const
Get apiVersion value.
Definition: PlanAction.h:113
virtual void validate(bool subcall=false) const
Validate if all required fields have been set.
Definition: PlanAction.cpp:213
std::vector< std::string > param_values() const
Get param-values value.
Definition: PlanAction.h:164
void set_executable(const bool &executable)
Set executable value.
Definition: PlanAction.h:259
void set_operator_name(const std::string &operator_name)
Set operator-name value.
Definition: PlanAction.h:156
std::optional< float > dispatch_time() const
Get dispatch-time value.
Definition: PlanAction.h:216
void set_apiVersion(const std::string &apiVersion)
Set apiVersion value.
Definition: PlanAction.h:122
void addto_effects(const std::shared_ptr< DomainEffect > &effects)
Add element to effects array.
Definition: PlanAction.h:328
void set__operator(const std::shared_ptr< DomainOperator > &_operator)
Set operator value.
Definition: PlanAction.h:276
static std::string api_version()
Get version of implemented API.
Definition: PlanAction.h:52
std::optional< bool > executable() const
Get executable value.
Definition: PlanAction.h:250
virtual void to_json_value(rapidjson::Document &d, rapidjson::Value &v) const
Render object to JSON.
Definition: PlanAction.cpp:62
void set_id(const int64_t &id)
Set id value.
Definition: PlanAction.h:139
virtual void from_json_value(const rapidjson::Value &v)
Retrieve data from JSON string.
Definition: PlanAction.cpp:152
std::vector< std::shared_ptr< DomainEffect > > effects() const
Get effects value.
Definition: PlanAction.h:301
void set_preconditions(const std::shared_ptr< GroundedFormula > &preconditions)
Set preconditions value.
Definition: PlanAction.h:353