Mobile API Reference  MicroStrategy 2019
WriteDataStream.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : WriteDataStream.h
3 // AUTHOR : Yi Luo
4 // PROJECT : PDSerialization
5 //
6 // CREATION : 07/10/2002
7 // Copyright (C) MicroStrategy, Inc. 2002
8 //==============================================================================================
9 #ifndef Serialization_WriteDataStream_H
10 #define Serialization_WriteDataStream_H
11 
12 #include "PDSerialization.h"
13 #include "StreamInt64Reserve.h"
19 #include "Base/Base/GUID.h"
20 #include "Base/Defines/StrongPtr.h"
21 #include "Base/Base/Buffer.h"
22 #include "Base/Defines/SmartPtrI.h"
25 #include "Synch/Defines/SmartPtr.h"
26 #if !defined(WIN32) && !defined(__ANDROID__)
28 #endif
30 
31 namespace MDataType
32 {
33  class DynamicTime;
34 }
35 
36 namespace MSerialization
37 {
38  class ReadDataStream;
39 
41  const unsigned short LONG_VERSION = 0x8000;
42 
56  {
57  public:
58 
67  virtual void SafeWrite(Int32 iValue)=0;
68 
73  virtual WriteDataStream& operator <<(const MDataType::Binary& irBinValue)=0;
74 
75 #ifndef NO_WCHAR_SUPPORT
76 
80  virtual WriteDataStream& operator<<(const wchar_t * ipString)=0;
81 #endif
82 
87  virtual WriteDataStream& operator<<(const char * ipString)=0;
88 
93  virtual WriteDataStream& operator<<(bool iValue)=0;
94 
99  virtual WriteDataStream& operator<<(short iValue)=0;
100 
105  virtual WriteDataStream& operator<<(unsigned short iValue)=0;
106 
111  virtual WriteDataStream& operator<<(Int32 iValue)=0;
112 
117  virtual WriteDataStream& operator<<(unsigned Int32 iValue)=0;
118 
123  virtual WriteDataStream& operator<<(Int64 iValue)=0;
124 
129  virtual WriteDataStream& operator<<(float iValue)=0;
130 
135  virtual WriteDataStream& operator<<(double iValue)=0;
136 
141  virtual WriteDataStream& operator<<(const GUID& irValue)=0;
142 
147  virtual WriteDataStream& operator <<(const MDataType::DateTime & pv)=0;
148 
153  virtual WriteDataStream& operator <<(const MDataType::DynamicTime & pv)=0;
154 
159  virtual WriteDataStream& operator <<(const MDataType::CellFmtData & pv)=0;
160 
166  virtual WriteDataStream& operator<<(const MDataType::Variant & irValue)=0;
167 
173  virtual WriteDataStream& operator<<(const SerializableObject& irValue)=0;
174 
175 
181  virtual void Write(bool const *ipValues, unsigned Int32 iElementCount)=0;
182 
188  virtual void Write(const unsigned char *ipValues, unsigned Int32 iElementCount)=0;
189 
195  virtual void Write(short const *ipValues, unsigned Int32 iElementCount)=0;
196 
202  virtual void Write(Int32 const *ipValues, unsigned Int32 iElementCount)=0;
203 
209  virtual void Write(Int64 const * ipValues, unsigned Int32 iElementCount)=0;
210 
216  virtual void Write(float const *ipValues, unsigned Int32 iElementCount)=0;
217 
223  virtual void Write(double const *ipValues, unsigned Int32 iElementCount)=0;
224 
230  virtual void Write(GUID const *ipValues, unsigned Int32 iElementCount)=0;
231 
237  virtual void Write(MDataType::DateTime const* ipValues, unsigned Int32 iElementCount)=0;
238 
244  virtual void Write(MDataType::DynamicTime const* ipValues, unsigned Int32 iElementCount)=0;
245 
251  virtual void Write(MDataType::CellFmtData const* ipValues, unsigned Int32 iElementCount)=0;
252 
258  virtual void Write(MDataType::Variant const* ipValues, unsigned Int32 iElementCount)=0;
259 
264  virtual void WriteByte(char iChar)=0;
265 
266 #ifndef NO_WCHAR_SUPPORT
267 
271  virtual void WriteWChar(const wchar_t iChar)=0;
272 #endif
273 
281  virtual StreamInt64Reserve* ReserveInt64()=0;
282 
291  virtual StreamInt32Reserve* ReserveInt32()=0;
292 
305  virtual MDataType::Binary* GiveOutBinary()=0;
306 
319  virtual MDataType::BinaryCollection* GiveOutBinaryCollection()=0;
320 
333  virtual MDataType::BinaryCollection* CopyOutBinaryCollection()=0;
334 
336  virtual Int64 Get64BitSize() throw() = 0;
337 
340  virtual unsigned Int32 GetSize() = 0;
341 
345  virtual void Rewind() = 0;
346 
355  virtual void CopyAppend(const ReadDataStream& irReadStream) = 0;
356 
358  virtual void Delete() throw() =0;
359 
360  // Mark the end of a stream.
361  virtual void CommitStream() = 0;
362 
363  // Abandon stream : freeze further actions on this stream
364  virtual void Abandon() = 0;
365 
366  virtual void SetTimeout(Int64 iTimeoutInMilliSeconds) = 0;
367 
368 #ifndef NO_WCHAR_SUPPORT
369 
374  virtual void WriteString(const wchar_t * ipString)=0;
375 #endif
376 
377  protected:
378  virtual ~WriteDataStream() throw () {};
379  };
380 
381 
382 
384 
394  unsigned short header = 1);
395 
407  unsigned short header = 1);
408 
419  unsigned short header = 1);
420 
436  unsigned short header = 1);
437 
452  MBase::MemoryContract * ipMemCon=0);
461  unsigned short header=1);
463  unsigned short header=1);
465  unsigned short header=1);
467  unsigned short header=1);
468 #if !defined(WIN32) && !defined(__ANDROID__)
469 
473 #endif
474 
479  MSerialization::WriteByteStream* ipSharedMemWriteByteStreamPtr);
480 }
481 
482 #endif // Serialization_WriteDataStream_H
Definition: BaseMemoryContract.h:40
DLL_PDSERIALIZATION_EXIM WriteDataStream * CreateSafeWriteDataStream(MBase::MemoryContract *ipMemCon=0, unsigned short header=1)
MDataType::Binary represents binary data.
Definition: Binary.h:33
Definition: BinaryCollection.h:23
const unsigned short LONG_VERSION
const value for specifying the safe version of WriteDataStream
Definition: WriteDataStream.h:41
DLL_PDSERIALIZATION_EXIM WriteDataStream * CreateSafeRawWriteDataStream(MBase::MemoryContract *ipMemCon=0, unsigned short header=1)
Definition: StreamInt64Reserve.h:37
Definition: PDSerialization.h:63
#define Int64
Definition: BasicTypes.h:36
Definition: BigDecimal.h:18
DLL_PDSERIALIZATION_EXIM WriteDataStream * CreateWriteDataStream(MBase::MemoryContract *ipMemCon=0, unsigned short header=1)
DLL_PDSERIALIZATION_EXIM WriteDataStream * CreateWriteDataStreamToSharedMem(MMultiProcess::SharedMemory *ipSharedMemPtr, unsigned Int32 iBlockSize=1024)
#define Int32
Definition: BasicTypes.h:20
Definition: ReadDataStream.h:51
DLL_PDSERIALIZATION_EXIM WriteDataStream * ConvertBinaries2WriteDataStream(MDataType::BinaryCollection *ipBins, MBase::MemoryContract *ipMemCon=0)
Definition: StreamInt64Reserve.h:21
Definition: Variant.h:36
virtual ~WriteDataStream()
Definition: WriteDataStream.h:378
Definition: StrongPtr.h:50
Definition: CellFmtData.h:76
#define DLL_PDSERIALIZATION_EXIM
Definition: PDSerialization.h:21
Definition: DynamicTime.h:54
Definition: SharedMemory.h:59
MBase::StrongPtr< WriteDataStream, MBase::DeleteOperatorGeneric< WriteDataStream > > WriteDataStreamPtr
Definition: WriteDataStream.h:383
Definition: WriteDataStream.h:55
Definition: MultiReadStream.h:23
Definition: DateTime.h:74
Definition: WriteByteStream.h:51
DLL_PDSERIALIZATION_EXIM WriteDataStream * CreateWriteDataStreamToSharedMemByteStream(MSerialization::WriteByteStream *ipSharedMemWriteByteStreamPtr)
Definition: Base/Base/GUID.h:32
DLL_PDSERIALIZATION_EXIM WriteDataStream * CreateRawWriteDataStream(MBase::MemoryContract *ipMemCon=0, unsigned short header=1)