Clean up some names (rename classes, methods, files)

* ConvenienceClasses.h/.inl/.cpp -> ConvenienceApiClasses.h/.inl/.cpp
  * IObjectProxy class -> IProxy
  * Interfaces class -> AdaptorInterfaces
  * Interfaces.h -> split into AdaptorInterfaces.h and ProxyInterfaces.h
  * createObjectProxy() method -> createProxy()
This commit is contained in:
sangelovic
2019-04-09 21:28:07 +02:00
parent e7c78460cf
commit 93b6e5237a
30 changed files with 421 additions and 318 deletions
+2 -2
View File
@@ -54,10 +54,10 @@ set(INTEGRATIONTESTS_SRCS
set(PERFTESTS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/perftests)
set(STRESSTESTS_CLIENT_SRCS
${PERFTESTS_SOURCE_DIR}/client.cpp
${PERFTESTS_SOURCE_DIR}/perftest-proxy.h)
${PERFTESTS_SOURCE_DIR}/perftests-proxy.h)
set(STRESSTESTS_SERVER_SRCS
${PERFTESTS_SOURCE_DIR}/server.cpp
${PERFTESTS_SOURCE_DIR}/perftest-adaptor.h)
${PERFTESTS_SOURCE_DIR}/perftests-adaptor.h)
set(STRESSTESTS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/stresstests)
set(STRESSTESTS_SRCS
+2 -2
View File
@@ -31,11 +31,11 @@
#include <chrono>
#include <atomic>
class TestingAdaptor : public sdbus::Interfaces<testing_adaptor>
class TestingAdaptor : public sdbus::AdaptorInterfaces<testing_adaptor>
{
public:
TestingAdaptor(sdbus::IConnection& connection) :
sdbus::Interfaces<::testing_adaptor>(connection, OBJECT_PATH) { }
sdbus::AdaptorInterfaces<::testing_adaptor>(connection, OBJECT_PATH) { }
virtual ~TestingAdaptor() { }
+2 -2
View File
@@ -34,7 +34,7 @@
class testing_proxy
{
protected:
testing_proxy(sdbus::IObjectProxy& object) :
testing_proxy(sdbus::IProxy& object) :
object_(object)
{
object_.uponSignal("simpleSignal").onInterface(INTERFACE_NAME).call([this](){ this->onSimpleSignal(); });
@@ -231,7 +231,7 @@ public:
private:
sdbus::IObjectProxy& object_;
sdbus::IProxy& object_;
};
+3 -3
View File
@@ -23,7 +23,7 @@
* along with sdbus-c++. If not, see <http://www.gnu.org/licenses/>.
*/
#include "perftest-proxy.h"
#include "perftests-proxy.h"
#include <sdbus-c++/sdbus-c++.h>
#include <vector>
#include <string>
@@ -36,11 +36,11 @@
using namespace std::chrono_literals;
class PerftestClient : public sdbus::ProxyInterfaces<org::sdbuscpp::perftest_proxy>
class PerftestClient : public sdbus::ProxyInterfaces<org::sdbuscpp::perftests_proxy>
{
public:
PerftestClient(std::string destination, std::string objectPath)
: sdbus::ProxyInterfaces<org::sdbuscpp::perftest_proxy>(std::move(destination), std::move(objectPath))
: sdbus::ProxyInterfaces<org::sdbuscpp::perftests_proxy>(std::move(destination), std::move(objectPath))
{
}
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<node name="/org/sdbuscpp/perftest">
<interface name="org.sdbuscpp.perftest">
<interface name="org.sdbuscpp.perftests">
<method name="sendDataSignals">
<arg type="u" name="numberOfSignals" direction="in" />
<arg type="u" name="signalMsgSize" direction="in" />
@@ -1,6 +1,6 @@
/*
* This file was automatically generated by sdbuscpp-xml2cpp; DO NOT EDIT!
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
*/
#ifndef __sdbuscpp__perftest_adaptor_h__adaptor__H__
@@ -13,13 +13,13 @@
namespace org {
namespace sdbuscpp {
class perftest_adaptor
class perftests_adaptor
{
public:
static constexpr const char* interfaceName = "org.sdbuscpp.perftests";
protected:
perftest_adaptor(sdbus::IObject& object)
perftests_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("sendDataSignals").onInterface(interfaceName).implementedAs([this](const uint32_t& numberOfSignals, const uint32_t& signalMsgSize){ return this->sendDataSignals(numberOfSignals, signalMsgSize); });
@@ -1,6 +1,6 @@
/*
* This file was automatically generated by sdbuscpp-xml2cpp; DO NOT EDIT!
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
*/
#ifndef __sdbuscpp__perftest_proxy_h__proxy__H__
@@ -13,16 +13,16 @@
namespace org {
namespace sdbuscpp {
class perftest_proxy
class perftests_proxy
{
public:
static constexpr const char* interfaceName = "org.sdbuscpp.perftests";
protected:
perftest_proxy(sdbus::IObjectProxy& object)
: object_(object)
perftests_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
object_.uponSignal("dataSignal").onInterface(interfaceName).call([this](const std::string& data){ this->onDataSignal(data); });
proxy_.uponSignal("dataSignal").onInterface(interfaceName).call([this](const std::string& data){ this->onDataSignal(data); });
}
virtual void onDataSignal(const std::string& data) = 0;
@@ -30,18 +30,18 @@ protected:
public:
void sendDataSignals(const uint32_t& numberOfSignals, const uint32_t& signalMsgSize)
{
object_.callMethod("sendDataSignals").onInterface(interfaceName).withArguments(numberOfSignals, signalMsgSize);
proxy_.callMethod("sendDataSignals").onInterface(interfaceName).withArguments(numberOfSignals, signalMsgSize);
}
std::string concatenateTwoStrings(const std::string& string1, const std::string& string2)
{
std::string result;
object_.callMethod("concatenateTwoStrings").onInterface(interfaceName).withArguments(string1, string2).storeResultsTo(result);
proxy_.callMethod("concatenateTwoStrings").onInterface(interfaceName).withArguments(string1, string2).storeResultsTo(result);
return result;
}
private:
sdbus::IObjectProxy& object_;
sdbus::IProxy& proxy_;
};
}} // namespaces
+3 -3
View File
@@ -23,7 +23,7 @@
* along with sdbus-c++. If not, see <http://www.gnu.org/licenses/>.
*/
#include "perftest-adaptor.h"
#include "perftests-adaptor.h"
#include <sdbus-c++/sdbus-c++.h>
#include <vector>
#include <string>
@@ -35,11 +35,11 @@ using namespace std::chrono_literals;
std::string createRandomString(size_t length);
class PerftestServer : public sdbus::Interfaces<org::sdbuscpp::perftest_adaptor>
class PerftestServer : public sdbus::AdaptorInterfaces<org::sdbuscpp::perftests_adaptor>
{
public:
PerftestServer(sdbus::IConnection& connection, std::string objectPath)
: sdbus::Interfaces<org::sdbuscpp::perftest_adaptor>(connection, std::move(objectPath))
: sdbus::AdaptorInterfaces<org::sdbuscpp::perftests_adaptor>(connection, std::move(objectPath))
{
}
+4 -4
View File
@@ -21,8 +21,8 @@ public:
static constexpr const char* interfaceName = "org.sdbuscpp.stresstests.celsius.thermometer";
protected:
thermometer_proxy(sdbus::IObjectProxy& object)
: object_(object)
thermometer_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
@@ -30,12 +30,12 @@ public:
uint32_t getCurrentTemperature()
{
uint32_t result;
object_.callMethod("getCurrentTemperature").onInterface(interfaceName).storeResultsTo(result);
proxy_.callMethod("getCurrentTemperature").onInterface(interfaceName).storeResultsTo(result);
return result;
}
private:
sdbus::IObjectProxy& object_;
sdbus::IProxy& proxy_;
};
}}}} // namespaces
+5 -5
View File
@@ -20,10 +20,10 @@ public:
static constexpr const char* interfaceName = "org.sdbuscpp.stresstests.concatenator";
protected:
concatenator_proxy(sdbus::IObjectProxy& object)
: object_(object)
concatenator_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
object_.uponSignal("concatenatedSignal").onInterface(interfaceName).call([this](const std::string& concatenatedString){ this->onConcatenatedSignal(concatenatedString); });
proxy_.uponSignal("concatenatedSignal").onInterface(interfaceName).call([this](const std::string& concatenatedString){ this->onConcatenatedSignal(concatenatedString); });
}
virtual void onConcatenatedSignal(const std::string& concatenatedString) = 0;
@@ -33,11 +33,11 @@ protected:
public:
void concatenate(const std::map<std::string, sdbus::Variant>& params)
{
object_.callMethodAsync("concatenate").onInterface(interfaceName).withArguments(params).uponReplyInvoke([this](const sdbus::Error* error, const std::string& result){ this->onConcatenateReply(result, error); });
proxy_.callMethodAsync("concatenate").onInterface(interfaceName).withArguments(params).uponReplyInvoke([this](const sdbus::Error* error, const std::string& result){ this->onConcatenateReply(result, error); });
}
private:
sdbus::IObjectProxy& object_;
sdbus::IProxy& proxy_;
};
}}} // namespaces
@@ -21,8 +21,8 @@ public:
static constexpr const char* interfaceName = "org.sdbuscpp.stresstests.fahrenheit.thermometer";
protected:
thermometer_proxy(sdbus::IObjectProxy& object)
: object_(object)
thermometer_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
@@ -30,12 +30,12 @@ public:
uint32_t getCurrentTemperature()
{
uint32_t result;
object_.callMethod("getCurrentTemperature").onInterface(interfaceName).storeResultsTo(result);
proxy_.callMethod("getCurrentTemperature").onInterface(interfaceName).storeResultsTo(result);
return result;
}
private:
sdbus::IObjectProxy& object_;
sdbus::IProxy& proxy_;
};
}}}} // namespaces
@@ -52,8 +52,8 @@ public:
static constexpr const char* interfaceName = "org.sdbuscpp.stresstests.fahrenheit.thermometer.factory";
protected:
factory_proxy(sdbus::IObjectProxy& object)
: object_(object)
factory_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
@@ -61,17 +61,17 @@ public:
sdbus::ObjectPath createDelegateObject()
{
sdbus::ObjectPath result;
object_.callMethod("createDelegateObject").onInterface(interfaceName).storeResultsTo(result);
proxy_.callMethod("createDelegateObject").onInterface(interfaceName).storeResultsTo(result);
return result;
}
void destroyDelegateObject(const sdbus::ObjectPath& delegate)
{
object_.callMethod("destroyDelegateObject").onInterface(interfaceName).withArguments(delegate).dontExpectReply();
proxy_.callMethod("destroyDelegateObject").onInterface(interfaceName).withArguments(delegate).dontExpectReply();
}
private:
sdbus::IObjectProxy& object_;
sdbus::IProxy& proxy_;
};
}}}}} // namespaces
+8 -8
View File
@@ -52,10 +52,10 @@ using namespace std::string_literals;
#define FAHRENHEIT_THERMOMETER_OBJECT_PATH "/org/sdbuscpp/stresstests/fahrenheit/thermometer"s
#define CONCATENATOR_OBJECT_PATH "/org/sdbuscpp/stresstests/concatenator"s
class CelsiusThermometerAdaptor : public sdbus::Interfaces<org::sdbuscpp::stresstests::celsius::thermometer_adaptor>
class CelsiusThermometerAdaptor : public sdbus::AdaptorInterfaces<org::sdbuscpp::stresstests::celsius::thermometer_adaptor>
{
public:
using sdbus::Interfaces<org::sdbuscpp::stresstests::celsius::thermometer_adaptor>::Interfaces;
using sdbus::AdaptorInterfaces<org::sdbuscpp::stresstests::celsius::thermometer_adaptor>::AdaptorInterfaces;
protected:
virtual uint32_t getCurrentTemperature() override
@@ -73,13 +73,13 @@ public:
using sdbus::ProxyInterfaces<org::sdbuscpp::stresstests::celsius::thermometer_proxy>::ProxyInterfaces;
};
class FahrenheitThermometerAdaptor : public sdbus::Interfaces< org::sdbuscpp::stresstests::fahrenheit::thermometer_adaptor
, org::sdbuscpp::stresstests::fahrenheit::thermometer::factory_adaptor >
class FahrenheitThermometerAdaptor : public sdbus::AdaptorInterfaces< org::sdbuscpp::stresstests::fahrenheit::thermometer_adaptor
, org::sdbuscpp::stresstests::fahrenheit::thermometer::factory_adaptor >
{
public:
FahrenheitThermometerAdaptor(sdbus::IConnection& connection, std::string objectPath)
: sdbus::Interfaces< org::sdbuscpp::stresstests::fahrenheit::thermometer_adaptor
, org::sdbuscpp::stresstests::fahrenheit::thermometer::factory_adaptor >(connection, std::move(objectPath))
: sdbus::AdaptorInterfaces< org::sdbuscpp::stresstests::fahrenheit::thermometer_adaptor
, org::sdbuscpp::stresstests::fahrenheit::thermometer::factory_adaptor >(connection, std::move(objectPath))
, celsiusProxy_(connection, SERVICE_2_BUS_NAME, CELSIUS_THERMOMETER_OBJECT_PATH)
{
unsigned int workers = std::thread::hardware_concurrency();
@@ -189,11 +189,11 @@ public:
, org::sdbuscpp::stresstests::fahrenheit::thermometer::factory_proxy >::ProxyInterfaces;
};
class ConcatenatorAdaptor : public sdbus::Interfaces<org::sdbuscpp::stresstests::concatenator_adaptor>
class ConcatenatorAdaptor : public sdbus::AdaptorInterfaces<org::sdbuscpp::stresstests::concatenator_adaptor>
{
public:
ConcatenatorAdaptor(sdbus::IConnection& connection, std::string objectPath)
: sdbus::Interfaces<org::sdbuscpp::stresstests::concatenator_adaptor>(connection, std::move(objectPath))
: sdbus::AdaptorInterfaces<org::sdbuscpp::stresstests::concatenator_adaptor>(connection, std::move(objectPath))
{
unsigned int workers = std::thread::hardware_concurrency();
if (workers < 4)