Fawkes API  Fawkes Development Version
InterfaceInfo.h
1 
2 /****************************************************************************
3  * Blackboard -- Schema InterfaceInfo
4  * (auto-generated, do not modify directly)
5  *
6  * Fawkes Blackboard REST API.
7  * Access blackboard data through a REST API.
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 "InterfaceFieldType.h"
18 #include "InterfaceMessageType.h"
19 
20 #include <rapidjson/fwd.h>
21 
22 #include <cstdint>
23 #include <memory>
24 #include <optional>
25 #include <string>
26 #include <vector>
27 
28 /** InterfaceInfo representation for JSON transfer. */
30 
31 {
32 public:
33  /** Constructor. */
34  InterfaceInfo();
35  /** Constructor from JSON.
36  * @param json JSON string to initialize from
37  */
38  InterfaceInfo(const std::string &json);
39  /** Constructor from JSON.
40  * @param v RapidJSON value object to initialize from.
41  */
42  InterfaceInfo(const rapidjson::Value &v);
43 
44  /** Destructor. */
45  virtual ~InterfaceInfo();
46 
47  /** Get version of implemented API.
48  * @return string representation of version
49  */
50  static std::string
52  {
53  return "v1beta1";
54  }
55 
56  /** Render object to JSON.
57  * @param pretty true to enable pretty printing (readable spacing)
58  * @return JSON string
59  */
60  virtual std::string to_json(bool pretty = false) const;
61  /** Render object to JSON.
62  * @param d RapidJSON document to retrieve allocator from
63  * @param v RapidJSON value to add data to
64  */
65  virtual void to_json_value(rapidjson::Document &d, rapidjson::Value &v) const;
66  /** Retrieve data from JSON string.
67  * @param json JSON representation suitable for this object.
68  * Will allow partial assignment and not validate automaticaly.
69  * @see validate()
70  */
71  virtual void from_json(const std::string &json);
72  /** Retrieve data from JSON string.
73  * @param v RapidJSON value suitable for this object.
74  * Will allow partial assignment and not validate automaticaly.
75  * @see validate()
76  */
77  virtual void from_json_value(const rapidjson::Value &v);
78 
79  /** Validate if all required fields have been set.
80  * @param subcall true if this is called from another class, e.g.,
81  * a sub-class or array holder. Will modify the kind of exception thrown.
82  * @exception std::vector<std::string> thrown if required information is
83  * missing and @p subcall is set to true. Contains a list of missing fields.
84  * @exception std::runtime_error informative message describing the missing
85  * fields
86  */
87  virtual void validate(bool subcall = false) const;
88 
89  // Schema: InterfaceInfo
90 public:
91  /** Get kind value.
92  * @return kind value
93  */
94  std::optional<std::string>
95  kind() const
96  {
97  return kind_;
98  }
99 
100  /** Set kind value.
101  * @param kind new value
102  */
103  void
104  set_kind(const std::string &kind)
105  {
106  kind_ = kind;
107  }
108  /** Get apiVersion value.
109  * @return apiVersion value
110  */
111  std::optional<std::string>
112  apiVersion() const
113  {
114  return apiVersion_;
115  }
116 
117  /** Set apiVersion value.
118  * @param apiVersion new value
119  */
120  void
121  set_apiVersion(const std::string &apiVersion)
122  {
123  apiVersion_ = apiVersion;
124  }
125  /** Get id value.
126  * @return id value
127  */
128  std::optional<std::string>
129  id() const
130  {
131  return id_;
132  }
133 
134  /** Set id value.
135  * @param id new value
136  */
137  void
138  set_id(const std::string &id)
139  {
140  id_ = id;
141  }
142  /** Get type value.
143  * @return type value
144  */
145  std::optional<std::string>
146  type() const
147  {
148  return type_;
149  }
150 
151  /** Set type value.
152  * @param type new value
153  */
154  void
155  set_type(const std::string &type)
156  {
157  type_ = type;
158  }
159  /** Get hash value.
160  * @return hash value
161  */
162  std::optional<std::string>
163  hash() const
164  {
165  return hash_;
166  }
167 
168  /** Set hash value.
169  * @param hash new value
170  */
171  void
172  set_hash(const std::string &hash)
173  {
174  hash_ = hash;
175  }
176  /** Get writer value.
177  * @return writer value
178  */
179  std::optional<std::string>
180  writer() const
181  {
182  return writer_;
183  }
184 
185  /** Set writer value.
186  * @param writer new value
187  */
188  void
189  set_writer(const std::string &writer)
190  {
191  writer_ = writer;
192  }
193  /** Get readers value.
194  * @return readers value
195  */
196  std::vector<std::string>
197  readers() const
198  {
199  return readers_;
200  }
201 
202  /** Set readers value.
203  * @param readers new value
204  */
205  void
206  set_readers(const std::vector<std::string> &readers)
207  {
208  readers_ = readers;
209  }
210  /** Add element to readers array.
211  * @param readers new value
212  */
213  void
214  addto_readers(const std::string &&readers)
215  {
216  readers_.push_back(std::move(readers));
217  }
218 
219  /** Add element to readers array.
220  * The move-semantics version (std::move) should be preferred.
221  * @param readers new value
222  */
223  void
224  addto_readers(const std::string &readers)
225  {
226  readers_.push_back(readers);
227  }
228  /** Get fields value.
229  * @return fields value
230  */
231  std::vector<std::shared_ptr<InterfaceFieldType>>
232  fields() const
233  {
234  return fields_;
235  }
236 
237  /** Set fields value.
238  * @param fields new value
239  */
240  void
241  set_fields(const std::vector<std::shared_ptr<InterfaceFieldType>> &fields)
242  {
243  fields_ = fields;
244  }
245  /** Add element to fields array.
246  * @param fields new value
247  */
248  void
249  addto_fields(const std::shared_ptr<InterfaceFieldType> &&fields)
250  {
251  fields_.push_back(std::move(fields));
252  }
253 
254  /** Add element to fields array.
255  * The move-semantics version (std::move) should be preferred.
256  * @param fields new value
257  */
258  void
259  addto_fields(const std::shared_ptr<InterfaceFieldType> &fields)
260  {
261  fields_.push_back(fields);
262  }
263  /** Add element to fields array.
264  * @param fields new value
265  */
266  void
268  {
269  fields_.push_back(std::make_shared<InterfaceFieldType>(std::move(fields)));
270  }
271  /** Get message_types value.
272  * @return message_types value
273  */
274  std::vector<std::shared_ptr<InterfaceMessageType>>
276  {
277  return message_types_;
278  }
279 
280  /** Set message_types value.
281  * @param message_types new value
282  */
283  void
284  set_message_types(const std::vector<std::shared_ptr<InterfaceMessageType>> &message_types)
285  {
286  message_types_ = message_types;
287  }
288  /** Add element to message_types array.
289  * @param message_types new value
290  */
291  void
292  addto_message_types(const std::shared_ptr<InterfaceMessageType> &&message_types)
293  {
294  message_types_.push_back(std::move(message_types));
295  }
296 
297  /** Add element to message_types array.
298  * The move-semantics version (std::move) should be preferred.
299  * @param message_types new value
300  */
301  void
302  addto_message_types(const std::shared_ptr<InterfaceMessageType> &message_types)
303  {
304  message_types_.push_back(message_types);
305  }
306  /** Add element to message_types array.
307  * @param message_types new value
308  */
309  void
311  {
312  message_types_.push_back(std::make_shared<InterfaceMessageType>(std::move(message_types)));
313  }
314 
315 private:
316  std::optional<std::string> kind_;
317  std::optional<std::string> apiVersion_;
318  std::optional<std::string> id_;
319  std::optional<std::string> type_;
320  std::optional<std::string> hash_;
321  std::optional<std::string> writer_;
322  std::vector<std::string> readers_;
323  std::vector<std::shared_ptr<InterfaceFieldType>> fields_;
324  std::vector<std::shared_ptr<InterfaceMessageType>> message_types_;
325 };
std::optional< std::string > id() const
Get id value.
void set_message_types(const std::vector< std::shared_ptr< InterfaceMessageType >> &message_types)
Set message_types value.
void addto_readers(const std::string &&readers)
Add element to readers array.
std::optional< std::string > apiVersion() const
Get apiVersion value.
virtual ~InterfaceInfo()
Destructor.
InterfaceInfo()
Constructor.
InterfaceMessageType representation for JSON transfer.
std::optional< std::string > kind() const
Get kind value.
Definition: InterfaceInfo.h:95
virtual std::string to_json(bool pretty=false) const
Render object to JSON.
void addto_message_types(const std::shared_ptr< InterfaceMessageType > &&message_types)
Add element to message_types array.
virtual void from_json_value(const rapidjson::Value &v)
Retrieve data from JSON string.
std::vector< std::shared_ptr< InterfaceFieldType > > fields() const
Get fields value.
std::optional< std::string > type() const
Get type value.
virtual void from_json(const std::string &json)
Retrieve data from JSON string.
void addto_fields(const std::shared_ptr< InterfaceFieldType > &fields)
Add element to fields array.
std::optional< std::string > writer() const
Get writer value.
void addto_readers(const std::string &readers)
Add element to readers array.
static std::string api_version()
Get version of implemented API.
Definition: InterfaceInfo.h:51
void addto_fields(const InterfaceFieldType &&fields)
Add element to fields array.
void set_fields(const std::vector< std::shared_ptr< InterfaceFieldType >> &fields)
Set fields value.
std::vector< std::string > readers() const
Get readers value.
void addto_message_types(const std::shared_ptr< InterfaceMessageType > &message_types)
Add element to message_types array.
virtual void to_json_value(rapidjson::Document &d, rapidjson::Value &v) const
Render object to JSON.
void set_type(const std::string &type)
Set type value.
std::optional< std::string > hash() const
Get hash value.
void addto_message_types(const InterfaceMessageType &&message_types)
Add element to message_types array.
void set_readers(const std::vector< std::string > &readers)
Set readers value.
virtual void validate(bool subcall=false) const
Validate if all required fields have been set.
void set_kind(const std::string &kind)
Set kind value.
void addto_fields(const std::shared_ptr< InterfaceFieldType > &&fields)
Add element to fields array.
InterfaceInfo representation for JSON transfer.
Definition: InterfaceInfo.h:29
void set_apiVersion(const std::string &apiVersion)
Set apiVersion value.
void set_writer(const std::string &writer)
Set writer value.
std::vector< std::shared_ptr< InterfaceMessageType > > message_types() const
Get message_types value.
void set_hash(const std::string &hash)
Set hash value.
void set_id(const std::string &id)
Set id value.
InterfaceFieldType representation for JSON transfer.