[DEV] add possibility to tag a signal periodic and remove log on it event
This commit is contained in:
parent
a2209a6a0e
commit
bf72807cef
@ -34,6 +34,9 @@ const std::string& esignal::Base::getDescription() const {
|
|||||||
return noValue;
|
return noValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void esignal::Base::setPeriodic(bool _state) {
|
||||||
|
m_periodic = _state;
|
||||||
|
}
|
||||||
|
|
||||||
std::ostream& esignal::operator <<(std::ostream& _os, const esignal::Base& _obj) {
|
std::ostream& esignal::operator <<(std::ostream& _os, const esignal::Base& _obj) {
|
||||||
_os << _obj.getName();
|
_os << _obj.getName();
|
||||||
|
@ -28,6 +28,7 @@ namespace esignal {
|
|||||||
public:
|
public:
|
||||||
using ObserverConnection = std::function<void(size_t)>; //!< Define an Observer of the number of observer
|
using ObserverConnection = std::function<void(size_t)>; //!< Define an Observer of the number of observer
|
||||||
protected:
|
protected:
|
||||||
|
bool m_periodic; //!< The signal is periodic ==> no log with this signal ... (no really needed)
|
||||||
esignal::LockSharedPtrRef<esignal::Base> m_shared; //!< Reference counter on itself.
|
esignal::LockSharedPtrRef<esignal::Base> m_shared; //!< Reference counter on itself.
|
||||||
static size_t s_uid; //!< global id of the signal (STATIC)
|
static size_t s_uid; //!< global id of the signal (STATIC)
|
||||||
static int64_t s_uidSignalEmit; //!< global id to emit counting
|
static int64_t s_uidSignalEmit; //!< global id to emit counting
|
||||||
@ -67,6 +68,11 @@ namespace esignal {
|
|||||||
* @return requested decription.
|
* @return requested decription.
|
||||||
*/
|
*/
|
||||||
virtual const std::string& getDescription() const;
|
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
|
//! @not-in-doc
|
||||||
std::ostream& operator <<(std::ostream& _os, const esignal::Base& _obj);
|
std::ostream& operator <<(std::ostream& _os, const esignal::Base& _obj);
|
||||||
|
@ -23,10 +23,16 @@ void esignal::Signal<T_ARGS...>::emit(const T_ARGS&... _args) {
|
|||||||
#endif
|
#endif
|
||||||
// TODO : Add protection ... but how ...
|
// TODO : Add protection ... but how ...
|
||||||
m_callInProgress++;
|
m_callInProgress++;
|
||||||
ESIGNAL_DEBUG(esignal::logIndent(m_callInProgress-1) << " signal{" << tmpID << "} : '" << getName() << "' ***/" << m_executors.size());
|
if (m_periodic == false) {
|
||||||
for (size_t iii=0; iii < m_executors.size(); ++iii) {
|
ESIGNAL_DEBUG(esignal::logIndent(m_callInProgress-1) << " signal{" << tmpID << "} : '" << getName() << "' ***/" << m_executors.size());
|
||||||
ESIGNAL_VERBOSE(esignal::logIndent(m_callInProgress-1) << " {" << tmpID << "} : " << iii);
|
for (size_t iii=0; iii < m_executors.size(); ++iii) {
|
||||||
m_executors[iii]->emit(_args...);
|
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) {
|
if (m_callInProgress == 1) {
|
||||||
bool haveRemove = false;
|
bool haveRemove = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user