geopm
3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
|
Abstraction around sd_bus interfaces that read from or append to sd_bus_message types. More...
#include <SDBusMessage.hpp>
Public Member Functions | |
SDBusMessage ()=default | |
virtual | ~SDBusMessage ()=default |
virtual sd_bus_message * | get_sd_ptr (void)=0 |
Get raw pointer to sd_bus struct. More... | |
virtual void | enter_container (char type, const std::string &contents)=0 |
Enter a container in the message for reading. More... | |
virtual void | exit_container (void)=0 |
Exit a container in the message for reading. More... | |
virtual void | open_container (char type, const std::string &contents)=0 |
Open a container in the message for writing. More... | |
virtual void | close_container (void)=0 |
Close a container in the message for writing. More... | |
virtual std::string | read_string (void)=0 |
Read a string out of the message. More... | |
virtual double | read_double (void)=0 |
Read a double out of the message. More... | |
virtual int | read_integer (void)=0 |
Read an integer out of the message. More... | |
virtual void | append_strings (const std::vector< std::string > &write_values)=0 |
Write an array of strings into the message. More... | |
virtual void | append_request (const geopm_request_s &request)=0 |
Write an array of geopm_request_s into the message. More... | |
virtual bool | was_success (void)=0 |
Determine if end of array has been reached. More... | |
Static Public Member Functions | |
static std::unique_ptr< SDBusMessage > | make_unique (sd_bus_message *bus_message) |
Factory method for SDBusMessage interface. More... | |
Static Public Attributes | |
static const char | M_MESSAGE_TYPE_STRUCT = SD_BUS_TYPE_STRUCT |
Used with enter_container() method to specify a structure container. More... | |
static const char | M_MESSAGE_TYPE_ARRAY = SD_BUS_TYPE_ARRAY |
Used with enter_container() method to specify an array container. More... | |
Abstraction around sd_bus interfaces that read from or append to sd_bus_message types.
A mock-able C++ interface wrapper around the sd_bus functions that read or modify messages. To read messages methods can enter or exit containers, as well as reading strings, doubles and integers. The abstraction also enables appending a list of strings to a container to write to the message.
|
default |
|
virtualdefault |
|
pure virtual |
Write an array of geopm_request_s into the message.
Wrapper around the "sd_bus_message_append(3)" function.
[in] | Vector | of geopm_request_s to write into the message as an array. |
Implemented in geopm::SDBusMessageImp.
|
pure virtual |
Write an array of strings into the message.
Wrapper around the "sd_bus_message_append_strv(3)" function.
[in] | Vector | of strings to write into the message as an array. |
Implemented in geopm::SDBusMessageImp.
|
pure virtual |
Close a container in the message for writing.
Wrapper around sd_bus_message_close_open_container(3)
Implemented in geopm::SDBusMessageImp.
|
pure virtual |
Enter a container in the message for reading.
Wrapper around sd_bus_message_enter_container(3) function.
type | [in] One of M_MESSAGE_TYPE_STRUCT or M_MESSAGE_TYPE_ARRAY which map to the related char values defined in "sd-bus.h". |
contents | [in] The sd_bus string expression that describes the data types in the message. |
Implemented in geopm::SDBusMessageImp.
|
pure virtual |
Exit a container in the message for reading.
Wrapper around sd_bus_message_exit_container(3) function.
Implemented in geopm::SDBusMessageImp.
|
pure virtual |
Get raw pointer to sd_bus struct.
This value can be used to make sd_bus interface calls that require the raw pointer in the SDBus class.
Implemented in geopm::SDBusMessageImp.
|
static |
Factory method for SDBusMessage interface.
|
pure virtual |
Open a container in the message for writing.
Wrapper around sd_bus_message_open_container(3)
type | [in] One of M_MESSAGE_TYPE_STRUCT or M_MESSAGE_TYPE_ARRAY which map to the related char values defined in "sd-bus.h". |
contents | [in] The sd_bus string expression that describes the data types in the message. |
Implemented in geopm::SDBusMessageImp.
|
pure virtual |
Read a double out of the message.
Wrapper around the "sd_bus_message_read(3)" function.
Implemented in geopm::SDBusMessageImp.
|
pure virtual |
Read an integer out of the message.
Wrapper around the "sd_bus_message_read(3)" function.
Implemented in geopm::SDBusMessageImp.
|
pure virtual |
Read a string out of the message.
Wrapper around the "sd_bus_message_read(3)" function.
Implemented in geopm::SDBusMessageImp.
|
pure virtual |
Determine if end of array has been reached.
When iterating through an array container, the was_success() method can be used to determine if the last read from the container was successful. After a read from an array was successful the was_success() will return true, and if the end of the array has been reached, was_success() will return false. The return value from a read from an array container that was unsuccessful should be ignored.
Implemented in geopm::SDBusMessageImp.
|
static |
Used with enter_container() method to specify an array container.
|
static |
Used with enter_container() method to specify a structure container.