Loading...
Searching...
No Matches
Types.h File Reference
`#include <sdbus-c++/Message.h>`
`#include <sdbus-c++/TypeTraits.h>`
`#include <cstring>`
`#include <cstddef>`
`#include <memory>`
`#include <string>`
`#include <tuple>`
`#include <type_traits>`
`#include <typeinfo>`
`#include <utility>`

Go to the source code of this file.

## Classes

class | sdbus::Variant
class | sdbus::Struct< _ValueTypes >
class | sdbus::ObjectPath
class | sdbus::BusName
class | sdbus::InterfaceName
class | sdbus::MemberName
class | sdbus::Signature
struct | sdbus::UnixFd
struct | std::tuple_element< _I, sdbus::Struct< _ValueTypes... > >
struct | std::tuple_size< sdbus::Struct< _ValueTypes... > >

## Macros

SDBUSCPP_REGISTER_STRUCT

A convenient way to extend sdbus-c++ type system with user-defined structs.

The macro teaches sdbus-c++ to recognize the user-defined struct as a valid C++ representation of a D-Bus Struct type, and enables clients to use their struct conveniently instead of the (too generic and less expressive) sdbus::Struct<...> in sdbus-c++ API.

It also enables to serialize a user-defined struct as an a{sv} dictionary, and to deserialize an a{sv} dictionary into the user-defined struct.

The first argument is the struct type name and the remaining arguments are names of struct members. Members must be of types supported by sdbus-c++ (or of user-defined types that sdbus-c++ was taught to support). Members can be other structs (nesting is supported). The macro must be placed in the global namespace.

For example, given the user-defined struct ABC:

namespace foo { struct ABC { int number; std::string name; std::vector<double> data; }; }

one can teach sdbus-c++ about the contents of this struct simply with:

SDBUSCPP_REGISTER_STRUCT(foo::ABC, number, name, data);

Up to 16 struct members are supported by the macro.

#define | SDBUSCPP_REGISTER_STRUCT(STRUCT, ...)
SDBUSCPP_ENABLE_RELAXED_DICT2STRUCT_DESERIALIZATION

Enables relaxed deserialization of an a{sv} dictionary into a user-defined struct STRUCT.

The default (strict) deserialization mode is that if there are entries in the dictionary which do not have a corresponding field in the struct, an exception is thrown. In the relaxed mode, such entries are silently skipped.

The macro can only be used in combination with SDBUSCPP_REGISTER_STRUCT macro, and must be placed before SDBUSCPP_REGISTER_STRUCT macro.

#define | SDBUSCPP_ENABLE_RELAXED_DICT2STRUCT_DESERIALIZATION(STRUCT)
SDBUSCPP_ENABLE_NESTED_STRUCT2DICT_SERIALIZATION

Enables nested serialization of user-defined struct STRUCT as an a{sv} dictionary.

By default, STRUCT fields which are structs themselves are serialized as D-Bus structs. This macro tells sdbus-c++ to also serialize nested structs, in a recursive fashion, as a{sv} dictionaries.

The macro can only be used in combination with SDBUSCPP_REGISTER_STRUCT macro, and must be placed before SDBUSCPP_REGISTER_STRUCT macro.

#define | SDBUSCPP_ENABLE_NESTED_STRUCT2DICT_SERIALIZATION(STRUCT)

## Typedefs

using | sdbus::ConnectionName = BusName
using | sdbus::MethodName = MemberName
using | sdbus::SignalName = MemberName
using | sdbus::PropertyName = MemberName
template<typename _T1, typename _T2>
using | sdbus::DictEntry = std::pair<_T1, _T2>

## Functions

template<typename... _Elements>
| sdbus::Struct (_Elements...) -> Struct< _Elements... >
template<typename... _Elements>
constexpr Struct< std::decay_t< _Elements >... > | sdbus::make_struct (_Elements &&... args)

## Detailed Description

(C) 2016 - 2021 KISTLER INSTRUMENTE AG, Winterthur, Switzerland (C) 2016 - 2024 Stanislav Angelovic stani.nosp@m.slav.nosp@m..ange.nosp@m.lovi.nosp@m.c@pro.nosp@m.tonm.nosp@m.ail.c.nosp@m.om

Created on: Nov 23, 2016 Project: sdbus-c++ Description: High-level D-Bus IPC C++ library based on sd-bus

This file is part of sdbus-c++.

sdbus-c++ is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any later version.

sdbus-c++ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with sdbus-c++. If not, see http://www.gnu.org/licenses/.

## Macro Definition Documentation

## SDBUSCPP_ENABLE_NESTED_STRUCT2DICT_SERIALIZATION

#define SDBUSCPP_ENABLE_NESTED_STRUCT2DICT_SERIALIZATION | ( |  | STRUCT | ) |

Value:
template <> \
constexpr auto sdbus::nested_struct_as_dict_serialization_v<STRUCT> = true \

## SDBUSCPP_ENABLE_RELAXED_DICT2STRUCT_DESERIALIZATION

#define SDBUSCPP_ENABLE_RELAXED_DICT2STRUCT_DESERIALIZATION | ( |  | STRUCT | ) |

Value:
template <> \
constexpr auto sdbus::strict_dict_as_struct_deserialization_v<STRUCT> = false; \

## Typedef Documentation

## DictEntry

template<typename _T1, typename _T2>

using sdbus::DictEntry = std::pair<_T1, _T2>

DictEntry is implemented as std::pair, a standard value_type in STL(-like) associative containers.