Files
sdbus-cpp/examples/org.freedesktop.DBus.ObjectManager/examplemanager-planet1-client-glue.h
Stanislav Angelovič 84a6fbbf86 fix: disable move in generated adaptor and proxy classes (#435)
Moving adaptor or proxy instances changes their `this` pointer. But `this` is captured by value in closures used by those instances, and this remains unchanged on move, leading to accessing an invalid instance when a lambda expression executes. Supporting move semantics would require unsubscribing/unregistering vtable, handlers, etc. and re-subscribing and re-registering all that, which is too complicated and may have side effects. Hence it has been decided that these classes are not moveable. One may use an indirection with e.g. `std::unique_ptr` to get move semantics.
2024-04-24 20:20:29 +02:00

60 lines
1.2 KiB
C++

/*
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
*/
#ifndef __sdbuscpp__examplemanager_planet1_client_glue_h__proxy__H__
#define __sdbuscpp__examplemanager_planet1_client_glue_h__proxy__H__
#include <sdbus-c++/sdbus-c++.h>
#include <string>
#include <tuple>
namespace org {
namespace sdbuscpp {
namespace ExampleManager {
class Planet1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.sdbuscpp.ExampleManager.Planet1";
protected:
Planet1_proxy(sdbus::IProxy& proxy)
: m_proxy(proxy)
{
}
Planet1_proxy(const Planet1_proxy&) = delete;
Planet1_proxy& operator=(const Planet1_proxy&) = delete;
Planet1_proxy(Planet1_proxy&&) = delete;
Planet1_proxy& operator=(Planet1_proxy&&) = delete;
~Planet1_proxy() = default;
void registerProxy()
{
}
public:
uint64_t GetPopulation()
{
uint64_t result;
m_proxy.callMethod("GetPopulation").onInterface(INTERFACE_NAME).storeResultsTo(result);
return result;
}
public:
std::string Name()
{
return m_proxy.getProperty("Name").onInterface(INTERFACE_NAME).get<std::string>();
}
private:
sdbus::IProxy& m_proxy;
};
}}} // namespaces
#endif