diff --git a/esignal/Base.cpp b/esignal/Base.cpp index 0da9171..a5c8a7c 100644 --- a/esignal/Base.cpp +++ b/esignal/Base.cpp @@ -34,6 +34,9 @@ const std::string& esignal::Base::getDescription() const { return noValue; } +void esignal::Base::setPeriodic(bool _state) { + m_periodic = _state; +} std::ostream& esignal::operator <<(std::ostream& _os, const esignal::Base& _obj) { _os << _obj.getName(); diff --git a/esignal/Base.h b/esignal/Base.h index 219a8a7..ba3fbd7 100644 --- a/esignal/Base.h +++ b/esignal/Base.h @@ -28,6 +28,7 @@ namespace esignal { public: using ObserverConnection = std::function; //!< Define an Observer of the number of observer protected: + bool m_periodic; //!< The signal is periodic ==> no log with this signal ... (no really needed) esignal::LockSharedPtrRef 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 @@ -67,6 +68,11 @@ namespace esignal { * @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); diff --git a/esignal/details/Signal.hxx b/esignal/details/Signal.hxx index 967538b..7c3c2f7 100644 --- a/esignal/details/Signal.hxx +++ b/esignal/details/Signal.hxx @@ -23,10 +23,16 @@ void esignal::Signal::emit(const T_ARGS&... _args) { #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;