27 using namespace Utils;
36 explicit IRTJmbInParameter(std::shared_ptr<IJmbParamDef> iParamDef) : fParamDef{std::move(iParamDef)} {}
39 inline IJmbParamDef
const *
getParamDef()
const {
return fParamDef.get(); }
42 ParamID
getParamID()
const {
return fParamDef->fParamID; }
48 virtual bool hasUpdate()
const = 0;
51 virtual tresult readFromMessage(
Message const &iMessage) = 0;
57 virtual void writeToStream(std::ostream &oStream)
const = 0;
77 fUpdateQueue{std::make_unique<T>(iParamDef->fDefaultValue),
true}
83 return static_cast<JmbParamDef<T>
const *
>(getParamDef());
96 bool hasUpdate()
const override {
return !fUpdateQueue.isEmpty(); }
99 tresult readFromMessage(
Message const &iMessage)
override;
102 void writeToStream(std::ostream &oStream)
const override;
114 bool res = fUpdateQueue.updateAndPushIf([
this, &iMessage](
auto oUpdate) ->
bool {
115 return getParamDefT()->readFromMessage(iMessage, *oUpdate) == kResultOk;
118 return res ? kResultOk : kResultFalse;
127 getParamDefT()->writeToStream(*last(), oStream);
145 DCHECK_F(fPtr !=
nullptr);
149 inline ParamID
getParamID()
const {
return fPtr->getParamID(); }
152 inline T *
pop() {
return fPtr->pop(); }
155 inline T
const *
last()
const {
return fPtr->last(); }
158 inline T
const *
popOrLast() {
return fPtr->popOrLast(); }
164 inline T
const &
getValue()
const {
return *fPtr->last(); }
167 inline T
const &
value()
const {
return *fPtr->last(); }
170 inline operator T
const &()
const {
return *fPtr->last(); }
ParamType const * last() const
Definition: RTJmbInParameter.h:90
Simple wrapper class with better api.
Definition: Messaging.h:44
ParamID getParamID() const
Definition: RTJmbInParameter.h:42
This is the main class that the plugin should use as it exposes only the necessary methods of the par...
Definition: RTJmbInParameter.h:140
T * pop()
Definition: RTJmbInParameter.h:152
RTJmbInParameter< T > * fPtr
Definition: RTJmbInParameter.h:176
Interface defining a message handler.
Definition: MessageHandler.h:30
RTJmbInParameter(std::shared_ptr< JmbParamDef< T >> iParamDef)
Definition: RTJmbInParameter.h:75
ParamID getParamID() const
Definition: RTJmbInParameter.h:149
T const * last() const
Definition: RTJmbInParameter.h:155
T const * popOrLast()
Definition: RTJmbInParameter.h:158
T const * operator->() const
Definition: RTJmbInParameter.h:173
Definition: RTJmbInParameter.h:25
void writeToStream(std::ostream &oStream) const override
Definition: RTJmbInParameter.h:125
ParamType const * popOrLast()
Definition: RTJmbInParameter.h:93
IJmbParamDef const * getParamDef() const
Definition: RTJmbInParameter.h:39
Templated class for RT Jamba Inbound parameter.
Definition: RTJmbInParameter.h:70
bool hasUpdate() const override
Definition: RTJmbInParameter.h:96
T const & getValue() const
Definition: RTJmbInParameter.h:164
bool hasUpdate() const
Definition: RTJmbInParameter.h:161
Base (non templated) class for RT Jamba (Inbound) parameters.
Definition: RTJmbInParameter.h:32
JmbParamDef< T > const * getParamDefT() const
Definition: RTJmbInParameter.h:81
tresult handleMessage(Message const &iMessage) override
Definition: RTJmbInParameter.h:54
T const & value() const
Definition: RTJmbInParameter.h:167
tresult readFromMessage(Message const &iMessage) override
Definition: RTJmbInParameter.h:112
IRTJmbInParameter(std::shared_ptr< IJmbParamDef > iParamDef)
Definition: RTJmbInParameter.h:36
T ParamType
Definition: RTJmbInParameter.h:73
RTJmbInParam(RTJmbInParameter< T > *iPtr)
Definition: RTJmbInParameter.h:143
std::shared_ptr< IJmbParamDef > fParamDef
Definition: RTJmbInParameter.h:60
This is the lock free version of the SingleElementQueue.
Definition: Concurrent.h:148
ParamType * pop()
Definition: RTJmbInParameter.h:87