![]() |
MAK RTIspy API Documentation for HLA Evolved
|
00001 /********************************************************************* 00002 ** Copyright (c) 2010 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: msgCompressor.h,v $ $Revision: $ $State: Exp $ 00007 *********************************************************************/ 00008 00012 00013 #ifndef msgCompressor_H_ 00014 #define msgCompressor_H_ 00015 00016 #include <rtiMsConfig.h> 00017 #include <vlutil/vlMachineTypes.h> 00018 #include <vlutil/vlSmartPointers.h> 00019 #include <vector> 00020 00021 #include "msgHeaderReader.h" 00022 00025 struct z_stream_s; 00026 typedef struct z_stream_s* z_streamp; 00027 00031 class DT_DLL_RTIUTIL DtMsgCompressor 00032 { 00033 public: 00034 00036 DtMsgCompressor(DtBoost::shared_ptr<DtMsgHeaderReader> hdrReader, 00037 size_t maxUncompressedMsgSize, MAKRti::DtU8 compressionLevel = 1); 00038 00040 virtual ~DtMsgCompressor(); 00041 00045 virtual bool compressMsg(char* msg, size_t msgSize, char** compressedMsg, 00046 size_t& compressedSize); 00047 00049 virtual bool isCompressed(const char* bufferPtr, size_t size) const; 00050 00054 virtual bool uncompressMsg(char* msg, size_t msgSize, char** uncompressedMsg, 00055 size_t& uncompressedSize); 00056 00058 virtual MAKRti::DtU8 compressionLevel() const { return myCompressionLevel; } 00059 virtual void setCompressionLevel(MAKRti::DtU8 level); 00060 00063 virtual size_t maxUncompressedMsgSize() const { return myMaxUncompressedMsgSize; } 00064 00065 protected: 00066 00068 std::vector<char> myCompressedBuffer; 00069 00071 std::vector<char> myUncompressedBuffer; 00072 00074 size_t myUncompressedDataSize; 00075 00077 DtBoost::shared_ptr<DtMsgHeaderReader> myHeaderReader; 00078 00080 MAKRti::DtU8 myCompressionLevel; 00081 00083 size_t myMaxUncompressedMsgSize; 00084 00086 z_streamp myCompressionStream; 00087 00089 z_streamp myUncompressionStream; 00090 00091 }; 00092 00093 #endif //! msgCompressor_H_