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
+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)