VR-Forces 4.0.4 Class Documentation
include/vrvUtil/DtMessageStream.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2007 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile: DtMessageStream.h,v $ $Revision: 1.11 $ $State: Exp $
00007 ******************************************************************************/
00008 
00012 
00013 #pragma once
00014 
00015 #include <vrvUtil/vrvUtil.h>
00016 #include <vrvUtil/DtMessage.h>
00017 
00018 #include <vector>
00019 
00020 namespace makVrv
00021 {
00025    class DT_DLL_VRVUTIL DtMessageStream
00026    {
00027    public:
00028       typedef std::vector<DtMessage*> MessageList;
00029 
00030       typedef unsigned char Byte;
00031       typedef std::vector<Byte> ByteBuffer;
00032 
00033       //The message stream will be reset should not get larger than 5 MB.
00034       static const size_t theMaxPersistentStreamSize = 0x500000;
00035 
00037       DtMessageStream(size_t initialReserve = 0xFFF);
00038 
00040       ~DtMessageStream();
00041 
00043       void clearStream();
00044 
00046 
00048       void writeMessageToStream(DtMessage* message);
00049 
00051       void writeMessagesToStream(MessageList& messages );
00052 
00054 
00056       Byte* streamData() const;
00057 
00059       size_t streamDataSize() const;    
00060 
00063       void addDataToStream(char* data,size_t size);    
00064 
00067       Byte* addSpaceToStream(size_t size);
00068 
00070       void trimEnd(size_t n);
00071 
00075       int readMessagesFromStream( MessageList& messages);
00076 
00077    protected:
00078       ByteBuffer myMessageBuffer;
00079    };
00080 }
00081 

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)