Fawkes API  Fawkes Development Version
Plan.h
1 
2 /****************************************************************************
3  * ClipsExecutive -- Schema Plan
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 "PlanAction.h"
18 
19 #include <rapidjson/fwd.h>
20 
21 #include <cstdint>
22 #include <memory>
23 #include <optional>
24 #include <string>
25 #include <vector>
26 
27 /** Plan representation for JSON transfer. */
28 class Plan
29 {
30 public:
31  /** Constructor. */
32  Plan();
33  /** Constructor from JSON.
34  * @param json JSON string to initialize from
35  */
36  Plan(const std::string &json);
37  /** Constructor from JSON.
38  * @param v RapidJSON value object to initialize from.
39  */
40  Plan(const rapidjson::Value &v);
41 
42  /** Destructor. */
43  virtual ~Plan();
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: Plan
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 id value.
124  * @return id value
125  */
126  std::optional<std::string>
127  id() const
128  {
129  return id_;
130  }
131 
132  /** Set id value.
133  * @param id new value
134  */
135  void
136  set_id(const std::string &id)
137  {
138  id_ = id;
139  }
140  /** Get goal-id value.
141  * @return goal-id value
142  */
143  std::optional<std::string>
144  goal_id() const
145  {
146  return goal_id_;
147  }
148 
149  /** Set goal-id value.
150  * @param goal_id new value
151  */
152  void
153  set_goal_id(const std::string &goal_id)
154  {
155  goal_id_ = goal_id;
156  }
157  /** Get cost value.
158  * @return cost value
159  */
160  std::optional<float>
161  cost() const
162  {
163  return cost_;
164  }
165 
166  /** Set cost value.
167  * @param cost new value
168  */
169  void
170  set_cost(const float &cost)
171  {
172  cost_ = cost;
173  }
174  /** Get actions value.
175  * @return actions value
176  */
177  std::vector<std::shared_ptr<PlanAction>>
178  actions() const
179  {
180  return actions_;
181  }
182 
183  /** Set actions value.
184  * @param actions new value
185  */
186  void
187  set_actions(const std::vector<std::shared_ptr<PlanAction>> &actions)
188  {
189  actions_ = actions;
190  }
191  /** Add element to actions array.
192  * @param actions new value
193  */
194  void
195  addto_actions(const std::shared_ptr<PlanAction> &&actions)
196  {
197  actions_.push_back(std::move(actions));
198  }
199 
200  /** Add element to actions array.
201  * The move-semantics version (std::move) should be preferred.
202  * @param actions new value
203  */
204  void
205  addto_actions(const std::shared_ptr<PlanAction> &actions)
206  {
207  actions_.push_back(actions);
208  }
209  /** Add element to actions array.
210  * @param actions new value
211  */
212  void
214  {
215  actions_.push_back(std::make_shared<PlanAction>(std::move(actions)));
216  }
217 
218 private:
219  std::optional<std::string> kind_;
220  std::optional<std::string> apiVersion_;
221  std::optional<std::string> id_;
222  std::optional<std::string> goal_id_;
223  std::optional<float> cost_;
224  std::vector<std::shared_ptr<PlanAction>> actions_;
225 };
PlanAction representation for JSON transfer.
Definition: PlanAction.h:32
Plan representation for JSON transfer.
Definition: Plan.h:29
Plan()
Constructor.
Definition: Plan.cpp:24
std::vector< std::shared_ptr< PlanAction > > actions() const
Get actions value.
Definition: Plan.h:178
void addto_actions(const std::shared_ptr< PlanAction > &&actions)
Add element to actions array.
Definition: Plan.h:195
virtual void to_json_value(rapidjson::Document &d, rapidjson::Value &v) const
Render object to JSON.
Definition: Plan.cpp:62
void set_id(const std::string &id)
Set id value.
Definition: Plan.h:136
std::optional< std::string > goal_id() const
Get goal-id value.
Definition: Plan.h:144
void set_goal_id(const std::string &goal_id)
Set goal-id value.
Definition: Plan.h:153
virtual ~Plan()
Destructor.
Definition: Plan.cpp:38
std::optional< std::string > apiVersion() const
Get apiVersion value.
Definition: Plan.h:110
std::optional< std::string > id() const
Get id value.
Definition: Plan.h:127
static std::string api_version()
Get version of implemented API.
Definition: Plan.h:49
virtual std::string to_json(bool pretty=false) const
Render object to JSON.
Definition: Plan.cpp:43
virtual void from_json(const std::string &json)
Retrieve data from JSON string.
Definition: Plan.cpp:105
void set_kind(const std::string &kind)
Set kind value.
Definition: Plan.h:102
void set_actions(const std::vector< std::shared_ptr< PlanAction >> &actions)
Set actions value.
Definition: Plan.h:187
void addto_actions(const std::shared_ptr< PlanAction > &actions)
Add element to actions array.
Definition: Plan.h:205
std::optional< float > cost() const
Get cost value.
Definition: Plan.h:161
std::optional< std::string > kind() const
Get kind value.
Definition: Plan.h:93
virtual void validate(bool subcall=false) const
Validate if all required fields have been set.
Definition: Plan.cpp:145
void set_cost(const float &cost)
Set cost value.
Definition: Plan.h:170
void set_apiVersion(const std::string &apiVersion)
Set apiVersion value.
Definition: Plan.h:119
void addto_actions(const PlanAction &&actions)
Add element to actions array.
Definition: Plan.h:213
virtual void from_json_value(const rapidjson::Value &v)
Retrieve data from JSON string.
Definition: Plan.cpp:114