Fawkes API Fawkes Development Version
|
Plan representation for JSON transfer. More...
#include <Plan.h>
Public Member Functions | |
Plan () | |
Constructor. More... | |
Plan (const std::string &json) | |
Constructor from JSON. More... | |
Plan (const rapidjson::Value &v) | |
Constructor from JSON. More... | |
virtual | ~Plan () |
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 > | kind () const |
Get kind value. More... | |
void | set_kind (const std::string &kind) |
Set kind value. More... | |
std::optional< std::string > | apiVersion () const |
Get apiVersion value. More... | |
void | set_apiVersion (const std::string &apiVersion) |
Set apiVersion value. More... | |
std::optional< std::string > | id () const |
Get id value. More... | |
void | set_id (const std::string &id) |
Set id value. More... | |
std::optional< std::string > | goal_id () const |
Get goal-id value. More... | |
void | set_goal_id (const std::string &goal_id) |
Set goal-id value. More... | |
std::optional< float > | cost () const |
Get cost value. More... | |
void | set_cost (const float &cost) |
Set cost value. More... | |
std::vector< std::shared_ptr< PlanAction > > | actions () const |
Get actions value. More... | |
void | set_actions (const std::vector< std::shared_ptr< PlanAction > > &actions) |
Set actions value. More... | |
void | addto_actions (const std::shared_ptr< PlanAction > &&actions) |
Add element to actions array. More... | |
void | addto_actions (const std::shared_ptr< PlanAction > &actions) |
Add element to actions array. More... | |
void | addto_actions (const PlanAction &&actions) |
Add element to actions array. More... | |
Static Public Member Functions | |
static std::string | api_version () |
Get version of implemented API. More... | |
Plan::Plan | ( | const std::string & | json | ) |
Constructor from JSON.
json | JSON string to initialize from |
Definition at line 28 of file Plan.cpp.
References from_json().
Plan::Plan | ( | const rapidjson::Value & | v | ) |
Constructor from JSON.
v | RapidJSON value object to initialize from. |
Definition at line 33 of file Plan.cpp.
References from_json_value().
|
inline |
Get actions value.
Definition at line 178 of file Plan.h.
Referenced by addto_actions(), and set_actions().
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inline |
Get apiVersion value.
Definition at line 110 of file Plan.h.
Referenced by set_apiVersion().
|
inline |
|
virtual |
Retrieve data from JSON string.
json | JSON representation suitable for this object. Will allow partial assignment and not validate automaticaly. |
Definition at line 105 of file Plan.cpp.
References from_json_value().
Referenced by Plan().
|
virtual |
Retrieve data from JSON string.
v | RapidJSON value suitable for this object. Will allow partial assignment and not validate automaticaly. |
Definition at line 114 of file Plan.cpp.
References PlanAction::from_json_value().
Referenced by from_json(), and Plan().
|
inline |
Get goal-id value.
Definition at line 144 of file Plan.h.
Referenced by set_goal_id().
|
inline |
|
inline |
|
inline |
|
inline |
Set apiVersion value.
apiVersion | new value |
Definition at line 119 of file Plan.h.
References apiVersion().
|
inline |
|
inline |
|
inline |
|
inline |
|
virtual |
Render object to JSON.
pretty | true to enable pretty printing (readable spacing) |
Definition at line 43 of file Plan.cpp.
References to_json_value().
|
virtual |
|
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 |