Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
602bb39ff2 | |||
5d8044756a | |||
69efe4f5b6 | |||
888a70d767 | |||
e103df58cd | |||
b64a3bfcb0 | |||
a2788997fd | |||
6ab7be7799 | |||
afca4fd646 | |||
31e74185c8 | |||
8b97705cb1 | |||
7f9b6b01c5 | |||
bf72807cef | |||
a2209a6a0e | |||
73f02160b5 | |||
ea6e306ee6 | |||
59ad3091d3 |
32
.travis.yml
32
.travis.yml
@@ -1,6 +1,7 @@
|
||||
language: cpp
|
||||
|
||||
sudo: false
|
||||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
branches:
|
||||
only:
|
||||
@@ -14,24 +15,24 @@ addons:
|
||||
packages:
|
||||
- g++-4.9
|
||||
- expect
|
||||
#- binutils-mingw-w64-x86-64 # 64bit MinGW
|
||||
#- gcc-mingw-w64-x86-64
|
||||
#- g++-mingw-w64-x86-64
|
||||
- binutils-mingw-w64-x86-64 # 64bit MinGW
|
||||
- gcc-mingw-w64-x86-64
|
||||
- g++-mingw-w64-x86-64
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
env: CONF=debug BUILDER=gcc TARGET=Linux TAG=Linux COMPILATOR_OPTION="--compilator-version=4.9" GCOV=--gcov
|
||||
env: CONF=release BUILDER=gcc TARGET=Linux TAG=Linux COMPILATOR_OPTION="--compilator-version=4.9" GCOV=--gcov
|
||||
compiler: gcc
|
||||
- os: linux
|
||||
env: CONF=debug BUILDER=clang TARGET=Linux
|
||||
compiler: clang
|
||||
#- os: linux
|
||||
# env: CONF=release BUILDER=gcc TARGET=Windows TAG=Mingw
|
||||
# compiler: x86_64-w64-mingw32-gcc
|
||||
#- os: linux
|
||||
# env: CONF=release BUILDER=gcc TARGET=Android TAG=Android DISABLE_PACKAGE=-p
|
||||
# compiler: gcc
|
||||
- os: linux
|
||||
env: CONF=release BUILDER=gcc TARGET=Windows TAG=Mingw
|
||||
compiler: x86_64-w64-mingw32-gcc
|
||||
- os: linux
|
||||
env: CONF=release BUILDER=gcc TARGET=Android TAG=Android DISABLE_PACKAGE=-p
|
||||
compiler: gcc
|
||||
- os: osx
|
||||
env: CONF=release BUILDER=clang TARGET=MacOs TAG=MacOs
|
||||
compiler: clang
|
||||
@@ -39,7 +40,6 @@ matrix:
|
||||
env: CONF=release BUILDER=clang TARGET=IOs TAG=IOs
|
||||
compiler: clang
|
||||
|
||||
|
||||
install:
|
||||
- cd ..
|
||||
- pip install --user lutin
|
||||
@@ -52,7 +52,9 @@ install:
|
||||
|
||||
before_script:
|
||||
- cd ..
|
||||
- git clone https://github.com/atria-soft/etk.git -b $TRAVIS_BRANCH
|
||||
- git clone https://github.com/atria-soft/elog.git
|
||||
- git clone https://github.com/atria-soft/etk.git
|
||||
- git clone https://github.com/atria-soft/ememory.git
|
||||
- git clone https://github.com/generic-library/gtest-lutin.git --recursive
|
||||
- git clone https://github.com/generic-library/z-lutin.git --recursive
|
||||
- pwd
|
||||
@@ -63,14 +65,14 @@ before_script:
|
||||
- ./ci/build_send.py --tag=$TAG --status=START;
|
||||
|
||||
script:
|
||||
- lutin -w -j4 -C -P -t$TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF $GCOV $DISABLE_PACKAGE esignal-*; STATUS=$?
|
||||
- lutin -w -j4 -C -P -t $TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF $GCOV $DISABLE_PACKAGE esignal-*; STATUS=$?
|
||||
- ./ci/build_send.py --tag=$TAG --status="$STATUS";
|
||||
|
||||
after_script:
|
||||
- if [ "$GCOV" != "" ]; then
|
||||
./ci/warning_send.py --find-path ./out/Linux_x86_64/$CONF/build/$BUILDER/esignal/;
|
||||
fi
|
||||
- lutin -w -j4 -C -P -t$TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF $GCOV $DISABLE_PACKAGE esignal-test?run:--elog-level=3 | tee out_test.txt
|
||||
- ./out/Linux_x86_64/$CONF/staging/$BUILDER/esignal-test/esignal-test.app/bin/esignal-test --elog-level=3 | tee out_test.txt
|
||||
- if [ "$GCOV" != "" ]; then
|
||||
./ci/test_send.py --file=out_test.txt;
|
||||
lutin -C -P -t $TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF -p esignal?gcov;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
e-signal
|
||||
========
|
||||
|
||||
`esignal` is c++ svg image parser and renderer.
|
||||
`esignal` is c++ simple direct signal manager.
|
||||
|
||||
Release (master)
|
||||
----------------
|
||||
@@ -49,6 +49,8 @@ download the software:
|
||||
mkdir WORKING_DIRECTORY
|
||||
cd WORKING_DIRECTORY
|
||||
git clone https://github.com/atria-soft/etk.git
|
||||
git clone https://github.com/atria-soft/elog.git
|
||||
git clone https://github.com/atria-soft/ememory.git
|
||||
git clone https://github.com/atria-soft/esignal.git
|
||||
git clone https://github.com/generic-library/gtest-lutin.git --recursive
|
||||
git clone https://github.com/generic-library/z-lutin.git --recursive
|
||||
@@ -57,7 +59,7 @@ Compile software:
|
||||
-----------------
|
||||
|
||||
cd WORKING_DIRECTORY
|
||||
lutin -C -P esignal-test
|
||||
lutin -C -P esignal-test esignal-sample
|
||||
|
||||
|
||||
License (APACHE v2.0)
|
||||
|
1
authors.txt
Normal file
1
authors.txt
Normal file
@@ -0,0 +1 @@
|
||||
MR Edouard DUPIN <yui.heero@gmail.com>
|
@@ -82,10 +82,10 @@ Now you can nonnect the functions:
|
||||
This Will generate this simple sample code:
|
||||
@snippet sampleAll.cpp esignal_sample_class_connection
|
||||
|
||||
Connection on std::shared_ptr<class> member function {#esignal_connection_shared}
|
||||
Connection on ememory::SharedPtr<class> member function {#esignal_connection_shared}
|
||||
----------------------------------------------------
|
||||
|
||||
std::hared_ptr have intrinsec knoledge of alive pointer, then, if you do not need to remove connection while the shared_ptr is alive, just connect it like:
|
||||
ememory::SharedPtr have intrinsec knowledge of alive pointer, then, if you do not need to remove connection while the ememory::SharedPtr is alive, just connect it like:
|
||||
@snippet sampleAll.cpp esignal_sample_shared_connection
|
||||
|
||||
Create new Signal {#esignal_create}
|
||||
|
@@ -6,7 +6,7 @@ import doxy.tools as tools
|
||||
|
||||
def create(target, module_name):
|
||||
my_module = module.Module(__file__, module_name)
|
||||
my_module.set_version([0,1,"dev"])
|
||||
my_module.set_version("version.txt")
|
||||
my_module.set_title("esignal: Ewol signal interface")
|
||||
my_module.set_website("http://atria-soft.github.io/" + module_name)
|
||||
my_module.set_website_sources("http://github.com/atria-soft/" + module_name)
|
||||
@@ -17,7 +17,7 @@ def create(target, module_name):
|
||||
my_module.add_sample_path([
|
||||
"sample",
|
||||
])
|
||||
my_module.add_module_depend([
|
||||
my_module.add_depend([
|
||||
'etk',
|
||||
'ememory',
|
||||
])
|
||||
@@ -25,7 +25,7 @@ def create(target, module_name):
|
||||
'*operator<<*',
|
||||
])
|
||||
my_module.add_exclude_file([
|
||||
'debug.h',
|
||||
'debug.hpp',
|
||||
])
|
||||
my_module.add_file_patterns([
|
||||
'*.h',
|
||||
|
@@ -6,34 +6,63 @@
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <esignal/debug.h>
|
||||
#include <esignal/Interface.h>
|
||||
#include <esignal/Base.h>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <esignal/debug.hpp>
|
||||
#include <esignal/Interface.hpp>
|
||||
#include <esignal/Base.hpp>
|
||||
|
||||
size_t esignal::Base::s_uid = 1;
|
||||
int64_t esignal::Base::s_uidSignalEmit = 1;
|
||||
size_t esignal::BaseInternal::s_uid = 1;
|
||||
int64_t esignal::BaseInternal::s_uidSignalEmit = 1;
|
||||
|
||||
esignal::Base::Base(ObserverConnection _countObs) :
|
||||
m_shared(this),
|
||||
m_connectionObserver(_countObs) {
|
||||
void esignal::BaseInternal::setPeriodic(bool _state) {
|
||||
m_periodic = _state;
|
||||
}
|
||||
|
||||
const std::string& esignal::BaseInternal::getName() const {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
void esignal::BaseInternal::setName(const std::string& _name) {
|
||||
m_name = _name;
|
||||
}
|
||||
|
||||
const std::string& esignal::BaseInternal::getDescription() const {
|
||||
return m_description;
|
||||
}
|
||||
|
||||
void esignal::BaseInternal::setDescription(const std::string& _desc) {
|
||||
m_description = _desc;
|
||||
}
|
||||
|
||||
esignal::Base::Base() :
|
||||
m_data(nullptr) {
|
||||
|
||||
}
|
||||
esignal::Base::~Base() {
|
||||
m_shared.removeData();
|
||||
m_data.reset();
|
||||
}
|
||||
|
||||
|
||||
const std::string& esignal::Base::getName() const {
|
||||
if (m_data != nullptr) {
|
||||
return m_data->getName();
|
||||
}
|
||||
static std::string noValue;
|
||||
return noValue;
|
||||
}
|
||||
|
||||
const std::string& esignal::Base::getDescription() const {
|
||||
if (m_data != nullptr) {
|
||||
return m_data->getDescription();
|
||||
}
|
||||
static std::string noValue;
|
||||
return noValue;
|
||||
}
|
||||
|
||||
void esignal::Base::setPeriodic(bool _state) {
|
||||
if (m_data != nullptr) {
|
||||
m_data->setPeriodic(_state);
|
||||
}
|
||||
}
|
||||
|
||||
std::ostream& esignal::operator <<(std::ostream& _os, const esignal::Base& _obj) {
|
||||
_os << _obj.getName();
|
||||
|
@@ -1,76 +0,0 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2016, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <esignal/debug.h>
|
||||
#include <esignal/Base.h>
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <mutex>
|
||||
#include <esignal/LockSharedPtrRef.h>
|
||||
|
||||
/**
|
||||
* @brief esignal global interface for all signal implementation
|
||||
*/
|
||||
namespace esignal {
|
||||
/**
|
||||
* @brief Base signal interface for esignal::Signal (permit to create abstract list of signals...)
|
||||
*/
|
||||
class Base {
|
||||
public:
|
||||
using ObserverConnection = std::function<void(size_t)>; //!< Define an Observer of the number of observer
|
||||
protected:
|
||||
esignal::LockSharedPtrRef<esignal::Base> m_shared; //!< Reference counter on itself.
|
||||
static size_t s_uid; //!< global id of the signal (STATIC)
|
||||
static int64_t s_uidSignalEmit; //!< global id to emit counting
|
||||
ObserverConnection m_connectionObserver; //!< propriétéry of the connection handle basic
|
||||
public:
|
||||
/**
|
||||
* @brief Basic constructor:
|
||||
* @param[in] _countObs Observer on the number of connection availlable
|
||||
*/
|
||||
Base(ObserverConnection _countObs = nullptr);
|
||||
//! @brief Copy constructor:
|
||||
Base(const Base&) = delete;
|
||||
//! @brief Move constructor
|
||||
Base(Base&&) = delete;
|
||||
/**
|
||||
* @brief Virtualize the destructor
|
||||
* @internal
|
||||
*/
|
||||
virtual ~Base();
|
||||
/**
|
||||
* @brief Disconnect the shared_ptr form the Signal
|
||||
* @param[in] _obj Link with the object to check
|
||||
*/
|
||||
virtual void disconnectShared(const std::shared_ptr<void>& _obj) = 0;
|
||||
/**
|
||||
* @brief Disconnect an observer of the signal.
|
||||
* @param[in] _uid Unique id of the signal connection.
|
||||
*/
|
||||
virtual void disconnect(size_t _uid) = 0;
|
||||
/**
|
||||
* @brief Get name of the signal.
|
||||
* @return requested name.
|
||||
*/
|
||||
virtual const std::string& getName() const;
|
||||
/**
|
||||
* @brief Get decription of the signal.
|
||||
* @return requested decription.
|
||||
*/
|
||||
virtual const std::string& getDescription() const;
|
||||
};
|
||||
//! @not-in-doc
|
||||
std::ostream& operator <<(std::ostream& _os, const esignal::Base& _obj);
|
||||
#ifdef DEBUG
|
||||
const char* logIndent(int32_t _iii);
|
||||
#endif
|
||||
}
|
140
esignal/Base.hpp
Normal file
140
esignal/Base.hpp
Normal file
@@ -0,0 +1,140 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2016, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <esignal/debug.hpp>
|
||||
#include <esignal/Base.hpp>
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <mutex>
|
||||
|
||||
/**
|
||||
* @brief esignal global interface for all signal implementation
|
||||
*/
|
||||
namespace esignal {
|
||||
class BaseInternal : public ememory::EnableSharedFromThis<esignal::BaseInternal> {
|
||||
public:
|
||||
using ObserverConnection = std::function<void(size_t)>; //!< Define an Observer of the number of observer
|
||||
protected:
|
||||
bool m_periodic; //!< The signal is periodic ==> no log with this signal ... (no really needed)
|
||||
static size_t s_uid; //!< global id of the signal (STATIC)
|
||||
static int64_t s_uidSignalEmit; //!< global id to emit counting
|
||||
ObserverConnection m_connectionObserver; //!< propri<72>t<EFBFBD>ry of the connection handle basic
|
||||
std::string m_name; //!< name of the signal.
|
||||
std::string m_description; //!< description of the signal.
|
||||
public:
|
||||
/**
|
||||
* @brief Basic constructor:
|
||||
* @param[in] _countObs Observer on the number of connection availlable
|
||||
*/
|
||||
BaseInternal(ObserverConnection _countObs) :
|
||||
m_connectionObserver(_countObs) {
|
||||
|
||||
}
|
||||
virtual ~BaseInternal() = default;
|
||||
/**
|
||||
* @brief Disconnect the shared_ptr form the Signal
|
||||
* @param[in] _obj Link with the object to check
|
||||
*/
|
||||
virtual void disconnectShared(const ememory::SharedPtr<void>& _obj) = 0;
|
||||
/**
|
||||
* @brief Disconnect an observer of the signal.
|
||||
* @param[in] _uid Unique id of the signal connection.
|
||||
*/
|
||||
virtual void disconnect(size_t _uid) = 0;
|
||||
/**
|
||||
* @brief Get name of the signal.
|
||||
* @return requested name.
|
||||
*/
|
||||
const std::string& getName() const;
|
||||
/**
|
||||
* @brief Set name of the signal.
|
||||
* @param[in] _name new name.
|
||||
*/
|
||||
void setName(const std::string& _name);
|
||||
/**
|
||||
* @brief Get decription of the signal.
|
||||
* @return requested decription.
|
||||
*/
|
||||
const std::string& getDescription() const;
|
||||
/**
|
||||
* @brief Set decription of the signal.
|
||||
* @param[in] _desc new decription.
|
||||
*/
|
||||
void setDescription(const std::string& _desc);
|
||||
/**
|
||||
* @brief Tag the signal as periodic...
|
||||
* @param[in] _state state of the periodic element
|
||||
*/
|
||||
void setPeriodic(bool _state);
|
||||
/**
|
||||
* @brief Get the number of observers connected on the signal.
|
||||
* @return The count of observer.
|
||||
*/
|
||||
virtual size_t size() const = 0;
|
||||
/**
|
||||
* @brief Check if we have a connected observers.
|
||||
* @return true More than one observers.
|
||||
* @return false No observers.
|
||||
*/
|
||||
virtual bool empty() const = 0;
|
||||
/**
|
||||
* @brief Clear all connectd observers.
|
||||
*/
|
||||
virtual void clear() = 0;
|
||||
};
|
||||
/**
|
||||
* @brief Base signal interface for esignal::Signal (permit to create abstract list of signals...)
|
||||
*/
|
||||
class Base {
|
||||
protected:
|
||||
ememory::SharedPtr<esignal::BaseInternal> m_data;
|
||||
public:
|
||||
/**
|
||||
* @brief Basic constructor:
|
||||
*/
|
||||
Base();
|
||||
//! @brief Copy constructor:
|
||||
Base(const Base&) = delete;
|
||||
//! @brief Move constructor
|
||||
Base(Base&&) = delete;
|
||||
/**
|
||||
* @brief Virtualize the destructor
|
||||
* @internal
|
||||
*/
|
||||
virtual ~Base();
|
||||
/**
|
||||
* @brief Disconnect the shared_ptr form the Signal
|
||||
* @param[in] _obj Link with the object to check
|
||||
*/
|
||||
virtual void disconnectShared(const ememory::SharedPtr<void>& _obj) = 0;
|
||||
/**
|
||||
* @brief Get name of the signal.
|
||||
* @return requested name.
|
||||
*/
|
||||
virtual const std::string& getName() const;
|
||||
/**
|
||||
* @brief Get decription of the signal.
|
||||
* @return requested decription.
|
||||
*/
|
||||
virtual const std::string& getDescription() const;
|
||||
/**
|
||||
* @brief Tag the signal as periodic...
|
||||
* @param[in] _state state of the periodic element
|
||||
*/
|
||||
void setPeriodic(bool _state);
|
||||
};
|
||||
//! @not-in-doc
|
||||
std::ostream& operator <<(std::ostream& _os, const esignal::Base& _obj);
|
||||
#ifdef DEBUG
|
||||
const char* logIndent(int32_t _iii);
|
||||
#endif
|
||||
}
|
@@ -5,44 +5,59 @@
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#include <esignal/debug.h>
|
||||
#include <esignal/Connection.h>
|
||||
#include <esignal/debug.hpp>
|
||||
#include <esignal/Connection.hpp>
|
||||
|
||||
esignal::Connection::Connection():
|
||||
m_signalRefUnique(), m_uid(0) {
|
||||
m_data(nullptr),
|
||||
m_uid(0) {
|
||||
|
||||
}
|
||||
|
||||
esignal::Connection::Connection(const esignal::LockSharedPtrRef<esignal::Base>& _ref, size_t _id):
|
||||
m_signalRefUnique(_ref),
|
||||
esignal::Connection::Connection(ememory::SharedPtr<esignal::BaseInternal> _ref, size_t _id):
|
||||
m_data(_ref),
|
||||
m_uid(_id) {
|
||||
|
||||
}
|
||||
|
||||
esignal::Connection::Connection(esignal::Connection&& _obj):
|
||||
m_signalRefUnique(_obj.m_signalRefUnique),
|
||||
m_data(_obj.m_data),
|
||||
m_uid(_obj.m_uid) {
|
||||
_obj.m_uid = 0;
|
||||
_obj.m_data.reset();
|
||||
}
|
||||
|
||||
esignal::Connection& esignal::Connection::operator=(esignal::Connection&& _obj) {
|
||||
disconnect();
|
||||
m_signalRefUnique = _obj.m_signalRefUnique;
|
||||
m_data = _obj.m_data;
|
||||
m_uid = _obj.m_uid;
|
||||
_obj.m_uid = 0;
|
||||
_obj.m_data.reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
esignal::Connection::~Connection() {
|
||||
m_signalRefUnique.disconnect(m_uid);
|
||||
ememory::SharedPtr<esignal::BaseInternal> ref = m_data.lock();
|
||||
if (ref == nullptr) {
|
||||
return;
|
||||
}
|
||||
ref->disconnect(m_uid);
|
||||
m_data.reset();
|
||||
m_uid = 0;
|
||||
}
|
||||
|
||||
void esignal::Connection::disconnect() {
|
||||
m_signalRefUnique.disconnect(m_uid);
|
||||
ememory::SharedPtr<esignal::BaseInternal> ref = m_data.lock();
|
||||
if (ref == nullptr) {
|
||||
return;
|
||||
}
|
||||
ref->disconnect(m_uid);
|
||||
m_data.reset();
|
||||
m_uid = 0;
|
||||
}
|
||||
|
||||
bool esignal::Connection::isConnected() {
|
||||
return m_signalRefUnique.isAlive();
|
||||
return m_data.useCount() != 0
|
||||
&& m_uid != 0;
|
||||
}
|
||||
|
||||
|
@@ -8,19 +8,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <esignal/debug.h>
|
||||
#include <esignal/Base.h>
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <mutex>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <esignal/debug.hpp>
|
||||
#include <esignal/Base.hpp>
|
||||
|
||||
namespace esignal {
|
||||
/**
|
||||
* @brief connection on the signal (disconnect it whe removed)
|
||||
*/
|
||||
class Connection {
|
||||
private:
|
||||
ememory::WeakPtr<esignal::BaseInternal> m_data;
|
||||
size_t m_uid; //!< UID of the current connection.
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor (no link)
|
||||
@@ -31,7 +30,7 @@ namespace esignal {
|
||||
* @param[in] _ref Reference ID of the Signal extern handle
|
||||
* @param[in] _id Id of the Connection handle
|
||||
*/
|
||||
Connection(const esignal::LockSharedPtrRef<esignal::Base>& _ref, size_t _id);
|
||||
Connection(ememory::SharedPtr<esignal::BaseInternal> _ref, size_t _id);
|
||||
/**
|
||||
* @brief Move Constructor
|
||||
* @param[in] _obj Connection Object to move
|
||||
@@ -66,9 +65,6 @@ namespace esignal {
|
||||
* @return false The signal is NOT connected.
|
||||
*/
|
||||
bool isConnected();
|
||||
private:
|
||||
esignal::LockSharedPtrRef<esignal::Base> m_signalRefUnique; //!< reference on the Signal.
|
||||
size_t m_uid; //!< UID of the current connection.
|
||||
};
|
||||
}
|
||||
|
@@ -1,73 +0,0 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2016, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <esignal/debug.h>
|
||||
#include <esignal/Base.h>
|
||||
#include <esignal/Signal.h>
|
||||
#include <esignal/Interface.h>
|
||||
|
||||
namespace esignal {
|
||||
/**
|
||||
* @brief Sigla same as @ref esignal::Signal withe a name and a description to manage a list of signals.
|
||||
*/
|
||||
template<class... T_ARGS>
|
||||
class ISignal : public Signal<T_ARGS...> {
|
||||
protected:
|
||||
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:
|
||||
/**
|
||||
* @brief Create a signal with a specific type.
|
||||
* @param[in] _signalInterfaceLink reference on the signal lister.
|
||||
* @param[in] _func Local observer to know the count of connection on the signal.
|
||||
* @param[in] _name Static name of the signal.
|
||||
* @param[in] _description Description of the signal.
|
||||
*/
|
||||
template<class CLASS_TYPE, class FUNC_TYPE>
|
||||
ISignal(CLASS_TYPE* _signalInterfaceLink,
|
||||
FUNC_TYPE _func,
|
||||
const std::string& _name,
|
||||
const std::string& _description);
|
||||
/**
|
||||
* @brief Create a signal with a specific type.
|
||||
* @param[in] _signalInterfaceLink reference on the signal lister.
|
||||
* @param[in] _name Static name of the signal.
|
||||
* @param[in] _description Description of the signal.
|
||||
*/
|
||||
ISignal(esignal::Interface* _signalInterfaceLink,
|
||||
const std::string& _name,
|
||||
const std::string& _description);
|
||||
/**
|
||||
* @brief Destructor.
|
||||
*/
|
||||
virtual ~ISignal();
|
||||
const std::string& getName() const override;
|
||||
const std::string& getDescription() const override;
|
||||
};
|
||||
}
|
||||
|
||||
template<class... T_ARGS>
|
||||
template<class CLASS_TYPE, class FUNC_TYPE>
|
||||
esignal::ISignal<T_ARGS...>::ISignal(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func,
|
||||
const std::string& _name,
|
||||
const std::string& _description) :
|
||||
esignal::Signal<T_ARGS...>(_class, _func),
|
||||
m_signalInterfaceLink(_class),
|
||||
m_name(_name),
|
||||
m_description(_description) {
|
||||
// add a reference on the current signal ...
|
||||
if (m_signalInterfaceLink != nullptr) {
|
||||
m_signalInterfaceLink->signals.add(this);
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <esignal/InterfaceData.h>
|
||||
#include <esignal/InterfaceData.hpp>
|
||||
|
||||
namespace esignal {
|
||||
/**
|
@@ -6,10 +6,10 @@
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <esignal/debug.h>
|
||||
#include <esignal/InterfaceData.h>
|
||||
#include <esignal/Base.h>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <esignal/debug.hpp>
|
||||
#include <esignal/InterfaceData.hpp>
|
||||
#include <esignal/Base.hpp>
|
||||
|
||||
esignal::InterfaceData::InterfaceData() {
|
||||
|
||||
@@ -50,7 +50,7 @@ std::vector<std::string> esignal::InterfaceData::getAll() const {
|
||||
return out;
|
||||
}
|
||||
|
||||
void esignal::InterfaceData::disconnect(const std::shared_ptr<void>& _object) {
|
||||
void esignal::InterfaceData::disconnect(const ememory::SharedPtr<void>& _object) {
|
||||
if (_object == nullptr) {
|
||||
ESIGNAL_ERROR("Input ERROR nullptr pointer Object ...");
|
||||
return;
|
||||
|
@@ -48,7 +48,7 @@ namespace esignal {
|
||||
* @brief Remove binding on all event class.
|
||||
* @param[in] _sharedPtr sharedPtr to unlink (no type needed ...).
|
||||
*/
|
||||
void disconnect(const std::shared_ptr<void>& _sharedPtr);
|
||||
void disconnect(const ememory::SharedPtr<void>& _sharedPtr);
|
||||
};
|
||||
}
|
||||
|
@@ -1,78 +0,0 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2016, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <esignal/RefCount.h>
|
||||
|
||||
namespace esignal {
|
||||
/**
|
||||
* @brief shared ptr that permeit to lock access of the internal data (it does not manage the allication and remove of the data).
|
||||
* @todo Change this with atomic_shared_ptr<> when availlable.
|
||||
* @param TYPE Type of the internal data
|
||||
*/
|
||||
template<class TYPE>
|
||||
class LockSharedPtrRef {
|
||||
public:
|
||||
// TODO : Remove data from refcounter ...==>
|
||||
// esignal::RefCount* m_counter; //!< Access on the reference counter
|
||||
// TYPE* m_data; //!< Pointer on the data
|
||||
esignal::RefCount<TYPE>* m_counter; //!< Access on the reference counter
|
||||
public:
|
||||
/**
|
||||
* @brief Basic contructor (with the object to ref count)
|
||||
* @param[in] _pointer Pointer on the data (default nullptr)
|
||||
*/
|
||||
LockSharedPtrRef(TYPE* _pointer=nullptr);
|
||||
/**
|
||||
* @brief Copy contructor
|
||||
* @param[in] _obj object to copy
|
||||
*/
|
||||
LockSharedPtrRef(const LockSharedPtrRef<TYPE>& _obj);
|
||||
/**
|
||||
* @brief Copy operator (It copy the counter and increment the it).
|
||||
* @param[in] _obj object to copy.
|
||||
* @return Reference of this
|
||||
*/
|
||||
LockSharedPtrRef& operator=(const LockSharedPtrRef<TYPE>& _obj);
|
||||
/**
|
||||
* @brief Contructor (move)
|
||||
* @param[in] _obj move object
|
||||
*/
|
||||
LockSharedPtrRef(LockSharedPtrRef<TYPE>&& _obj);
|
||||
/**
|
||||
* @brief Copy operator (force move) ==> removed
|
||||
* @return Reference of this
|
||||
*/
|
||||
LockSharedPtrRef& operator=(LockSharedPtrRef<TYPE>&&) = delete;
|
||||
/**
|
||||
* @brief Destructor of the class (decrement the counter and remove it if it is the last one...)
|
||||
*/
|
||||
~LockSharedPtrRef();
|
||||
/**
|
||||
* @brief Remove the data on the conter reference (it does not exist anymore)
|
||||
*/
|
||||
void removeData();
|
||||
/**
|
||||
* @brief Call disconnect on the parameter class with lock prevention
|
||||
* @param[in] _uid ID to dicsonnect on the sub element
|
||||
*/
|
||||
void disconnect(size_t _uid);
|
||||
/**
|
||||
* @brief Check if the value is availlable
|
||||
* @return true The data is availlable
|
||||
* @return false The data has been removed
|
||||
*/
|
||||
bool isAlive();
|
||||
private:
|
||||
/**
|
||||
* @remove reference on the refcounter...
|
||||
*/
|
||||
void rmShared();
|
||||
};
|
||||
}
|
||||
|
@@ -1,75 +0,0 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2016, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
#include <mutex>
|
||||
|
||||
namespace esignal {
|
||||
/**
|
||||
* @brief Ref counting tool.
|
||||
*/
|
||||
template<class TYPE>
|
||||
class RefCount {
|
||||
private:
|
||||
std::mutex m_lock; //!< mutex on the refcounting element
|
||||
int64_t m_count; //!< number of element connected
|
||||
TYPE* m_data; //!< Pointer on the refconting data
|
||||
public:
|
||||
/**
|
||||
* @brief generic constructor
|
||||
* @param[in] _data Data to reference the Refcounting
|
||||
*/
|
||||
RefCount(TYPE* _data);
|
||||
//! @brief Copy constructor (REMOVED)
|
||||
RefCount(const RefCount&) = delete;
|
||||
/**
|
||||
* @brief Copy operator (REMOVED)
|
||||
* @return Reference on this
|
||||
*/
|
||||
RefCount& operator=(RefCount) = delete;
|
||||
/**
|
||||
* @brief Copy operator (REMOVED)
|
||||
* @return Reference on this
|
||||
*/
|
||||
RefCount& operator=(const RefCount&) = delete;
|
||||
//! @brief Move constructor (REMOVED)
|
||||
RefCount(RefCount&&) = delete;
|
||||
/**
|
||||
* @brief Move operator (REMOVED)
|
||||
* @return Reference on this
|
||||
*/
|
||||
RefCount& operator=(RefCount&&) = delete;
|
||||
//! @brief Destructor
|
||||
~RefCount();
|
||||
public:
|
||||
//! @brief Lock the interface
|
||||
void lock();
|
||||
//! @brief Unlock the interface
|
||||
void unlock();
|
||||
//! @brief Increment the ref-counting
|
||||
void inc();
|
||||
/**
|
||||
* @brief Decrement the ref-counting
|
||||
* @return Number of element connected when decrement
|
||||
*/
|
||||
int64_t dec();
|
||||
/**
|
||||
* @brief Get number of connected
|
||||
* @return The number of element connected on it
|
||||
*/
|
||||
int64_t getCount() const;
|
||||
//! @brief Remove the data
|
||||
void remove();
|
||||
/**
|
||||
* @brief Get the recoreded data
|
||||
* @return The pointer of the data
|
||||
*/
|
||||
TYPE* get();
|
||||
};
|
||||
}
|
263
esignal/Signal.h
263
esignal/Signal.h
@@ -1,263 +0,0 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2016, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <esignal/debug.h>
|
||||
#include <esignal/Base.h>
|
||||
#include <esignal/LockSharedPtrRef.h>
|
||||
#include <esignal/RefCount.h>
|
||||
#include <esignal/Connection.h>
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <mutex>
|
||||
|
||||
namespace esignal {
|
||||
/**
|
||||
* @brief Basic signal base
|
||||
* @param[in] Args... Argument of the signal
|
||||
*/
|
||||
template<class... T_ARGS>
|
||||
class Signal : public esignal::Base {
|
||||
public:
|
||||
using Observer = std::function<void(const T_ARGS&...)>; //!< Define an Observer: function pointer
|
||||
protected:
|
||||
int32_t m_callInProgress; //!< know if we are in a recursive loop
|
||||
public:
|
||||
/**
|
||||
* @brief Basic constructor with connection observer
|
||||
* @param[in] _countObs Local observer to know the count of connection on the signal.
|
||||
*/
|
||||
Signal(ObserverConnection _countObs=nullptr);
|
||||
/**
|
||||
* @brief Basic constructor with connection observer
|
||||
* @param[in] _class Class which is associated the function to call.
|
||||
* @param[in] _func Function to call when an observer has connected or disconnected.
|
||||
*/
|
||||
template<class CLASS_TYPE, class FUNC_TYPE>
|
||||
Signal(CLASS_TYPE* _class, FUNC_TYPE _func);
|
||||
//! @brief Copy constructor (REMOVED)
|
||||
Signal(const Signal&) = delete;
|
||||
/**
|
||||
* @brief Copy operator (REMOVED)
|
||||
* @return Reference on this
|
||||
*/
|
||||
Signal& operator=(Signal) = delete;
|
||||
/**
|
||||
* @brief Copy operator (REMOVED)
|
||||
* @return Reference on this
|
||||
*/
|
||||
Signal& operator=(const Signal&) = delete;
|
||||
//! @brief Move constructor (REMOVED)
|
||||
Signal(Signal&&) = delete;
|
||||
/**
|
||||
* @brief Move operator (REMOVED)
|
||||
* @return Reference on this
|
||||
*/
|
||||
Signal& operator=(Signal&&) = delete;
|
||||
private:
|
||||
/**
|
||||
* @brief Executor: Class to manage the UID and basic value of an observer
|
||||
*/
|
||||
class Executor {
|
||||
public:
|
||||
Observer m_observer; //!< Observer to call when needed (if not removed).
|
||||
bool m_removed; //!< the executor has been removed.
|
||||
size_t m_uid; //!< unique ID of the signal (used to remove it).
|
||||
public:
|
||||
/**
|
||||
* @brief Basic constructor.
|
||||
* @param[in] _observer Observer to call.
|
||||
*/
|
||||
Executor(Observer&& _observer);
|
||||
//! @brief virtual destructor.
|
||||
virtual ~Executor() = default;
|
||||
public:
|
||||
/**
|
||||
* @brief Emit the data on the observer.
|
||||
* @param[in] _values... Multiple value needed to send on observers
|
||||
*/
|
||||
virtual void emit(const T_ARGS&... _values);
|
||||
public:
|
||||
/**
|
||||
* @brief check if the Executor is a managed by this shared_ptr
|
||||
* @param[in] _obj Object to check
|
||||
* @return true The Executor depend on this shared_ptr
|
||||
* @return false The Executor does not depend on this shared_ptr
|
||||
*/
|
||||
virtual bool isSharedPtr(const std::shared_ptr<void>& _obj);
|
||||
};
|
||||
protected:
|
||||
std::vector<std::unique_ptr<Executor>> m_executors; //!< List of all executors.
|
||||
private:
|
||||
/**
|
||||
* @brief Executor specific to the Shared_ptr caller that does not want to worry about the removing of the signal.
|
||||
*/
|
||||
class ExecutorShared : public Executor {
|
||||
protected:
|
||||
std::weak_ptr<void> m_object; //!< a weak reference on the object to verify that it is alive
|
||||
public:
|
||||
/**
|
||||
* @brief shared constructor.
|
||||
* @param[in] _object A weak reference of the object.
|
||||
* @param[in] _observer Observer to call.
|
||||
*/
|
||||
ExecutorShared(std::weak_ptr<void> _object, Observer&& _observer);
|
||||
public:
|
||||
/**
|
||||
* @brief Emit the data on the observer.
|
||||
* @param[in] _values... Multiple value needed to send on observers
|
||||
*/
|
||||
void emit(const T_ARGS&... _values) override;
|
||||
public:
|
||||
bool isSharedPtr(const std::shared_ptr<void>& _obj) override;
|
||||
};
|
||||
public:
|
||||
/**
|
||||
* @brief Connect an observer on the signal.
|
||||
* @param[in] _observer Observer to call.
|
||||
* @return Connection handle (connection is removed if the handle is destroy)
|
||||
*/
|
||||
template< class OBSERVER_TYPE >
|
||||
esignal::Connection connect(OBSERVER_TYPE&& _observer);
|
||||
/**
|
||||
* @brief Connect an function member on the signal.
|
||||
* @param[in] _class Object on whe we need to call.
|
||||
* @param[in] _func Function to call.
|
||||
* @param[in] _arg Argument optinnal the user want to add.
|
||||
* @return Connection handle (connection is removed if the handle is destroy)
|
||||
*/
|
||||
template<class CLASS_TYPE, class FUNC_TYPE, class... FUNC_ARGS_TYPE>
|
||||
esignal::Connection connect(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func,
|
||||
FUNC_ARGS_TYPE... _arg);
|
||||
/**
|
||||
* @brief Connect an function member on the signal with the shared_ptr object.
|
||||
* @param[in] _class shared_ptr Object on whe we need to call ==> the object is get in keeped in weak_ptr.
|
||||
* @param[in] _func Function to call.
|
||||
* @param[in] _args Argument optinnal the user want to add.
|
||||
*/
|
||||
template<class PARENT_CLASS_TYPE, class CLASS_TYPE, typename... FUNC_ARGS_TYPE>
|
||||
void connect(const std::shared_ptr<PARENT_CLASS_TYPE>& _class,
|
||||
void (CLASS_TYPE::*_func)(const T_ARGS&..., FUNC_ARGS_TYPE...),
|
||||
FUNC_ARGS_TYPE... _args);
|
||||
public:
|
||||
/**
|
||||
* @brief Emit data on the signal.
|
||||
* @param[in] _args Argument data to emit.
|
||||
*/
|
||||
void emit(const T_ARGS&... _args);
|
||||
protected:
|
||||
/**
|
||||
* @brief Remove observer in the internal list if the user has disconnected
|
||||
* @note Done only if it is the last caller ...
|
||||
*/
|
||||
void removeIfPossible();
|
||||
public:
|
||||
/**
|
||||
* @brief Disconnect an observer of the signal.
|
||||
* @param[in] _uid Unique id of the signal connection.
|
||||
*/
|
||||
void disconnect(size_t _uid) override;
|
||||
/**
|
||||
* @brief Disconnect the shared_ptr form the Signal
|
||||
* @param[in] _obj Link with the object to check
|
||||
*/
|
||||
void disconnectShared(const std::shared_ptr<void>& _obj) override;
|
||||
/**
|
||||
* @brief Get the number of observers connected on the signal.
|
||||
* @return The count of observer.
|
||||
*/
|
||||
size_t size() const;
|
||||
/**
|
||||
* @brief Check if we have a connected observers.
|
||||
* @return true More than one observers.
|
||||
* @return false No observers.
|
||||
*/
|
||||
bool empty() const;
|
||||
/**
|
||||
* @brief Clear all connectd observers.
|
||||
*/
|
||||
void clear();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
template<class... T_ARGS>
|
||||
template< class OBSERVER_TYPE >
|
||||
esignal::Connection esignal::Signal<T_ARGS...>::connect(OBSERVER_TYPE&& _observer ) {
|
||||
ESIGNAL_DEBUG("esignal: '" << getName() << "' try connect: '" << getName() << "' (observer)");
|
||||
std::unique_ptr<Executor> executer(new Executor(std::forward<OBSERVER_TYPE>(_observer)));
|
||||
size_t uid = executer->m_uid;
|
||||
m_executors.push_back(std::move(executer));
|
||||
if (m_connectionObserver!=nullptr) {
|
||||
m_connectionObserver(m_executors.size());
|
||||
}
|
||||
ESIGNAL_DEBUG(" '" << getName() << "' new count: " << m_executors.size());
|
||||
return esignal::Connection(Base::m_shared, uid);
|
||||
}
|
||||
|
||||
template<class... T_ARGS>
|
||||
template<class CLASS_TYPE, class FUNC_TYPE, class... FUNC_ARGS_TYPE>
|
||||
esignal::Connection esignal::Signal<T_ARGS...>::connect(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func,
|
||||
FUNC_ARGS_TYPE... _arg) {
|
||||
ESIGNAL_DEBUG("esignal: '" << getName() << "' try connect: '" << getName() << "' (reference)");
|
||||
if (_class == nullptr) {
|
||||
ESIGNAL_ERROR(" '" << getName() << "' Class pointer in nullptr");
|
||||
return esignal::Connection();
|
||||
}
|
||||
std::unique_ptr<Executor> executer(new Executor([=](const T_ARGS& ... _argBase){
|
||||
(*_class.*_func)(_argBase..., _arg... );
|
||||
}));
|
||||
size_t uid = executer->m_uid;
|
||||
m_executors.push_back(std::move(executer));
|
||||
if (m_connectionObserver != nullptr) {
|
||||
m_connectionObserver(m_executors.size());
|
||||
}
|
||||
ESIGNAL_DEBUG(" '" << getName() << "' new count: " << m_executors.size());
|
||||
return Connection(Base::m_shared, uid);
|
||||
}
|
||||
|
||||
template<class... T_ARGS>
|
||||
template<class PARENT_CLASS_TYPE, class CLASS_TYPE, typename... FUNC_ARGS_TYPE>
|
||||
void esignal::Signal<T_ARGS...>::connect(const std::shared_ptr<PARENT_CLASS_TYPE>& _class,
|
||||
void (CLASS_TYPE::*_func)(const T_ARGS&..., FUNC_ARGS_TYPE...),
|
||||
FUNC_ARGS_TYPE... _args) {
|
||||
ESIGNAL_DEBUG("esignal: '" << getName() << "' try connect: '" << getName() << "' (weak pointer)");
|
||||
if (_class == nullptr) {
|
||||
ESIGNAL_ERROR(" '" << getName() << "' Class pointer in nullptr");
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<CLASS_TYPE> obj2 = std::dynamic_pointer_cast<CLASS_TYPE>(_class);
|
||||
if (obj2 == nullptr) {
|
||||
ESIGNAL_ERROR("Can not connect signal ...");
|
||||
return;
|
||||
}
|
||||
CLASS_TYPE* directPointer = obj2.get();
|
||||
std::unique_ptr<ExecutorShared> executer(new ExecutorShared(_class, [=]( const T_ARGS& ... _argBase){
|
||||
// TODO : Check if compilator does not use the shared ptr ...
|
||||
(*directPointer.*_func)(_argBase..., _args... );
|
||||
}));
|
||||
m_executors.push_back(std::move(executer));
|
||||
if (m_connectionObserver!=nullptr) {
|
||||
m_connectionObserver(m_executors.size());
|
||||
}
|
||||
ESIGNAL_DEBUG(" '" << getName() << "' new count: " << m_executors.size());
|
||||
}
|
||||
|
||||
template<class... T_ARGS>
|
||||
template<class CLASS_TYPE, class FUNC_TYPE>
|
||||
esignal::Signal<T_ARGS...>::Signal(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func):
|
||||
esignal::Base([=](size_t _val){(*_class.*_func)(_val);}),
|
||||
m_callInProgress(0) {
|
||||
// nothing to do
|
||||
}
|
432
esignal/Signal.hpp
Normal file
432
esignal/Signal.hpp
Normal file
@@ -0,0 +1,432 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2016, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <esignal/debug.hpp>
|
||||
#include <esignal/Base.hpp>
|
||||
#include <esignal/Connection.hpp>
|
||||
#include <utility>
|
||||
#include <esignal/Interface.hpp>
|
||||
|
||||
namespace esignal {
|
||||
|
||||
template<class... T_ARGS>
|
||||
class SignalInternal : public esignal::BaseInternal {
|
||||
public:
|
||||
using Observer = std::function<void(const T_ARGS&...)>; //!< Define an Observer: function pointer
|
||||
protected:
|
||||
int32_t m_callInProgress; //!< know if we are in a recursive loop
|
||||
public:
|
||||
/**
|
||||
* @brief Basic constructor:
|
||||
* @param[in] _countObs Observer on the number of connection availlable
|
||||
*/
|
||||
SignalInternal(ObserverConnection _countObs):
|
||||
esignal::BaseInternal(_countObs),
|
||||
m_callInProgress(0) {
|
||||
|
||||
}
|
||||
private:
|
||||
/**
|
||||
* @brief Executor: Class to manage the UID and basic value of an observer
|
||||
*/
|
||||
class Executor {
|
||||
public:
|
||||
Observer m_observer; //!< Observer to call when needed (if not removed).
|
||||
bool m_removed; //!< the executor has been removed.
|
||||
size_t m_uid; //!< unique ID of the signal (used to remove it).
|
||||
public:
|
||||
/**
|
||||
* @brief Basic constructor.
|
||||
* @param[in] _observer Observer to call.
|
||||
*/
|
||||
Executor(Observer&& _observer);
|
||||
//! @brief virtual destructor.
|
||||
virtual ~Executor() = default;
|
||||
public:
|
||||
/**
|
||||
* @brief Emit the data on the observer.
|
||||
* @param[in] _values... Multiple value needed to send on observers
|
||||
*/
|
||||
virtual void emit(const T_ARGS&... _values);
|
||||
public:
|
||||
/**
|
||||
* @brief check if the Executor is a managed by this shared_ptr
|
||||
* @param[in] _obj Object to check
|
||||
* @return true The Executor depend on this shared_ptr
|
||||
* @return false The Executor does not depend on this shared_ptr
|
||||
*/
|
||||
virtual bool isSharedPtr(const ememory::SharedPtr<void>& _obj);
|
||||
};
|
||||
protected:
|
||||
std::vector<std::unique_ptr<Executor>> m_executors; //!< List of all executors.
|
||||
private:
|
||||
/**
|
||||
* @brief Executor specific to the Shared_ptr caller that does not want to worry about the removing of the signal.
|
||||
*/
|
||||
class ExecutorShared : public Executor {
|
||||
protected:
|
||||
ememory::WeakPtr<void> m_object; //!< a weak reference on the object to verify that it is alive
|
||||
public:
|
||||
/**
|
||||
* @brief shared constructor.
|
||||
* @param[in] _object A weak reference of the object.
|
||||
* @param[in] _observer Observer to call.
|
||||
*/
|
||||
ExecutorShared(ememory::WeakPtr<void> _object, Observer&& _observer);
|
||||
public:
|
||||
/**
|
||||
* @brief Emit the data on the observer.
|
||||
* @param[in] _values... Multiple value needed to send on observers
|
||||
*/
|
||||
void emit(const T_ARGS&... _values) override;
|
||||
public:
|
||||
bool isSharedPtr(const ememory::SharedPtr<void>& _obj) override;
|
||||
};
|
||||
public:
|
||||
/**
|
||||
* @brief Connect an observer on the signal.
|
||||
* @param[in] _observer Observer to call.
|
||||
* @return Connection handle (connection is removed if the handle is destroy)
|
||||
*/
|
||||
template< class OBSERVER_TYPE >
|
||||
esignal::Connection connect(OBSERVER_TYPE&& _observer);
|
||||
/**
|
||||
* @brief Connect an function member on the signal.
|
||||
* @param[in] _class Object on whe we need to call.
|
||||
* @param[in] _func Function to call.
|
||||
* @param[in] _arg Argument optinnal the user want to add.
|
||||
* @return Connection handle (connection is removed if the handle is destroy)
|
||||
*/
|
||||
template<class CLASS_TYPE, class FUNC_TYPE, class... FUNC_ARGS_TYPE>
|
||||
esignal::Connection connect(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func,
|
||||
FUNC_ARGS_TYPE... _arg);
|
||||
/**
|
||||
* @brief Connect an function member on the signal with the shared_ptr object.
|
||||
* @param[in] _class shared_ptr Object on whe we need to call ==> the object is get in keeped in weak_ptr.
|
||||
* @param[in] _func Function to call.
|
||||
* @param[in] _args Argument optinnal the user want to add.
|
||||
*/
|
||||
template<class PARENT_CLASS_TYPE, class CLASS_TYPE, typename... FUNC_ARGS_TYPE>
|
||||
void connect(const ememory::SharedPtr<PARENT_CLASS_TYPE>& _class,
|
||||
void (CLASS_TYPE::*_func)(const T_ARGS&..., FUNC_ARGS_TYPE...),
|
||||
FUNC_ARGS_TYPE... _args);
|
||||
/**
|
||||
* @brief Emit data on the signal.
|
||||
* @param[in] _args Argument data to emit.
|
||||
*/
|
||||
void emit(const T_ARGS&... _args);
|
||||
protected:
|
||||
/**
|
||||
* @brief Remove observer in the internal list if the user has disconnected
|
||||
* @note Done only if it is the last caller ...
|
||||
*/
|
||||
void removeIfPossible();
|
||||
public:
|
||||
void disconnect(size_t _uid) override;
|
||||
void disconnectShared(const ememory::SharedPtr<void>& _obj) override;
|
||||
size_t size() const override;
|
||||
bool empty() const override;
|
||||
void clear() override;
|
||||
};
|
||||
/**
|
||||
* @brief Basic signal base
|
||||
* @param[in] Args... Argument of the signal
|
||||
*/
|
||||
template<class... T_ARGS>
|
||||
class Signal : public esignal::Base {
|
||||
protected:
|
||||
esignal::Interface* m_signalInterfaceLink; //!< interface of the signal manager.
|
||||
public:
|
||||
/**
|
||||
* @brief Basic constructor with connection observer
|
||||
* @param[in] _countObs Local observer to know the count of connection on the signal.
|
||||
* @param[in] _name Static name of the signal.
|
||||
* @param[in] _description Description of the signal.
|
||||
*/
|
||||
Signal(esignal::BaseInternal::ObserverConnection _countObs=nullptr,
|
||||
const std::string& _name="",
|
||||
const std::string& _description="");
|
||||
/**
|
||||
* @brief Basic constructor with connection interface
|
||||
* @param[in] _signalInterfaceLink reference on the signal lister.
|
||||
* @param[in] _name Static name of the signal.
|
||||
* @param[in] _description Description of the signal.
|
||||
*/
|
||||
Signal(esignal::Interface* _signalInterfaceLink,
|
||||
const std::string& _name,
|
||||
const std::string& _description);
|
||||
/**
|
||||
* @brief Basic constructor with connection observer
|
||||
* @param[in] _class Class which is associated the function to call.
|
||||
* @param[in] _func Function to call when an observer has connected or disconnected.
|
||||
* @param[in] _name Static name of the signal.
|
||||
* @param[in] _description Description of the signal.
|
||||
*/
|
||||
template<class CLASS_TYPE,
|
||||
class FUNC_TYPE,
|
||||
typename std::enable_if<std::is_base_of<esignal::Interface, CLASS_TYPE>::value
|
||||
, int>::type = 0>
|
||||
Signal(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func,
|
||||
const std::string& _name,
|
||||
const std::string& _description);
|
||||
template<class CLASS_TYPE,
|
||||
class FUNC_TYPE,
|
||||
typename std::enable_if<!std::is_base_of<esignal::Interface, CLASS_TYPE>::value
|
||||
, int>::type = 0>
|
||||
Signal(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func,
|
||||
const std::string& _name="",
|
||||
const std::string& _description="");
|
||||
//! @brief Copy constructor (REMOVED)
|
||||
Signal(const Signal&) = delete;
|
||||
/**
|
||||
* @brief Copy operator (REMOVED)
|
||||
* @return Reference on this
|
||||
*/
|
||||
Signal& operator=(Signal) = delete;
|
||||
/**
|
||||
* @brief Copy operator (REMOVED)
|
||||
* @return Reference on this
|
||||
*/
|
||||
Signal& operator=(const Signal&) = delete;
|
||||
//! @brief Move constructor (REMOVED)
|
||||
Signal(Signal&&) = delete;
|
||||
/**
|
||||
* @brief Move operator (REMOVED)
|
||||
* @return Reference on this
|
||||
*/
|
||||
Signal& operator=(Signal&&) = delete;
|
||||
/**
|
||||
* @brief Destructor.
|
||||
*/
|
||||
virtual ~Signal();
|
||||
public:
|
||||
/**
|
||||
* @brief Connect an observer on the signal.
|
||||
* @param[in] _observer Observer to call.
|
||||
* @return Connection handle (connection is removed if the handle is destroy)
|
||||
*/
|
||||
template< class OBSERVER_TYPE >
|
||||
esignal::Connection connect(OBSERVER_TYPE&& _observer) {
|
||||
if (m_data == nullptr) {
|
||||
return esignal::Connection();
|
||||
}
|
||||
ememory::SharedPtr<esignal::SignalInternal<T_ARGS...>> pointer = ememory::staticPointerCast<esignal::SignalInternal<T_ARGS...>>(m_data);
|
||||
return pointer->connect(std::forward<OBSERVER_TYPE>(_observer));
|
||||
}
|
||||
/**
|
||||
* @brief Connect an function member on the signal.
|
||||
* @param[in] _class Object on whe we need to call.
|
||||
* @param[in] _func Function to call.
|
||||
* @param[in] _args Argument optinnal the user want to add.
|
||||
* @return Connection handle (connection is removed if the handle is destroy)
|
||||
*/
|
||||
template<class CLASS_TYPE, class FUNC_TYPE, class... FUNC_ARGS_TYPE>
|
||||
esignal::Connection connect(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func,
|
||||
FUNC_ARGS_TYPE... _args) {
|
||||
if (m_data == nullptr) {
|
||||
return esignal::Connection();
|
||||
}
|
||||
ememory::SharedPtr<esignal::SignalInternal<T_ARGS...>> pointer = ememory::staticPointerCast<esignal::SignalInternal<T_ARGS...>>(m_data);
|
||||
return pointer->connect(_class, _func, std::forward<FUNC_ARGS_TYPE>(_args)...);
|
||||
}
|
||||
/**
|
||||
* @brief Connect an function member on the signal with the shared_ptr object.
|
||||
* @param[in] _class shared_ptr Object on whe we need to call ==> the object is get in keeped in weak_ptr.
|
||||
* @param[in] _func Function to call.
|
||||
* @param[in] _args Argument optinnal the user want to add.
|
||||
*/
|
||||
template<class PARENT_CLASS_TYPE, class CLASS_TYPE, typename... FUNC_ARGS_TYPE>
|
||||
void connect(const ememory::SharedPtr<PARENT_CLASS_TYPE>& _class,
|
||||
void (CLASS_TYPE::*_func)(const T_ARGS&..., FUNC_ARGS_TYPE...),
|
||||
FUNC_ARGS_TYPE... _args) {
|
||||
if (m_data == nullptr) {
|
||||
return;
|
||||
}
|
||||
ememory::SharedPtr<esignal::SignalInternal<T_ARGS...>> pointer = ememory::staticPointerCast<esignal::SignalInternal<T_ARGS...>>(m_data);
|
||||
return pointer->connect(_class, _func, std::forward<FUNC_ARGS_TYPE>(_args)...);
|
||||
}
|
||||
public:
|
||||
/**
|
||||
* @brief Emit data on the signal.
|
||||
* @param[in] _args Argument data to emit.
|
||||
*/
|
||||
void emit(const T_ARGS&... _args) {
|
||||
if (m_data == nullptr) {
|
||||
return;
|
||||
}
|
||||
ememory::SharedPtr<esignal::SignalInternal<T_ARGS...>> pointer = ememory::staticPointerCast<esignal::SignalInternal<T_ARGS...>>(m_data);
|
||||
return pointer->emit(std::forward<const T_ARGS&>(_args)...);
|
||||
}
|
||||
public:
|
||||
/**
|
||||
* @brief Disconnect the shared_ptr form the Signal
|
||||
* @param[in] _obj Link with the object to check
|
||||
*/
|
||||
void disconnectShared(const ememory::SharedPtr<void>& _obj) override {
|
||||
if (m_data == nullptr) {
|
||||
return;;
|
||||
}
|
||||
m_data->disconnectShared(_obj);
|
||||
}
|
||||
/**
|
||||
* @brief Get the number of observers connected on the signal.
|
||||
* @return The count of observer.
|
||||
*/
|
||||
size_t size() const {
|
||||
if (m_data == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
return m_data->size();
|
||||
}
|
||||
/**
|
||||
* @brief Check if we have a connected observers.
|
||||
* @return true More than one observers.
|
||||
* @return false No observers.
|
||||
*/
|
||||
bool empty() const {
|
||||
if (m_data == nullptr) {
|
||||
return true;
|
||||
}
|
||||
return m_data->empty();
|
||||
}
|
||||
/**
|
||||
* @brief Clear all connectd observers.
|
||||
*/
|
||||
void clear() {
|
||||
if (m_data == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_data->clear();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
template<class... T_ARGS>
|
||||
template<class OBSERVER_TYPE >
|
||||
esignal::Connection esignal::SignalInternal<T_ARGS...>::connect(OBSERVER_TYPE&& _observer ) {
|
||||
ESIGNAL_DEBUG("esignal: '" << getName() << "' try connect: '" << getName() << "' (observer)");
|
||||
std::unique_ptr<Executor> executer(new Executor(std::forward<OBSERVER_TYPE>(_observer)));
|
||||
size_t uid = executer->m_uid;
|
||||
m_executors.push_back(std::move(executer));
|
||||
if (m_connectionObserver!=nullptr) {
|
||||
m_connectionObserver(m_executors.size());
|
||||
}
|
||||
ESIGNAL_DEBUG(" '" << getName() << "' new count: " << m_executors.size());
|
||||
return esignal::Connection(sharedFromThis(), uid);
|
||||
}
|
||||
|
||||
template<class... T_ARGS>
|
||||
template<class CLASS_TYPE, class FUNC_TYPE, class... FUNC_ARGS_TYPE>
|
||||
esignal::Connection esignal::SignalInternal<T_ARGS...>::connect(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func,
|
||||
FUNC_ARGS_TYPE... _arg) {
|
||||
ESIGNAL_DEBUG("esignal: '" << getName() << "' try connect: '" << getName() << "' (reference)");
|
||||
if (_class == nullptr) {
|
||||
ESIGNAL_ERROR(" '" << getName() << "' Class pointer in nullptr");
|
||||
return esignal::Connection();
|
||||
}
|
||||
std::unique_ptr<Executor> executer(new Executor([=](const T_ARGS& ... _argBase){
|
||||
(*_class.*_func)(_argBase..., _arg... );
|
||||
}));
|
||||
size_t uid = executer->m_uid;
|
||||
m_executors.push_back(std::move(executer));
|
||||
if (m_connectionObserver != nullptr) {
|
||||
m_connectionObserver(m_executors.size());
|
||||
}
|
||||
ESIGNAL_DEBUG(" '" << getName() << "' new count: " << m_executors.size());
|
||||
return Connection(sharedFromThis(), uid);
|
||||
}
|
||||
|
||||
template<class... T_ARGS>
|
||||
template<class PARENT_CLASS_TYPE, class CLASS_TYPE, typename... FUNC_ARGS_TYPE>
|
||||
void esignal::SignalInternal<T_ARGS...>::connect(const ememory::SharedPtr<PARENT_CLASS_TYPE>& _class,
|
||||
void (CLASS_TYPE::*_func)(const T_ARGS&..., FUNC_ARGS_TYPE...),
|
||||
FUNC_ARGS_TYPE... _args) {
|
||||
ESIGNAL_DEBUG("esignal: '" << getName() << "' try connect: '" << getName() << "' (weak pointer)");
|
||||
if (_class == nullptr) {
|
||||
ESIGNAL_ERROR(" '" << getName() << "' Class pointer in nullptr");
|
||||
return;
|
||||
}
|
||||
ememory::SharedPtr<CLASS_TYPE> obj2 = ememory::dynamicPointerCast<CLASS_TYPE>(_class);
|
||||
if (obj2 == nullptr) {
|
||||
ESIGNAL_ERROR("Can not connect signal ...");
|
||||
return;
|
||||
}
|
||||
CLASS_TYPE* directPointer = obj2.get();
|
||||
std::unique_ptr<ExecutorShared> executer(new ExecutorShared(_class, [=]( const T_ARGS& ... _argBase){
|
||||
// TODO : Check if compilator does not use the shared ptr ...
|
||||
(*directPointer.*_func)(_argBase..., _args... );
|
||||
}));
|
||||
m_executors.push_back(std::move(executer));
|
||||
if (m_connectionObserver!=nullptr) {
|
||||
m_connectionObserver(m_executors.size());
|
||||
}
|
||||
ESIGNAL_DEBUG(" '" << getName() << "' new count: " << m_executors.size());
|
||||
}
|
||||
|
||||
template<class... T_ARGS>
|
||||
template<class CLASS_TYPE,
|
||||
class FUNC_TYPE,
|
||||
typename std::enable_if<std::is_base_of<esignal::Interface, CLASS_TYPE>::value
|
||||
, int>::type>
|
||||
esignal::Signal<T_ARGS...>::Signal(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func,
|
||||
const std::string& _name,
|
||||
const std::string& _description):
|
||||
m_signalInterfaceLink(nullptr) {
|
||||
// nothing to do
|
||||
if (_func != nullptr) {
|
||||
esignal::Base::m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>([=](size_t _val){(*_class.*_func)(_val);});
|
||||
} else {
|
||||
esignal::Base::m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>(nullptr);
|
||||
}
|
||||
if (esignal::Base::m_data != nullptr) {
|
||||
esignal::Base::m_data->setName(_name);
|
||||
esignal::Base::m_data->setDescription(_description);
|
||||
}
|
||||
m_signalInterfaceLink = _class;
|
||||
// add a reference on the current signal ...
|
||||
if (m_signalInterfaceLink != nullptr) {
|
||||
m_signalInterfaceLink->signals.add(this);
|
||||
}
|
||||
}
|
||||
template<class... T_ARGS>
|
||||
template<class CLASS_TYPE,
|
||||
class FUNC_TYPE,
|
||||
typename std::enable_if<!std::is_base_of<esignal::Interface, CLASS_TYPE>::value
|
||||
, int>::type>
|
||||
esignal::Signal<T_ARGS...>::Signal(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func,
|
||||
const std::string& _name,
|
||||
const std::string& _description):
|
||||
m_signalInterfaceLink(nullptr) {
|
||||
// nothing to do
|
||||
if (_func != nullptr) {
|
||||
esignal::Base::m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>([=](size_t _val){(*_class.*_func)(_val);});
|
||||
} else {
|
||||
esignal::Base::m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>(nullptr);
|
||||
}
|
||||
if (esignal::Base::m_data != nullptr) {
|
||||
esignal::Base::m_data->setName(_name);
|
||||
esignal::Base::m_data->setDescription(_description);
|
||||
}
|
||||
}
|
||||
|
||||
#define ESIGNAL_DECLARE_SIGNAL(...) \
|
||||
template class esignal::Signal<__VA_ARGS__>; \
|
||||
template class esignal::SignalInternal<__VA_ARGS__>;
|
||||
|
@@ -6,7 +6,7 @@
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <esignal/debug.h>
|
||||
#include <esignal/debug.hpp>
|
||||
|
||||
int32_t esignal::getLogId() {
|
||||
static int32_t g_val = elog::registerInstance("esignal");
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <elog/log.h>
|
||||
#include <elog/log.hpp>
|
||||
|
||||
namespace esignal {
|
||||
int32_t getLogId();
|
@@ -1,49 +0,0 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2016, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#include <esignal/details/ISignal.hxx>
|
||||
#include <etk/types.h>
|
||||
#include <etk/math/Vector2D.h>
|
||||
#include <etk/math/Vector3D.h>
|
||||
#include <etk/Color.h>
|
||||
|
||||
// void generic signal
|
||||
template class esignal::ISignal<>;
|
||||
// std generic signal
|
||||
template class esignal::ISignal<bool>;
|
||||
template class esignal::ISignal<std::string>;
|
||||
#if __CPP_VERSION__ >= 2011
|
||||
template class esignal::ISignal<std::u32string>;
|
||||
#endif
|
||||
|
||||
template class esignal::ISignal<int64_t>;
|
||||
template class esignal::ISignal<int32_t>;
|
||||
template class esignal::ISignal<int16_t>;
|
||||
template class esignal::ISignal<int8_t>;
|
||||
|
||||
template class esignal::ISignal<uint64_t>;
|
||||
template class esignal::ISignal<uint32_t>;
|
||||
template class esignal::ISignal<uint16_t>;
|
||||
template class esignal::ISignal<uint8_t>;
|
||||
|
||||
template class esignal::ISignal<float>;
|
||||
template class esignal::ISignal<double>;
|
||||
// etk generic vetor 2D
|
||||
template class esignal::ISignal<vec2>;
|
||||
template class esignal::ISignal<bvec2>;
|
||||
template class esignal::ISignal<ivec2>;
|
||||
template class esignal::ISignal<uivec2>;
|
||||
// etk generic vetor 3D
|
||||
template class esignal::ISignal<vec3>;
|
||||
template class esignal::ISignal<bvec3>;
|
||||
template class esignal::ISignal<ivec3>;
|
||||
template class esignal::ISignal<uivec3>;
|
||||
// etk generic color
|
||||
template class esignal::ISignal<etk::Color<unsigned char,4>>;
|
||||
template class esignal::ISignal<etk::Color<unsigned char,3>>;
|
||||
template class esignal::ISignal<etk::Color<float,4>>;
|
||||
template class esignal::ISignal<etk::Color<float,3>>;
|
@@ -1,42 +0,0 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2016, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <esignal/ISignal.h>
|
||||
#include <esignal/details/Signal.hxx>
|
||||
|
||||
template<class... T_ARGS>
|
||||
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 ...
|
||||
if (m_signalInterfaceLink != nullptr) {
|
||||
m_signalInterfaceLink->signals.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
template<class... T_ARGS>
|
||||
esignal::ISignal<T_ARGS...>::~ISignal() {
|
||||
if (m_signalInterfaceLink != nullptr) {
|
||||
m_signalInterfaceLink->signals.remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
template<class... T_ARGS>
|
||||
const std::string& esignal::ISignal<T_ARGS...>::getName() const {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
template<class... T_ARGS>
|
||||
const std::string& esignal::ISignal<T_ARGS...>::getDescription() const {
|
||||
return m_description;
|
||||
}
|
||||
|
@@ -1,16 +0,0 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2016, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <esignal/debug.h>
|
||||
#include <esignal/details/LockSharedPtrRef.hxx>
|
||||
#include <esignal/Base.h>
|
||||
|
||||
// only one really needed ...
|
||||
template class esignal::LockSharedPtrRef<esignal::Base>;
|
||||
|
||||
|
@@ -1,117 +0,0 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2016, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <esignal/LockSharedPtrRef.h>
|
||||
#include <esignal/debug.h>
|
||||
|
||||
template<class TYPE>
|
||||
esignal::LockSharedPtrRef<TYPE>::LockSharedPtrRef(TYPE* _pointer) :
|
||||
m_counter(nullptr) {
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef new [START] " << int64_t(_pointer));
|
||||
if (_pointer != nullptr) {
|
||||
m_counter = new RefCount<TYPE>(_pointer);
|
||||
m_counter->inc();
|
||||
}
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef new [STOP]");
|
||||
}
|
||||
|
||||
template<class TYPE>
|
||||
esignal::LockSharedPtrRef<TYPE>::LockSharedPtrRef(const LockSharedPtrRef<TYPE>& _obj) :
|
||||
m_counter(_obj.m_counter) {
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef new [START] ref ...");
|
||||
if (m_counter == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_counter->inc();
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef new [STOP]");
|
||||
}
|
||||
|
||||
template<class TYPE>
|
||||
esignal::LockSharedPtrRef<TYPE>& esignal::LockSharedPtrRef<TYPE>::operator=(const esignal::LockSharedPtrRef<TYPE>& _obj) {
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef copy [START]");
|
||||
if (&_obj == this) {
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef copy [STOP] auto-copy");
|
||||
return *this;
|
||||
}
|
||||
if (m_counter != nullptr) {
|
||||
m_counter->dec();
|
||||
m_counter = nullptr;
|
||||
}
|
||||
m_counter = _obj.m_counter;
|
||||
if (m_counter == nullptr) {
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef copy [STOP] no counter");
|
||||
return *this;
|
||||
}
|
||||
m_counter->inc();
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef copy [STOP]");
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class TYPE>
|
||||
esignal::LockSharedPtrRef<TYPE>::LockSharedPtrRef(LockSharedPtrRef<TYPE>&& _obj) :
|
||||
m_counter(std::move(_obj.m_counter)) {
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef move [DONE]");
|
||||
}
|
||||
|
||||
template<class TYPE>
|
||||
esignal::LockSharedPtrRef<TYPE>::~LockSharedPtrRef() {
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef delete [START]");
|
||||
rmShared();
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef delete [STOP]");
|
||||
}
|
||||
|
||||
template<class TYPE>
|
||||
void esignal::LockSharedPtrRef<TYPE>::rmShared() {
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef rmShared [START]");
|
||||
if (m_counter == nullptr) {
|
||||
return;
|
||||
}
|
||||
int64_t count = m_counter->dec();
|
||||
if (count > 0) {
|
||||
m_counter = nullptr;
|
||||
return;
|
||||
}
|
||||
delete m_counter;
|
||||
m_counter = nullptr;
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef rmShared [STOP]");
|
||||
}
|
||||
|
||||
template<class TYPE>
|
||||
void esignal::LockSharedPtrRef<TYPE>::removeData() {
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef removeData [START]");
|
||||
if (m_counter != nullptr) {
|
||||
m_counter->remove();
|
||||
}
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef removeData [STOP]");
|
||||
}
|
||||
|
||||
template<class TYPE>
|
||||
void esignal::LockSharedPtrRef<TYPE>::disconnect(size_t _uid) {
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef disconnect [START] " << _uid);
|
||||
if (m_counter == nullptr) {
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef disconnect [STOP] No counter");
|
||||
return;
|
||||
}
|
||||
m_counter->lock();
|
||||
TYPE* val = m_counter->get();
|
||||
if (val != nullptr) {
|
||||
val->disconnect(_uid);
|
||||
}
|
||||
m_counter->unlock();
|
||||
rmShared();
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef disconnect [STOP]");
|
||||
}
|
||||
|
||||
template<class TYPE>
|
||||
bool esignal::LockSharedPtrRef<TYPE>::isAlive() {
|
||||
ESIGNAL_VERBOSE("LockSharedPtrRef isAlive [DONE] ");
|
||||
return m_counter != nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,16 +0,0 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2016, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <esignal/debug.h>
|
||||
#include <esignal/details/RefCount.hxx>
|
||||
#include <esignal/Base.h>
|
||||
|
||||
// only one really needed ...
|
||||
template class esignal::RefCount<esignal::Base>;
|
||||
|
||||
|
@@ -1,80 +0,0 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2016, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <esignal/RefCount.h>
|
||||
#include <esignal/debug.h>
|
||||
|
||||
template<class TYPE>
|
||||
esignal::RefCount<TYPE>::RefCount(TYPE* _data) :
|
||||
m_count(0),
|
||||
m_data(_data) {
|
||||
ESIGNAL_VERBOSE(int64_t(this) << " RefCount New : " << int64_t(_data));
|
||||
// nothing to do.
|
||||
}
|
||||
|
||||
template<class TYPE>
|
||||
esignal::RefCount<TYPE>::~RefCount() {
|
||||
ESIGNAL_VERBOSE(int64_t(this) << " RefCount delete");
|
||||
m_data = nullptr;
|
||||
}
|
||||
|
||||
template<class TYPE>
|
||||
void esignal::RefCount<TYPE>::lock() {
|
||||
ESIGNAL_VERBOSE(int64_t(this) << " RefCount LOCK [START]");
|
||||
m_lock.lock();
|
||||
ESIGNAL_VERBOSE(int64_t(this) << " RefCount LOCK [STOP]");
|
||||
}
|
||||
|
||||
template<class TYPE>
|
||||
void esignal::RefCount<TYPE>::unlock() {
|
||||
ESIGNAL_VERBOSE(int64_t(this) << " RefCount UN-LOCK [START]");
|
||||
m_lock.unlock();
|
||||
ESIGNAL_VERBOSE(int64_t(this) << " RefCount UN-LOCK [STOP]");
|
||||
}
|
||||
|
||||
template<class TYPE>
|
||||
void esignal::RefCount<TYPE>::inc() {
|
||||
ESIGNAL_VERBOSE(int64_t(this) << " RefCount INC [START] " << m_count);
|
||||
lock();
|
||||
m_count++;
|
||||
unlock();
|
||||
ESIGNAL_VERBOSE(int64_t(this) << " RefCount INC [STOP] " << m_count);
|
||||
}
|
||||
|
||||
template<class TYPE>
|
||||
int64_t esignal::RefCount<TYPE>::dec() {
|
||||
ESIGNAL_VERBOSE(int64_t(this) << " RefCount DEC [START] " << m_count);
|
||||
int64_t val;
|
||||
lock();
|
||||
m_count--;
|
||||
val = m_count;
|
||||
unlock();
|
||||
ESIGNAL_VERBOSE(int64_t(this) << " RefCount DEC [STOP] " << m_count);
|
||||
return val;
|
||||
}
|
||||
|
||||
template<class TYPE>
|
||||
int64_t esignal::RefCount<TYPE>::getCount() const {
|
||||
ESIGNAL_VERBOSE(int64_t(this) << " RefCount get count " << m_count);
|
||||
return m_count;
|
||||
}
|
||||
|
||||
template<class TYPE>
|
||||
void esignal::RefCount<TYPE>::remove() {
|
||||
ESIGNAL_VERBOSE(int64_t(this) << " RefCount remove [START]");
|
||||
lock();
|
||||
m_data = nullptr;
|
||||
unlock();
|
||||
ESIGNAL_VERBOSE(int64_t(this) << " RefCount remove [STOP]");
|
||||
}
|
||||
|
||||
template<class TYPE>
|
||||
TYPE* esignal::RefCount<TYPE>::get() {
|
||||
return m_data;
|
||||
}
|
@@ -6,44 +6,45 @@
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#include <esignal/details/Signal.hxx>
|
||||
#include <etk/types.h>
|
||||
#include <etk/math/Vector2D.h>
|
||||
#include <etk/math/Vector3D.h>
|
||||
#include <etk/Color.h>
|
||||
#include <etk/types.hpp>
|
||||
#include <etk/math/Vector2D.hpp>
|
||||
#include <etk/math/Vector3D.hpp>
|
||||
#include <etk/Color.hpp>
|
||||
|
||||
// void generic signal
|
||||
template class esignal::Signal<>;
|
||||
ESIGNAL_DECLARE_SIGNAL();
|
||||
// std generic signal
|
||||
template class esignal::Signal<bool>;
|
||||
template class esignal::Signal<std::string>;
|
||||
ESIGNAL_DECLARE_SIGNAL(bool);
|
||||
ESIGNAL_DECLARE_SIGNAL(std::string);
|
||||
#if __CPP_VERSION__ >= 2011
|
||||
template class esignal::Signal<std::u32string>;
|
||||
ESIGNAL_DECLARE_SIGNAL(std::u32string);
|
||||
#endif
|
||||
|
||||
template class esignal::Signal<int64_t>;
|
||||
template class esignal::Signal<int32_t>;
|
||||
template class esignal::Signal<int16_t>;
|
||||
template class esignal::Signal<int8_t>;
|
||||
ESIGNAL_DECLARE_SIGNAL(int64_t);
|
||||
ESIGNAL_DECLARE_SIGNAL(int32_t);
|
||||
ESIGNAL_DECLARE_SIGNAL(int16_t);
|
||||
ESIGNAL_DECLARE_SIGNAL(int8_t);
|
||||
|
||||
template class esignal::Signal<uint64_t>;
|
||||
template class esignal::Signal<uint32_t>;
|
||||
template class esignal::Signal<uint16_t>;
|
||||
template class esignal::Signal<uint8_t>;
|
||||
ESIGNAL_DECLARE_SIGNAL(uint64_t);
|
||||
ESIGNAL_DECLARE_SIGNAL(uint32_t);
|
||||
ESIGNAL_DECLARE_SIGNAL(uint16_t);
|
||||
ESIGNAL_DECLARE_SIGNAL(uint8_t);
|
||||
|
||||
template class esignal::Signal<float>;
|
||||
template class esignal::Signal<double>;
|
||||
ESIGNAL_DECLARE_SIGNAL(float);
|
||||
ESIGNAL_DECLARE_SIGNAL(double);
|
||||
// etk generic vetor 2D
|
||||
template class esignal::Signal<vec2>;
|
||||
template class esignal::Signal<bvec2>;
|
||||
template class esignal::Signal<ivec2>;
|
||||
template class esignal::Signal<uivec2>;
|
||||
ESIGNAL_DECLARE_SIGNAL(vec2);
|
||||
ESIGNAL_DECLARE_SIGNAL(bvec2);
|
||||
ESIGNAL_DECLARE_SIGNAL(ivec2);
|
||||
ESIGNAL_DECLARE_SIGNAL(uivec2);
|
||||
// etk generic vetor 3D
|
||||
template class esignal::Signal<vec3>;
|
||||
template class esignal::Signal<bvec3>;
|
||||
template class esignal::Signal<ivec3>;
|
||||
template class esignal::Signal<uivec3>;
|
||||
ESIGNAL_DECLARE_SIGNAL(vec3);
|
||||
ESIGNAL_DECLARE_SIGNAL(bvec3);
|
||||
ESIGNAL_DECLARE_SIGNAL(ivec3);
|
||||
ESIGNAL_DECLARE_SIGNAL(uivec3);
|
||||
// etk generic color
|
||||
template class esignal::Signal<etk::Color<unsigned char,4>>;
|
||||
template class esignal::Signal<etk::Color<unsigned char,3>>;
|
||||
template class esignal::Signal<etk::Color<float,4>>;
|
||||
template class esignal::Signal<etk::Color<float,3>>;
|
||||
ESIGNAL_DECLARE_SIGNAL(etk::Color<unsigned char,4>);
|
||||
ESIGNAL_DECLARE_SIGNAL(etk::Color<unsigned char,3>);
|
||||
ESIGNAL_DECLARE_SIGNAL(etk::Color<float,4>);
|
||||
ESIGNAL_DECLARE_SIGNAL(etk::Color<float,3>);
|
||||
|
||||
|
@@ -7,26 +7,63 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <esignal/Signal.h>
|
||||
#include <esignal/Signal.hpp>
|
||||
|
||||
template<typename... T_ARGS>
|
||||
esignal::Signal<T_ARGS...>::Signal(ObserverConnection _countObs):
|
||||
esignal::Base(_countObs),
|
||||
m_callInProgress(0) {
|
||||
// nothing to do
|
||||
template<class... T_ARGS>
|
||||
esignal::Signal<T_ARGS...>::~Signal() {
|
||||
if (m_signalInterfaceLink != nullptr) {
|
||||
m_signalInterfaceLink->signals.remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename... T_ARGS>
|
||||
void esignal::Signal<T_ARGS...>::emit(const T_ARGS&... _args) {
|
||||
esignal::Signal<T_ARGS...>::Signal(esignal::BaseInternal::ObserverConnection _countObs,
|
||||
const std::string& _name,
|
||||
const std::string& _description):
|
||||
esignal::Base(),
|
||||
m_signalInterfaceLink(nullptr) {
|
||||
// create internal data assiciated:
|
||||
m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>(std::move(_countObs));
|
||||
if (esignal::Base::m_data != nullptr) {
|
||||
esignal::Base::m_data->setName(_name);
|
||||
esignal::Base::m_data->setDescription(_description);
|
||||
}
|
||||
}
|
||||
|
||||
template<class... T_ARGS>
|
||||
esignal::Signal<T_ARGS...>::Signal(esignal::Interface* _signalInterfaceLink,
|
||||
const std::string& _name,
|
||||
const std::string& _description):
|
||||
m_signalInterfaceLink(_signalInterfaceLink) {
|
||||
// create internal data assiciated:
|
||||
m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>(nullptr);
|
||||
if (esignal::Base::m_data != nullptr) {
|
||||
esignal::Base::m_data->setName(_name);
|
||||
esignal::Base::m_data->setDescription(_description);
|
||||
}
|
||||
// add a reference on the current signal ...
|
||||
if (m_signalInterfaceLink != nullptr) {
|
||||
m_signalInterfaceLink->signals.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename... T_ARGS>
|
||||
void esignal::SignalInternal<T_ARGS...>::emit(const T_ARGS&... _args) {
|
||||
#ifdef DEBUG
|
||||
int32_t tmpID = s_uidSignalEmit++;
|
||||
#endif
|
||||
// TODO : Add protection ... but how ...
|
||||
m_callInProgress++;
|
||||
ESIGNAL_DEBUG(esignal::logIndent(m_callInProgress-1) << " signal{" << tmpID << "} : '" << getName() << "' ***/" << m_executors.size());
|
||||
for (size_t iii=0; iii < m_executors.size(); ++iii) {
|
||||
ESIGNAL_VERBOSE(esignal::logIndent(m_callInProgress-1) << " {" << tmpID << "} : " << iii);
|
||||
m_executors[iii]->emit(_args...);
|
||||
if (m_periodic == false) {
|
||||
ESIGNAL_DEBUG(esignal::logIndent(m_callInProgress-1) << " signal{" << tmpID << "} : '" << getName() << "' ***/" << m_executors.size());
|
||||
for (size_t iii=0; iii < m_executors.size(); ++iii) {
|
||||
ESIGNAL_VERBOSE(esignal::logIndent(m_callInProgress-1) << " {" << tmpID << "} : " << iii);
|
||||
m_executors[iii]->emit(_args...);
|
||||
}
|
||||
} else {
|
||||
for (size_t iii=0; iii < m_executors.size(); ++iii) {
|
||||
m_executors[iii]->emit(_args...);
|
||||
}
|
||||
}
|
||||
if (m_callInProgress == 1) {
|
||||
bool haveRemove = false;
|
||||
@@ -50,7 +87,7 @@ void esignal::Signal<T_ARGS...>::emit(const T_ARGS&... _args) {
|
||||
}
|
||||
|
||||
template<typename... T_ARGS>
|
||||
void esignal::Signal<T_ARGS...>::removeIfPossible() {
|
||||
void esignal::SignalInternal<T_ARGS...>::removeIfPossible() {
|
||||
if (m_callInProgress != 0) {
|
||||
return;
|
||||
}
|
||||
@@ -73,7 +110,7 @@ void esignal::Signal<T_ARGS...>::removeIfPossible() {
|
||||
}
|
||||
|
||||
template<typename... T_ARGS>
|
||||
void esignal::Signal<T_ARGS...>::disconnect(size_t _uid) {
|
||||
void esignal::SignalInternal<T_ARGS...>::disconnect(size_t _uid) {
|
||||
for (size_t iii=0; iii < m_executors.size(); ++iii) {
|
||||
if (m_executors[iii]->m_uid == _uid) {
|
||||
m_executors[iii]->m_removed = true;
|
||||
@@ -84,7 +121,7 @@ void esignal::Signal<T_ARGS...>::disconnect(size_t _uid) {
|
||||
}
|
||||
|
||||
template<typename... T_ARGS>
|
||||
void esignal::Signal<T_ARGS...>::disconnectShared(const std::shared_ptr<void>& _obj) {
|
||||
void esignal::SignalInternal<T_ARGS...>::disconnectShared(const ememory::SharedPtr<void>& _obj) {
|
||||
for (size_t iii=0; iii < m_executors.size(); ++iii) {
|
||||
if (m_executors[iii]->isSharedPtr(_obj) == true) {
|
||||
m_executors[iii]->m_removed = true;
|
||||
@@ -94,17 +131,17 @@ void esignal::Signal<T_ARGS...>::disconnectShared(const std::shared_ptr<void>& _
|
||||
}
|
||||
|
||||
template<typename... T_ARGS>
|
||||
size_t esignal::Signal<T_ARGS...>::size() const {
|
||||
size_t esignal::SignalInternal<T_ARGS...>::size() const {
|
||||
return m_executors.size();
|
||||
}
|
||||
|
||||
template<typename... T_ARGS>
|
||||
bool esignal::Signal<T_ARGS...>::empty() const {
|
||||
bool esignal::SignalInternal<T_ARGS...>::empty() const {
|
||||
return m_executors.empty();
|
||||
}
|
||||
|
||||
template<typename... T_ARGS>
|
||||
void esignal::Signal<T_ARGS...>::clear() {
|
||||
void esignal::SignalInternal<T_ARGS...>::clear() {
|
||||
for (size_t iii=0; iii < m_executors.size(); ++iii) {
|
||||
m_executors[iii]->m_removed = true;
|
||||
}
|
||||
@@ -113,7 +150,7 @@ void esignal::Signal<T_ARGS...>::clear() {
|
||||
|
||||
|
||||
template<typename... T_ARGS>
|
||||
esignal::Signal<T_ARGS...>::Executor::Executor(Observer&& _observer):
|
||||
esignal::SignalInternal<T_ARGS...>::Executor::Executor(Observer&& _observer):
|
||||
m_removed(false),
|
||||
m_uid(0) {
|
||||
m_uid = s_uid++;
|
||||
@@ -121,7 +158,7 @@ esignal::Signal<T_ARGS...>::Executor::Executor(Observer&& _observer):
|
||||
}
|
||||
|
||||
template<typename... T_ARGS>
|
||||
void esignal::Signal<T_ARGS...>::Executor::emit(const T_ARGS&... _values) {
|
||||
void esignal::SignalInternal<T_ARGS...>::Executor::emit(const T_ARGS&... _values) {
|
||||
if (m_removed == true) {
|
||||
return;
|
||||
}
|
||||
@@ -133,7 +170,7 @@ void esignal::Signal<T_ARGS...>::Executor::emit(const T_ARGS&... _values) {
|
||||
}
|
||||
|
||||
template<typename... T_ARGS>
|
||||
bool esignal::Signal<T_ARGS...>::Executor::isSharedPtr(const std::shared_ptr<void>& _obj) {
|
||||
bool esignal::SignalInternal<T_ARGS...>::Executor::isSharedPtr(const ememory::SharedPtr<void>& _obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -141,16 +178,16 @@ bool esignal::Signal<T_ARGS...>::Executor::isSharedPtr(const std::shared_ptr<voi
|
||||
|
||||
|
||||
template<typename... T_ARGS>
|
||||
esignal::Signal<T_ARGS...>::ExecutorShared::ExecutorShared(std::weak_ptr<void> _object, Observer&& _observer) :
|
||||
esignal::SignalInternal<T_ARGS...>::ExecutorShared::ExecutorShared(ememory::WeakPtr<void> _object, Observer&& _observer) :
|
||||
Executor(std::move(_observer)),
|
||||
m_object(_object) {
|
||||
|
||||
}
|
||||
|
||||
template<typename... T_ARGS>
|
||||
void esignal::Signal<T_ARGS...>::ExecutorShared::emit(const T_ARGS&... _values) {
|
||||
void esignal::SignalInternal<T_ARGS...>::ExecutorShared::emit(const T_ARGS&... _values) {
|
||||
// TODO: maybe an error if the object is not manage by the same thread.
|
||||
std::shared_ptr<void> destObject = m_object.lock();
|
||||
ememory::SharedPtr<void> destObject = m_object.lock();
|
||||
if (destObject == nullptr) {
|
||||
Executor::m_removed = true;
|
||||
return;
|
||||
@@ -166,8 +203,8 @@ void esignal::Signal<T_ARGS...>::ExecutorShared::emit(const T_ARGS&... _values)
|
||||
}
|
||||
|
||||
template<typename... T_ARGS>
|
||||
bool esignal::Signal<T_ARGS...>::ExecutorShared::isSharedPtr(const std::shared_ptr<void>& _obj) {
|
||||
std::shared_ptr<void> destObject = m_object.lock();
|
||||
bool esignal::SignalInternal<T_ARGS...>::ExecutorShared::isSharedPtr(const ememory::SharedPtr<void>& _obj) {
|
||||
ememory::SharedPtr<void> destObject = m_object.lock();
|
||||
if (destObject == nullptr) {
|
||||
return true;
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
import lutin.module as module
|
||||
import lutin.debug as debug
|
||||
import lutin.tools as tools
|
||||
import datetime
|
||||
|
||||
def get_type():
|
||||
return "BINARY"
|
||||
@@ -22,13 +21,15 @@ def get_compagny_name():
|
||||
return "atria-soft"
|
||||
|
||||
def get_maintainer():
|
||||
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
|
||||
return "authors.txt"
|
||||
|
||||
def create(target, module_name):
|
||||
my_module = module.Module(__file__, module_name, get_type())
|
||||
def configure(target, my_module):
|
||||
my_module.add_src_file([
|
||||
'sample/sampleAll.cpp'
|
||||
])
|
||||
my_module.add_module_depend(['esignal', 'test-debug'])
|
||||
return my_module
|
||||
'sample/sampleAll.cpp'
|
||||
])
|
||||
my_module.add_depend([
|
||||
'esignal',
|
||||
'test-debug'
|
||||
])
|
||||
return True
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
import lutin.module as module
|
||||
import lutin.debug as debug
|
||||
import lutin.tools as tools
|
||||
import datetime
|
||||
|
||||
|
||||
def get_type():
|
||||
@@ -23,20 +22,23 @@ def get_compagny_name():
|
||||
return "atria-soft"
|
||||
|
||||
def get_maintainer():
|
||||
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
|
||||
return "authors.txt"
|
||||
|
||||
def create(target, module_name):
|
||||
my_module = module.Module(__file__, module_name, get_type())
|
||||
def configure(target, my_module):
|
||||
my_module.add_src_file([
|
||||
'test/main.cpp',
|
||||
'test/declareSignals.cpp',
|
||||
'test/test_signal_counter.cpp',
|
||||
'test/test_signal_class_func.cpp',
|
||||
'test/test_signal_recursive.cpp',
|
||||
'test/test_signal_shared_ptr_func.cpp',
|
||||
'test/test_signal_static_func.cpp',
|
||||
'test/test_isignal.cpp'
|
||||
])
|
||||
my_module.add_module_depend(['esignal', 'gtest', 'test-debug'])
|
||||
return my_module
|
||||
'test/main.cpp',
|
||||
'test/declareSignals.cpp',
|
||||
'test/test_signal_counter.cpp',
|
||||
'test/test_signal_class_func.cpp',
|
||||
'test/test_signal_recursive.cpp',
|
||||
'test/test_signal_shared_ptr_func.cpp',
|
||||
'test/test_signal_static_func.cpp',
|
||||
'test/test_isignal.cpp'
|
||||
])
|
||||
my_module.add_depend([
|
||||
'esignal',
|
||||
'gtest',
|
||||
'test-debug'
|
||||
])
|
||||
return True
|
||||
|
||||
|
@@ -1,9 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
import lutin.module as module
|
||||
import lutin.tools as tools
|
||||
import lutin.debug as debug
|
||||
import os
|
||||
import lutin.multiprocess as lutinMultiprocess
|
||||
|
||||
|
||||
def get_type():
|
||||
@@ -22,48 +19,38 @@ def get_compagny_name():
|
||||
return "atria-soft"
|
||||
|
||||
def get_maintainer():
|
||||
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
|
||||
return "authors.txt"
|
||||
|
||||
def get_version():
|
||||
return [0,1,"dev"]
|
||||
return "version.txt"
|
||||
|
||||
def create(target, module_name):
|
||||
my_module = module.Module(__file__, module_name, get_type())
|
||||
my_module.add_extra_compile_flags()
|
||||
def configure(target, my_module):
|
||||
my_module.add_extra_flags()
|
||||
my_module.add_src_file([
|
||||
'esignal/debug.cpp',
|
||||
'esignal/Connection.cpp',
|
||||
'esignal/InterfaceData.cpp',
|
||||
'esignal/Base.cpp',
|
||||
'esignal/details/LockSharedPtrRef.cpp',
|
||||
'esignal/details/RefCount.cpp',
|
||||
'esignal/details/Signal.cpp',
|
||||
'esignal/details/ISignal.cpp',
|
||||
])
|
||||
'esignal/debug.cpp',
|
||||
'esignal/Connection.cpp',
|
||||
'esignal/InterfaceData.cpp',
|
||||
'esignal/Base.cpp',
|
||||
'esignal/details/Signal.cpp',
|
||||
])
|
||||
my_module.add_header_file([
|
||||
'esignal/debug.h',
|
||||
'esignal/Interface.h',
|
||||
'esignal/InterfaceData.h',
|
||||
'esignal/Base.h',
|
||||
'esignal/Signal.h',
|
||||
'esignal/ISignal.h',
|
||||
'esignal/LockSharedPtrRef.h',
|
||||
'esignal/RefCount.h',
|
||||
'esignal/Connection.h',
|
||||
'esignal/details/Signal.hxx',
|
||||
'esignal/details/ISignal.hxx',
|
||||
'esignal/details/LockSharedPtrRef.hxx',
|
||||
'esignal/details/RefCount.hxx',
|
||||
])
|
||||
'esignal/debug.hpp',
|
||||
'esignal/Interface.hpp',
|
||||
'esignal/InterfaceData.hpp',
|
||||
'esignal/Base.hpp',
|
||||
'esignal/Signal.hpp',
|
||||
'esignal/Connection.hpp',
|
||||
'esignal/details/Signal.hxx',
|
||||
])
|
||||
my_module.compile_version("c++", 2011)
|
||||
my_module.add_module_depend([
|
||||
my_module.add_depend([
|
||||
'etk',
|
||||
'ememory'
|
||||
])
|
||||
my_module.add_path(tools.get_current_path(__file__))
|
||||
my_module.compile_flags('c++', [
|
||||
my_module.add_path(".")
|
||||
my_module.add_flag('c++', [
|
||||
"-DESIGNAL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\""
|
||||
])
|
||||
my_module.add_tools(['esignal-test'])
|
||||
return my_module
|
||||
return True
|
||||
|
||||
|
@@ -5,11 +5,11 @@
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#include <etk/etk.h>
|
||||
#include <test-debug/debug.h>
|
||||
#include <etk/etk.hpp>
|
||||
#include <test-debug/debug.hpp>
|
||||
|
||||
//! [esignal_sample_declare]
|
||||
#include <esignal/Signal.h>
|
||||
#include <esignal/Signal.hpp>
|
||||
//! [esignal_sample_declare]
|
||||
|
||||
void declareSignals() {
|
||||
@@ -100,7 +100,7 @@ void sharedConnection() {
|
||||
// Create the signal
|
||||
esignal::Signal<int32_t> signalValue;
|
||||
// Declare the class
|
||||
std::shared_ptr<TmpClass> myClassShared = std::make_shared<TmpClass>();
|
||||
ememory::SharedPtr<TmpClass> myClassShared = ememory::makeShared<TmpClass>();
|
||||
// Connect signals
|
||||
signalValue.connect(myClassShared, &TmpClass::localCallBack);
|
||||
// Emit sample signals
|
||||
@@ -132,7 +132,7 @@ void newSignal() {
|
||||
// do it in a single C++: Implementation of signal
|
||||
//! [esignal_sample_new_register]
|
||||
#include <esignal/details/Signal.hxx>
|
||||
template class esignal::Signal<int32_t, std::string>;
|
||||
ESIGNAL_DECLARE_SIGNAL(int32_t, std::string);
|
||||
//! [esignal_sample_new_register]
|
||||
|
||||
//! [esignal_sample_new]
|
||||
|
@@ -6,8 +6,9 @@
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#include <esignal/details/Signal.hxx>
|
||||
#include <etk/types.h>
|
||||
|
||||
template class esignal::Signal<int32_t, std::string>;
|
||||
#include <etk/types.hpp>
|
||||
|
||||
|
||||
ESIGNAL_DECLARE_SIGNAL(int32_t, std::string);
|
||||
|
||||
|
||||
|
@@ -7,9 +7,9 @@
|
||||
*/
|
||||
#define NAME "Empty"
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/etk.h>
|
||||
#include <test-debug/debug.h>
|
||||
#include <etk/types.hpp>
|
||||
#include <etk/etk.hpp>
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
int main(int _argc, const char *_argv[]) {
|
||||
|
@@ -8,17 +8,17 @@
|
||||
|
||||
#define NAME "SingleArg"
|
||||
#include <gtest/gtest.h>
|
||||
#include <esignal/ISignal.h>
|
||||
#include <esignal/Interface.h>
|
||||
#include <memory>
|
||||
#include <test-debug/debug.h>
|
||||
#include <esignal/Signal.hpp>
|
||||
#include <esignal/Interface.hpp>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <test-debug/debug.hpp>
|
||||
|
||||
|
||||
class testISignal : public esignal::Interface {
|
||||
public:
|
||||
esignal::ISignal<int32_t> m_signalInt;
|
||||
esignal::ISignal<std::string> m_signalString;
|
||||
esignal::ISignal<float> m_signalFloat;
|
||||
esignal::Signal<int32_t> m_signalInt;
|
||||
esignal::Signal<std::string> m_signalString;
|
||||
esignal::Signal<float> m_signalFloat;
|
||||
public:
|
||||
size_t m_count;
|
||||
testISignal():
|
||||
@@ -85,7 +85,7 @@ TEST(test_isignal_counter, localbasicNameDesc) {
|
||||
EXPECT_EQ(localClass.m_signalString.getDescription(), "desc string");
|
||||
}
|
||||
|
||||
class testCallbackIShared : public std::enable_shared_from_this<testCallbackIShared> {
|
||||
class testCallbackIShared : public ememory::EnableSharedFromThis<testCallbackIShared> {
|
||||
public:
|
||||
testCallbackIShared() {
|
||||
}
|
||||
@@ -110,7 +110,7 @@ TEST(test_isignal_counter, localbasicInterfaceDisconnectNullPtr) {
|
||||
|
||||
TEST(test_isignal_counter, localbasicInterfaceDisconnectSharedPtr) {
|
||||
testISignal localClass;
|
||||
std::shared_ptr<testCallbackIShared> tmp = std::make_shared<testCallbackIShared>();
|
||||
ememory::SharedPtr<testCallbackIShared> tmp = ememory::makeShared<testCallbackIShared>();
|
||||
localClass.signals.disconnect(tmp);
|
||||
EXPECT_EQ(localClass.m_signalInt.size(), 0);
|
||||
EXPECT_EQ(localClass.m_signalInt.empty(), true);
|
||||
|
@@ -8,10 +8,10 @@
|
||||
|
||||
#define NAME "SingleArg"
|
||||
#include <gtest/gtest.h>
|
||||
#include <esignal/Signal.h>
|
||||
#include <esignal/Interface.h>
|
||||
#include <memory>
|
||||
#include <test-debug/debug.h>
|
||||
#include <esignal/Signal.hpp>
|
||||
#include <esignal/Interface.hpp>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <test-debug/debug.hpp>
|
||||
|
||||
class testCallback {
|
||||
public:
|
||||
|
@@ -8,10 +8,10 @@
|
||||
|
||||
#define NAME "SingleArg"
|
||||
#include <gtest/gtest.h>
|
||||
#include <esignal/Signal.h>
|
||||
#include <esignal/Interface.h>
|
||||
#include <memory>
|
||||
#include <test-debug/debug.h>
|
||||
#include <esignal/Signal.hpp>
|
||||
#include <esignal/Interface.hpp>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <test-debug/debug.hpp>
|
||||
|
||||
class testCounter {
|
||||
public:
|
||||
|
@@ -8,10 +8,10 @@
|
||||
|
||||
#define NAME "SingleArg"
|
||||
#include <gtest/gtest.h>
|
||||
#include <esignal/Signal.h>
|
||||
#include <esignal/Interface.h>
|
||||
#include <memory>
|
||||
#include <test-debug/debug.h>
|
||||
#include <esignal/Signal.hpp>
|
||||
#include <esignal/Interface.hpp>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <test-debug/debug.hpp>
|
||||
|
||||
static esignal::Signal<int32_t>* signalll;
|
||||
static int32_t tmpRetInt32 = 0;
|
||||
|
@@ -8,12 +8,12 @@
|
||||
|
||||
#define NAME "SingleArg"
|
||||
#include <gtest/gtest.h>
|
||||
#include <esignal/Signal.h>
|
||||
#include <esignal/Interface.h>
|
||||
#include <memory>
|
||||
#include <test-debug/debug.h>
|
||||
#include <esignal/Signal.hpp>
|
||||
#include <esignal/Interface.hpp>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <test-debug/debug.hpp>
|
||||
|
||||
class testCallbackShared : public std::enable_shared_from_this<testCallbackShared> {
|
||||
class testCallbackShared : public ememory::EnableSharedFromThis<testCallbackShared> {
|
||||
public:
|
||||
int32_t m_int32;
|
||||
std::string m_string;
|
||||
@@ -74,7 +74,7 @@ class testCallbackShared : public std::enable_shared_from_this<testCallbackShare
|
||||
m_string = _b + _char;
|
||||
}
|
||||
void callbackDisconnect(esignal::Signal<>* _signal) {
|
||||
_signal->disconnectShared(shared_from_this());
|
||||
_signal->disconnectShared(sharedFromThis());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -84,7 +84,7 @@ void removeObserver(size_t _count) {
|
||||
}
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localNullClass) {
|
||||
std::shared_ptr<testCallbackShared> localClass;
|
||||
ememory::SharedPtr<testCallbackShared> localClass;
|
||||
esignal::Signal<> signal(&removeObserver);
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
@@ -96,7 +96,7 @@ TEST(test_signal_shared_ptr_func, localNullClass) {
|
||||
/*
|
||||
Impossible case ...
|
||||
TEST(test_signal_shared_ptr_func, localNullFunction) {
|
||||
std::shared_ptr<testCallbackShared> localClass = std::make_shared<testCallbackShared>();
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
@@ -108,7 +108,7 @@ TEST(test_signal_shared_ptr_func, localNullFunction) {
|
||||
}
|
||||
*/
|
||||
TEST(test_signal_shared_ptr_func, localFunctionVoid) {
|
||||
std::shared_ptr<testCallbackShared> localClass = std::make_shared<testCallbackShared>();
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
@@ -120,7 +120,7 @@ TEST(test_signal_shared_ptr_func, localFunctionVoid) {
|
||||
}
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localFunctionInt32) {
|
||||
std::shared_ptr<testCallbackShared> localClass = std::make_shared<testCallbackShared>();
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<int32_t> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
@@ -136,7 +136,7 @@ TEST(test_signal_shared_ptr_func, localFunctionInt32) {
|
||||
}
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localFunctionConstInt32) {
|
||||
std::shared_ptr<testCallbackShared> localClass = std::make_shared<testCallbackShared>();
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<int32_t> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
@@ -148,7 +148,7 @@ TEST(test_signal_shared_ptr_func, localFunctionConstInt32) {
|
||||
}
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localFunctionString) {
|
||||
std::shared_ptr<testCallbackShared> localClass = std::make_shared<testCallbackShared>();
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<std::string> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
@@ -164,7 +164,7 @@ TEST(test_signal_shared_ptr_func, localFunctionString) {
|
||||
}
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localFunctionConstString) {
|
||||
std::shared_ptr<testCallbackShared> localClass = std::make_shared<testCallbackShared>();
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<std::string> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
@@ -176,7 +176,7 @@ TEST(test_signal_shared_ptr_func, localFunctionConstString) {
|
||||
}
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localFunctionIntString) {
|
||||
std::shared_ptr<testCallbackShared> localClass = std::make_shared<testCallbackShared>();
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
@@ -193,7 +193,7 @@ TEST(test_signal_shared_ptr_func, localFunctionIntString) {
|
||||
}
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localFunctionConstIntString) {
|
||||
std::shared_ptr<testCallbackShared> localClass = std::make_shared<testCallbackShared>();
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
@@ -206,7 +206,7 @@ TEST(test_signal_shared_ptr_func, localFunctionConstIntString) {
|
||||
}
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localFunctionMixedIntString) {
|
||||
std::shared_ptr<testCallbackShared> localClass = std::make_shared<testCallbackShared>();
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
@@ -224,7 +224,7 @@ TEST(test_signal_shared_ptr_func, localFunctionMixedIntString) {
|
||||
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localFunctionConstIntStringPolyArg) {
|
||||
std::shared_ptr<testCallbackShared> localClass = std::make_shared<testCallbackShared>();
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
@@ -246,7 +246,7 @@ class testCallbackSharedHerited : public testCallbackShared {
|
||||
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localFunctionHerited) {
|
||||
std::shared_ptr<testCallbackSharedHerited> localClass = std::make_shared<testCallbackSharedHerited>();
|
||||
ememory::SharedPtr<testCallbackSharedHerited> localClass = ememory::makeShared<testCallbackSharedHerited>();
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
@@ -260,7 +260,7 @@ TEST(test_signal_shared_ptr_func, localFunctionHerited) {
|
||||
|
||||
|
||||
TEST(test_signal_shared_ptr_func, disconnect) {
|
||||
std::shared_ptr<testCallbackShared> localClass = std::make_shared<testCallbackShared>();
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<int32_t> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
@@ -276,7 +276,7 @@ TEST(test_signal_shared_ptr_func, disconnect) {
|
||||
|
||||
|
||||
TEST(test_signal_shared_ptr_func, connect_disconnect_multiple) {
|
||||
std::shared_ptr<testCallbackShared> localClass = std::make_shared<testCallbackShared>();
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<int32_t> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
@@ -302,7 +302,7 @@ TEST(test_signal_shared_ptr_func, connect_disconnect_multiple) {
|
||||
|
||||
|
||||
TEST(test_signal_shared_ptr_func, disconnect_inCallback) {
|
||||
std::shared_ptr<testCallbackShared> localClass = std::make_shared<testCallbackShared>();
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
@@ -319,8 +319,8 @@ static void callbackVoid() {
|
||||
}
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localFunctionWeakTest) {
|
||||
std::shared_ptr<testCallbackShared> localClassA = std::make_shared<testCallbackShared>();
|
||||
std::shared_ptr<testCallbackShared> localClassB = std::make_shared<testCallbackShared>();
|
||||
ememory::SharedPtr<testCallbackShared> localClassA = ememory::makeShared<testCallbackShared>();
|
||||
ememory::SharedPtr<testCallbackShared> localClassB = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<> signal(&removeObserver);
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
@@ -339,7 +339,7 @@ TEST(test_signal_shared_ptr_func, localFunctionWeakTest) {
|
||||
signal.emit();
|
||||
EXPECT_EQ(signal.size(), 3);
|
||||
EXPECT_EQ(signal.empty(), false);
|
||||
localClassB = std::make_shared<testCallbackShared>();
|
||||
localClassB = ememory::makeShared<testCallbackShared>();
|
||||
signal.connect(localClassB, &testCallbackShared::callbackVoid);
|
||||
EXPECT_EQ(signal.size(), 4);
|
||||
EXPECT_EQ(signal.empty(), false);
|
||||
|
@@ -8,10 +8,10 @@
|
||||
|
||||
#define NAME "SingleArg"
|
||||
#include <gtest/gtest.h>
|
||||
#include <esignal/Signal.h>
|
||||
#include <esignal/Interface.h>
|
||||
#include <memory>
|
||||
#include <test-debug/debug.h>
|
||||
#include <esignal/Signal.hpp>
|
||||
#include <esignal/Interface.hpp>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <test-debug/debug.hpp>
|
||||
|
||||
static int32_t tmpRetInt32 = 0;
|
||||
static std::string tmpRetString = "";
|
||||
|
1
version.txt
Normal file
1
version.txt
Normal file
@@ -0,0 +1 @@
|
||||
0.5.0
|
Reference in New Issue
Block a user