Jamba C++ API 7.5.0
Loading...
Searching...
No Matches
GUIJmbParameter.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018-2020 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>
30#include "IGUIParameter.h"
31#include "GUIParamCx.h"
32
34
42{
43public:
44 // Constructor
45 explicit IGUIJmbParameter(std::shared_ptr<IJmbParamDef> iParamDef) : fParamDef{std::move(iParamDef)} {}
46
47 // getParamDef
48 inline IJmbParamDef const *getParamDef() const { return fParamDef.get(); }
49
50 // getJmbParamID
51 ParamID getJmbParamID() const { return fParamDef->fParamID; }
52
53 // readFromStream
54 virtual tresult readFromStream(IBStreamer &iStreamer) = 0;
55
56 // writeToStream
57 virtual tresult writeToStream(IBStreamer &oStreamer) const = 0;
58
59 // readFromMessage
60 virtual tresult readFromMessage(Message const &iMessage) = 0;
61
62 // writeToMessage
63 virtual tresult writeToMessage(Message &oMessage) const = 0;
64
65 // writeToStream
66 virtual void writeToStream(std::ostream &oStream) const = 0;
67
68 // handleMessage
69 tresult handleMessage(Message const &iMessage) override { return readFromMessage(iMessage); }
70
71 // broadcast
72 tresult broadcast() const;
73
74 // setMessageProducer
75 void setMessageProducer(IMessageProducer *iMessageProducer) { fMessageProducer = iMessageProducer; }
76
77protected:
78 std::shared_ptr<IJmbParamDef> fParamDef;
80};
81
86template<typename T>
87class GUIJmbParameter : public ITGUIParameter<T>, public IGUIJmbParameter, public FObject
88{
89public:
90 using ParamType = T;
92
93 using FObject::update; // fixes overload hiding warning
94
95 // Constructor
96 explicit GUIJmbParameter(std::shared_ptr<JmbParamDef<T>> iParamDef) :
97 IGUIJmbParameter(iParamDef),
98 FObject(),
99 fValue{iParamDef->fDefaultValue}
100 {
101// DLOG_F(INFO, "GUIJmbParameter(%p)", this);
102 }
103
104 // Destructor
106 {
107// DLOG_F(INFO, "~GUIJmbParameter(%p)", this);
108 }
109
110 // getParamID
111 ParamID getParamID() const override { return getJmbParamID(); }
112
113 inline int32 getStepCount() const override { return 0; }
114
115 // getParamDef
116 inline JmbParamDef<T> const *getParamDefT() const
117 {
118 return static_cast<JmbParamDef<T> const *>(getParamDef());
119 }
120
126 bool update(ParamType const &iValue) override
127 {
128 // Implementation note: because this method is declared virtual the compiler must instantiate it
129 // even if never called and will generate an error if the ParamType does not define operator!=, so we
130 // need to account for this case
132 {
133 if(fValue != iValue)
134 {
135 if(setValue(iValue) == kResultOk)
136 return true;
137 }
138 }
139 else
140 {
141 if(setValue(iValue) == kResultOk)
142 return true;
143 }
144 return false;
145 }
146
152 template<class ValueModifier>
153 bool updateIf(ValueModifier const &iValueModifier)
154 {
155 if(iValueModifier(&fValue))
156 {
157 changed();
158 return true;
159 }
160 return false;
161 }
162
167 tresult setValue(ParamType const &iValue) override
168 {
169 // Implementation note: because this method is declared virtual the compiler must instantiate it
170 // even if never called and will generate an error if the ParamType does is not copy assignable, so we
171 // need to account for this case
172 if constexpr(std::is_copy_assignable_v<ParamType>)
173 {
174 fValue = iValue;
175 changed();
176 return kResultOk;
177 }
178 else
179 {
180 DLOG_F(ERROR, "%s is not copy_assignable. Call updateIf instead.", typeid(ParamType).name());
181 return kResultFalse;
182 }
183 }
184
189 tresult setValue(ParamType &&iValue)
190 {
191 fValue = std::move(iValue);
192 changed();
193 return kResultOk;
194 }
195
198 tresult resetToDefault() override
199 {
200 return setValue(getParamDefT()->fDefaultValue);
201 }
202
203 // readFromStream
204 tresult readFromStream(IBStreamer &iStreamer) override
205 {
206 tresult res = getParamDefT()->readFromStream(iStreamer, fValue);
207 if(res == kResultOk)
208 changed();
209 return res;
210 }
211
212 // writeToStream
213 tresult writeToStream(IBStreamer &oStreamer) const override
214 {
215 return getParamDefT()->writeToStream(fValue, oStreamer);
216 }
217
218 // writeToStream
219 void writeToStream(std::ostream &oStream) const override
220 {
221 getParamDefT()->writeToStream(fValue, oStream);
222 }
223
224 // toUTF8String
225 std::string toUTF8String(int32 iPrecision) const override
226 {
227 return getParamDefT()->toUTF8String(getValue(), iPrecision);
228 }
229
230 // readFromMessage
231 tresult readFromMessage(Message const &iMessage) override
232 {
233 tresult res = getParamDefT()->readFromMessage(iMessage, fValue);
234 if(res == kResultOk)
235 changed();
236 return res;
237 }
238
239 // writeToMessage
240 tresult writeToMessage(Message &oMessage) const override
241 {
242 return getParamDefT()->writeToMessage(fValue, oMessage);
243 }
244
245 // accessValue
246 tresult accessValue(typename ITGUIParameter<T>::ValueAccessor const &iGetter) const override
247 {
248 iGetter(fValue);
249 return kResultOk;
250 }
251
252 // getValue
253 inline ParamType const &getValue() const { return fValue; }
254
255 // getValue
256 inline ParamType &getValue() { return fValue; }
257
258 // edit
259 std::unique_ptr<EditorType> edit() override
260 {
261 return std::make_unique<DefaultEditorImpl<T>>(this, getValue());
262 }
263
267 using ITGUIParameter<T>::edit;
268
272 std::unique_ptr<FObjectCx> connect(Parameters::IChangeListener *iChangeListener) const override
273 {
274 return std::make_unique<GUIParamCx>(getJmbParamID(), const_cast<GUIJmbParameter *>(this), iChangeListener);
275 }
276
280 std::unique_ptr<FObjectCx> connect(Parameters::ChangeCallback iChangeCallback) const override
281 {
282 return std::make_unique<FObjectCxCallback>(const_cast<GUIJmbParameter *>(this), std::move(iChangeCallback));
283 }
284
285 // asDiscreteParameter
286 std::shared_ptr<GUIDiscreteParameter> asDiscreteParameter(int32 iStepCount) override;
287
288protected:
290};
291
296template<typename T>
297static std::shared_ptr<GUIJmbParameter<T>> castToJmb(std::shared_ptr<IGUIParameter> iParam)
298{
299 return std::dynamic_pointer_cast<GUIJmbParameter<T>>(iParam);
300}
301
305template<typename T>
306class GUIDiscreteJmbParameter : public GUIDiscreteParameter
307{
308public:
309 using EditorType = typename GUIDiscreteParameter::ITEditor;
310
311public:
312 GUIDiscreteJmbParameter(std::shared_ptr<GUIJmbParameter<T>> iJmbParameter,
313 std::shared_ptr<IDiscreteConverter<T>> iConverter) :
314 fJmbParameter{std::move(iJmbParameter)},
315 fConverter{iConverter}
316 {
317 DCHECK_F(fJmbParameter != nullptr);
318 DCHECK_F(fConverter != nullptr);
319 }
320
321 // getParamID
322 ParamID getParamID() const override
323 {
324 return fJmbParameter->getParamID();
325 }
326
327 // getStepCount
328 int32 getStepCount() const override
329 {
330 return fConverter->getStepCount();
331 }
332
333 // connect
334 std::unique_ptr<FObjectCx> connect(Parameters::IChangeListener *iChangeListener) const override
335 {
336 return fJmbParameter->connect(iChangeListener);
337 }
338
339 // connect
340 std::unique_ptr<FObjectCx> connect(Parameters::ChangeCallback iChangeCallback) const override
341 {
342 return fJmbParameter->connect(iChangeCallback);
343 }
344
345 // asDiscreteParameter
346 std::shared_ptr <GUIDiscreteParameter> asDiscreteParameter(int32 iStepCount) override
347 {
348 return fJmbParameter->asDiscreteParameter(iStepCount);
349 }
350
356 tresult getValue(int32 &oDiscreteValue) const
357 {
358 auto res = fConverter->convertToDiscreteValue(fJmbParameter->getValue(), oDiscreteValue);
359 #ifndef NDEBUG
360 if(res == kResultFalse)
361 DLOG_F(WARNING, "Cannot convert current value of Jmb param [%d] to a discrete value", getParamID());
362 #endif
363 return res;
364 }
365
366 // accessValue
367 tresult accessValue(ValueAccessor const &iGetter) const override
368 {
369 int32 discreteValue;
370 if(getValue(discreteValue) == kResultOk)
371 {
372 iGetter(discreteValue);
373 return kResultOk;
374 }
375 return kResultFalse;
376 }
377
378 // update
379 bool update(int32 const &iDiscreteValue) override
380 {
381 int32 currentDiscreteValue;
382 tresult res = getValue(currentDiscreteValue);
383
384 if(res == kResultOk)
385 {
386 if(iDiscreteValue != currentDiscreteValue)
387 {
388 if(setValue(iDiscreteValue) == kResultOk)
389 return true;
390 }
391 }
392
393 return false;
394 }
395
396 // setValue
397 tresult setValue(int32 const &iDiscreteValue) override
398 {
399 int32 currentDiscreteValue;
400 tresult res = getValue(currentDiscreteValue);
401 if(res == kResultOk)
402 {
403 if(iDiscreteValue != currentDiscreteValue)
404 {
405 res = kResultFalse;
406 if constexpr(std::is_copy_assignable_v<T>)
407 {
408 T jmbValue = fJmbParameter->getValue();
409 if(fConverter->convertFromDiscreteValue(iDiscreteValue, jmbValue) == kResultOk)
410 res = fJmbParameter->setValue(jmbValue);
411 else
412 DLOG_F(WARNING, "Cannot convert discrete value [%d] to a [%s] value of Jmb param [%d]",
413 iDiscreteValue,
414 typeid(T).name(),
415 getParamID());
416 }
417 }
418 }
419
420 return res;
421 }
422
423 // resetToDefault
424 tresult resetToDefault() override
425 {
426 return fJmbParameter->resetToDefault();
427 }
428
429 // edit
430 std::unique_ptr<EditorType> edit() override
431 {
432 int32 currentDiscreteValue;
433 tresult res = getValue(currentDiscreteValue);
434 if(res == kResultOk)
435 return std::make_unique<DefaultEditorImpl<int32>>(this, currentDiscreteValue);
436 else
437 return nullptr;
438 }
439
440 // toUTF8String
441 std::string toUTF8String(int32 iPrecision) const override
442 {
443 return fJmbParameter->toUTF8String(iPrecision);
444 }
445
446protected:
447 std::shared_ptr<GUIJmbParameter<T>> fJmbParameter;
448 std::shared_ptr<IDiscreteConverter<T>> fConverter;
449};
450
451//------------------------------------------------------------------------
452// GUIJmbParameter<T>::asDiscreteParameter
453//------------------------------------------------------------------------
454template<typename T>
455std::shared_ptr<GUIDiscreteParameter> GUIJmbParameter<T>::asDiscreteParameter(int32 iStepCount)
456{
457 // Step 1: check if the Jmb param provide a discrete converter
458 auto converter = getParamDefT()->getDiscreteConverter();
459
460 if(converter && converter->getStepCount() > 0)
461 return std::make_shared<GUIDiscreteJmbParameter<T>>(std::dynamic_pointer_cast<GUIJmbParameter<T>>(ITGUIParameter<T>::shared_from_this()),
462 std::move(converter));
463 else
464 {
465 // Step 2: no discrete converter, so we check if T can be automatically converted to an int32 (case where
466 // T is a numeric value, an enum, or a type that offers a "constructor(int32)" and "operator int32()" methods)
467 if(iStepCount > 0)
468 {
470 {
471 converter = std::make_shared<StaticCastDiscreteConverter<T>>(iStepCount);
472 return std::make_shared<GUIDiscreteJmbParameter<T>>(std::dynamic_pointer_cast<GUIJmbParameter<T>>(ITGUIParameter<T>::shared_from_this()),
473 std::move(converter));
474 }
475 else
476 {
477 DLOG_F(WARNING, "Jmb param [%d] (type [%s]) cannot be converted to a discrete parameter",
478 getParamID(),
479 Utils::typeString<T>().c_str());
480 }
481 }
482 return nullptr;
483 }
484}
485
486//------------------------------------------------------------------------
487// GUIJmbParam - wrapper to make writing the code much simpler and natural
488//------------------------------------------------------------------------
495template<typename T>
497{
498public:
499 using ParamType = T;
501 using Editor = std::unique_ptr<EditorType>;
502
503public:
504 GUIJmbParam(std::shared_ptr<GUIJmbParameter<T>> iPtr = nullptr) : // NOLINT (not marked explicit on purpose)
505 fPtr{std::move(iPtr)}
506 {}
507
509 GUIJmbParam<T> &operator=(GUIJmbParam<T> const &iOther) = default;
510
511 // exists
512 inline bool exists() const { return fPtr != nullptr; }
513
514 // getParamID
515 inline ParamID getParamID() const { DCHECK_F(exists()); return fPtr->getParamID(); }
516
521 inline bool update(T const &iNewValue) { DCHECK_F(exists()); return fPtr->update(iNewValue); }
522
527 template<class ValueModifier>
528 inline bool updateIf(ValueModifier const &iValueModifier) { DCHECK_F(exists()); return fPtr->updateIf(iValueModifier); }
529
533 inline void setValue(T const &iNewValue) { DCHECK_F(exists()); fPtr->setValue(iNewValue); }
534
538 inline void setValue(T &&iNewValue) { DCHECK_F(exists()); fPtr->setValue(std::move(iNewValue)); }
539
542 inline Editor edit() { DCHECK_F(exists()); return fPtr->edit(); }
543
547 inline Editor edit(T const &iValue) { DCHECK_F(exists()); return fPtr->edit(iValue); }
548
551 inline tresult resetToDefault() { DCHECK_F(exists()); return fPtr->resetToDefault(); }
552
553 // getValue
554 inline T const & getValue() const { DCHECK_F(exists()); return fPtr->getValue(); }
555
557 inline T const & value() const { DCHECK_F(exists()); return fPtr->getValue(); }
558
559 // allow to use the param as the underlying `ParamType` (ex: `if(param)` in the case `ParamType` is `bool`))
560 [[deprecated("Since 4.1.0 - use operator* or .value() instead (ex: if(*param) {...} or if(param.value()) {...}")]]
561 inline operator T const &() const { DCHECK_F(exists()); return fPtr->getValue(); } // NOLINT
562
564 constexpr T const & operator *() const { DCHECK_F(exists()); return fPtr->getValue(); }
565
566 // allow writing param->xxx to access the underlying type directly (if not a primitive)
567 constexpr T const * operator->() const { DCHECK_F(exists()); return &fPtr->getValue(); }
568
570 inline GUIJmbParam<T> &operator=(T const &iValue) { DCHECK_F(exists()); fPtr->setValue(iValue); return *this; }
571
572 // broadcast
573 inline tresult broadcast() const { DCHECK_F(exists()); return fPtr->broadcast(); }
574
575 // broadcast
576 inline void broadcast(T const &iValue)
577 {
578 setValue(iValue);
579 broadcast();
580 }
581
582 // broadcast
583 inline void broadcast(T &&iValue)
584 {
585 setValue(std::move(iValue));
586 broadcast();
587 }
588
591 inline std::string toUTF8String(int32 iPrecision) const { DCHECK_F(exists()); return fPtr->toUTF8String(iPrecision); }
592
593 // connect
594 inline std::unique_ptr<FObjectCx> connect(Parameters::IChangeListener *iChangeListener) { DCHECK_F(exists()); return fPtr->connect(iChangeListener); }
595
596 // connect
597 inline std::unique_ptr<FObjectCx> connect(Parameters::ChangeCallback iChangeCallback) { DCHECK_F(exists()); return fPtr->connect(std::move(iChangeCallback)); }
598
599private:
600 std::shared_ptr<GUIJmbParameter<T>> fPtr;
601};
602
603}
Implements all the various equality and relational operators for the type T which is assumed to encap...
Definition Operators.h:56
tresult setValue(int32 const &iDiscreteValue) override
Definition GUIJmbParameter.h:397
std::string toUTF8String(int32 iPrecision) const override
Definition GUIJmbParameter.h:441
std::shared_ptr< GUIJmbParameter< T > > fJmbParameter
Definition GUIJmbParameter.h:447
std::shared_ptr< IDiscreteConverter< T > > fConverter
Definition GUIJmbParameter.h:448
int32 getStepCount() const override
Definition GUIJmbParameter.h:328
ParamID getParamID() const override
Definition GUIJmbParameter.h:322
std::shared_ptr< GUIDiscreteParameter > asDiscreteParameter(int32 iStepCount) override
Definition GUIJmbParameter.h:346
tresult resetToDefault() override
Definition GUIJmbParameter.h:424
tresult getValue(int32 &oDiscreteValue) const
Because converting the current Jmb value to an int32 may fail this api returns kResultOk if it works ...
Definition GUIJmbParameter.h:356
std::unique_ptr< EditorType > edit() override
Definition GUIJmbParameter.h:430
std::unique_ptr< FObjectCx > connect(Parameters::ChangeCallback iChangeCallback) const override
Definition GUIJmbParameter.h:340
tresult accessValue(ValueAccessor const &iGetter) const override
Definition GUIJmbParameter.h:367
std::unique_ptr< FObjectCx > connect(Parameters::IChangeListener *iChangeListener) const override
Definition GUIJmbParameter.h:334
GUIDiscreteJmbParameter(std::shared_ptr< GUIJmbParameter< T > > iJmbParameter, std::shared_ptr< IDiscreteConverter< T > > iConverter)
Definition GUIJmbParameter.h:312
bool update(int32 const &iDiscreteValue) override
Definition GUIJmbParameter.h:379
typename GUIDiscreteParameter::ITEditor EditorType
Definition GUIJmbParameter.h:309
std::shared_ptr< GUIJmbParameter< T > > fPtr
Definition GUIJmbParameter.h:600
std::unique_ptr< FObjectCx > connect(Parameters::IChangeListener *iChangeListener)
Definition GUIJmbParameter.h:594
bool updateIf(ValueModifier const &iValueModifier)
Use this flavor of update if you want to modify the value itself.
Definition GUIJmbParameter.h:528
void setValue(T &&iNewValue)
The difference with update is that it does not check for equality (case when T is not comparable).
Definition GUIJmbParameter.h:538
constexpr T const * operator->() const
Definition GUIJmbParameter.h:567
void setValue(T const &iNewValue)
The difference with update is that it does not check for equality (case when T is not comparable).
Definition GUIJmbParameter.h:533
std::string toUTF8String(int32 iPrecision) const
Returns the current value of the parameter as a string (which is properly UTF-8 encoded).
Definition GUIJmbParameter.h:591
bool update(T const &iNewValue)
This method is typically called by a view to change the value of the parameter.
Definition GUIJmbParameter.h:521
Editor edit(T const &iValue)
Definition GUIJmbParameter.h:547
typename GUIJmbParameter< T >::EditorType EditorType
Definition GUIJmbParameter.h:500
GUIJmbParam< T > & operator=(GUIJmbParam< T > const &iOther)=default
Assignment operator: fMyParam = registerParam(...);.
GUIJmbParam< T > & operator=(T const &iValue)
Allow to write param = 3.0.
Definition GUIJmbParameter.h:570
constexpr T const & operator*() const
allow writing *param to access the underlying value (or in other words, *param is the same param....
Definition GUIJmbParameter.h:564
std::unique_ptr< FObjectCx > connect(Parameters::ChangeCallback iChangeCallback)
Definition GUIJmbParameter.h:597
ParamID getParamID() const
Definition GUIJmbParameter.h:515
void broadcast(T &&iValue)
Definition GUIJmbParameter.h:583
bool exists() const
Definition GUIJmbParameter.h:512
T const & value() const
Synonym to getValue().
Definition GUIJmbParameter.h:557
T ParamType
Definition GUIJmbParameter.h:499
tresult resetToDefault()
Resets the param to its default value.
Definition GUIJmbParameter.h:551
std::unique_ptr< EditorType > Editor
Definition GUIJmbParameter.h:501
T const & getValue() const
Definition GUIJmbParameter.h:554
void broadcast(T const &iValue)
Definition GUIJmbParameter.h:576
Editor edit()
Definition GUIJmbParameter.h:542
tresult broadcast() const
Definition GUIJmbParameter.h:573
GUIJmbParam(std::shared_ptr< GUIJmbParameter< T > > iPtr=nullptr)
Definition GUIJmbParameter.h:504
This is the templated version providing serializer methods, very similar to the GUIVstParameter conce...
Definition GUIJmbParameter.h:88
bool updateIf(ValueModifier const &iValueModifier)
Use this flavor of update if you want to modify the value itself.
Definition GUIJmbParameter.h:153
std::string toUTF8String(int32 iPrecision) const override
Returns the current value of the parameter as a string (which is properly UTF-8 encoded).
Definition GUIJmbParameter.h:225
GUIJmbParameter(std::shared_ptr< JmbParamDef< T > > iParamDef)
Definition GUIJmbParameter.h:96
ParamType & getValue()
Definition GUIJmbParameter.h:256
int32 getStepCount() const override
When a parameter is a discrete parameter (which means its underlying backing type is an int32 with va...
Definition GUIJmbParameter.h:113
ParamID getParamID() const override
Each parameter has a unique ID returned by this method.
Definition GUIJmbParameter.h:111
tresult writeToMessage(Message &oMessage) const override
Definition GUIJmbParameter.h:240
tresult readFromStream(IBStreamer &iStreamer) override
Definition GUIJmbParameter.h:204
~GUIJmbParameter() override
Definition GUIJmbParameter.h:105
ParamType fValue
Definition GUIJmbParameter.h:289
std::shared_ptr< GUIDiscreteParameter > asDiscreteParameter(int32 iStepCount) override
Converts this parameter into a discrete parameter.
Definition GUIJmbParameter.h:455
tresult resetToDefault() override
Resets the param to its default value.
Definition GUIJmbParameter.h:198
tresult setValue(ParamType const &iValue) override
Sets the value.
Definition GUIJmbParameter.h:167
tresult writeToStream(IBStreamer &oStreamer) const override
Definition GUIJmbParameter.h:213
std::unique_ptr< EditorType > edit() override
Creates an editor to modify the parameter in a transactional fashion.
Definition GUIJmbParameter.h:259
std::unique_ptr< FObjectCx > connect(Parameters::ChangeCallback iChangeCallback) const override
Definition GUIJmbParameter.h:280
JmbParamDef< T > const * getParamDefT() const
Definition GUIJmbParameter.h:116
bool update(ParamType const &iValue) override
Update the parameter with a value.
Definition GUIJmbParameter.h:126
std::unique_ptr< FObjectCx > connect(Parameters::IChangeListener *iChangeListener) const override
Definition GUIJmbParameter.h:272
T ParamType
Definition GUIJmbParameter.h:90
typename ITGUIParameter< T >::ITEditor EditorType
Definition GUIJmbParameter.h:91
ParamType const & getValue() const
Definition GUIJmbParameter.h:253
tresult accessValue(typename ITGUIParameter< T >::ValueAccessor const &iGetter) const override
Definition GUIJmbParameter.h:246
tresult readFromMessage(Message const &iMessage) override
Definition GUIJmbParameter.h:231
void writeToStream(std::ostream &oStream) const override
Definition GUIJmbParameter.h:219
tresult setValue(ParamType &&iValue)
Sets the value.
Definition GUIJmbParameter.h:189
ParamID getJmbParamID() const
Definition GUIJmbParameter.h:51
tresult handleMessage(Message const &iMessage) override
Definition GUIJmbParameter.h:69
IJmbParamDef const * getParamDef() const
Definition GUIJmbParameter.h:48
IGUIJmbParameter(std::shared_ptr< IJmbParamDef > iParamDef)
Definition GUIJmbParameter.h:45
virtual tresult writeToStream(IBStreamer &oStreamer) const =0
IMessageProducer * fMessageProducer
Definition GUIJmbParameter.h:79
virtual tresult readFromMessage(Message const &iMessage)=0
void setMessageProducer(IMessageProducer *iMessageProducer)
Definition GUIJmbParameter.h:75
virtual void writeToStream(std::ostream &oStream) const =0
virtual tresult writeToMessage(Message &oMessage) const =0
virtual tresult readFromStream(IBStreamer &iStreamer)=0
std::shared_ptr< IJmbParamDef > fParamDef
Definition GUIJmbParameter.h:78
tresult broadcast() const
Definition GUIJmbParameter.cpp:30
Defines the API for the editor which can be obtained by calling ITGUIParameter::edit().
Definition IGUIParameter.h:238
Represents a gui parameter with its underlying backing type T (aka ParamType).
Definition IGUIParameter.h:172
std::function< void(T const &)> ValueAccessor
API to access the value of the param.
Definition IGUIParameter.h:183
Interface that defines a converter from a type T to an int32 given a number of steps (provided by get...
Definition ParamSerializers.h:47
Base class for jamba parameters (non templated).
Definition ParamDef.h:281
Interface defining a message handler.
Definition MessageHandler.h:32
Abstraction for allocating and sending a message.
Definition MessageProducer.h:35
Base class for all non vst parameters (need to provide serialization/deserialization).
Definition ParamDef.h:318
Simple wrapper class with better api.
Definition Messaging.h:46
Interface to implement to receive parameter changes.
Definition Parameters.h:45
std::function< void()> ChangeCallback
A callback that will be invoked for changes.
Definition Parameters.h:56
constexpr auto is_operator_not_eq_defined
Allows to detect whether a type defines operator!= at compile time.
Definition Metaprogramming.h:70
std::string typeString()
typeid(T).name() does not account for const or reference.
Definition Metaprogramming.h:121
constexpr auto is_static_cast_defined
Allows to detect (at compilation time) whether the call static_cast<To>(from) (where from is of type ...
Definition Metaprogramming.h:94
Definition GUIState.h:38
static std::shared_ptr< GUIJmbParameter< T > > castToJmb(std::shared_ptr< IGUIParameter > iParam)
Convenient function to cast a generic IGUIParameter to a GUIJmbParameter<T>.
Definition GUIJmbParameter.h:297