Fawkes API  Fawkes Development Version
InterfaceInfo Class Reference

InterfaceInfo representation for JSON transfer. More...

#include <InterfaceInfo.h>

Public Member Functions

 InterfaceInfo ()
 Constructor. More...
 
 InterfaceInfo (const std::string &json)
 Constructor from JSON. More...
 
 InterfaceInfo (const rapidjson::Value &v)
 Constructor from JSON. More...
 
virtual ~InterfaceInfo ()
 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 > type () const
 Get type value. More...
 
void set_type (const std::string &type)
 Set type value. More...
 
std::optional< std::string > hash () const
 Get hash value. More...
 
void set_hash (const std::string &hash)
 Set hash value. More...
 
std::optional< std::string > writer () const
 Get writer value. More...
 
void set_writer (const std::string &writer)
 Set writer value. More...
 
std::vector< std::string > readers () const
 Get readers value. More...
 
void set_readers (const std::vector< std::string > &readers)
 Set readers value. More...
 
void addto_readers (const std::string &&readers)
 Add element to readers array. More...
 
void addto_readers (const std::string &readers)
 Add element to readers array. 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...
 
std::vector< std::shared_ptr< InterfaceMessageType > > message_types () const
 Get message_types value. More...
 
void set_message_types (const std::vector< std::shared_ptr< InterfaceMessageType >> &message_types)
 Set message_types value. More...
 
void addto_message_types (const std::shared_ptr< InterfaceMessageType > &&message_types)
 Add element to message_types array. More...
 
void addto_message_types (const std::shared_ptr< InterfaceMessageType > &message_types)
 Add element to message_types array. More...
 
void addto_message_types (const InterfaceMessageType &&message_types)
 Add element to message_types array. More...
 

Static Public Member Functions

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

Detailed Description

InterfaceInfo representation for JSON transfer.

Definition at line 29 of file InterfaceInfo.h.

Constructor & Destructor Documentation

◆ InterfaceInfo() [1/3]

InterfaceInfo::InterfaceInfo ( )

Constructor.

Definition at line 23 of file InterfaceInfo.cpp.

◆ InterfaceInfo() [2/3]

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

Constructor from JSON.

Parameters
jsonJSON string to initialize from

Definition at line 27 of file InterfaceInfo.cpp.

References from_json().

◆ InterfaceInfo() [3/3]

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

Constructor from JSON.

Parameters
vRapidJSON value object to initialize from.

Definition at line 32 of file InterfaceInfo.cpp.

References from_json_value().

◆ ~InterfaceInfo()

InterfaceInfo::~InterfaceInfo ( )
virtual

Destructor.

Definition at line 37 of file InterfaceInfo.cpp.

Member Function Documentation

◆ addto_fields() [1/3]

void InterfaceInfo::addto_fields ( const std::shared_ptr< InterfaceFieldType > &&  fields)
inline

Add element to fields array.

Parameters
fieldsnew value

Definition at line 249 of file InterfaceInfo.h.

References fields().

◆ addto_fields() [2/3]

void InterfaceInfo::addto_fields ( const std::shared_ptr< InterfaceFieldType > &  fields)
inline

Add element to fields array.

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

Parameters
fieldsnew value

Definition at line 259 of file InterfaceInfo.h.

References fields().

◆ addto_fields() [3/3]

void InterfaceInfo::addto_fields ( const InterfaceFieldType &&  fields)
inline

Add element to fields array.

Parameters
fieldsnew value

Definition at line 267 of file InterfaceInfo.h.

References fields().

◆ addto_message_types() [1/3]

void InterfaceInfo::addto_message_types ( const std::shared_ptr< InterfaceMessageType > &&  message_types)
inline

Add element to message_types array.

Parameters
message_typesnew value

Definition at line 292 of file InterfaceInfo.h.

References message_types().

◆ addto_message_types() [2/3]

void InterfaceInfo::addto_message_types ( const std::shared_ptr< InterfaceMessageType > &  message_types)
inline

Add element to message_types array.

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

Parameters
message_typesnew value

Definition at line 302 of file InterfaceInfo.h.

References message_types().

◆ addto_message_types() [3/3]

void InterfaceInfo::addto_message_types ( const InterfaceMessageType &&  message_types)
inline

Add element to message_types array.

Parameters
message_typesnew value

Definition at line 310 of file InterfaceInfo.h.

References message_types().

◆ addto_readers() [1/2]

void InterfaceInfo::addto_readers ( const std::string &&  readers)
inline

Add element to readers array.

Parameters
readersnew value

Definition at line 214 of file InterfaceInfo.h.

References readers().

◆ addto_readers() [2/2]

void InterfaceInfo::addto_readers ( const std::string &  readers)
inline

Add element to readers array.

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

Parameters
readersnew value

Definition at line 224 of file InterfaceInfo.h.

References readers().

◆ api_version()

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

Get version of implemented API.

Returns
string representation of version

Definition at line 51 of file InterfaceInfo.h.

◆ apiVersion()

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

Get apiVersion value.

Returns
apiVersion value

Definition at line 112 of file InterfaceInfo.h.

Referenced by set_apiVersion().

◆ fields()

std::vector<std::shared_ptr<InterfaceFieldType> > InterfaceInfo::fields ( ) const
inline

Get fields value.

Returns
fields value

Definition at line 232 of file InterfaceInfo.h.

Referenced by addto_fields(), and set_fields().

◆ from_json()

void InterfaceInfo::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 125 of file InterfaceInfo.cpp.

References from_json_value().

Referenced by InterfaceInfo().

◆ from_json_value()

void InterfaceInfo::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 134 of file InterfaceInfo.cpp.

References InterfaceFieldType::from_json_value(), and InterfaceMessageType::from_json_value().

Referenced by from_json(), and InterfaceInfo().

◆ hash()

std::optional<std::string> InterfaceInfo::hash ( ) const
inline

Get hash value.

Returns
hash value

Definition at line 163 of file InterfaceInfo.h.

Referenced by set_hash().

◆ id()

std::optional<std::string> InterfaceInfo::id ( ) const
inline

Get id value.

Returns
id value

Definition at line 129 of file InterfaceInfo.h.

Referenced by set_id().

◆ kind()

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

Get kind value.

Returns
kind value

Definition at line 95 of file InterfaceInfo.h.

Referenced by set_kind().

◆ message_types()

std::vector<std::shared_ptr<InterfaceMessageType> > InterfaceInfo::message_types ( ) const
inline

Get message_types value.

Returns
message_types value

Definition at line 275 of file InterfaceInfo.h.

Referenced by addto_message_types(), and set_message_types().

◆ readers()

std::vector<std::string> InterfaceInfo::readers ( ) const
inline

Get readers value.

Returns
readers value

Definition at line 197 of file InterfaceInfo.h.

Referenced by addto_readers(), and set_readers().

◆ set_apiVersion()

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

Set apiVersion value.

Parameters
apiVersionnew value

Definition at line 121 of file InterfaceInfo.h.

References apiVersion().

◆ set_fields()

void InterfaceInfo::set_fields ( const std::vector< std::shared_ptr< InterfaceFieldType >> &  fields)
inline

Set fields value.

Parameters
fieldsnew value

Definition at line 241 of file InterfaceInfo.h.

References fields().

◆ set_hash()

void InterfaceInfo::set_hash ( const std::string &  hash)
inline

Set hash value.

Parameters
hashnew value

Definition at line 172 of file InterfaceInfo.h.

References hash().

◆ set_id()

void InterfaceInfo::set_id ( const std::string &  id)
inline

Set id value.

Parameters
idnew value

Definition at line 138 of file InterfaceInfo.h.

References id().

◆ set_kind()

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

Set kind value.

Parameters
kindnew value

Definition at line 104 of file InterfaceInfo.h.

References kind().

◆ set_message_types()

void InterfaceInfo::set_message_types ( const std::vector< std::shared_ptr< InterfaceMessageType >> &  message_types)
inline

Set message_types value.

Parameters
message_typesnew value

Definition at line 284 of file InterfaceInfo.h.

References message_types().

◆ set_readers()

void InterfaceInfo::set_readers ( const std::vector< std::string > &  readers)
inline

Set readers value.

Parameters
readersnew value

Definition at line 206 of file InterfaceInfo.h.

References readers().

◆ set_type()

void InterfaceInfo::set_type ( const std::string &  type)
inline

Set type value.

Parameters
typenew value

Definition at line 155 of file InterfaceInfo.h.

References type().

◆ set_writer()

void InterfaceInfo::set_writer ( const std::string &  writer)
inline

Set writer value.

Parameters
writernew value

Definition at line 189 of file InterfaceInfo.h.

References writer().

◆ to_json()

std::string InterfaceInfo::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 InterfaceInfo.cpp.

References to_json_value(), and writer().

◆ to_json_value()

void InterfaceInfo::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 InterfaceInfo.cpp.

Referenced by to_json().

◆ type()

std::optional<std::string> InterfaceInfo::type ( ) const
inline

Get type value.

Returns
type value

Definition at line 146 of file InterfaceInfo.h.

Referenced by set_type().

◆ validate()

void InterfaceInfo::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 188 of file InterfaceInfo.cpp.

◆ writer()

std::optional<std::string> InterfaceInfo::writer ( ) const
inline

Get writer value.

Returns
writer value

Definition at line 180 of file InterfaceInfo.h.

Referenced by set_writer(), and to_json().


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