27#ifndef PX_PVD_MARSHALLING_H
28#define PX_PVD_MARSHALLING_H
30#include "foundation/PxMathIntrinsics.h"
32#include "PxPvdObjectModelBaseTypes.h"
42template <
typename TSmallerType,
typename TLargerType>
51template <
typename smtype,
typename lgtype>
52static inline void marshalSingleT(
const uint8_t* srcData, uint8_t* destData)
56 physx::intrinsics::memCopy(&incoming, srcData,
sizeof(smtype));
57 lgtype outgoing =
static_cast<lgtype
>(incoming);
58 physx::intrinsics::memCopy(destData, &outgoing,
sizeof(lgtype));
61template <
typename smtype,
typename lgtype>
62static inline void marshalBlockT(
const uint8_t* srcData, uint8_t* destData, uint32_t numBytes)
64 for(
const uint8_t* item = srcData, *end = srcData + numBytes; item < end;
65 item +=
sizeof(smtype), destData +=
sizeof(lgtype))
66 marshalSingleT<smtype, lgtype>(item, destData);
69#define PVD_TYPE_MARSHALLER(smtype, lgtype) \
71 struct PvdMarshalling<smtype, lgtype> \
73 uint32_t canMarshal; \
74 static void marshalSingle(const uint8_t* srcData, uint8_t* destData) \
76 marshalSingleT<smtype, lgtype>(srcData, destData); \
78 static void marshalBlock(const uint8_t* srcData, uint8_t* destData, uint32_t numBytes) \
80 marshalBlockT<smtype, lgtype>(srcData, destData, numBytes); \
85PVD_TYPE_MARSHALLER(int8_t, int16_t)
86PVD_TYPE_MARSHALLER(int8_t, uint16_t)
87PVD_TYPE_MARSHALLER(int8_t, int32_t)
88PVD_TYPE_MARSHALLER(int8_t, uint32_t)
89PVD_TYPE_MARSHALLER(int8_t, int64_t)
90PVD_TYPE_MARSHALLER(int8_t, uint64_t)
91PVD_TYPE_MARSHALLER(int8_t, PvdF32)
92PVD_TYPE_MARSHALLER(int8_t, PvdF64)
94PVD_TYPE_MARSHALLER(uint8_t, int16_t)
95PVD_TYPE_MARSHALLER(uint8_t, uint16_t)
96PVD_TYPE_MARSHALLER(uint8_t, int32_t)
97PVD_TYPE_MARSHALLER(uint8_t, uint32_t)
98PVD_TYPE_MARSHALLER(uint8_t, int64_t)
99PVD_TYPE_MARSHALLER(uint8_t, uint64_t)
100PVD_TYPE_MARSHALLER(uint8_t, PvdF32)
101PVD_TYPE_MARSHALLER(uint8_t, PvdF64)
103PVD_TYPE_MARSHALLER(int16_t, int32_t)
104PVD_TYPE_MARSHALLER(int16_t, uint32_t)
105PVD_TYPE_MARSHALLER(int16_t, int64_t)
106PVD_TYPE_MARSHALLER(int16_t, uint64_t)
107PVD_TYPE_MARSHALLER(int16_t, PvdF32)
108PVD_TYPE_MARSHALLER(int16_t, PvdF64)
110PVD_TYPE_MARSHALLER(uint16_t, int32_t)
111PVD_TYPE_MARSHALLER(uint16_t, uint32_t)
112PVD_TYPE_MARSHALLER(uint16_t, int64_t)
113PVD_TYPE_MARSHALLER(uint16_t, uint64_t)
114PVD_TYPE_MARSHALLER(uint16_t, PvdF32)
115PVD_TYPE_MARSHALLER(uint16_t, PvdF64)
117PVD_TYPE_MARSHALLER(int32_t, int64_t)
118PVD_TYPE_MARSHALLER(int32_t, uint64_t)
119PVD_TYPE_MARSHALLER(int32_t, PvdF64)
120PVD_TYPE_MARSHALLER(int32_t, PvdF32)
122PVD_TYPE_MARSHALLER(uint32_t, int64_t)
123PVD_TYPE_MARSHALLER(uint32_t, uint64_t)
124PVD_TYPE_MARSHALLER(uint32_t, PvdF64)
125PVD_TYPE_MARSHALLER(uint32_t, PvdF32)
127PVD_TYPE_MARSHALLER(PvdF32, PvdF64)
128PVD_TYPE_MARSHALLER(PvdF32, uint32_t)
129PVD_TYPE_MARSHALLER(PvdF32, int32_t)
131PVD_TYPE_MARSHALLER(uint64_t, PvdF64)
132PVD_TYPE_MARSHALLER(int64_t, PvdF64)
133PVD_TYPE_MARSHALLER(PvdF64, uint64_t)
134PVD_TYPE_MARSHALLER(PvdF64, int64_t)
136template <
typename TMarshaller>
137static inline bool getMarshalOperators(TSingleMarshaller&, TBlockMarshaller&, TMarshaller&,
bool)
142template <
typename TMarshaller>
143static inline bool getMarshalOperators(TSingleMarshaller& single, TBlockMarshaller& block, TMarshaller&, uint32_t)
145 single = TMarshaller::marshalSingle;
146 block = TMarshaller::marshalBlock;
150template <
typename smtype,
typename lgtype>
151static inline bool getMarshalOperators(TSingleMarshaller& single, TBlockMarshaller& block)
155 PvdMarshalling<smtype, lgtype> marshaller = PvdMarshalling<smtype, lgtype>();
156 return getMarshalOperators(single, block, marshaller, marshaller.canMarshal);
159template <
typename smtype>
160static inline bool getMarshalOperators(TSingleMarshaller& single, TBlockMarshaller& block, int32_t lgtypeId)
164 case PvdBaseType::PvdI8:
165 return getMarshalOperators<smtype, int8_t>(single, block);
166 case PvdBaseType::PvdU8:
167 return getMarshalOperators<smtype, uint8_t>(single, block);
168 case PvdBaseType::PvdI16:
169 return getMarshalOperators<smtype, int16_t>(single, block);
170 case PvdBaseType::PvdU16:
171 return getMarshalOperators<smtype, uint16_t>(single, block);
172 case PvdBaseType::PvdI32:
173 return getMarshalOperators<smtype, int32_t>(single, block);
174 case PvdBaseType::PvdU32:
175 return getMarshalOperators<smtype, uint32_t>(single, block);
176 case PvdBaseType::PvdI64:
177 return getMarshalOperators<smtype, int64_t>(single, block);
178 case PvdBaseType::PvdU64:
179 return getMarshalOperators<smtype, uint64_t>(single, block);
180 case PvdBaseType::PvdF32:
181 return getMarshalOperators<smtype, PvdF32>(single, block);
182 case PvdBaseType::PvdF64:
183 return getMarshalOperators<smtype, PvdF64>(single, block);
188static inline bool getMarshalOperators(TSingleMarshaller& single, TBlockMarshaller& block, int32_t smtypeId,
193 case PvdBaseType::PvdI8:
194 return getMarshalOperators<int8_t>(single, block, lgtypeId);
195 case PvdBaseType::PvdU8:
196 return getMarshalOperators<uint8_t>(single, block, lgtypeId);
197 case PvdBaseType::PvdI16:
198 return getMarshalOperators<int16_t>(single, block, lgtypeId);
199 case PvdBaseType::PvdU16:
200 return getMarshalOperators<uint16_t>(single, block, lgtypeId);
201 case PvdBaseType::PvdI32:
202 return getMarshalOperators<int32_t>(single, block, lgtypeId);
203 case PvdBaseType::PvdU32:
204 return getMarshalOperators<uint32_t>(single, block, lgtypeId);
205 case PvdBaseType::PvdI64:
206 return getMarshalOperators<int64_t>(single, block, lgtypeId);
207 case PvdBaseType::PvdU64:
208 return getMarshalOperators<uint64_t>(single, block, lgtypeId);
209 case PvdBaseType::PvdF32:
210 return getMarshalOperators<PvdF32>(single, block, lgtypeId);
211 case PvdBaseType::PvdF64:
212 return getMarshalOperators<PvdF64>(single, block, lgtypeId);
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition PxPvdMarshalling.h:44