16#include <tbb/tbb_allocator.h>
34 typedef unsigned char Byte;
35 typedef std::vector<Byte, tbb::tbb_allocator<Byte> >
ByteBuffer;
37 static const int theHeaderSize = (
sizeof(
unsigned short) +
sizeof(char)) * 2;
40 #define packSizeOf(type) ((sizeof(type)-1)<<4)
43 #define unpackSizeOf(dataType) (((dataType)>>4)+1)
188 void addData(
unsigned int dataType,
const void*
data,
int dataSize);
226 template <
typename T1>
232 template <
typename T1,
typename T2>
238 template <
typename T1,
typename T2,
typename T3>
241 *
this << t1 << t2 << t3;
244 template <
typename T1,
typename T2,
typename T3,
typename T4>
247 *
this << t1 << t2 << t3 << t4;
250 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
253 *
this << t1 << t2 << t3 << t4 << t5;
256 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
260 *
this << t1 << t2 << t3 << t4 << t5 << t6;
263 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
264 typename T6,
typename T7>
267 *
this << t1 << t2 << t3 << t4 << t5 << t6 << t7;
270 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
271 typename T6,
typename T7,
typename T8>
274 *
this << t1 << t2 << t3 << t4 << t5 << t6 << t7 << t8;
281 template <
typename T1>
287 template <
typename T1,
typename T2>
293 template <
typename T1,
typename T2,
typename T3>
296 *
this >> t1 >> t2 >> t3;
299 template <
typename T1,
typename T2,
typename T3,
typename T4>
302 *
this >> t1 >> t2 >> t3 >> t4;
305 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
308 *
this >> t1 >> t2 >> t3 >> t4 >> t5;
311 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
315 *
this >> t1 >> t2 >> t3 >> t4 >> t5 >> t6;
318 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
319 typename T6,
typename T7>
322 *
this >> t1 >> t2 >> t3 >> t4 >> t5 >> t6 >> t7;
325 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
326 typename T6,
typename T7,
typename T8>
327 void readMultiple(T1& t1,T2& t2,T3& t3,T4& t4,T5& t5,T6& t6,T7& t7,T8& t8)
329 *
this >> t1 >> t2 >> t3 >> t4 >> t5 >> t6 >> t7 >> t8;
333 template <
typename T1>
342 template <
typename T1,
typename T2>
351 template <
typename T1,
typename T2,
typename T3>
355 *
this >> t1 >> t2 >> t3;
357 *
this << t1 << t2 << t3;
360 template <
typename T1,
typename T2,
typename T3,
typename T4>
364 *
this >> t1 >> t2 >> t3 >> t4;
366 *
this << t1 << t2 << t3 << t4;
369 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
373 *
this >> t1 >> t2 >> t3 >> t4 >> t5;
375 *
this << t1 << t2 << t3 << t4 << t5;
378 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
380 void serialize(T1& t1,T2& t2,T3& t3,T4& t4,T5& t5,T6& t6)
383 *
this >> t1 >> t2 >> t3 >> t4 >> t5 >> t6;
385 *
this << t1 << t2 << t3 << t4 << t5 << t6;
388 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
389 typename T6,
typename T7>
390 void serialize(T1& t1,T2& t2,T3& t3,T4& t4,T5& t5,T6& t6,T7& t7)
393 *
this >> t1 >> t2 >> t3 >> t4 >> t5 >> t6 >> t7;
395 *
this << t1 << t2 << t3 << t4 << t5 << t6 << t7;
398 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
399 typename T6,
typename T7,
typename T8>
400 void serialize(T1& t1,T2& t2,T3& t3,T4& t4,T5& t5,T6& t6,T7& t7,T8& t8)
403 *
this >> t1 >> t2 >> t3 >> t4 >> t5 >> t6 >> t7 >> t8;
405 *
this << t1 << t2 << t3 << t4 << t5 << t6 << t7 << t8;
409 template <
typename T>
415 class FastStringBuf :
public std::stringbuf
418 const char* c_str()
const {
return pbase();}
419 size_t outputSize()
const
421 return pptr() - pbase();
425 std::pair<void*,int> configMemory;
432 std::istringstream memoryStream;
434 memoryStream.str(std::string((
char*)configMemory.first,configMemory.second));
441 delete[] (
char*)configMemory.first;
447 FastStringBuf fastBuffer;
449 std::ostream memoryStream(&fastBuffer);
456 configMemory.first = (
void*) fastBuffer.c_str();
457 configMemory.second = fastBuffer.outputSize();
#define packSizeOf(type)
Definition DtMessage.h:40
std::ostream & operator<<(std::ostream &str, const vrvControlToolkit::DtVdcVector2D &vec)
void readMultiple()
Definition DtMessage.h:277
void serialize(T1 &t1, T2 &t2, T3 &t3, T4 &t4, T5 &t5)
Definition DtMessage.h:370
const Byte * data() const
Get a pointer to the start of the data.
void printDebugMessageContents(std::ostream &)
Print the message contents for debugging.
void readMultiple(T1 &t1, T2 &t2, T3 &t3, T4 &t4, T5 &t5, T6 &t6)
Definition DtMessage.h:313
DataType
Definition DtMessage.h:48
@ FixedArray
Definition DtMessage.h:64
@ UnicodeString
Definition DtMessage.h:65
@ User_Last
Definition DtMessage.h:67
@ UnsignedChar
Definition DtMessage.h:51
@ Char
Definition DtMessage.h:50
@ Long
Definition DtMessage.h:61
@ Short
Definition DtMessage.h:52
@ UnsignedLong
Definition DtMessage.h:62
@ Int
Definition DtMessage.h:54
@ LongLong
Definition DtMessage.h:57
@ Bool
Definition DtMessage.h:60
@ UnsignedShort
Definition DtMessage.h:53
@ Float
Definition DtMessage.h:56
@ Unknown
Definition DtMessage.h:49
@ Double
Definition DtMessage.h:59
@ User_Start
Definition DtMessage.h:66
@ UnsignedInt
Definition DtMessage.h:55
@ UnsignedLongLong
Definition DtMessage.h:58
@ String
Definition DtMessage.h:63
void setClassId(unsigned short classId)
Set the class id.
unsigned short functionId() const
Get the function id.
const char * dataTypeName(unsigned char dataType)
Get the name of a data type in English.
bool mySerializeWriteOutFlag
Definition DtMessage.h:473
static const int theHeaderSize
Definition DtMessage.h:37
ByteBuffer::const_iterator myReadIter
Definition DtMessage.h:472
void serialize(T1 &t1, T2 &t2)
Definition DtMessage.h:343
unsigned char Byte
Definition DtMessage.h:34
void serialize(T1 &t1, T2 &t2, T3 &t3)
Definition DtMessage.h:352
bool serializeWriteOut() const
Is this message set to write out data during serialization or read in data.
void readMultiple(T1 &t1, T2 &t2, T3 &t3, T4 &t4)
Definition DtMessage.h:300
unsigned short classId() const
Get the class id.
ByteBuffer myBuffer
Definition DtMessage.h:471
void emptyMessage()
Empty the message. This does NOT dealloc memory.
DtMessage(const DtMessage &orig)
CTOR. Note that the internal read pointer is also copied, in addition to the data.
unsigned char nextDataType() const
Get the type of the next data in the message.
void readMultiple(T1 &t1)
Definition DtMessage.h:282
void setFunctionId(unsigned short functionId)
Set the function id.
void serializeHeader(unsigned short classId, unsigned short functionId)
If the message is set to write out, this will verify that the input class id and the function id matc...
void addData(unsigned int dataType, const void *data, int dataSize)
Low level add data call.
void addMultiple(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7)
Definition DtMessage.h:265
void serialize(T1 &t1)
Definition DtMessage.h:334
void getData(int dataType, void *output)
Read the next parameter into the output. It is assumed that output has sufficient space,...
void setSerializeWriteOut(bool writeOut)
Set whether the message will write out data during serialization or read in data.
void skipToNextData()
Move the read pointer to the next data element in the message.
void readMultiple(T1 &t1, T2 &t2, T3 &t3, T4 &t4, T5 &t5, T6 &t6, T7 &t7)
Definition DtMessage.h:320
void addOnlyData(DtMessage &message)
Adds only the data from the message (no header).
void readMultiple(T1 &t1, T2 &t2)
Definition DtMessage.h:288
const void * nextDataPointer() const
Get a pointer to the next chunk of data. Do not modify the data in this pointer.
void addMultiple(T1 t1, T2 t2, T3 t3, T4 t4)
Definition DtMessage.h:245
void addMultiple()
Helper functions for doing multiple adds and reads.
Definition DtMessage.h:222
void serializeViaArchive(T &t)
Definition DtMessage.h:410
void resetRead()
Reset the internal reader to the beginning of data. This does not include the internal message header...
bool canReadData() const
Get if there is more data that can be read.
void serialize(T1 &t1, T2 &t2, T3 &t3, T4 &t4, T5 &t5, T6 &t6, T7 &t7, T8 &t8)
Definition DtMessage.h:400
std::vector< Byte, tbb::tbb_allocator< Byte > > ByteBuffer
Definition DtMessage.h:35
DtMessage(const Byte *buffer, size_t size)
Construct a message from a raw buffer, the raw buffer MUST have come from another IGI message,...
void readMultiple(T1 &t1, T2 &t2, T3 &t3, T4 &t4, T5 &t5)
Definition DtMessage.h:306
void addMultiple(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
Definition DtMessage.h:251
void serialize(T1 &t1, T2 &t2, T3 &t3, T4 &t4, T5 &t5, T6 &t6)
Definition DtMessage.h:380
DtMessage(unsigned short classId=0, unsigned short functionId=0)
Byte 0: DataType Id.
void addMultiple(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8)
Definition DtMessage.h:272
void addMultiple(T1 t1, T2 t2, T3 t3)
Definition DtMessage.h:239
void serialize(T1 &t1, T2 &t2, T3 &t3, T4 &t4, T5 &t5, T6 &t6, T7 &t7)
Definition DtMessage.h:390
void addMultiple(T1 t1, T2 t2)
Definition DtMessage.h:233
void addMultiple(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)
Definition DtMessage.h:258
size_t size() const
Get the current size of the message in bytes.
unsigned int nextDataSize() const
Get the data size of the next parameter to be read. NOTE! the reader pointer must be pointing to the ...
void addMultiple(T1 t1)
Definition DtMessage.h:227
void advanceRead(size_t bytes)
Move the read pointer forward a number of bytes.
void readMultiple(T1 &t1, T2 &t2, T3 &t3)
Definition DtMessage.h:294
void readMultiple(T1 &t1, T2 &t2, T3 &t3, T4 &t4, T5 &t5, T6 &t6, T7 &t7, T8 &t8)
Definition DtMessage.h:327
void serialize(T1 &t1, T2 &t2, T3 &t3, T4 &t4)
Definition DtMessage.h:361
Definition DtUnicode.h:34
Definition portable_binary_iarchive.hpp:86
Definition portable_binary_oarchive.hpp:86
Contains DtCreateSensorFieldOfViewCommand and DtCreateSensorFieldOfViewCommandCreator class declarati...
Definition DtGridLinesSettingsRecord.h:16
Contains DLL export macros.
#define DT_DLL_VRVUTIL
Definition vrvUtil.h:34