MrSID Decode SDK for Raster Reference Manual 9.5.4.4709

- Main Page
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

lt_ioDynamicMemStream.h
Go to the documentation of this file.
1 /* $Id$ */
2 /* //////////////////////////////////////////////////////////////////////////
3 // //
4 // This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue, //
5 // Suite 200, Seattle, WA 98104. Unauthorized use or distribution //
6 // prohibited. Access to and use of this code is permitted only under //
7 // license from LizardTech, Inc. Portions of the code are protected by //
8 // US and foreign patents and other filings. All Rights Reserved. //
9 // //
11 /* PUBLIC */
12
13
14 #ifndef LT_IO_DYNAMIC_MEM_STREAM_H
15 #define LT_IO_DYNAMIC_MEM_STREAM_H
16
17 #include "lt_ioStreamInf.h"
18 #include <stdlib.h>
19
20 LT_BEGIN_NAMESPACE( LizardTech )
21
22
23
33 class LTIODynamicMemStream : public LTIOStreamInf
34 {
35 public:
38 #if defined(LT_OS_WINCE)
39 typedef void* (__cdecl * Allocator)(size_t);
40 typedef void(__cdecl *Deallocator)(void*);
41 typedef void*(__cdecl *Reallocator)(void*,size_t);
42 #else
43 typedef void*(*Allocator)(size_t);
44 typedef void(*Deallocator)(void*);
45 typedef void*(*Reallocator)(void*,size_t);
46 #endif
47
48
49 public:
50 LTIODynamicMemStream();
51 virtual ~LTIODynamicMemStream();
52
63 virtual LT_STATUS initialize( lt_uint32 size = 4096, float growthRate=2 );
64
78 virtual LT_STATUS initialize( lt_uint32 size,
79 Allocator allo, Deallocator deallo,
80 Reallocator reallo=NULL, float growthRate=2 );
81
84 virtual bool isEOF();
85 virtual bool isOpen();
86 virtual LT_STATUS open();
87 virtual LT_STATUS close();
88 virtual lt_uint32 read( lt_uint8 *pDest, lt_uint32 numBytes );
89 virtual lt_uint32 write( const lt_uint8 *pSrc, lt_uint32 numBytes );
90 virtual LT_STATUS seek( lt_int64 offset, LTIOSeekDir origin );
91 virtual lt_int64 tell();
92
93
101 Allocator getAllocator() const { return m_alloc; }
102
106 Deallocator getDeallocator() const { return m_dealloc; }
107
111 Reallocator getReallocator() const { return m_realloc; }
112
121 const lt_uint8* getData() const { return m_data; }
122
123
134 LT_STATUS detachAndClose(lt_uint8*& data);
135
143 lt_uint64 size() const { return m_userSize; }
144
147 virtual LTIOStreamInf* duplicate();
148 virtual LT_STATUS getLastError() const;
149 virtual const char* getID() const;
150 virtual char *readString(int delimiter);
151
152 protected:
154 bool grow(lt_uint32 numBytes);
155
157 lt_uint8* m_data;
158
160 lt_uint32 m_initialSize;
161
163 lt_uint32 m_bufferSize;
164
166 lt_uint32 m_userSize;
167
169 lt_uint32 m_cur;
170
172 bool m_isOpen;
173
175 Allocator m_alloc;
176
178 Deallocator m_dealloc;
179
181 Reallocator m_realloc;
182
183 void* defaultRealloc(void*,size_t);
184
185 LT_STATUS m_lastError;
186
187 bool m_isEOF;
188
190 float m_growthRate;
191 };
192
193
194 LT_END_NAMESPACE( LizardTech )
195
196
197 #endif // LT_IO_DYNAMIC_MEM_STREAM_H

LizardTech