31 #include "MultiSetter.h"
35 #include <xplra/Protocol.h>
37 #include <hu/varadiistvan/scpl/io/DataStream.h>
50 MultiSetter::MultiSetter(
XPlane& xplane) noexcept :
51 MultiBuffer(xplane, Protocol::COMMAND_REGISTER_SET_MULTI,
52 Protocol::COMMAND_UNREGISTER_SET_MULTI)
58 inline void MultiSetter::write(
const DataRef& dataRef)
const
60 switch (dataRef.
type) {
61 case Protocol::TYPE_INT:
62 xplane.
stream->writeS32(*
reinterpret_cast<const int32_t*
>
65 case Protocol::TYPE_FLOAT:
66 xplane.
stream->writeFloat(*
reinterpret_cast<const float*
>
69 case Protocol::TYPE_DOUBLE:
70 xplane.
stream->writeDouble(*
reinterpret_cast<const double*
>
73 case Protocol::TYPE_FLOAT_ARRAY:
74 case Protocol::TYPE_INT_ARRAY:
75 case Protocol::TYPE_BYTE_ARRAY:
78 (dataRef.
type==Protocol::TYPE_FLOAT_ARRAY) ?
sizeof(
float) :
79 ((dataRef.
type==Protocol::TYPE_INT_ARRAY) ?
80 sizeof(int32_t) :
sizeof(uint8_t));
82 dataRef.
length * elementSize);
92 xplane.
stream->writeU8(Protocol::COMMAND_EXECUTE_SET_MULTI);
94 for(vector<DataRef>::const_iterator i =
dataRefs.begin();
110 for(vector<DataRef>::const_iterator i =
dataRefs.begin();
bool isArray() const noexcept
std::vector< DataRef > dataRefs
virtual void doExecuteUnregistered()
void write(const DataRef &dataRef) const
scpl::io::DataStream * stream
void checkResult(uint8_t result, bool hasParameter=false, long parameter=0)