Diff to HTML by rtfpessoa

{baseline/home/runner/work/ThunderTools/ThunderTools/ghpages_baseline/PluginSkeletonGenerator/master/latest_raw/InProcessConfigPreconditions → generated/artifacts/PluginSkeleton-InProcessConfigPreconditions}/InProcessConfigPreconditions.cpp RENAMED
@@ -16,60 +16,100 @@
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
18
  */
19
19
 
20
20
  #include "InProcessConfigPreconditions.h"
21
- #include <interfaces/json/JDictionary.h>
21
+ #include <interfaces/json/JVolumeControl.h>
22
22
 
23
23
  namespace Thunder {
24
24
  namespace Plugin {
25
25
 
26
26
  namespace {
27
27
 
28
- static Metadata<InProcessConfigPreconditions>metadata(
28
+ static Metadata<InProcessConfigPreconditions> metadata(
29
29
  // Version
30
30
  1, 0, 0,
31
31
  // Preconditions
32
- { subsystem::GRAPHICS },
32
+ {subsystem::GRAPHICS},
33
33
  // Terminations
34
- { subsystem::NOT_GRAPHICS },
34
+ {subsystem::NOT_GRAPHICS},
35
35
  // Controls
36
- { subsystem::TIME }
36
+ {subsystem::TIME}
37
37
  );
38
38
  }
39
39
 
40
40
  const string InProcessConfigPreconditions::Initialize(PluginHost::IShell* service) {
41
41
  string message;
42
42
 
43
43
  ASSERT(service != nullptr);
44
- Config config;
44
+ PluginConfig config;
45
45
  config.FromString(service->ConfigLine());
46
46
  TRACE(Trace::Information, (_T("This is just an example: [%s]"), config.Example.Value().c_str()));
47
- Exchange::JDictionary::Register(*this, this);
47
+ Exchange::JVolumeControl::Register(*this, this);
48
48
  return (message);
49
49
  }
50
50
 
51
51
  void InProcessConfigPreconditions::Deinitialize(VARIABLE_IS_NOT_USED PluginHost::IShell* service) {
52
- Exchange::JDictionary::Unregister(*this);
52
+ Exchange::JVolumeControl::Unregister(*this);
53
53
  }
54
54
 
55
55
  string InProcessConfigPreconditions::Information() const {
56
56
  return (string());
57
57
  }
58
58
 
59
- Core::hresult InProcessConfigPreconditions::Register(const string& /* path */, IDictionary::INotification* /* sink */) {
60
- return Core::ERROR_NONE;
59
+ void InProcessConfigPreconditions::Register(Exchange::IVolumeControl::INotification* notification) {
60
+ ASSERT(notification != nullptr);
61
+
62
+ _adminLock.Lock();
63
+ auto item = std::find(_volumecontrolNotification.begin(), _volumecontrolNotification.end(), notification);
64
+ ASSERT(item == _volumecontrolNotification.end());
65
+
66
+ if (item == _volumecontrolNotification.end()) {
67
+ notification->AddRef();
68
+ _volumecontrolNotification.push_back(notification);
69
+ }
70
+
71
+ _adminLock.Unlock();
61
72
  }
62
- Core::hresult InProcessConfigPreconditions::Unregister(const string& /* path */, const IDictionary::INotification* /* sink */) {
73
+ void InProcessConfigPreconditions::Unregister(const Exchange::IVolumeControl::INotification* notification) {
74
+ ASSERT(notification != nullptr);
75
+
76
+ _adminLock.Lock();
77
+ auto item = std::find(_volumecontrolNotification.begin(), _volumecontrolNotification.end(), notification);
78
+ ASSERT(item != _volumecontrolNotification.end());
79
+
80
+ if (item != _volumecontrolNotification.end()) {
81
+ _volumecontrolNotification.erase(item);
82
+ notification->Release();
83
+ }
84
+ _adminLock.Unlock();
85
+ }
86
+ uint32_t InProcessConfigPreconditions::Muted(const bool /* muted */) {
63
87
  return Core::ERROR_NONE;
64
88
  }
65
- Core::hresult InProcessConfigPreconditions::Get(const string& /* path */, const string& /* key */, string& /* value */ /* @out */) const {
89
+ uint32_t InProcessConfigPreconditions::Muted(bool& /* muted */ /* @out */) const {
66
90
  return Core::ERROR_NONE;
67
91
  }
68
- Core::hresult InProcessConfigPreconditions::Set(const string& /* path */, const string& /* key */, const string& /* value */) {
92
+ uint32_t InProcessConfigPreconditions::Volume(const uint8_t /* volume */) {
69
93
  return Core::ERROR_NONE;
70
94
  }
71
- Core::hresult InProcessConfigPreconditions::PathEntries(const string& /* path */, IDictionary::IPathIterator*& /* entries */ /* @out */) const {
95
+ uint32_t InProcessConfigPreconditions::Volume(uint8_t& /* volume */ /* @out */) const {
72
96
  return Core::ERROR_NONE;
73
97
  }
98
+
99
+ void InProcessConfigPreconditions::NotifyVolume(const uint8_t volume) const {
100
+ _adminLock.Lock();
101
+ for (auto* notification : _volumecontrolNotification) {
102
+ notification->Volume(volume);
103
+ }
104
+ _adminLock.Unlock();
105
+ }
106
+
107
+ void InProcessConfigPreconditions::NotifyMuted(const bool muted) const {
108
+ _adminLock.Lock();
109
+ for (auto* notification : _volumecontrolNotification) {
110
+ notification->Muted(muted);
111
+ }
112
+ _adminLock.Unlock();
113
+ }
74
114
  } // Plugin
75
115
  } // Thunder
{baseline/home/runner/work/ThunderTools/ThunderTools/ghpages_baseline/PluginSkeletonGenerator/master/latest_raw/InProcessConfigPreconditions → generated/artifacts/PluginSkeleton-InProcessConfigPreconditions}/InProcessConfigPreconditions.h RENAMED
@@ -18,76 +18,82 @@
18
18
  */
19
19
 
20
20
  #pragma once
21
21
 
22
22
  #include "Module.h"
23
- #include <interfaces/IDictionary.h>
23
+ #include <interfaces/IVolumeControl.h>
24
24
 
25
25
  namespace Thunder {
26
26
  namespace Plugin {
27
27
 
28
- class InProcessConfigPreconditions : public PluginHost::IPlugin, public PluginHost::JSONRPC, public Exchange::IDictionary {
28
+ class InProcessConfigPreconditions : public PluginHost::IPlugin, public PluginHost::JSONRPC, public Exchange::IVolumeControl {
29
29
  public:
30
30
  InProcessConfigPreconditions(const InProcessConfigPreconditions&) = delete;
31
31
  InProcessConfigPreconditions& operator=(const InProcessConfigPreconditions&) = delete;
32
32
  InProcessConfigPreconditions(InProcessConfigPreconditions&&) = delete;
33
33
  InProcessConfigPreconditions& operator=(InProcessConfigPreconditions&&) = delete;
34
34
 
35
35
  InProcessConfigPreconditions()
36
36
  : PluginHost::IPlugin()
37
37
  , PluginHost::JSONRPC()
38
- , Exchange::IDictionary()
38
+ , Exchange::IVolumeControl()
39
39
  , _adminLock()
40
- , _dictionaryNotification()
40
+ , _volumecontrolNotification()
41
41
  {
42
42
  }
43
43
 
44
44
  ~InProcessConfigPreconditions() override = default;
45
- class Config : public Core::JSON::Container {
45
+ private:
46
+ class PluginConfig : public Core::JSON::Container {
46
47
  public:
47
- Config(const Config&) = delete;
48
- Config& operator=(const Config&) = delete;
49
- Config(Config&&) = delete;
50
- Config& operator=(Config&&) = delete;
48
+ PluginConfig(const PluginConfig&) = delete;
49
+ PluginConfig& operator=(const PluginConfig&) = delete;
50
+ PluginConfig(PluginConfig&&) = delete;
51
+ PluginConfig& operator=(PluginConfig&&) = delete;
51
52
 
52
- Config()
53
+ PluginConfig()
53
54
  : Core::JSON::Container()
54
55
  , Example()
55
56
  {
56
57
  Add(_T("example"), &Example);
57
58
  }
58
- ~Config() override = default;
59
+ ~PluginConfig() override = default;
59
60
  public:
60
61
  Core::JSON::String Example;
61
62
  };
62
63
  public:
63
64
  // IPlugin Methods
64
65
  const string Initialize(PluginHost::IShell* service) override;
65
66
  void Deinitialize(PluginHost::IShell* service) override;
66
67
  string Information() const override;
67
68
 
68
- // IDictionary methods
69
+ // IVolumeControl methods
70
+
71
+ void Register(Exchange::IVolumeControl::INotification* const /* sink */) override;
69
72
 
70
- Core::hresult Register(const string& /* path */, IDictionary::INotification* /* sink */) override;
73
+ void Unregister(const Exchange::IVolumeControl::INotification* const /* sink */) override;
71
74
 
72
- Core::hresult Unregister(const string& /* path */, const IDictionary::INotification* /* sink */) override;
75
+ uint32_t Muted(const bool /* muted */) override;
73
76
 
74
- Core::hresult Get(const string& /* path */, const string& /* key */, string& /* value */ /* @out */) const override;
77
+ uint32_t Muted(bool& /* muted */ /* @out */) const override;
75
78
 
76
- Core::hresult Set(const string& /* path */, const string& /* key */, const string& /* value */) override;
79
+ uint32_t Volume(const uint8_t /* volume */) override;
77
80
 
78
- Core::hresult PathEntries(const string& /* path */, IDictionary::IPathIterator*& /* entries */ /* @out */) const override;
81
+ uint32_t Volume(uint8_t& /* volume */ /* @out */) const override;
79
82
 
80
83
  BEGIN_INTERFACE_MAP(InProcessConfigPreconditions)
81
84
  INTERFACE_ENTRY(PluginHost::IPlugin)
82
85
  INTERFACE_ENTRY(PluginHost::IDispatcher)
83
- INTERFACE_ENTRY(Exchange::IDictionary)
86
+ INTERFACE_ENTRY(Exchange::IVolumeControl)
84
87
  END_INTERFACE_MAP
85
88
 
86
89
  private:
87
- using DictionaryNotificationContainer = std::vector<Exchange::IDictionary::INotification*>;
90
+ using VolumeControlNotificationContainer = std::vector<Exchange::IVolumeControl::INotification*>;
91
+
92
+ void NotifyVolume(const uint8_t /* volume */) const;
93
+ void NotifyMuted(const bool /* muted */) const;
88
94
 
89
95
  mutable Core::CriticalSection _adminLock;
90
- DictionaryNotificationContainer _dictionaryNotification;
96
+ VolumeControlNotificationContainer _volumecontrolNotification;
91
97
  };
92
98
  } // Plugin
93
99
  } // Thunder
{baseline/home/runner/work/ThunderTools/ThunderTools/ghpages_baseline/PluginSkeletonGenerator/master/latest_raw/InProcessConfigPreconditions → generated/artifacts/PluginSkeleton-InProcessConfigPreconditions}/InProcessConfigPreconditionsPlugin.json RENAMED
@@ -24,8 +24,8 @@
24
24
  }
25
25
  }
26
26
  }
27
27
  },
28
28
  "interface": {
29
- "$cppref": "{cppinterfacedir}/IDictionary.h"
29
+ "$cppref": "{cppinterfacedir}/IVolumeControl.h"
30
30
  }
31
31
  }