30 using namespace Utils;
39 explicit IRTJmbOutParameter(std::shared_ptr<IJmbParamDef> iParamDef) : fParamDef{std::move(iParamDef)} {}
42 inline IJmbParamDef
const *
getParamDef()
const {
return fParamDef.get(); }
45 ParamID
getParamID()
const {
return fParamDef->fParamID; }
51 virtual bool hasUpdate()
const = 0;
54 virtual tresult writeToMessage(
Message &oMessage) = 0;
57 virtual void writeToStream(std::ostream &oStream)
const = 0;
78 fUpdateQueue{std::make_unique<T>(iParamDef->fDefaultValue),
true}
84 return static_cast<JmbParamDef<T>
const *
>(getParamDef());
94 fUpdateQueue.push(iValue);
102 template<
class ElementModifier>
105 fUpdateQueue.updateAndPush(iElementModifier);
114 template<
class ElementModifier>
117 return fUpdateQueue.updateAndPushIf(iElementModifier);
121 bool hasUpdate()
const override {
return !fUpdateQueue.isEmpty(); }
124 tresult writeToMessage(
Message &oMessage)
override;
127 void writeToStream(std::ostream &oStream)
const override;
139 auto update = fUpdateQueue.pop();
142 tresult res = getParamDefT()->writeToMessage(*update, oMessage);
147 disposable->dispose();
161 getParamDefT()->writeToStream(*fUpdateQueue.last(), oStream);
178 inline ParamID
getParamID()
const {
return fPtr->getParamID(); }
184 inline void broadcast(T
const &iValue) { fPtr->broadcastValue(iValue); }
190 template<
class ElementModifier>
191 void broadcast(ElementModifier
const &iElementModifier) { fPtr->broadcast(iElementModifier); }
198 template<
class ElementModifier>
199 bool broadcastIf(ElementModifier
const &iElementModifier) {
return fPtr->broadcastIf(iElementModifier); }
This is the main class that the plugin should use as it exposes only the necessary methods of the par...
Definition: RTJmbOutParameter.h:172
Templated class for RT Jamba parameter.
Definition: RTJmbOutParameter.h:71
void broadcast(ElementModifier const &iElementModifier)
Enqueues the value to be delivered to the GUI (or whoever is listening to messages).
Definition: RTJmbOutParameter.h:191
Base (non templated) class for RT Jamba (Outbound) parameters.
Definition: RTJmbOutParameter.h:35
bool broadcastIf(ElementModifier const &iElementModifier)
Enqueues the value to be delivered to the GUI (or whoever is listening to messages).
Definition: RTJmbOutParameter.h:115
Simple wrapper class with better api.
Definition: Messaging.h:42
RTJmbOutParam(RTJmbOutParameter< T > *iPtr)
Definition: RTJmbOutParameter.h:175
ParamID getParamID() const
Definition: RTJmbOutParameter.h:178
static U dynamic(T *iPtr)
Definition: Metaprogramming.h:37
void broadcast(T const &iValue)
Enqueues the value to be delivered to the GUI (or whoever is listening to messages).
Definition: RTJmbOutParameter.h:184
std::shared_ptr< IJmbParamDef > fParamDef
Definition: RTJmbOutParameter.h:60
bool hasUpdate() const override
Definition: RTJmbOutParameter.h:121
RTJmbOutParameter< T > * fPtr
Definition: RTJmbOutParameter.h:202
void broadcast(ElementModifier const &iElementModifier)
Enqueues the value to be delivered to the GUI (or whoever is listening to messages).
Definition: RTJmbOutParameter.h:103
IJmbParamDef const * getParamDef() const
Definition: RTJmbOutParameter.h:42
tresult writeToMessage(Message &oMessage) override
Definition: RTJmbOutParameter.h:137
JmbParamDef< T > const * getParamDefT() const
Definition: RTJmbOutParameter.h:82
RTJmbOutParameter(std::shared_ptr< JmbParamDef< T >> iParamDef)
Definition: RTJmbOutParameter.h:76
void broadcastValue(ParamType const &iValue)
Enqueues the value to be delivered to the GUI (or whoever is listening to messages).
Definition: RTJmbOutParameter.h:92
ParamID getParamID() const
Definition: RTJmbOutParameter.h:45
void writeToStream(std::ostream &oStream) const override
Definition: RTJmbOutParameter.h:159
T ParamType
Definition: RTJmbOutParameter.h:74
bool broadcastIf(ElementModifier const &iElementModifier)
Enqueues the value to be delivered to the GUI (or whoever is listening to messages).
Definition: RTJmbOutParameter.h:199
IRTJmbOutParameter(std::shared_ptr< IJmbParamDef > iParamDef)
Definition: RTJmbOutParameter.h:39
This is the lock free version of the SingleElementQueue.
Definition: Concurrent.h:148