Fawkes API  Fawkes Development Version
Skill Class Reference

Skill representation for JSON transfer. More...

#include <Skill.h>

Public Member Functions

 Skill ()
 Constructor. More...
 
 Skill (const std::string &json)
 Constructor from JSON. More...
 
 Skill (const rapidjson::Value &v)
 Constructor from JSON. More...
 
virtual ~Skill ()
 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 > name () const
 Get name value. More...
 
void set_name (const std::string &name)
 Set name value. More...
 
std::optional< std::string > graph () const
 Get graph value. More...
 
void set_graph (const std::string &graph)
 Set graph value. More...
 
std::optional< std::string > skill_string () const
 The skill string is given only for the active skill. More...
 
void set_skill_string (const std::string &skill_string)
 Set skill-string value. More...
 
std::optional< std::string > error () const
 An error is presented for the active skill if it has FAILED. More...
 
void set_error (const std::string &error)
 Set error value. More...
 
std::optional< int64_t > msg_id () const
 Get msg_id value. More...
 
void set_msg_id (const int64_t &msg_id)
 Set msg_id value. More...
 
std::optional< std::string > exclusive_controller () const
 Get exclusive_controller value. More...
 
void set_exclusive_controller (const std::string &exclusive_controller)
 Set exclusive_controller value. More...
 
std::optional< std::string > status () const
 Get status value. More...
 
void set_status (const std::string &status)
 Set status value. More...
 

Static Public Member Functions

static std::string api_version ()
 Get version of implemented API. More...
 

Detailed Description

Skill representation for JSON transfer.

Definition at line 27 of file Skill.h.

Constructor & Destructor Documentation

◆ Skill() [1/3]

Skill::Skill ( )

Constructor.

Definition at line 24 of file Skill.cpp.

◆ Skill() [2/3]

Skill::Skill ( const std::string &  json)

Constructor from JSON.

Parameters
jsonJSON string to initialize from

Definition at line 28 of file Skill.cpp.

References from_json().

◆ Skill() [3/3]

Skill::Skill ( const rapidjson::Value &  v)

Constructor from JSON.

Parameters
vRapidJSON value object to initialize from.

Definition at line 33 of file Skill.cpp.

References from_json_value().

◆ ~Skill()

Skill::~Skill ( )
virtual

Destructor.

Definition at line 38 of file Skill.cpp.

Member Function Documentation

◆ api_version()

static std::string Skill::api_version ( )
inlinestatic

Get version of implemented API.

Returns
string representation of version

Definition at line 49 of file Skill.h.

◆ apiVersion()

std::optional<std::string> Skill::apiVersion ( ) const
inline

Get apiVersion value.

Returns
apiVersion value

Definition at line 110 of file Skill.h.

Referenced by set_apiVersion().

◆ error()

std::optional<std::string> Skill::error ( ) const
inline

An error is presented for the active skill if it has FAILED.

Returns
error value

Definition at line 180 of file Skill.h.

Referenced by set_error().

◆ exclusive_controller()

std::optional<std::string> Skill::exclusive_controller ( ) const
inline

Get exclusive_controller value.

Returns
exclusive_controller value

Definition at line 214 of file Skill.h.

Referenced by set_exclusive_controller().

◆ from_json()

void Skill::from_json ( const std::string &  json)
virtual

Retrieve data from JSON string.

Parameters
jsonJSON representation suitable for this object. Will allow partial assignment and not validate automaticaly.
See also
validate()

Definition at line 117 of file Skill.cpp.

References from_json_value().

Referenced by Skill().

◆ from_json_value()

void Skill::from_json_value ( const rapidjson::Value &  v)
virtual

Retrieve data from JSON string.

Parameters
vRapidJSON value suitable for this object. Will allow partial assignment and not validate automaticaly.
See also
validate()

Definition at line 126 of file Skill.cpp.

Referenced by from_json(), and Skill().

◆ graph()

std::optional<std::string> Skill::graph ( ) const
inline

Get graph value.

Returns
graph value

Definition at line 144 of file Skill.h.

Referenced by set_graph().

◆ kind()

std::optional<std::string> Skill::kind ( ) const
inline

Get kind value.

Returns
kind value

Definition at line 93 of file Skill.h.

Referenced by set_kind().

◆ msg_id()

std::optional<int64_t> Skill::msg_id ( ) const
inline

Get msg_id value.

Returns
msg_id value

Definition at line 197 of file Skill.h.

Referenced by set_msg_id().

◆ name()

std::optional<std::string> Skill::name ( ) const
inline

Get name value.

Returns
name value

Definition at line 127 of file Skill.h.

Referenced by set_name().

◆ set_apiVersion()

void Skill::set_apiVersion ( const std::string &  apiVersion)
inline

Set apiVersion value.

Parameters
apiVersionnew value

Definition at line 119 of file Skill.h.

References apiVersion().

◆ set_error()

void Skill::set_error ( const std::string &  error)
inline

Set error value.

Parameters
errornew value

Definition at line 189 of file Skill.h.

References error().

◆ set_exclusive_controller()

void Skill::set_exclusive_controller ( const std::string &  exclusive_controller)
inline

Set exclusive_controller value.

Parameters
exclusive_controllernew value

Definition at line 223 of file Skill.h.

References exclusive_controller().

◆ set_graph()

void Skill::set_graph ( const std::string &  graph)
inline

Set graph value.

Parameters
graphnew value

Definition at line 153 of file Skill.h.

References graph().

◆ set_kind()

void Skill::set_kind ( const std::string &  kind)
inline

Set kind value.

Parameters
kindnew value

Definition at line 102 of file Skill.h.

References kind().

◆ set_msg_id()

void Skill::set_msg_id ( const int64_t &  msg_id)
inline

Set msg_id value.

Parameters
msg_idnew value

Definition at line 206 of file Skill.h.

References msg_id().

◆ set_name()

void Skill::set_name ( const std::string &  name)
inline

Set name value.

Parameters
namenew value

Definition at line 136 of file Skill.h.

References name().

◆ set_skill_string()

void Skill::set_skill_string ( const std::string &  skill_string)
inline

Set skill-string value.

Parameters
skill_stringnew value

Definition at line 171 of file Skill.h.

References skill_string().

◆ set_status()

void Skill::set_status ( const std::string &  status)
inline

Set status value.

Parameters
statusnew value

Definition at line 240 of file Skill.h.

References status().

◆ skill_string()

std::optional<std::string> Skill::skill_string ( ) const
inline

The skill string is given only for the active skill.

Returns
skill-string value

Definition at line 162 of file Skill.h.

Referenced by set_skill_string().

◆ status()

std::optional<std::string> Skill::status ( ) const
inline

Get status value.

Returns
status value

Definition at line 231 of file Skill.h.

Referenced by set_status().

◆ to_json()

std::string Skill::to_json ( bool  pretty = false) const
virtual

Render object to JSON.

Parameters
prettytrue to enable pretty printing (readable spacing)
Returns
JSON string

Definition at line 43 of file Skill.cpp.

References to_json_value().

◆ to_json_value()

void Skill::to_json_value ( rapidjson::Document &  d,
rapidjson::Value &  v 
) const
virtual

Render object to JSON.

Parameters
dRapidJSON document to retrieve allocator from
vRapidJSON value to add data to

Definition at line 62 of file Skill.cpp.

Referenced by to_json().

◆ validate()

void Skill::validate ( bool  subcall = false) const
virtual

Validate if all required fields have been set.

Parameters
subcalltrue if this is called from another class, e.g., a sub-class or array holder. Will modify the kind of exception thrown.
Exceptions
std::vector<std::string>thrown if required information is missing and subcall is set to true. Contains a list of missing fields.
std::runtime_errorinformative message describing the missing fields

Definition at line 158 of file Skill.cpp.


The documentation for this class was generated from the following files: