Flyby SDK v1.0.2
Loading...
Searching...
No Matches
flyby::MessageObject Class Referenceabstract

A key-value object that is serializable. More...

#include <message.h>

Inheritance diagram for flyby::MessageObject:
Collaboration diagram for flyby::MessageObject:

Public Member Functions

virtual std::shared_ptr< MessageObjectset_field (const std::string &key, const std::string &value)=0
 Set a string field.
virtual std::shared_ptr< MessageObjectset_field (const std::string &key, long value)=0
 Set a long field.
virtual std::shared_ptr< MessageObjectset_field (const std::string &key, double value)=0
 Set a double field.
virtual std::shared_ptr< MessageObjectset_field (const std::string &key, std::shared_ptr< MessageObject > value)=0
 Set an object field.
virtual bool is_string (const std::string &key)=0
 Check if a field is a string.
virtual bool is_long (const std::string &key)=0
 Check if a field is a long.
virtual bool is_double (const std::string &key)=0
 Check if a field is a double.
virtual bool is_object (const std::string &key)=0
 Check if a field is an object.
virtual std::string get_string (const std::string &key) const =0
 Get the string value stored with key.
virtual long get_long (const std::string &key) const =0
 Get the long value stored with key.
virtual double get_double (const std::string &key) const =0
 Get the double value stored with key.
virtual std::shared_ptr< MessageObjectget_object (const std::string &key) const =0
 Get the object value stored with key.
Public Member Functions inherited from flyby::SerialObject
virtual std::string serialize () const =0
 Serialize the object.

Static Public Member Functions

static std::shared_ptr< MessageObjectcreate ()
 Creates a new message object.
static std::shared_ptr< MessageObjectfrom (const std::string &obj)
 Creates a new message object from a serialized object string.

Detailed Description

A key-value object that is serializable.

Messages that send objects do so using the MessageObject

Member Function Documentation

◆ create()

std::shared_ptr< MessageObject > flyby::MessageObject::create ( )
static

Creates a new message object.

Returns
a shared pointer holding the new message object

◆ from()

std::shared_ptr< MessageObject > flyby::MessageObject::from ( const std::string & obj)
static

Creates a new message object from a serialized object string.

Parameters
obj- the serialized object string
Returns
a shared pointer holding the new message object

◆ get_double()

virtual double flyby::MessageObject::get_double ( const std::string & key) const
pure virtual

Get the double value stored with key.

May throw std::bad_cast if the value is not a double

Returns
the value stored as a double

◆ get_long()

virtual long flyby::MessageObject::get_long ( const std::string & key) const
pure virtual

Get the long value stored with key.

May throw std::bad_cast if the value is not a long

Returns
the value stored as a long

◆ get_object()

virtual std::shared_ptr< MessageObject > flyby::MessageObject::get_object ( const std::string & key) const
pure virtual

Get the object value stored with key.

May throw std::bad_cast if the value is not an object

Returns
the value stored as an object (as a shared pointer)

◆ get_string()

virtual std::string flyby::MessageObject::get_string ( const std::string & key) const
pure virtual

Get the string value stored with key.

May throw std::bad_cast if the value is not a string

Returns
the value stored as a string

◆ is_double()

virtual bool flyby::MessageObject::is_double ( const std::string & key)
pure virtual

Check if a field is a double.

Returns
true if the stored value is a double

◆ is_long()

virtual bool flyby::MessageObject::is_long ( const std::string & key)
pure virtual

Check if a field is a long.

Returns
true if the stored value is a long

◆ is_object()

virtual bool flyby::MessageObject::is_object ( const std::string & key)
pure virtual

Check if a field is an object.

Returns
true if the stored value is an object

◆ is_string()

virtual bool flyby::MessageObject::is_string ( const std::string & key)
pure virtual

Check if a field is a string.

Returns
true if the stored value is a string

◆ set_field() [1/4]

virtual std::shared_ptr< MessageObject > flyby::MessageObject::set_field ( const std::string & key,
const std::string & value )
pure virtual

Set a string field.

Parameters
key- the identifier string for the field
value- the string value of the field
Returns
the original object with the new key-value pair, returned as a shared pointer

◆ set_field() [2/4]

virtual std::shared_ptr< MessageObject > flyby::MessageObject::set_field ( const std::string & key,
double value )
pure virtual

Set a double field.

Returns
the original object with the new key-value pair, returned as a shared pointer

◆ set_field() [3/4]

virtual std::shared_ptr< MessageObject > flyby::MessageObject::set_field ( const std::string & key,
long value )
pure virtual

Set a long field.

Parameters
key- the identifier string for the field
value- the long value of the field
Returns
the original object with the new key-value pair, returned as a shared pointer

◆ set_field() [4/4]

virtual std::shared_ptr< MessageObject > flyby::MessageObject::set_field ( const std::string & key,
std::shared_ptr< MessageObject > value )
pure virtual

Set an object field.

Returns
the original object with the new key-value pair, returned as a shared pointer

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