forked from Kistler-Group/sdbus-cpp
Add emit prefix to generated signal emitting methods
This commit is contained in:
committed by
Stanislav Angelovič
parent
dbeaf87208
commit
fbb5242729
@ -91,8 +91,11 @@ v0.6.0
|
|||||||
- Use release v1.8.1 of googletest for tests
|
- Use release v1.8.1 of googletest for tests
|
||||||
|
|
||||||
vX.Y.Z
|
vX.Y.Z
|
||||||
- [[Breaking ABI change]] Added support for ObjectManager and other standard D-Bus interfaces
|
- [[Breaking ABI change]] Added full support for ObjectManager, Properties and other standard D-Bus interfaces (Reordering virtual functions in interface classes)
|
||||||
- sdbus-c++ now can automatically download, build and incorporate libsystemd static library, which makes things pretty easy in non-systemd environments
|
- sdbus-c++ now can automatically download, build and incorporate libsystemd static library, which makes things pretty easy in non-systemd environments
|
||||||
|
- Minor changes in generated proxy/adaptor code:
|
||||||
|
* renamed interfaceName to INTERFACE_NAME to avoid potential naming clashes
|
||||||
|
* signal emitting methods now begin with "emit" prefix and capitalized first letter of signal name
|
||||||
- sdbus-c++ file organization has been adjusted to comply to de-facto OSS project standards
|
- sdbus-c++ file organization has been adjusted to comply to de-facto OSS project standards
|
||||||
- Build system improvements -- moving towards more modern CMake
|
- Build system improvements -- moving towards more modern CMake
|
||||||
- Using googletest from master branch instead of v1.8.1 which has THREADS_PTHREAD_ARG issue when cross-compiling
|
- Using googletest from master branch instead of v1.8.1 which has THREADS_PTHREAD_ARG issue when cross-compiling
|
||||||
|
@ -552,7 +552,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void concatenated(const std::string& concatenatedString)
|
void emitConcatenated(const std::string& concatenatedString)
|
||||||
{
|
{
|
||||||
object_.emitSignal("concatenated").onInterface(INTERFACE_NAME).withArguments(concatenatedString);
|
object_.emitSignal("concatenated").onInterface(INTERFACE_NAME).withArguments(concatenatedString);
|
||||||
}
|
}
|
||||||
@ -666,7 +666,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Emit the 'concatenated' signal with the resulting string
|
// Emit the 'concatenated' signal with the resulting string
|
||||||
concatenated(result);
|
emitConcatenated(result);
|
||||||
|
|
||||||
// Return the resulting string
|
// Return the resulting string
|
||||||
return result;
|
return result;
|
||||||
@ -869,7 +869,7 @@ void concatenate(sdbus::Result<std::string>&& result, std::vector<int32_t> numbe
|
|||||||
methodResult.returnReply(result);
|
methodResult.returnReply(result);
|
||||||
|
|
||||||
// Emit the 'concatenated' signal with the resulting string
|
// Emit the 'concatenated' signal with the resulting string
|
||||||
this->concatenated(result);
|
this->emitConcatenated(result);
|
||||||
}).detach();
|
}).detach();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -28,7 +28,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void dataSignal(const std::string& data)
|
void emitDataSignal(const std::string& data)
|
||||||
{
|
{
|
||||||
object_.emitSignal("dataSignal").onInterface(INTERFACE_NAME).withArguments(data);
|
object_.emitSignal("dataSignal").onInterface(INTERFACE_NAME).withArguments(data);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ protected:
|
|||||||
for (uint32_t i = 0; i < numberOfSignals; ++i)
|
for (uint32_t i = 0; i < numberOfSignals; ++i)
|
||||||
{
|
{
|
||||||
// Emit signal
|
// Emit signal
|
||||||
dataSignal(data);
|
emitDataSignal(data);
|
||||||
}
|
}
|
||||||
auto stop_time = std::chrono::steady_clock::now();
|
auto stop_time = std::chrono::steady_clock::now();
|
||||||
std::cout << "Server sent " << numberOfSignals << " signals in: " << std::chrono::duration_cast<std::chrono::milliseconds>(stop_time - start_time).count() << " ms" << std::endl;
|
std::cout << "Server sent " << numberOfSignals << " signals in: " << std::chrono::duration_cast<std::chrono::milliseconds>(stop_time - start_time).count() << " ms" << std::endl;
|
||||||
|
@ -28,7 +28,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void concatenatedSignal(const std::string& concatenatedString)
|
void emitConcatenatedSignal(const std::string& concatenatedString)
|
||||||
{
|
{
|
||||||
object_.emitSignal("concatenatedSignal").onInterface(INTERFACE_NAME).withArguments(concatenatedString);
|
object_.emitSignal("concatenatedSignal").onInterface(INTERFACE_NAME).withArguments(concatenatedString);
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ public:
|
|||||||
|
|
||||||
request.result.returnResults(resultString);
|
request.result.returnResults(resultString);
|
||||||
|
|
||||||
concatenatedSignal(resultString);
|
emitConcatenatedSignal(resultString);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
#include <cctype>
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
@ -202,7 +203,7 @@ std::tuple<std::string, std::string> AdaptorGenerator::processMethods(const Node
|
|||||||
|
|
||||||
std::string argStr, argTypeStr;
|
std::string argStr, argTypeStr;
|
||||||
std::tie(argStr, argTypeStr, std::ignore) = argsToNamesAndTypes(inArgs, async);
|
std::tie(argStr, argTypeStr, std::ignore) = argsToNamesAndTypes(inArgs, async);
|
||||||
|
|
||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
||||||
registrationSS << tab << tab << "object_.registerMethod(\""
|
registrationSS << tab << tab << "object_.registerMethod(\""
|
||||||
@ -270,7 +271,10 @@ std::tuple<std::string, std::string> AdaptorGenerator::processSignals(const Node
|
|||||||
signalRegistrationSS << annotationRegistration;
|
signalRegistrationSS << annotationRegistration;
|
||||||
signalRegistrationSS << ";" << endl;
|
signalRegistrationSS << ";" << endl;
|
||||||
|
|
||||||
signalMethodSS << tab << "void " << name << "(" << argTypeStr << ")" << endl
|
auto nameWithCapFirstLetter = name;
|
||||||
|
nameWithCapFirstLetter[0] = std::toupper(nameWithCapFirstLetter[0]);
|
||||||
|
|
||||||
|
signalMethodSS << tab << "void emit" << nameWithCapFirstLetter << "(" << argTypeStr << ")" << endl
|
||||||
<< tab << "{" << endl
|
<< tab << "{" << endl
|
||||||
<< tab << tab << "object_.emitSignal(\"" << name << "\")"
|
<< tab << tab << "object_.emitSignal(\"" << name << "\")"
|
||||||
".onInterface(INTERFACE_NAME)";
|
".onInterface(INTERFACE_NAME)";
|
||||||
|
Reference in New Issue
Block a user