geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
Public Member Functions | List of all members
geopm::SDBusMessageImp Class Reference

#include <SDBusMessage.hpp>

Inheritance diagram for geopm::SDBusMessageImp:
Inheritance graph
[legend]
Collaboration diagram for geopm::SDBusMessageImp:
Collaboration graph
[legend]

Public Member Functions

 SDBusMessageImp ()
 
 SDBusMessageImp (sd_bus_message *bus_message)
 
virtual ~SDBusMessageImp ()
 
sd_bus_message * get_sd_ptr (void) override
 Get raw pointer to sd_bus struct. More...
 
void enter_container (char type, const std::string &contents) override
 Enter a container in the message for reading. More...
 
void exit_container (void) override
 Exit a container in the message for reading. More...
 
virtual void open_container (char type, const std::string &contents) override
 Open a container in the message for writing. More...
 
virtual void close_container (void) override
 Close a container in the message for writing. More...
 
std::string read_string (void) override
 Read a string out of the message. More...
 
double read_double (void) override
 Read a double out of the message. More...
 
int read_integer (void) override
 Read an integer out of the message. More...
 
void append_strings (const std::vector< std::string > &write_values) override
 Write an array of strings into the message. More...
 
void append_request (const geopm_request_s &request) override
 Write an array of geopm_request_s into the message. More...
 
bool was_success (void) override
 Determine if end of array has been reached. More...
 
- Public Member Functions inherited from geopm::SDBusMessage
 SDBusMessage ()=default
 
virtual ~SDBusMessage ()=default
 

Additional Inherited Members

- Static Public Member Functions inherited from geopm::SDBusMessage
static std::unique_ptr< SDBusMessagemake_unique (sd_bus_message *bus_message)
 Factory method for SDBusMessage interface. More...
 
- Static Public Attributes inherited from geopm::SDBusMessage
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...
 

Constructor & Destructor Documentation

◆ SDBusMessageImp() [1/2]

geopm::SDBusMessageImp::SDBusMessageImp ( )

◆ SDBusMessageImp() [2/2]

geopm::SDBusMessageImp::SDBusMessageImp ( sd_bus_message *  bus_message)

◆ ~SDBusMessageImp()

geopm::SDBusMessageImp::~SDBusMessageImp ( )
virtual

Member Function Documentation

◆ append_request()

void geopm::SDBusMessageImp::append_request ( const geopm_request_s request)
overridevirtual

Write an array of geopm_request_s into the message.

Wrapper around the "sd_bus_message_append(3)" function.

Parameters
[in]Vectorof geopm_request_s to write into the message as an array.

Implements geopm::SDBusMessage.

◆ append_strings()

void geopm::SDBusMessageImp::append_strings ( const std::vector< std::string > &  write_values)
overridevirtual

Write an array of strings into the message.

Wrapper around the "sd_bus_message_append_strv(3)" function.

Parameters
[in]Vectorof strings to write into the message as an array.

Implements geopm::SDBusMessage.

◆ close_container()

void geopm::SDBusMessageImp::close_container ( void  )
overridevirtual

Close a container in the message for writing.

Wrapper around sd_bus_message_close_open_container(3)

Implements geopm::SDBusMessage.

◆ enter_container()

void geopm::SDBusMessageImp::enter_container ( char  type,
const std::string &  contents 
)
overridevirtual

Enter a container in the message for reading.

Wrapper around sd_bus_message_enter_container(3) function.

Parameters
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.

Implements geopm::SDBusMessage.

◆ exit_container()

void geopm::SDBusMessageImp::exit_container ( void  )
overridevirtual

Exit a container in the message for reading.

Wrapper around sd_bus_message_exit_container(3) function.

Implements geopm::SDBusMessage.

◆ get_sd_ptr()

sd_bus_message * geopm::SDBusMessageImp::get_sd_ptr ( void  )
overridevirtual

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.

Returns
Pointer used to construct the object.

Implements geopm::SDBusMessage.

◆ open_container()

void geopm::SDBusMessageImp::open_container ( char  type,
const std::string &  contents 
)
overridevirtual

Open a container in the message for writing.

Wrapper around sd_bus_message_open_container(3)

Parameters
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.

Implements geopm::SDBusMessage.

◆ read_double()

double geopm::SDBusMessageImp::read_double ( void  )
overridevirtual

Read a double out of the message.

Wrapper around the "sd_bus_message_read(3)" function.

Returns
The double that is next in the message.

Implements geopm::SDBusMessage.

◆ read_integer()

int geopm::SDBusMessageImp::read_integer ( void  )
overridevirtual

Read an integer out of the message.

Wrapper around the "sd_bus_message_read(3)" function.

Returns
The integer that is next in the message.

Implements geopm::SDBusMessage.

◆ read_string()

std::string geopm::SDBusMessageImp::read_string ( void  )
overridevirtual

Read a string out of the message.

Wrapper around the "sd_bus_message_read(3)" function.

Returns
The string that is next in the message.

Implements geopm::SDBusMessage.

◆ was_success()

bool geopm::SDBusMessageImp::was_success ( void  )
overridevirtual

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.

Returns
Will return true if last read from object was successful and false otherwise.

Implements geopm::SDBusMessage.


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