Mobile API Reference  MicroStrategy 2019
WriteByteStream.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : WriteByteStream.h
3 // AUTHOR : Yuan Wei
4 // CREATION : 12/31/2007
5 // Copyright (C) MicroStrategy, Inc. 2007
6 //==============================================================================================
7 
8 #ifndef Serialization_WriteByteStream_H
9 #define Serialization_WriteByteStream_H
10 
11 #include "PDSerialization.h"
17 #include "PDCHeader/PDCvector"
18 #ifndef __ANDROID__
20 #endif
21 namespace MSerialization
22 {
23 
24 class WriteByteStream;
25 class WriteByteStreamFileImpl;
26 class WriteByteStreamImpl;
27 
29 {
30 public:
31  // ReservedPosition(const ReservedPosition& irCopy); use default copy constructor
32  ~ReservedPosition() throw() { } ;
33 
34 private:
35  friend class WriteByteStreamFileImpl;
36  friend class WriteByteStreamImpl;
38 
39  union
40  {
41  void* mpAddr;
43  };
44 
45  ReservedPosition(void* ipMemAddr) : mpAddr(ipMemAddr) {} ;
46  ReservedPosition(Int64 iFilePos) : mFilePos(iFilePos) { } ;
47 
48 };
49 
50 
52 {
53 public:
54 
57 
58  virtual ~WriteByteStream() throw() {};
59  virtual void Delete() throw() { delete this; } ;
60 
61  // Shared interface
62  virtual void Write(const unsigned char * pData, unsigned Int32 cb, ReservedPosition* ipReservedOffset = 0 ) = 0;
63  virtual void Write(const unsigned char * pData, Int64 cb, ReservedPosition* ipReservedOffset = 0) = 0;
64  virtual void Abandon() = 0;
65 
66  // Interface functions for shared memory based write byte streams only
67  // Mark the end of a stream
68  virtual void CommitStream() = 0;
69 
70  // Interface functions for non-shared memory based write byte streams.
71  virtual ReservedPosition ReserveBytes(unsigned Int32 iByteCnt) = 0;
72  virtual Int64 GetSize() throw() = 0;
73  virtual StreamType GetStreamType() = 0;
74  virtual void Pack() = 0;
75 
76  virtual void SetTimeout(Int64 iTimeoutInMilliSeconds) = 0;
77 };
78 
79 
80 DLL_PDSERIALIZATION_EXIM WriteByteStream::ReturnPtr CreateWriteByteStream(MDataType::BinaryCollection* ipBins,
81  unsigned Int32 iBlockSize = 512,
82  MBase::MemoryContract* ipMemoryContract = NULL);
83 
84 DLL_PDSERIALIZATION_EXIM WriteByteStream::ReturnPtr CreateWriteByteStream(MFileSystem::WriteableFile::Ptr& iFilePtr);
85 #ifndef __ANDROID__
87  unsigned Int32 iBlockSize = 1024);
88 #endif
89 
90 
91 };
92 
93 #endif // Serialization_WriteByteStream_H
virtual void Delete()
Definition: WriteByteStream.h:59
MBase::ReturnPtr< WriteByteStream, MBase::DeleteOperatorGeneric< WriteByteStream > > ReturnPtr
Definition: WriteByteStream.h:56
Definition: WriteByteStreamFileImpl.h:19
MBase::StrongPtr< WriteByteStream, MBase::DeleteOperatorGeneric< WriteByteStream > > Ptr
Definition: WriteByteStream.h:55
DLL_PDSERIALIZATION_EXIM WriteByteStream::ReturnPtr CreateWriteByteStream(MDataType::BinaryCollection *ipBins, unsigned Int32 iBlockSize=512, MBase::MemoryContract *ipMemoryContract=NULL)
StreamType
Enumeration of different stream types.
Definition: Facilities.h:40
#define Int64
Definition: BasicTypes.h:36
Definition: BigDecimal.h:18
friend class WriteSharedMemByteStreamImpl
Definition: WriteByteStream.h:37
~ReservedPosition()
Definition: WriteByteStream.h:32
#define Int32
Definition: BasicTypes.h:20
Definition: WriteByteStreamImpl.h:28
Definition: Allocator.h:47
void * mpAddr
Definition: WriteByteStream.h:41
Definition: StrongPtr.h:50
ULONG cb
Definition: Msi_objbase.h:25
#define DLL_PDSERIALIZATION_EXIM
Definition: PDSerialization.h:21
virtual ~WriteByteStream()
Definition: WriteByteStream.h:58
Definition: SharedMemory.h:59
Definition: MultiReadStream.h:23
Definition: WriteByteStream.h:51
Int64 mFilePos
Definition: WriteByteStream.h:42
#define NULL
Definition: Null.h:10
Definition: WriteByteStream.h:28
Definition: StrongObjects.h:21
Definition: ReturnPtr.h:22