Fawkes API  Fawkes Development Version
PlanAction Class Reference

PlanAction representation for JSON transfer. More...

#include <PlanAction.h>

Public Member Functions

 PlanAction ()
 Constructor. More...
 
 PlanAction (const std::string &json)
 Constructor from JSON. More...
 
 PlanAction (const rapidjson::Value &v)
 Constructor from JSON. More...
 
virtual ~PlanAction ()
 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< int64_t > id () const
 Get id value. More...
 
void set_id (const int64_t &id)
 Set id value. More...
 
std::optional< std::string > operator_name () const
 Get operator-name value. More...
 
void set_operator_name (const std::string &operator_name)
 Set operator-name value. More...
 
std::vector< std::string > param_values () const
 Get param-values value. More...
 
void set_param_values (const std::vector< std::string > &param_values)
 Set param-values value. More...
 
void addto_param_values (const std::string &&param_values)
 Add element to param-values array. More...
 
void addto_param_values (const std::string &param_values)
 Add element to param-values array. More...
 
std::optional< float > duration () const
 Get duration value. More...
 
void set_duration (const float &duration)
 Set duration value. More...
 
std::optional< float > dispatch_time () const
 Get dispatch-time value. More...
 
void set_dispatch_time (const float &dispatch_time)
 Set dispatch-time value. More...
 
std::optional< std::string > state () const
 Get state value. More...
 
void set_state (const std::string &state)
 Set state value. More...
 
std::optional< bool > executable () const
 Get executable value. More...
 
void set_executable (const bool &executable)
 Set executable value. More...
 
std::shared_ptr< DomainOperator_operator () const
 Get operator value. More...
 
void set__operator (const std::shared_ptr< DomainOperator > &_operator)
 Set operator value. More...
 
std::vector< std::shared_ptr< DomainPrecondition > > preconditions () const
 Get preconditions value. More...
 
void set_preconditions (const std::vector< std::shared_ptr< DomainPrecondition >> &preconditions)
 Set preconditions value. More...
 
void addto_preconditions (const std::shared_ptr< DomainPrecondition > &&preconditions)
 Add element to preconditions array. More...
 
void addto_preconditions (const std::shared_ptr< DomainPrecondition > &preconditions)
 Add element to preconditions array. More...
 
void addto_preconditions (const DomainPrecondition &&preconditions)
 Add element to preconditions array. More...
 
std::vector< std::shared_ptr< DomainEffect > > effects () const
 Get effects value. More...
 
void set_effects (const std::vector< std::shared_ptr< DomainEffect >> &effects)
 Set effects value. More...
 
void addto_effects (const std::shared_ptr< DomainEffect > &&effects)
 Add element to effects array. More...
 
void addto_effects (const std::shared_ptr< DomainEffect > &effects)
 Add element to effects array. More...
 
void addto_effects (const DomainEffect &&effects)
 Add element to effects array. More...
 

Static Public Member Functions

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

Detailed Description

PlanAction representation for JSON transfer.

Definition at line 30 of file PlanAction.h.

Constructor & Destructor Documentation

◆ PlanAction() [1/3]

PlanAction::PlanAction ( )

Constructor.

Definition at line 23 of file PlanAction.cpp.

◆ PlanAction() [2/3]

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

Constructor from JSON.

Parameters
jsonJSON string to initialize from

Definition at line 27 of file PlanAction.cpp.

References from_json().

◆ PlanAction() [3/3]

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

Constructor from JSON.

Parameters
vRapidJSON value object to initialize from.

Definition at line 32 of file PlanAction.cpp.

References from_json_value().

◆ ~PlanAction()

PlanAction::~PlanAction ( )
virtual

Destructor.

Definition at line 37 of file PlanAction.cpp.

Member Function Documentation

◆ _operator()

std::shared_ptr<DomainOperator> PlanAction::_operator ( ) const
inline

Get operator value.

Returns
operator value

Definition at line 267 of file PlanAction.h.

Referenced by set__operator().

◆ addto_effects() [1/3]

void PlanAction::addto_effects ( const DomainEffect &&  effects)
inline

Add element to effects array.

Parameters
effectsnew value

Definition at line 362 of file PlanAction.h.

References effects().

◆ addto_effects() [2/3]

void PlanAction::addto_effects ( const std::shared_ptr< DomainEffect > &&  effects)
inline

Add element to effects array.

Parameters
effectsnew value

Definition at line 344 of file PlanAction.h.

References effects().

◆ addto_effects() [3/3]

void PlanAction::addto_effects ( const std::shared_ptr< DomainEffect > &  effects)
inline

Add element to effects array.

The move-semantics version (std::move) should be preferred.

Parameters
effectsnew value

Definition at line 354 of file PlanAction.h.

References effects().

◆ addto_param_values() [1/2]

void PlanAction::addto_param_values ( const std::string &&  param_values)
inline

Add element to param-values array.

Parameters
param_valuesnew value

Definition at line 181 of file PlanAction.h.

References param_values().

◆ addto_param_values() [2/2]

void PlanAction::addto_param_values ( const std::string &  param_values)
inline

Add element to param-values array.

The move-semantics version (std::move) should be preferred.

Parameters
param_valuesnew value

Definition at line 191 of file PlanAction.h.

References param_values().

◆ addto_preconditions() [1/3]

void PlanAction::addto_preconditions ( const DomainPrecondition &&  preconditions)
inline

Add element to preconditions array.

Parameters
preconditionsnew value

Definition at line 319 of file PlanAction.h.

References preconditions().

◆ addto_preconditions() [2/3]

void PlanAction::addto_preconditions ( const std::shared_ptr< DomainPrecondition > &&  preconditions)
inline

Add element to preconditions array.

Parameters
preconditionsnew value

Definition at line 301 of file PlanAction.h.

References preconditions().

◆ addto_preconditions() [3/3]

void PlanAction::addto_preconditions ( const std::shared_ptr< DomainPrecondition > &  preconditions)
inline

Add element to preconditions array.

The move-semantics version (std::move) should be preferred.

Parameters
preconditionsnew value

Definition at line 311 of file PlanAction.h.

References preconditions().

◆ api_version()

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

Get version of implemented API.

Returns
string representation of version

Definition at line 52 of file PlanAction.h.

◆ apiVersion()

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

Get apiVersion value.

Returns
apiVersion value

Definition at line 113 of file PlanAction.h.

Referenced by set_apiVersion().

◆ dispatch_time()

std::optional<float> PlanAction::dispatch_time ( ) const
inline

Get dispatch-time value.

Returns
dispatch-time value

Definition at line 216 of file PlanAction.h.

Referenced by set_dispatch_time().

◆ duration()

std::optional<float> PlanAction::duration ( ) const
inline

Get duration value.

Returns
duration value

Definition at line 199 of file PlanAction.h.

Referenced by set_duration().

◆ effects()

std::vector<std::shared_ptr<DomainEffect> > PlanAction::effects ( ) const
inline

Get effects value.

Returns
effects value

Definition at line 327 of file PlanAction.h.

Referenced by addto_effects(), and set_effects().

◆ executable()

std::optional<bool> PlanAction::executable ( ) const
inline

Get executable value.

Returns
executable value

Definition at line 250 of file PlanAction.h.

Referenced by set_executable().

◆ from_json()

void PlanAction::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 140 of file PlanAction.cpp.

References from_json_value().

Referenced by PlanAction().

◆ from_json_value()

void PlanAction::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 149 of file PlanAction.cpp.

References DomainPrecondition::from_json_value(), and DomainEffect::from_json_value().

Referenced by from_json(), Plan::from_json_value(), and PlanAction().

◆ id()

std::optional<int64_t> PlanAction::id ( ) const
inline

Get id value.

Returns
id value

Definition at line 130 of file PlanAction.h.

Referenced by set_id().

◆ kind()

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

Get kind value.

Returns
kind value

Definition at line 96 of file PlanAction.h.

Referenced by set_kind().

◆ operator_name()

std::optional<std::string> PlanAction::operator_name ( ) const
inline

Get operator-name value.

Returns
operator-name value

Definition at line 147 of file PlanAction.h.

Referenced by set_operator_name().

◆ param_values()

std::vector<std::string> PlanAction::param_values ( ) const
inline

Get param-values value.

Returns
param-values value

Definition at line 164 of file PlanAction.h.

Referenced by addto_param_values(), and set_param_values().

◆ preconditions()

std::vector<std::shared_ptr<DomainPrecondition> > PlanAction::preconditions ( ) const
inline

Get preconditions value.

Returns
preconditions value

Definition at line 284 of file PlanAction.h.

Referenced by addto_preconditions(), and set_preconditions().

◆ set__operator()

void PlanAction::set__operator ( const std::shared_ptr< DomainOperator > &  _operator)
inline

Set operator value.

Parameters
_operatornew value

Definition at line 276 of file PlanAction.h.

References _operator().

◆ set_apiVersion()

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

Set apiVersion value.

Parameters
apiVersionnew value

Definition at line 122 of file PlanAction.h.

References apiVersion().

◆ set_dispatch_time()

void PlanAction::set_dispatch_time ( const float &  dispatch_time)
inline

Set dispatch-time value.

Parameters
dispatch_timenew value

Definition at line 225 of file PlanAction.h.

References dispatch_time().

◆ set_duration()

void PlanAction::set_duration ( const float &  duration)
inline

Set duration value.

Parameters
durationnew value

Definition at line 208 of file PlanAction.h.

References duration().

◆ set_effects()

void PlanAction::set_effects ( const std::vector< std::shared_ptr< DomainEffect >> &  effects)
inline

Set effects value.

Parameters
effectsnew value

Definition at line 336 of file PlanAction.h.

References effects().

◆ set_executable()

void PlanAction::set_executable ( const bool &  executable)
inline

Set executable value.

Parameters
executablenew value

Definition at line 259 of file PlanAction.h.

References executable().

◆ set_id()

void PlanAction::set_id ( const int64_t &  id)
inline

Set id value.

Parameters
idnew value

Definition at line 139 of file PlanAction.h.

References id().

◆ set_kind()

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

Set kind value.

Parameters
kindnew value

Definition at line 105 of file PlanAction.h.

References kind().

◆ set_operator_name()

void PlanAction::set_operator_name ( const std::string &  operator_name)
inline

Set operator-name value.

Parameters
operator_namenew value

Definition at line 156 of file PlanAction.h.

References operator_name().

◆ set_param_values()

void PlanAction::set_param_values ( const std::vector< std::string > &  param_values)
inline

Set param-values value.

Parameters
param_valuesnew value

Definition at line 173 of file PlanAction.h.

References param_values().

◆ set_preconditions()

void PlanAction::set_preconditions ( const std::vector< std::shared_ptr< DomainPrecondition >> &  preconditions)
inline

Set preconditions value.

Parameters
preconditionsnew value

Definition at line 293 of file PlanAction.h.

References preconditions().

◆ set_state()

void PlanAction::set_state ( const std::string &  state)
inline

Set state value.

Parameters
statenew value

Definition at line 242 of file PlanAction.h.

References state().

◆ state()

std::optional<std::string> PlanAction::state ( ) const
inline

Get state value.

Returns
state value

Definition at line 233 of file PlanAction.h.

Referenced by set_state().

◆ to_json()

std::string PlanAction::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 42 of file PlanAction.cpp.

References to_json_value().

◆ to_json_value()

void PlanAction::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 61 of file PlanAction.cpp.

Referenced by to_json().

◆ validate()

void PlanAction::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 213 of file PlanAction.cpp.


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