29 using namespace Utils;
38 explicit IRTJmbInParameter(std::shared_ptr<IJmbParamDef> iParamDef) : fParamDef{std::move(iParamDef)} {}
41 inline IJmbParamDef
const *
getParamDef()
const {
return fParamDef.get(); }
44 ParamID
getParamID()
const {
return fParamDef->fParamID; }
50 virtual bool hasUpdate()
const = 0;
53 virtual tresult readFromMessage(
Message const &iMessage) = 0;
59 virtual void writeToStream(std::ostream &oStream)
const = 0;
79 fUpdateQueue{std::make_unique<T>(iParamDef->fDefaultValue),
true}
85 return static_cast<JmbParamDef<T>
const *
>(getParamDef());
98 bool hasUpdate()
const override {
return !fUpdateQueue.isEmpty(); }
101 tresult readFromMessage(
Message const &iMessage)
override;
104 void writeToStream(std::ostream &oStream)
const override;
116 bool res = fUpdateQueue.updateAndPushIf([
this, &iMessage](
auto oUpdate) ->
bool {
117 return getParamDefT()->readFromMessage(iMessage, *oUpdate) == kResultOk;
120 return res ? kResultOk : kResultFalse;
129 getParamDefT()->writeToStream(*last(), oStream);
148 inline ParamID
getParamID()
const {
return fPtr->getParamID(); }
151 inline T *
pop() {
return fPtr->pop(); }
154 inline T
const *
last()
const {
return fPtr->last(); }
157 inline T
const *
popOrLast() {
return fPtr->popOrLast(); }
163 inline T
const &
getValue()
const {
return *fPtr->last(); }
166 inline T
const &
value()
const {
return *fPtr->last(); }
169 inline operator T
const &()
const {
return *fPtr->last(); }
ParamType const * last() const
Definition: RTJmbInParameter.h:92
Simple wrapper class with better api.
Definition: Messaging.h:42
ParamID getParamID() const
Definition: RTJmbInParameter.h:44
This is the main class that the plugin should use as it exposes only the necessary methods of the par...
Definition: RTJmbInParameter.h:142
T * pop()
Definition: RTJmbInParameter.h:151
RTJmbInParameter< T > * fPtr
Definition: RTJmbInParameter.h:175
Interface defining a message handler.
Definition: MessageHandler.h:30
RTJmbInParameter(std::shared_ptr< JmbParamDef< T >> iParamDef)
Definition: RTJmbInParameter.h:77
ParamID getParamID() const
Definition: RTJmbInParameter.h:148
T const * last() const
Definition: RTJmbInParameter.h:154
T const * popOrLast()
Definition: RTJmbInParameter.h:157
T const * operator->() const
Definition: RTJmbInParameter.h:172
void writeToStream(std::ostream &oStream) const override
Definition: RTJmbInParameter.h:127
ParamType const * popOrLast()
Definition: RTJmbInParameter.h:95
IJmbParamDef const * getParamDef() const
Definition: RTJmbInParameter.h:41
Templated class for RT Jamba Inbound parameter.
Definition: RTJmbInParameter.h:72
bool hasUpdate() const override
Definition: RTJmbInParameter.h:98
T const & getValue() const
Definition: RTJmbInParameter.h:163
bool hasUpdate() const
Definition: RTJmbInParameter.h:160
Base (non templated) class for RT Jamba (Inbound) parameters.
Definition: RTJmbInParameter.h:34
JmbParamDef< T > const * getParamDefT() const
Definition: RTJmbInParameter.h:83
tresult handleMessage(Message const &iMessage) override
Definition: RTJmbInParameter.h:56
T const & value() const
Definition: RTJmbInParameter.h:166
tresult readFromMessage(Message const &iMessage) override
Definition: RTJmbInParameter.h:114
IRTJmbInParameter(std::shared_ptr< IJmbParamDef > iParamDef)
Definition: RTJmbInParameter.h:38
T ParamType
Definition: RTJmbInParameter.h:75
RTJmbInParam(RTJmbInParameter< T > *iPtr)
Definition: RTJmbInParameter.h:145
std::shared_ptr< IJmbParamDef > fParamDef
Definition: RTJmbInParameter.h:62
This is the lock free version of the SingleElementQueue.
Definition: Concurrent.h:148
ParamType * pop()
Definition: RTJmbInParameter.h:89