00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __ZStream_Memory__
00026 #define __ZStream_Memory__ 1
00027
00028 #include "zconfig.h"
00029
00030 #include "ZStreamer.h"
00031
00032
00033 #pragma mark -
00034 #pragma mark * ZStreamR_Memory
00035
00037
00038 class ZStreamR_Memory : public ZStreamR
00039 {
00040 public:
00041 ZStreamR_Memory(const void* iAddress);
00042
00043
00044 virtual void Imp_Read(void* iDest, size_t iCount, size_t* oCountRead);
00045
00046 virtual void Imp_CopyToDispatch(const ZStreamW& iStreamW, uint64 iCount,
00047 uint64* oCountRead, uint64* oCountWritten);
00048
00049 virtual void Imp_CopyTo(const ZStreamW& iStreamW, uint64 iCount,
00050 uint64* oCountRead, uint64* oCountWritten);
00051
00052 virtual void Imp_Skip(uint64 iCount, uint64* oCountSkipped);
00053
00054
00056 const void* GetCurrentAddress();
00057
00058 protected:
00059 void pCopyTo(const ZStreamW& iStreamW, uint64 iCount,
00060 uint64* oCountRead, uint64* oCountWritten);
00061
00062 const char* fAddress;
00063 };
00064
00065 typedef ZStreamerR_T<ZStreamR_Memory> ZStreamerR_Memory;
00066
00067
00068 #pragma mark -
00069 #pragma mark * ZStreamRPos_Memory
00070
00072
00073 class ZStreamRPos_Memory : public ZStreamRPos
00074 {
00075 public:
00076 ZStreamRPos_Memory(const void* iAddress, size_t iSize);
00077 ZStreamRPos_Memory(const std::pair<const void*, size_t>& iParam);
00078
00079
00080 virtual void Imp_Read(void* iDest, size_t iCount, size_t* oCountRead);
00081 virtual size_t Imp_CountReadable();
00082
00083 virtual void Imp_CopyToDispatch(const ZStreamW& iStreamW, uint64 iCount,
00084 uint64* oCountRead, uint64* oCountWritten);
00085
00086 virtual void Imp_CopyTo(const ZStreamW& iStreamW, uint64 iCount,
00087 uint64* oCountRead, uint64* oCountWritten);
00088
00089 virtual void Imp_Skip(uint64 iCount, uint64* oCountSkipped);
00090
00091
00092 virtual uint64 Imp_GetPosition();
00093 virtual void Imp_SetPosition(uint64 iPosition);
00094
00095 virtual uint64 Imp_GetSize();
00096
00097
00099 const void* GetCurrentAddress();
00100
00101 protected:
00102 void pCopyTo(const ZStreamW& iStreamW, uint64 iCount,
00103 uint64* oCountRead, uint64* oCountWritten);
00104
00105 const char* fAddress;
00106 uint64 fPosition;
00107 size_t fSize;
00108 };
00109
00110
00111 #pragma mark -
00112 #pragma mark * ZStreamerRPos_Memory
00113
00115
00116 class ZStreamerRPos_Memory : public ZStreamerRPos
00117 {
00118 public:
00119 ZStreamerRPos_Memory(const void* iAddress, size_t iSize);
00120 virtual ~ZStreamerRPos_Memory();
00121
00122
00123 virtual const ZStreamRPos& GetStreamRPos();
00124
00125
00126 const void* GetCurrentAddress();
00127
00128 protected:
00129 ZStreamRPos_Memory fStream;
00130 };
00131
00132
00133
00134
00135
00136 #pragma mark -
00137 #pragma mark * ZStreamW_Memory
00138
00140
00141 class ZStreamW_Memory : public ZStreamW
00142 {
00143 public:
00144 ZStreamW_Memory(void* iAddress);
00145
00146
00147 virtual void Imp_Write(const void* iSource, size_t iCount, size_t* oCountWritten);
00148
00149 virtual void Imp_CopyFromDispatch(const ZStreamR& iStreamR, uint64 iCount,
00150 uint64* oCountRead, uint64* oCountWritten);
00151
00152 virtual void Imp_CopyFrom(const ZStreamR& iStreamR, uint64 iCount,
00153 uint64* oCountRead, uint64* oCountWritten);
00154
00155
00157 void* GetCurrentAddress();
00158
00159 protected:
00160 void pCopyFrom(const ZStreamR& iStreamR, uint64 iCount,
00161 uint64* oCountRead, uint64* oCountWritten);
00162
00163 char* fAddress;
00164 };
00165
00166 typedef ZStreamerW_T<ZStreamW_Memory> ZStreamerW_Memory;
00167
00168
00169 #pragma mark -
00170 #pragma mark * ZStreamWPos_Memory
00171
00173
00174 class ZStreamWPos_Memory : public ZStreamWPos
00175 {
00176 public:
00177 ZStreamWPos_Memory(void* iAddress, size_t iSize);
00178 ZStreamWPos_Memory(void* iAddress, size_t iSize, size_t iCapacity);
00179
00180
00181 virtual void Imp_Write(const void* iSource, size_t iCount, size_t* oCountWritten);
00182
00183 virtual void Imp_CopyFromDispatch(const ZStreamR& iStreamR, uint64 iCount,
00184 uint64* oCountRead, uint64* oCountWritten);
00185
00186 virtual void Imp_CopyFrom(const ZStreamR& iStreamR, uint64 iCount,
00187 uint64* oCountRead, uint64* oCountWritten);
00188
00189
00190 virtual uint64 Imp_GetPosition();
00191 virtual void Imp_SetPosition(uint64 iPosition);
00192
00193 virtual uint64 Imp_GetSize();
00194 virtual void Imp_SetSize(uint64 iSize);
00195
00196
00198 void* GetCurrentAddress();
00199
00200 protected:
00201 void pCopyFrom(const ZStreamR& iStreamR, uint64 iCount,
00202 uint64* oCountRead, uint64* oCountWritten);
00203
00204 char* fAddress;
00205 uint64 fPosition;
00206 size_t fSize;
00207 size_t fCapacity;
00208 };
00209
00210
00211 #pragma mark -
00212 #pragma mark * ZStreamerWPos_Memory
00213
00215
00216 class ZStreamerWPos_Memory : public ZStreamerWPos
00217 {
00218 public:
00219 ZStreamerWPos_Memory(void* iAddress, size_t iSize);
00220 ZStreamerWPos_Memory(void* iAddress, size_t iSize, size_t iCapacity);
00221 virtual ~ZStreamerWPos_Memory();
00222
00223
00224 virtual const ZStreamWPos& GetStreamWPos();
00225
00226
00227 void* GetCurrentAddress();
00228
00229 protected:
00230 ZStreamWPos_Memory fStream;
00231 };
00232
00233
00234
00235
00236 #endif // __ZStream_Memory__