JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
updatehandler.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------
2// Project : SDK Base
3// Version : 1.0
4//
5// Category : Helpers
6// Filename : base/source/updatehandler.h
7// Created by : Steinberg, 2008
8// Description :
9//
10//-----------------------------------------------------------------------------
11// LICENSE
12// (c) 2023, Steinberg Media Technologies GmbH, All Rights Reserved
13//-----------------------------------------------------------------------------
14// Redistribution and use in source and binary forms, with or without modification,
15// are permitted provided that the following conditions are met:
16//
17// * Redistributions of source code must retain the above copyright notice,
18// this list of conditions and the following disclaimer.
19// * Redistributions in binary form must reproduce the above copyright notice,
20// this list of conditions and the following disclaimer in the documentation
21// and/or other materials provided with the distribution.
22// * Neither the name of the Steinberg Media Technologies nor the names of its
23// contributors may be used to endorse or promote products derived from this
24// software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
27// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
30// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
34// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
35// OF THE POSSIBILITY OF SUCH DAMAGE.
36//-----------------------------------------------------------------------------
37
38#pragma once
39
40#include "base/source/fobject.h"
43
44namespace Steinberg {
45
47namespace Update { struct Table; }
49
50//------------------------------------------------------------------------
52//------------------------------------------------------------------------
54{
55public:
56//------------------------------------------------------------------------
58 virtual tresult PLUGIN_API cancelUpdates (FUnknown* object) = 0;
60 virtual tresult PLUGIN_API triggerDeferedUpdates (FUnknown* object = nullptr) = 0;
61 static const FUID iid;
62};
63
64DECLARE_CLASS_IID (IUpdateManager, 0x030B780C, 0xD6E6418D, 0x8CE00BC2, 0x09C834D4)
65
66//------------------------------------------------------------------------------
75//------------------------------------------------------------------------------
76class UpdateHandler : public FObject, public IUpdateHandler, public IUpdateManager
77{
78public:
79//------------------------------------------------------------------------------
81 ~UpdateHandler () SMTG_OVERRIDE;
82
86
87 // IUpdateHandler
88//private:
89 friend class FObject;
91 tresult PLUGIN_API addDependent (FUnknown* object, IDependent* dependent) SMTG_OVERRIDE;
93 tresult PLUGIN_API removeDependent (FUnknown* object, IDependent* dependent, size_t& earseCount);
94 tresult PLUGIN_API removeDependent (FUnknown* object,
95 IDependent* dependent) SMTG_OVERRIDE;
96public:
98 tresult PLUGIN_API triggerUpdates (FUnknown* object, int32 message) SMTG_OVERRIDE;
100 tresult PLUGIN_API deferUpdates (FUnknown* object, int32 message) SMTG_OVERRIDE;
101
102 // IUpdateManager
104 tresult PLUGIN_API cancelUpdates (FUnknown* object) SMTG_OVERRIDE;
106 tresult PLUGIN_API triggerDeferedUpdates (FUnknown* object = nullptr) SMTG_OVERRIDE;
107
109 // obsolete functions kept for compatibility
110 void checkUpdates (FObject* object = nullptr)
111 {
112 triggerDeferedUpdates (object ? object->unknownCast () : nullptr);
113 }
114 void flushUpdates (FObject* object)
115 {
116 if (object)
117 cancelUpdates (object->unknownCast ());
118 }
119 void deferUpdate (FObject* object, int32 message)
120 {
121 if (object)
122 deferUpdates (object->unknownCast (), message);
123 }
124 void signalChange (FObject* object, int32 message, bool suppressUpdateDone = false)
125 {
126 if (object)
127 doTriggerUpdates (object->unknownCast (), message, suppressUpdateDone);
128 }
129#if DEVELOPMENT
130 bool checkDeferred (FUnknown* object);
131 bool hasDependencies (FUnknown* object);
132 void printForObject (FObject* object) const;
133#endif
135 size_t countDependencies (FUnknown* object = nullptr);
136
137 OBJ_METHODS (UpdateHandler, FObject)
138 FUNKNOWN_METHODS2 (IUpdateHandler, IUpdateManager, FObject)
139 SINGLETON (UpdateHandler)
140//------------------------------------------------------------------------------
141private:
142 tresult doTriggerUpdates (FUnknown* object, int32 message, bool suppressUpdateDone);
143
145 Update::Table* table = nullptr;
146};
147
148
149//------------------------------------------------------------------------
150} // namespace Steinberg
FLock declaration.
Definition flock.h:92
Implements FUnknown and IDependent.
Definition fobject.h:84
virtual void addDependent(IDependent *dep)
adds dependency to the object
Definition fobject.cpp:141
virtual void removeDependent(IDependent *dep)
removes dependency from the object
Definition fobject.cpp:153
virtual void deferUpdate(int32 msg=kChanged)
Similar to triggerUpdates, except only delivered in idle (usefull in collecting updates).
Definition fobject.cpp:202
FUnknown * unknownCast()
get FUnknown interface from object
Definition fobject.h:104
Handling 16 Byte Globally Unique Identifiers.
Definition funknown.h:241
The basic interface of all interfaces.
Definition funknown.h:375
A dependent will get notified about changes of a model.
Host implements dependency handling for plugins.
Handle Send and Cancel pending message for a given object.
virtual tresult PLUGIN_API cancelUpdates(FUnknown *object)=0
cancel pending messages send by
virtual tresult PLUGIN_API triggerDeferedUpdates(FUnknown *object=nullptr)=0
send pending messages send by
UpdateHandler implements IUpdateManager and IUpdateHandler to handle dependencies between objects to ...
Locks.
Basic Object implementing FUnknown.