Fawkes API  Fawkes Development Version
InterfaceData.h
1 
2 /****************************************************************************
3  * Blackboard -- Schema InterfaceData
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 <rapidjson/fwd.h>
18 
19 #include <cstdint>
20 #include <memory>
21 #include <optional>
22 #include <string>
23 #include <vector>
24 
25 /** InterfaceData representation for JSON transfer. */
26 class InterfaceData
27 
28 {
29 public:
30  /** Constructor. */
31  InterfaceData();
32  /** Constructor from JSON.
33  * @param json JSON string to initialize from
34  */
35  InterfaceData(const std::string &json);
36  /** Constructor from JSON.
37  * @param v RapidJSON value object to initialize from.
38  */
39  InterfaceData(const rapidjson::Value &v);
40 
41  /** Destructor. */
42  virtual ~InterfaceData();
43 
44  /** Get version of implemented API.
45  * @return string representation of version
46  */
47  static std::string
48  api_version()
49  {
50  return "v1beta1";
51  }
52 
53  /** Render object to JSON.
54  * @param pretty true to enable pretty printing (readable spacing)
55  * @return JSON string
56  */
57  virtual std::string to_json(bool pretty = false) const;
58  /** Render object to JSON.
59  * @param d RapidJSON document to retrieve allocator from
60  * @param v RapidJSON value to add data to
61  */
62  virtual void to_json_value(rapidjson::Document &d, rapidjson::Value &v) const;
63  /** Retrieve data from JSON string.
64  * @param json JSON representation suitable for this object.
65  * Will allow partial assignment and not validate automaticaly.
66  * @see validate()
67  */
68  virtual void from_json(const std::string &json);
69  /** Retrieve data from JSON string.
70  * @param v RapidJSON value suitable for this object.
71  * Will allow partial assignment and not validate automaticaly.
72  * @see validate()
73  */
74  virtual void from_json_value(const rapidjson::Value &v);
75 
76  /** Validate if all required fields have been set.
77  * @param subcall true if this is called from another class, e.g.,
78  * a sub-class or array holder. Will modify the kind of exception thrown.
79  * @exception std::vector<std::string> thrown if required information is
80  * missing and @p subcall is set to true. Contains a list of missing fields.
81  * @exception std::runtime_error informative message describing the missing
82  * fields
83  */
84  virtual void validate(bool subcall = false) const;
85 
86  // Schema: InterfaceData
87 public:
88  /** Get kind value.
89  * @return kind value
90  */
91  std::optional<std::string>
92  kind() const
93  {
94  return kind_;
95  }
96 
97  /** Set kind value.
98  * @param kind new value
99  */
100  void
101  set_kind(const std::string &kind)
102  {
103  kind_ = kind;
104  }
105  /** Get apiVersion value.
106  * @return apiVersion value
107  */
108  std::optional<std::string>
109  apiVersion() const
110  {
111  return apiVersion_;
112  }
113 
114  /** Set apiVersion value.
115  * @param apiVersion new value
116  */
117  void
118  set_apiVersion(const std::string &apiVersion)
119  {
120  apiVersion_ = apiVersion;
121  }
122  /** Get id value.
123  * @return id value
124  */
125  std::optional<std::string>
126  id() const
127  {
128  return id_;
129  }
130 
131  /** Set id value.
132  * @param id new value
133  */
134  void
135  set_id(const std::string &id)
136  {
137  id_ = id;
138  }
139  /** Get type value.
140  * @return type value
141  */
142  std::optional<std::string>
143  type() const
144  {
145  return type_;
146  }
147 
148  /** Set type value.
149  * @param type new value
150  */
151  void
152  set_type(const std::string &type)
153  {
154  type_ = type;
155  }
156  /** Get writer value.
157  * @return writer value
158  */
159  std::optional<std::string>
160  writer() const
161  {
162  return writer_;
163  }
164 
165  /** Set writer value.
166  * @param writer new value
167  */
168  void
169  set_writer(const std::string &writer)
170  {
171  writer_ = writer;
172  }
173  /** Get readers value.
174  * @return readers value
175  */
176  std::vector<std::string>
177  readers() const
178  {
179  return readers_;
180  }
181 
182  /** Set readers value.
183  * @param readers new value
184  */
185  void
186  set_readers(const std::vector<std::string> &readers)
187  {
188  readers_ = readers;
189  }
190  /** Add element to readers array.
191  * @param readers new value
192  */
193  void
194  addto_readers(const std::string &&readers)
195  {
196  readers_.push_back(std::move(readers));
197  }
198 
199  /** Add element to readers array.
200  * The move-semantics version (std::move) should be preferred.
201  * @param readers new value
202  */
203  void
204  addto_readers(const std::string &readers)
205  {
206  readers_.push_back(readers);
207  }
208  /** Get data value.
209  * @return data value
210  */
211  std::shared_ptr<rapidjson::Document>
212  data() const
213  {
214  return data_;
215  }
216 
217  /** Set data value.
218  * @param data new value
219  */
220  void
221  set_data(const std::shared_ptr<rapidjson::Document> &data)
222  {
223  data_ = data;
224  }
225  /** Get timestamp value.
226  * @return timestamp value
227  */
228  std::optional<std::string>
229  timestamp() const
230  {
231  return timestamp_;
232  }
233 
234  /** Set timestamp value.
235  * @param timestamp new value
236  */
237  void
238  set_timestamp(const std::string &timestamp)
239  {
240  timestamp_ = timestamp;
241  }
242 
243 private:
244  std::optional<std::string> kind_;
245  std::optional<std::string> apiVersion_;
246  std::optional<std::string> id_;
247  std::optional<std::string> type_;
248  std::optional<std::string> writer_;
249  std::vector<std::string> readers_;
250  std::shared_ptr<rapidjson::Document> data_;
251  std::optional<std::string> timestamp_;
252 };
InterfaceData::from_json
virtual void from_json(const std::string &json)
Retrieve data from JSON string.
Definition: InterfaceData.cpp:111
InterfaceData::id
std::optional< std::string > id() const
Get id value.
Definition: InterfaceData.h:125
InterfaceData::readers
std::vector< std::string > readers() const
Get readers value.
Definition: InterfaceData.h:176
InterfaceData::timestamp
std::optional< std::string > timestamp() const
Get timestamp value.
Definition: InterfaceData.h:228
InterfaceData::from_json_value
virtual void from_json_value(const rapidjson::Value &v)
Retrieve data from JSON string.
Definition: InterfaceData.cpp:120
InterfaceData::InterfaceData
InterfaceData()
Constructor.
Definition: InterfaceData.cpp:22
InterfaceData::apiVersion
std::optional< std::string > apiVersion() const
Get apiVersion value.
Definition: InterfaceData.h:108
InterfaceData::set_apiVersion
void set_apiVersion(const std::string &apiVersion)
Set apiVersion value.
Definition: InterfaceData.h:117
InterfaceData::api_version
static std::string api_version()
Get version of implemented API.
Definition: InterfaceData.h:47
InterfaceData::set_data
void set_data(const std::shared_ptr< rapidjson::Document > &data)
Set data value.
Definition: InterfaceData.h:220
InterfaceData::set_type
void set_type(const std::string &type)
Set type value.
Definition: InterfaceData.h:151
InterfaceData::validate
virtual void validate(bool subcall=false) const
Validate if all required fields have been set.
Definition: InterfaceData.cpp:156
InterfaceData
InterfaceData representation for JSON transfer.
Definition: InterfaceData.h:25
InterfaceData::set_id
void set_id(const std::string &id)
Set id value.
Definition: InterfaceData.h:134
InterfaceData::set_timestamp
void set_timestamp(const std::string &timestamp)
Set timestamp value.
Definition: InterfaceData.h:237
InterfaceData::to_json_value
virtual void to_json_value(rapidjson::Document &d, rapidjson::Value &v) const
Render object to JSON.
Definition: InterfaceData.cpp:60
InterfaceData::~InterfaceData
virtual ~InterfaceData()
Destructor.
Definition: InterfaceData.cpp:36
InterfaceData::set_readers
void set_readers(const std::vector< std::string > &readers)
Set readers value.
Definition: InterfaceData.h:185
InterfaceData::writer
std::optional< std::string > writer() const
Get writer value.
Definition: InterfaceData.h:159
InterfaceData::addto_readers
void addto_readers(const std::string &&readers)
Add element to readers array.
Definition: InterfaceData.h:193
InterfaceData::kind
std::optional< std::string > kind() const
Get kind value.
Definition: InterfaceData.h:91
InterfaceData::to_json
virtual std::string to_json(bool pretty=false) const
Render object to JSON.
Definition: InterfaceData.cpp:41
InterfaceData::type
std::optional< std::string > type() const
Get type value.
Definition: InterfaceData.h:142
InterfaceData::set_writer
void set_writer(const std::string &writer)
Set writer value.
Definition: InterfaceData.h:168
InterfaceData::data
std::shared_ptr< rapidjson::Document > data() const
Get data value.
Definition: InterfaceData.h:211
InterfaceData::set_kind
void set_kind(const std::string &kind)
Set kind value.
Definition: InterfaceData.h:100