[DEV] correct interface declaration
This commit is contained in:
parent
abb334a3a2
commit
67d644353f
@ -21,7 +21,7 @@ namespace esignal {
|
||||
template<class... T_ARGS>
|
||||
class ISignal : public Signal<T_ARGS...> {
|
||||
protected:
|
||||
esignal::Interface& m_signalInterfaceLink; //!< interface of the signal manager.
|
||||
esignal::Interface* m_signalInterfaceLink; //!< interface of the signal manager.
|
||||
std::string m_name; //!< name of the signal.
|
||||
std::string m_description; //!< description of the signal.
|
||||
public:
|
||||
@ -36,10 +36,10 @@ namespace esignal {
|
||||
ISignal(CLASS_TYPE* _signalInterfaceLink,
|
||||
FUNC_TYPE _func,
|
||||
const std::string& _name,
|
||||
const std::string& _description = "");
|
||||
ISignal(esignal::Interface& _signalInterfaceLink,
|
||||
const std::string& _description);
|
||||
ISignal(esignal::Interface* _signalInterfaceLink,
|
||||
const std::string& _name,
|
||||
const std::string& _description = "");
|
||||
const std::string& _description);
|
||||
/**
|
||||
* @brief Destructor.
|
||||
*/
|
||||
@ -56,10 +56,12 @@ esignal::ISignal<T_ARGS...>::ISignal(CLASS_TYPE* _class,
|
||||
const std::string& _name,
|
||||
const std::string& _description) :
|
||||
esignal::Signal<T_ARGS...>(_class, _func),
|
||||
m_signalInterfaceLink(*_class),
|
||||
m_signalInterfaceLink(_class),
|
||||
m_name(_name),
|
||||
m_description(_description) {
|
||||
// add a reference on the current signal ...
|
||||
m_signalInterfaceLink.signalAdd(this);
|
||||
if (m_signalInterfaceLink != nullptr) {
|
||||
m_signalInterfaceLink->signalAdd(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,19 +11,23 @@
|
||||
#include <esignal/details/Signal.hxx>
|
||||
|
||||
template<class... T_ARGS>
|
||||
esignal::ISignal<T_ARGS...>::ISignal(esignal::Interface& _signalInterfaceLink,
|
||||
esignal::ISignal<T_ARGS...>::ISignal(esignal::Interface* _signalInterfaceLink,
|
||||
const std::string& _name,
|
||||
const std::string& _description):
|
||||
m_signalInterfaceLink(_signalInterfaceLink),
|
||||
m_name(_name),
|
||||
m_description(_description) {
|
||||
// add a reference on the current signal ...
|
||||
m_signalInterfaceLink.signalAdd(this);
|
||||
if (m_signalInterfaceLink != nullptr) {
|
||||
m_signalInterfaceLink->signalAdd(this);
|
||||
}
|
||||
}
|
||||
|
||||
template<class... T_ARGS>
|
||||
esignal::ISignal<T_ARGS...>::~ISignal() {
|
||||
m_signalInterfaceLink.signalRemove(this);
|
||||
if (m_signalInterfaceLink != nullptr) {
|
||||
m_signalInterfaceLink->signalRemove(this);
|
||||
}
|
||||
}
|
||||
|
||||
template<class... T_ARGS>
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "etk-test"
|
||||
#define __class__ "esignal-test"
|
||||
|
||||
int main(int _argc, const char *_argv[]) {
|
||||
::testing::InitGoogleTest(&_argc, const_cast<char **>(_argv));
|
||||
|
@ -26,8 +26,8 @@ class testISignal : public esignal::Interface {
|
||||
size_t m_count;
|
||||
testISignal():
|
||||
m_signalInt(this, &testISignal::changeCount, "int", "desc int"),
|
||||
m_signalString(*this, "string", "desc string"),
|
||||
m_signalFloat(*this, "float", "desc float") {
|
||||
m_signalString(this, "string", "desc string"),
|
||||
m_signalFloat(this, "float", "desc float") {
|
||||
m_count = 0;
|
||||
}
|
||||
void changeCount(size_t _a) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user