28 using namespace Utils;
37 explicit IRTJmbOutParameter(std::shared_ptr<IJmbParamDef> iParamDef) : fParamDef{std::move(iParamDef)} {}
40 inline IJmbParamDef
const *
getParamDef()
const {
return fParamDef.get(); }
43 ParamID
getParamID()
const {
return fParamDef->fParamID; }
49 virtual bool hasUpdate()
const = 0;
52 virtual tresult writeToMessage(
Message &oMessage) = 0;
55 virtual void writeToStream(std::ostream &oStream)
const = 0;
76 fUpdateQueue{std::make_unique<T>(iParamDef->fDefaultValue),
true}
82 return static_cast<JmbParamDef<T>
const *
>(getParamDef());
92 fUpdateQueue.push(iValue);
100 template<
class ElementModifier>
103 fUpdateQueue.updateAndPush(iElementModifier);
112 template<
class ElementModifier>
115 return fUpdateQueue.updateAndPushIf(iElementModifier);
119 bool hasUpdate()
const override {
return !fUpdateQueue.isEmpty(); }
122 tresult writeToMessage(
Message &oMessage)
override;
125 void writeToStream(std::ostream &oStream)
const override;
137 auto update = fUpdateQueue.pop();
140 tresult res = getParamDefT()->writeToMessage(*update, oMessage);
145 disposable->dispose();
159 getParamDefT()->writeToStream(*fUpdateQueue.last(), oStream);
175 DCHECK_F(fPtr !=
nullptr);
179 inline ParamID
getParamID()
const {
return fPtr->getParamID(); }
185 inline void broadcast(T
const &iValue) { fPtr->broadcastValue(iValue); }
191 template<
class ElementModifier>
192 void broadcast(ElementModifier
const &iElementModifier) { fPtr->broadcast(iElementModifier); }
199 template<
class ElementModifier>
200 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:170
Templated class for RT Jamba parameter.
Definition: RTJmbOutParameter.h:69
void broadcast(ElementModifier const &iElementModifier)
Enqueues the value to be delivered to the GUI (or whoever is listening to messages).
Definition: RTJmbOutParameter.h:192
Base (non templated) class for RT Jamba (Outbound) parameters.
Definition: RTJmbOutParameter.h:33
bool broadcastIf(ElementModifier const &iElementModifier)
Enqueues the value to be delivered to the GUI (or whoever is listening to messages).
Definition: RTJmbOutParameter.h:113
Simple wrapper class with better api.
Definition: Messaging.h:42
RTJmbOutParam(RTJmbOutParameter< T > *iPtr)
Definition: RTJmbOutParameter.h:173
ParamID getParamID() const
Definition: RTJmbOutParameter.h:179
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:185
Definition: RTJmbInParameter.h:25
std::shared_ptr< IJmbParamDef > fParamDef
Definition: RTJmbOutParameter.h:58
bool hasUpdate() const override
Definition: RTJmbOutParameter.h:119
RTJmbOutParameter< T > * fPtr
Definition: RTJmbOutParameter.h:203
void broadcast(ElementModifier const &iElementModifier)
Enqueues the value to be delivered to the GUI (or whoever is listening to messages).
Definition: RTJmbOutParameter.h:101
IJmbParamDef const * getParamDef() const
Definition: RTJmbOutParameter.h:40
tresult writeToMessage(Message &oMessage) override
Definition: RTJmbOutParameter.h:135
JmbParamDef< T > const * getParamDefT() const
Definition: RTJmbOutParameter.h:80
RTJmbOutParameter(std::shared_ptr< JmbParamDef< T >> iParamDef)
Definition: RTJmbOutParameter.h:74
void broadcastValue(ParamType const &iValue)
Enqueues the value to be delivered to the GUI (or whoever is listening to messages).
Definition: RTJmbOutParameter.h:90
ParamID getParamID() const
Definition: RTJmbOutParameter.h:43
void writeToStream(std::ostream &oStream) const override
Definition: RTJmbOutParameter.h:157
T ParamType
Definition: RTJmbOutParameter.h:72
bool broadcastIf(ElementModifier const &iElementModifier)
Enqueues the value to be delivered to the GUI (or whoever is listening to messages).
Definition: RTJmbOutParameter.h:200
IRTJmbOutParameter(std::shared_ptr< IJmbParamDef > iParamDef)
Definition: RTJmbOutParameter.h:37
This is the lock free version of the SingleElementQueue.
Definition: Concurrent.h:148