diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-07-07 22:23:49 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-07-07 22:23:49 +0200 |
commit | da2b049e248c1ad7efeb53685158a205335e4e36 (patch) | |
tree | 1e7e5e940e9b760b2108081b1d2f3879cebdb0ff /common/domainadaptor.h | |
parent | 9bcb822963fc96c94dbe7dcc4134dcd2dac454ff (diff) | |
download | sink-da2b049e248c1ad7efeb53685158a205335e4e36.tar.gz sink-da2b049e248c1ad7efeb53685158a205335e4e36.zip |
A new debug system.
Instead of a single #define as debug area the new system allows for an
identifier for each debug message with the structure component.area.
The component is a dot separated identifier of the runtime component,
such as the process or the plugin.
The area is the code component, and can be as such defined at
compiletime.
The idea of this system is that it becomes possible to i.e. look at the
output of all messages in the query subsystem of a specific resource
(something that happens in the client process, but in the
resource-specific subcomponent).
The new macros are supposed to be less likely to clash with other names,
hence the new names.
Diffstat (limited to 'common/domainadaptor.h')
-rw-r--r-- | common/domainadaptor.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/common/domainadaptor.h b/common/domainadaptor.h index 8ac8171..25448f3 100644 --- a/common/domainadaptor.h +++ b/common/domainadaptor.h | |||
@@ -47,12 +47,12 @@ createBufferPart(const Sink::ApplicationDomain::ApplicationDomainType &domainObj | |||
47 | // First create a primitives such as strings using the mappings | 47 | // First create a primitives such as strings using the mappings |
48 | QList<std::function<void(Builder &)>> propertiesToAddToResource; | 48 | QList<std::function<void(Builder &)>> propertiesToAddToResource; |
49 | for (const auto &property : domainObject.changedProperties()) { | 49 | for (const auto &property : domainObject.changedProperties()) { |
50 | // Trace() << "copying property " << property; | 50 | // SinkTrace() << "copying property " << property; |
51 | const auto value = domainObject.getProperty(property); | 51 | const auto value = domainObject.getProperty(property); |
52 | if (mapper.hasMapping(property)) { | 52 | if (mapper.hasMapping(property)) { |
53 | mapper.setProperty(property, domainObject.getProperty(property), propertiesToAddToResource, fbb); | 53 | mapper.setProperty(property, domainObject.getProperty(property), propertiesToAddToResource, fbb); |
54 | } else { | 54 | } else { |
55 | // Trace() << "no mapping for property available " << property; | 55 | // SinkTrace() << "no mapping for property available " << property; |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
@@ -79,7 +79,7 @@ static void createBufferPartBuffer(const Sink::ApplicationDomain::ApplicationDom | |||
79 | fbb.Finish(pos, "AKFB"); | 79 | fbb.Finish(pos, "AKFB"); |
80 | flatbuffers::Verifier verifier(fbb.GetBufferPointer(), fbb.GetSize()); | 80 | flatbuffers::Verifier verifier(fbb.GetBufferPointer(), fbb.GetSize()); |
81 | if (!verifier.VerifyBuffer<Buffer>()) { | 81 | if (!verifier.VerifyBuffer<Buffer>()) { |
82 | Warning() << "Created invalid uffer"; | 82 | SinkWarning_(0, "bufferadaptor") << "Created invalid uffer"; |
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
@@ -89,6 +89,7 @@ static void createBufferPartBuffer(const Sink::ApplicationDomain::ApplicationDom | |||
89 | template <class LocalBuffer, class ResourceBuffer> | 89 | template <class LocalBuffer, class ResourceBuffer> |
90 | class GenericBufferAdaptor : public Sink::ApplicationDomain::BufferAdaptor | 90 | class GenericBufferAdaptor : public Sink::ApplicationDomain::BufferAdaptor |
91 | { | 91 | { |
92 | SINK_DEBUG_AREA("bufferadaptor") | ||
92 | public: | 93 | public: |
93 | GenericBufferAdaptor() : BufferAdaptor() | 94 | GenericBufferAdaptor() : BufferAdaptor() |
94 | { | 95 | { |
@@ -96,7 +97,7 @@ public: | |||
96 | 97 | ||
97 | virtual void setProperty(const QByteArray &key, const QVariant &value) Q_DECL_OVERRIDE | 98 | virtual void setProperty(const QByteArray &key, const QVariant &value) Q_DECL_OVERRIDE |
98 | { | 99 | { |
99 | Warning() << "Can't set property " << key; | 100 | SinkWarning() << "Can't set property " << key; |
100 | Q_ASSERT(false); | 101 | Q_ASSERT(false); |
101 | } | 102 | } |
102 | 103 | ||
@@ -107,7 +108,7 @@ public: | |||
107 | } else if (mLocalBuffer && mLocalMapper->hasMapping(key)) { | 108 | } else if (mLocalBuffer && mLocalMapper->hasMapping(key)) { |
108 | return mLocalMapper->getProperty(key, mLocalBuffer); | 109 | return mLocalMapper->getProperty(key, mLocalBuffer); |
109 | } | 110 | } |
110 | Warning() << "No mapping available for key " << key << mLocalBuffer << mResourceBuffer; | 111 | SinkWarning() << "No mapping available for key " << key << mLocalBuffer << mResourceBuffer; |
111 | return QVariant(); | 112 | return QVariant(); |
112 | } | 113 | } |
113 | 114 | ||
@@ -168,13 +169,13 @@ public: | |||
168 | { | 169 | { |
169 | flatbuffers::FlatBufferBuilder localFbb; | 170 | flatbuffers::FlatBufferBuilder localFbb; |
170 | if (mLocalWriteMapper) { | 171 | if (mLocalWriteMapper) { |
171 | // Trace() << "Creating local buffer part"; | 172 | // SinkTrace() << "Creating local buffer part"; |
172 | createBufferPartBuffer<LocalBuffer, LocalBuilder>(domainObject, localFbb, *mLocalWriteMapper); | 173 | createBufferPartBuffer<LocalBuffer, LocalBuilder>(domainObject, localFbb, *mLocalWriteMapper); |
173 | } | 174 | } |
174 | 175 | ||
175 | flatbuffers::FlatBufferBuilder resFbb; | 176 | flatbuffers::FlatBufferBuilder resFbb; |
176 | if (mResourceWriteMapper) { | 177 | if (mResourceWriteMapper) { |
177 | // Trace() << "Creating resouce buffer part"; | 178 | // SinkTrace() << "Creating resouce buffer part"; |
178 | createBufferPartBuffer<ResourceBuffer, ResourceBuilder>(domainObject, resFbb, *mResourceWriteMapper); | 179 | createBufferPartBuffer<ResourceBuffer, ResourceBuilder>(domainObject, resFbb, *mResourceWriteMapper); |
179 | } | 180 | } |
180 | 181 | ||