|
Fawkes API
Fawkes Development Version
|
InterfaceMessageType representation for JSON transfer. More...
#include <InterfaceMessageType.h>
Public Member Functions | |
| InterfaceMessageType () | |
| Constructor. More... | |
| InterfaceMessageType (const std::string &json) | |
| Constructor from JSON. More... | |
| InterfaceMessageType (const rapidjson::Value &v) | |
| Constructor from JSON. More... | |
| virtual | ~InterfaceMessageType () |
| Destructor. More... | |
| virtual std::string | to_json (bool pretty=false) const |
| Render object to JSON. More... | |
| virtual void | to_json_value (rapidjson::Document &d, rapidjson::Value &v) const |
| Render object to JSON. More... | |
| virtual void | from_json (const std::string &json) |
| Retrieve data from JSON string. More... | |
| virtual void | from_json_value (const rapidjson::Value &v) |
| Retrieve data from JSON string. More... | |
| virtual void | validate (bool subcall=false) const |
| Validate if all required fields have been set. More... | |
| std::optional< std::string > | name () const |
| Get name value. More... | |
| void | set_name (const std::string &name) |
| Set name value. More... | |
| std::vector< std::shared_ptr< InterfaceFieldType > > | fields () const |
| Get fields value. More... | |
| void | set_fields (const std::vector< std::shared_ptr< InterfaceFieldType >> &fields) |
| Set fields value. More... | |
| void | addto_fields (const std::shared_ptr< InterfaceFieldType > &&fields) |
| Add element to fields array. More... | |
| void | addto_fields (const std::shared_ptr< InterfaceFieldType > &fields) |
| Add element to fields array. More... | |
| void | addto_fields (const InterfaceFieldType &&fields) |
| Add element to fields array. More... | |
Static Public Member Functions | |
| static std::string | api_version () |
| Get version of implemented API. More... | |
InterfaceMessageType representation for JSON transfer.
Definition at line 28 of file InterfaceMessageType.h.
| InterfaceMessageType::InterfaceMessageType | ( | ) |
Constructor.
Definition at line 23 of file InterfaceMessageType.cpp.
| InterfaceMessageType::InterfaceMessageType | ( | const std::string & | json | ) |
Constructor from JSON.
| json | JSON string to initialize from |
Definition at line 27 of file InterfaceMessageType.cpp.
References from_json().
| InterfaceMessageType::InterfaceMessageType | ( | const rapidjson::Value & | v | ) |
Constructor from JSON.
| v | RapidJSON value object to initialize from. |
Definition at line 32 of file InterfaceMessageType.cpp.
References from_json_value().
|
virtual |
Destructor.
Definition at line 37 of file InterfaceMessageType.cpp.
|
inline |
Add element to fields array.
| fields | new value |
Definition at line 146 of file InterfaceMessageType.h.
References fields().
|
inline |
Add element to fields array.
| fields | new value |
Definition at line 128 of file InterfaceMessageType.h.
References fields().
|
inline |
Add element to fields array.
The move-semantics version (std::move) should be preferred.
| fields | new value |
Definition at line 138 of file InterfaceMessageType.h.
References fields().
|
inlinestatic |
Get version of implemented API.
Definition at line 50 of file InterfaceMessageType.h.
|
inline |
Get fields value.
Definition at line 111 of file InterfaceMessageType.h.
Referenced by addto_fields(), and set_fields().
|
virtual |
Retrieve data from JSON string.
| json | JSON representation suitable for this object. Will allow partial assignment and not validate automaticaly. |
Definition at line 84 of file InterfaceMessageType.cpp.
References from_json_value().
Referenced by InterfaceMessageType().
|
virtual |
Retrieve data from JSON string.
| v | RapidJSON value suitable for this object. Will allow partial assignment and not validate automaticaly. |
Definition at line 93 of file InterfaceMessageType.cpp.
References InterfaceFieldType::from_json_value().
Referenced by from_json(), InterfaceInfo::from_json_value(), and InterfaceMessageType().
|
inline |
Get name value.
Definition at line 94 of file InterfaceMessageType.h.
Referenced by set_name().
|
inline |
Set fields value.
| fields | new value |
Definition at line 120 of file InterfaceMessageType.h.
References fields().
|
inline |
Set name value.
| name | new value |
Definition at line 103 of file InterfaceMessageType.h.
References name().
|
virtual |
Render object to JSON.
| pretty | true to enable pretty printing (readable spacing) |
Definition at line 42 of file InterfaceMessageType.cpp.
References to_json_value().
|
virtual |
Render object to JSON.
| d | RapidJSON document to retrieve allocator from |
| v | RapidJSON value to add data to |
Definition at line 61 of file InterfaceMessageType.cpp.
Referenced by to_json().
|
virtual |
Validate if all required fields have been set.
| subcall | true if this is called from another class, e.g., a sub-class or array holder. Will modify the kind of exception thrown. |
| std::vector<std::string> | thrown if required information is missing and subcall is set to true. Contains a list of missing fields. |
| std::runtime_error | informative message describing the missing fields |
Definition at line 112 of file InterfaceMessageType.cpp.