MrSID Decode SDK for Raster Reference Manual
9.5.1.4427
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
151
protected
:
153
bool
grow(
lt_uint32
numBytes);
154
156
lt_uint8
*
m_data
;
157
159
lt_uint32
m_initialSize
;
160
162
lt_uint32
m_bufferSize
;
163
165
lt_uint32
m_userSize
;
166
168
lt_uint32
m_cur
;
169
171
bool
m_isOpen
;
172
174
Allocator
m_alloc
;
175
177
Deallocator
m_dealloc
;
178
180
Reallocator
m_realloc
;
181
182
void
* defaultRealloc(
void
*,
size_t
);
183
184
LT_STATUS
m_lastError
;
185
186
bool
m_isEOF
;
187
189
float
m_growthRate
;
190
};
191
192
193
LT_END_NAMESPACE
( LizardTech )
194
195
196
#endif // LT_IO_DYNAMIC_MEM_STREAM_H
LizardTech