utility.h File Reference
#include <dbus-cxx/callmessage.h>
#include <dbus-cxx/returnmessage.h>
#include <dbus-cxx/demangle.h>
#include <dbus-cxx/messageiterator.h>
#include <dbus-cxx/signature.h>
#include <dbus-cxx/simplelogger_defs.h>
#include <functional>
#include <memory>
#include <sstream>
#include <string>
#include <tuple>
#include <typeinfo>
#include <vector>
#include <sigc++/sigc++.h>
#include <chrono>
#include <dbus-cxx/multiplereturn.h>
Include dependency graph for utility.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  DBus::priv::method_signature<>
 
class  DBus::priv::method_signature< arg1, argn... >
 
class  DBus::priv::multireturn_signature<>
 
class  DBus::priv::multireturn_signature< arg1, argn... >
 
struct  DBus::priv::dbus_function_traits< std::function< void(Args...)> >
 
struct  DBus::priv::dbus_function_traits< std::function< T_ret(Args...)> >
 
struct  DBus::priv::dbus_function_traits< std::function< DBus::MultipleReturn< T_ret... >(Args...)> >
 

Namespaces

 DBus
 Global DBus namespace, where everything happens.
 
 DBus::priv
 Private namespace for internal dbux-cxx implementation.
 

Macros

#define DBUS_CXX_INTROSPECTABLE_INTERFACE   "org.freedesktop.DBus.Introspectable"
 
#define DBUS_CXX_PEER_INTERFACE   "org.freedesktop.DBus.Peer"
 
#define DBUS_CXX_PROPERTIES_INTERFACE   "org.freedesktop.DBus.Properties"
 
#define DBUS_CXX_PROPERTY_EMITS_CHANGE_SIGNAL_ANNOTATION   "org.freedesktop.DBus.Property.EmitsChangedSignal"
 
#define DBUS_CXX_ITERATOR_SUPPORT(CppType, DBusType)
 Provides support for unsupported types that can be cast to DBus supported types. More...
 

Functions

void DBus::set_logging_function (::simplelogger_log_function function)
 Set the callback function that is used for printing log messages. More...
 
void DBus::log_std_err (const char *logger_name, const struct ::SL_LogLocation *location, const enum ::SL_LogLevel level, const char *log_string)
 Log messages to stderr(std::cerr). More...
 
void DBus::set_log_level (const enum ::SL_LogLevel level)
 When used in conjunction with DBus::logStdErr, will only print out log messages above the set level. More...
 
void DBus::hexdump (const std::vector< uint8_t > *vec, std::ostream *stream)
 Print the vector as a hexdump output to the given output stream. More...
 
void DBus::hexdump (const uint8_t *vec, const uint32_t len, std::ostream *stream)
 Print the C array as a hexdump output to the given output stream. More...
 
void DBus::set_default_endianess (DBus::Endianess endianess)
 Set the default endianess that the library uses in order to send messages. More...
 
DBus::Endianess DBus::default_endianess ()
 
std::tuple< bool, int, std::vector< int >, std::chrono::milliseconds > DBus::priv::wait_for_fd_activity (std::vector< int > fds, int timeout_ms)
 Wait for activity on any of the given FDs. More...
 

Macro Definition Documentation

◆ DBUS_CXX_INTROSPECTABLE_INTERFACE

#define DBUS_CXX_INTROSPECTABLE_INTERFACE   "org.freedesktop.DBus.Introspectable"

◆ DBUS_CXX_ITERATOR_SUPPORT

#define DBUS_CXX_ITERATOR_SUPPORT (   CppType,
  DBusType 
)
Value:
inline \
DBus::MessageIterator& operator>>(DBus::MessageIterator& __msgiter, CppType& __cpptype) \
{ \
DBusType __dbustype; \
__msgiter >> __dbustype; \
__cpptype = static_cast< CppType >( __dbustype ); \
return __msgiter; \
} \
\
inline \
DBus::MessageAppendIterator& operator<<(DBus::MessageAppendIterator& __msgiter, CppType& __cpptype) \
{ \
__msgiter << static_cast< DBusType >( __cpptype ); \
return __msgiter; \
} \
\
namespace DBus { \
inline std::string signature( CppType ) { DBusType d; return signature( d ); } \
}
Insertion iterator allow values to be appended to a message.
Definition: messageappenditerator.h:38
Extraction iterator allowing values to be retrieved from a message.
Definition: messageiterator.h:56
Global DBus namespace, where everything happens.
Definition: callmessage.cpp:18
std::shared_ptr< DBus::Connection > operator<<(std::shared_ptr< DBus::Connection > ptr, std::shared_ptr< DBus::Message > msg)
Definition: connection.h:431
DBus::MessageIterator operator>>(std::shared_ptr< const DBus::Message > ptr, T &value)
Definition: message.h:183
std::string signature(const std::tuple< T... > &)

Provides support for unsupported types that can be cast to DBus supported types.

This macro provides message iterator and introspection support for types that are not supported by the DBus native types, but can be static_cast<> to a DBus native type. Typically, this is an enum.

Parameters
CppTypeThe unsupported type. Must be able to static_cast<> to DBusType
DBusTypeOne of the types inherently supported by dbus-cxx

Example supporting an enum as a 32-bit int:

typedef MyEnum { ZERO, ONE, TWO, THREE } MyEnum;
DBUS_CXX_ITERATOR_SUPPORT( MyEnum, uint32_t )
#define DBUS_CXX_ITERATOR_SUPPORT(CppType, DBusType)
Provides support for unsupported types that can be cast to DBus supported types.
Definition: utility.h:60

◆ DBUS_CXX_PEER_INTERFACE

#define DBUS_CXX_PEER_INTERFACE   "org.freedesktop.DBus.Peer"

◆ DBUS_CXX_PROPERTIES_INTERFACE

#define DBUS_CXX_PROPERTIES_INTERFACE   "org.freedesktop.DBus.Properties"

◆ DBUS_CXX_PROPERTY_EMITS_CHANGE_SIGNAL_ANNOTATION

#define DBUS_CXX_PROPERTY_EMITS_CHANGE_SIGNAL_ANNOTATION   "org.freedesktop.DBus.Property.EmitsChangedSignal"