From 8b8a1d44b3385879c944630ef93b4a6ae6d002ae Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Tue, 8 Apr 2014 17:08:02 +0200 Subject: [PATCH] refs #199, added unique id to context. A unique id allows to detect roundtrips when redirecting output (qDebug, qWarning) --- src/blackcore/context.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/blackcore/context.h b/src/blackcore/context.h index 7347adeeb..48f69e29f 100644 --- a/src/blackcore/context.h +++ b/src/blackcore/context.h @@ -1,9 +1,10 @@ #ifndef BLACKCORE_CONTEXT_H #define BLACKCORE_CONTEXT_H -#include #include "blackcore/context_runtime_config.h" #include "blackcore/context_runtime.h" +#include +#include namespace BlackCore { @@ -12,9 +13,6 @@ namespace BlackCore */ class CContext : public QObject { - private: - CRuntimeConfig::ContextMode m_mode; - public: //! Destructor ~CContext() {} @@ -39,6 +37,12 @@ namespace BlackCore return static_cast(this->parent()); } + //! Mode + CRuntimeConfig::ContextMode getMode() const { return this->m_mode; } + + //! Unique id + qint64 getUniqueId() const { return this->m_contextId; } + // // cross context access // @@ -75,9 +79,16 @@ namespace BlackCore protected: //! Constructor - CContext(CRuntimeConfig::ContextMode mode, QObject *parent) : QObject(parent), m_mode(mode) + CContext(CRuntimeConfig::ContextMode mode, QObject *parent) : + QObject(parent), m_mode(mode), m_contextId(QDateTime::currentMSecsSinceEpoch()) {} + //! Re-emit signal locally + //! \details proxy uses slot to send signal, and on implementation side this re-emitted as signal + void reEmitSignalFromProxy(const QString &signalName); + + CRuntimeConfig::ContextMode m_mode; //!< How context is used + qint64 m_contextId; //!< unique identifer, avoid redirection rountrips }; } #endif // guard