30 using namespace Utils;
39 explicit IRTJmbOutParameter(std::shared_ptr<IJmbParamDef> iParamDef) : fParamDef{std::move(iParamDef)} {}
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}
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); }
void broadcast(T const &iValue)
Definition: RTJmbOutParameter.h:184
Definition: RTJmbOutParameter.h:172
Definition: RTJmbOutParameter.h:71
Definition: RTJmbOutParameter.h:35
Definition: ParamDef.h:199
ParamID getParamID() const
Definition: RTJmbOutParameter.h:45
Definition: Messaging.h:43
RTJmbOutParameter(std::shared_ptr< JmbParamDef< T >> iParamDef)
Definition: RTJmbOutParameter.h:76
void writeToStream(std::ostream &oStream) const override
Definition: RTJmbOutParameter.h:159
ParamID getParamID() const
Definition: RTJmbOutParameter.h:178
T ParamType
Definition: RTJmbOutParameter.h:74
void broadcast(ElementModifier const &iElementModifier)
Definition: RTJmbOutParameter.h:191
bool broadcastIf(ElementModifier const &iElementModifier)
Definition: RTJmbOutParameter.h:199
IJmbParamDef const * getParamDef() const
Definition: RTJmbOutParameter.h:42
bool hasUpdate() const override
Definition: RTJmbOutParameter.h:121
void broadcast(ElementModifier const &iElementModifier)
Definition: RTJmbOutParameter.h:103
IRTJmbOutParameter(std::shared_ptr< IJmbParamDef > iParamDef)
Definition: RTJmbOutParameter.h:39
tresult writeToMessage(Message &oMessage) override
Definition: RTJmbOutParameter.h:137
RTJmbOutParam(RTJmbOutParameter< T > *iPtr)
Definition: RTJmbOutParameter.h:175
RTJmbOutParameter< T > * fPtr
Definition: RTJmbOutParameter.h:202
static U dynamic(T *iPtr, typename std::enable_if<!std::is_polymorphic< T >::value >::type *=nullptr)
Definition: Metaprogramming.h:35
Definition: Concurrent.h:148
Definition: ParamDef.h:225
void broadcastValue(ParamType const &iValue)
Definition: RTJmbOutParameter.h:92
bool broadcastIf(ElementModifier const &iElementModifier)
Definition: RTJmbOutParameter.h:115
std::shared_ptr< IJmbParamDef > fParamDef
Definition: RTJmbOutParameter.h:60
JmbParamDef< T > const * getParamDefT() const
Definition: RTJmbOutParameter.h:82