Mobile API Reference  MicroStrategy 2019
ReadDataStream.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : PDSerializatoin/PDSerialization/ReadDataStream.h
3 // PROJECT : PDSerialization
4 //
5 // AUTHOR : Yi Luo
6 // CREATION : 2002-07-10
7 // Copyright (C) MicroStrategy, Inc. 2002
8 //==============================================================================================
9 #ifndef Serialization_ReadDataStream_H
10 #define Serialization_ReadDataStream_H
11 
12 #include "PDSerialization.h"
15 #include "Base/Base/GUID.h"
16 #include "Base/Base/ReturnString.h"
18 #include "Base/Defines/SmartPtrI.h"
20 #include "Synch/Defines/SmartPtr.h"
21 #if !defined(WIN32) && !defined(__ANDROID__)
23 #endif
25 
26 namespace MDataType
27 {
28  class BinaryCollection;
29  class DynamicTime;
30 }
31 
32 namespace MSerialization
33 {
34 
35  class WriteDataStream; // foward class declaration
36 
52  {
53  public:
54 
61  virtual ReadDataStream& operator >> (MDataType::Binary& orValue)=0;
62 
69  virtual ReadDataStream& operator >> (bool& orValue)=0;
70 
78  virtual void Read(bool * iopValueArray, unsigned Int32 iElementCount)=0;
79 
87  virtual void Read(unsigned char * iopValueArray, unsigned Int32 iElementCount)=0;
88 
95  virtual ReadDataStream& operator >> (short & orValue)=0;
96 
103  virtual ReadDataStream& operator >> (unsigned short & orValue)=0;
104 
112  virtual void Read(short * iopValueArray, unsigned Int32 iElementCount)=0;
113 
120  virtual ReadDataStream& operator >> (Int32& orValue)=0;
121 
128  virtual ReadDataStream& operator >> (unsigned Int32 & orValue)=0;
129 
137  virtual void Read(Int32* iopValueArray, unsigned Int32 iElementCount)=0;
138 
145  virtual ReadDataStream& operator >> (Int64& orValue)=0;
146 
154  virtual void Read(Int64* iopValueArray, unsigned Int32 iElementCount)=0;
155 
162  virtual ReadDataStream& operator >> (float& orValue)=0;
163 
171  virtual void Read(float* iopValueArray, unsigned Int32 iElementCount)=0;
172 
179  virtual ReadDataStream& operator >> (double& orValue)=0;
180 
188  virtual void Read(double* iopValueArray, unsigned Int32 iElementCount)=0;
189 
190 #ifndef NO_WCHAR_SUPPORT
191 
196  virtual MBase::ReturnWString ReadWString()=0;
197 #endif
198 
203  virtual MBase::ReturnString ReadString()=0;
204 
210  virtual char ReadByte()=0;
211 
212 #ifndef NO_WCHAR_SUPPORT
213 
219  virtual wchar_t ReadWChar()=0;
220 #endif
221 
222  // serialization of complext data type
223 
230  virtual ReadDataStream& operator >> (GUID& orValue)=0;
231 
239  virtual void Read(GUID * iopValueArray, unsigned Int32 iElementCount )=0;
240 
247  virtual ReadDataStream& operator >> (MDataType::DateTime& orValue)=0;
248 
256  virtual void Read(MDataType::DateTime * iopValueArray, unsigned Int32 iElementCount)=0;
257 
264  virtual ReadDataStream& operator >> (MDataType::DynamicTime& orValue)=0;
265 
273  virtual void Read(MDataType::DynamicTime * iopValueArray, unsigned Int32 iElementCount)=0;
274 
275 
282  virtual ReadDataStream& operator >> (MDataType::CellFmtData& orValue)=0;
283 
291  virtual void Read(MDataType::CellFmtData * iopValueArray, unsigned Int32 iElementCount)=0;
292 
293 
300  virtual ReadDataStream& operator >> (MDataType::Variant& orValue)=0;
301 
307  virtual ReadDataStream& operator >> (SerializableObject& irValue)=0;
308 
319  virtual void Read(MDataType::Variant * iopValueArray, unsigned Int32 iElementCount)=0;
320 
328  virtual Int32 ReadSafeInt()=0;
329 
331  virtual void Rewind() =0 ;
332 
339  virtual unsigned Int32 GetSize() = 0;
340 
346  virtual Int64 Get64BitSize() throw() = 0;
347 
349  virtual Int64 GetNumberOfUnreadBytes() throw() = 0;
350 
362  virtual MDataType::BinaryCollection* GiveOutBinaryCollection()=0;
363 
375  virtual MDataType::BinaryCollection* CopyOutBinaryCollection() const =0;
376 
389  virtual MDataType::BinaryCollection* CopyOutContentBinaryCollection() const =0;
390 
392  virtual void Delete() throw() =0;
393 
394  // return the type of next item
395  virtual TYPE GetItemType() =0;
396 
397  // return whether the stream is encrypted
398  virtual bool IsEncrypted() = 0;
399 
400  // Wait for data in read streams
401  virtual bool WaitForData(unsigned Int32 iTimeOut) = 0;
402 
403  // set a timeout value for all subsequent read actions.
404  virtual void SetTimeout(Int64 iTimeoutInMilliseconds) = 0;
405 
406  protected:
407 
409  virtual void Skip(Int64 dwOffset)=0;
410 
412  virtual void Skip(unsigned Int32 dwOffset)=0;
413 
414  virtual ~ReadDataStream(){};
415  };
416 
419 
420  // factory function to create a ReadDataStream from a Binary.
421 
436  MBase::MemoryContract * ipMemCon = 0);
437 
451  MBase::MemoryContract * ipMemCon = 0);
452 
453 
461 
462 #if !defined(WIN32) && !defined(__ANDROID__)
463 
468  MBase::MemoryContract * ipMemCon);
469 #endif
470 
475  ReadByteStream * ipSharedMemReadBStreamPtr,
476  MBase::MemoryContract * ipMemCon);
477 }
478 
479 #endif // Serialization_ReadDataStream_H
Definition: BaseMemoryContract.h:40
Definition: ReadByteStream.h:30
DLL_PDSERIALIZATION_EXIM ReadDataStream * CreateReadDataStreamFromSharedMemByteStream(ReadByteStream *ipSharedMemReadBStreamPtr, MBase::MemoryContract *ipMemCon)
MDataType::Binary represents binary data.
Definition: Binary.h:33
Definition: BinaryCollection.h:23
Definition: ReturnString.h:36
DLL_PDSERIALIZATION_EXIM ReadDataStream * ConvertBinary2ReadDataStream(MDataType::Binary *ipB, MBase::MemoryContract *ipMemCon=0)
Definition: PDSerialization.h:63
#define Int64
Definition: BasicTypes.h:36
DLL_PDSERIALIZATION_EXIM ReadDataStream * ConvertWriteDataStream2ReadDataStream(WriteDataStream *ipWriteStream, MBase::MemoryContract *ipMemCon=0)
TYPE
Definition: PDSerialization.h:87
Definition: ReturnString.h:85
Definition: BigDecimal.h:18
MBase::StrongPtr< ReadDataStream, MBase::DeleteOperatorGeneric< ReadDataStream > > ReadDataStreamPtr
Strong pointer to the ReadDataStream.
Definition: ReadDataStream.h:418
#define Int32
Definition: BasicTypes.h:20
Definition: ReadDataStream.h:51
Definition: Variant.h:36
Definition: StrongPtr.h:50
DLL_PDSERIALIZATION_EXIM ReadDataStream * GetReadDataStreamFromFile(MFileSystem::ReadableFile::Ptr &iFilePtr)
virtual ~ReadDataStream()
Definition: ReadDataStream.h:414
Definition: CellFmtData.h:76
#define DLL_PDSERIALIZATION_EXIM
Definition: PDSerialization.h:21
Definition: DynamicTime.h:54
Definition: SharedMemory.h:59
Definition: WriteDataStream.h:55
Definition: MultiReadStream.h:23
Definition: DateTime.h:74
DLL_PDSERIALIZATION_EXIM ReadDataStream * CreateReadDataStreamFromSharedMem(MMultiProcess::SharedMemory *ipSharedMemPtr, MBase::MemoryContract *ipMemCon)
Definition: Base/Base/GUID.h:32