Jamba C++ API 8.0.0
Loading...
Searching...
No Matches
FObjectCx.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 pongasoft
3 *
4 * Licensed under the Apache License, Version 2.0 or the MIT license,
5 * at your option. You may not use this file except in compliance with
6 * one of these licenses. You may obtain copies of the licenses at:
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 * https://opensource.org/licenses/MIT
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 *
17 * @author Yan Pujante
18 */
19#pragma once
20
21#include <base/source/fobject.h>
22#include <pluginterfaces/vst/vsttypes.h>
24
25namespace pongasoft {
26namespace VST {
27
28using namespace Steinberg::Vst;
29using namespace Steinberg;
30
36class FObjectCx : protected FObject
37{
38public:
39 // Constructor
40 explicit FObjectCx(FObject *iTarget);
41
45 virtual void close();
46
50 virtual void onTargetChange() {}
51
55 ~FObjectCx() override { FObjectCx::close(); }
56
57 // disabling copy
58 FObjectCx(FObjectCx const &) = delete;
59 FObjectCx& operator=(FObjectCx const &) = delete;
60
61protected:
65 void PLUGIN_API update(FUnknown *iChangedUnknown, Steinberg::int32 iMessage) SMTG_OVERRIDE;
66
67protected:
68 FObject *fTarget;
70};
71
76{
77public:
78 using ChangeCallback = std::function<void()>;
79
80 // Constructor
81 FObjectCxCallback(FObject *iTarget, ChangeCallback iChangeCallback);
82
85
86 // close
87 void close() override;
88
89 // onTargetChange
90 void onTargetChange() override;
91
92 // disabling copy
95
96protected:
98};
99
100}
101}
std::function< void()> ChangeCallback
Definition FObjectCx.h:78
FObjectCxCallback(FObjectCxCallback const &)=delete
void close() override
Call to stop listening for changes.
Definition FObjectCx.cpp:72
FObjectCxCallback & operator=(FObjectCxCallback const &)=delete
FObjectCxCallback(FObject *iTarget, ChangeCallback iChangeCallback)
Definition FObjectCx.cpp:64
~FObjectCxCallback() override
Destructor (calls close()).
Definition FObjectCx.h:84
ChangeCallback fChangeCallback
Definition FObjectCx.h:97
void onTargetChange() override
Called when the target changes (by default does nothing).
Definition FObjectCx.cpp:83
FObjectCx & operator=(FObjectCx const &)=delete
void PLUGIN_API update(FUnknown *iChangedUnknown, Steinberg::int32 iMessage) SMTG_OVERRIDE
This is being called when fTarget sends a message to this object.
Definition FObjectCx.cpp:53
bool fIsConnected
Definition FObjectCx.h:69
FObjectCx(FObjectCx const &)=delete
virtual void close()
Call to stop listening for changes.
Definition FObjectCx.cpp:40
~FObjectCx() override
This destructor must be overridden to call its own version of close() because close() is virtual.
Definition FObjectCx.h:55
FObjectCx(FObject *iTarget)
Definition FObjectCx.cpp:28
FObject * fTarget
Definition FObjectCx.h:68
virtual void onTargetChange()
Called when the target changes (by default does nothing).
Definition FObjectCx.h:50
Definition Clock.h:24
Definition Clock.h:23