forked from Kistler-Group/sdbus-cpp
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.
61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
|
|
/*
|
|
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
|
*/
|
|
|
|
#ifndef __sdbuscpp__perftests_proxy_h__proxy__H__
|
|
#define __sdbuscpp__perftests_proxy_h__proxy__H__
|
|
|
|
#include <sdbus-c++/sdbus-c++.h>
|
|
#include <string>
|
|
#include <tuple>
|
|
|
|
namespace org {
|
|
namespace sdbuscpp {
|
|
|
|
class perftests_proxy
|
|
{
|
|
public:
|
|
static constexpr const char* INTERFACE_NAME = "org.sdbuscpp.perftests";
|
|
|
|
protected:
|
|
perftests_proxy(sdbus::IProxy& proxy)
|
|
: m_proxy(proxy)
|
|
{
|
|
}
|
|
|
|
perftests_proxy(const perftests_proxy&) = delete;
|
|
perftests_proxy& operator=(const perftests_proxy&) = delete;
|
|
perftests_proxy(perftests_proxy&&) = delete;
|
|
perftests_proxy& operator=(perftests_proxy&&) = delete;
|
|
|
|
~perftests_proxy() = default;
|
|
|
|
void registerProxy()
|
|
{
|
|
m_proxy.uponSignal("dataSignal").onInterface(INTERFACE_NAME).call([this](const std::string& data){ this->onDataSignal(data); });
|
|
}
|
|
|
|
virtual void onDataSignal(const std::string& data) = 0;
|
|
|
|
public:
|
|
void sendDataSignals(const uint32_t& numberOfSignals, const uint32_t& signalMsgSize)
|
|
{
|
|
m_proxy.callMethod("sendDataSignals").onInterface(INTERFACE_NAME).withArguments(numberOfSignals, signalMsgSize);
|
|
}
|
|
|
|
std::string concatenateTwoStrings(const std::string& string1, const std::string& string2)
|
|
{
|
|
std::string result;
|
|
m_proxy.callMethod("concatenateTwoStrings").onInterface(INTERFACE_NAME).withArguments(string1, string2).storeResultsTo(result);
|
|
return result;
|
|
}
|
|
|
|
private:
|
|
sdbus::IProxy& m_proxy;
|
|
};
|
|
|
|
}} // namespaces
|
|
|
|
#endif
|