Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libjni-ecwcompress / include / include-sdk / NCSJPCMemoryIOStream.h @ 12522

History | View | Annotate | Download (4.13 KB)

1
/********************************************************
2
** Copyright 2002 Earth Resource Mapping Ltd.
3
** This document contains proprietary source code of
4
** Earth Resource Mapping Ltd, and can only be used under
5
** one of the three licenses as described in the 
6
** license.txt file supplied with this distribution. 
7
** See separate license.txt file for license details 
8
** and conditions.
9
**
10
** This software is covered by US patent #6,442,298,
11
** #6,102,897 and #6,633,688.  Rights to use these patents 
12
** is included in the license agreements.
13
**
14
** FILE:     $Archive: /NCS/Source/include/NCSJP2IOStream.h $
15
** CREATED:  28/11/2002 3:27:34 PM
16
** AUTHOR:   Simon Cope
17
** PURPOSE:  CNCSJPCIOStream class header
18
** EDITS:    [xx] ddMmmyy NAME COMMENTS
19
 *******************************************************/
20

    
21
#ifndef NCSJPCMEMORYIOSTREAM_H
22
#define NCSJPCMEMORYIOSTREAM_H
23

    
24
#ifndef NCSJPCIOSTREAM_H
25
#include "NCSJPCIOStream.h"
26
#endif // NCSJPCIOSTREAM_H
27

    
28
/**
29
 * CNCSJPCFileIOStream class - 64bit File-based IO "Stream" class.
30
 * This class is the IO mechanism used to access JP2 files.
31
 * << and >> Operators are not implemented as we can't use exception handling for portability reasons.
32
 * 
33
 * @author       Simon Cope
34
 * @version      $Revision: 3538 $ $Author: nacho $ $Date: 2006-01-09 12:56:54 +0100 (Mon, 09 Jan 2006) $ 
35
 */
36
class NCSJPC_EXPORT_ALL CNCSJPCMemoryIOStream: public CNCSJPCIOStream {
37
public:
38
                /** Default constructor, initialises members */
39
        CNCSJPCMemoryIOStream(bool bSeekable = true);
40
                /** Virtual destructor, releases members */
41
        virtual ~CNCSJPCMemoryIOStream();
42

    
43
                /** 
44
                 * Open the stream on the specified memory.
45
                 * @param                pMemory                Pointer to memory image
46
                 * @param                nMemoryLength        Memory image length
47
                 * @return      CNCSError        NCS_SUCCESS, or error code on failure.
48
                 */
49
        virtual CNCSError Open(const void *pMemory, UINT32 nMemoryLength);
50
                /** 
51
                 * Open the memory stream from the specified IOStream.  IOStream is left seeked forward by nMemoryLength
52
                 * @param                Stream                Stream to open from
53
                 * @param                nMemoryLength        Memory image length
54
                 * @return      CNCSError        NCS_SUCCESS, or error code on failure.
55
                 */
56
        virtual CNCSError Open(CNCSJPCIOStream &Stream, UINT32 nMemoryLength);
57
                /** 
58
                 * Close the stream.
59
                 * @return      CNCSError        NCS_SUCCESS, or error code on failure.
60
                 */
61
        virtual CNCSError Close();
62
                /** 
63
                 * Seek on the file to the specified location.
64
                 * @param                offset                Signed 64bit offset to seek by
65
                 * @param                origin                Origin to calculate new position from.
66
                 * @return      bool                true, or false on failure.  Instance inherits CNCSError object containing error value.
67
                 */
68
        virtual bool NCS_FASTCALL Seek(INT64 offset, Origin origin = CURRENT);
69
                /** 
70
                 * Is stream seekable.
71
                 * @return      bool                true if seekable, or false if not.
72
                 */
73
        virtual bool NCS_FASTCALL Seek();
74
                /** 
75
                 * Get the total current size of the file, in bytes.
76
                 * @return      INT64                Size of the file, or -1 on error.
77
                 */
78
        virtual INT64 NCS_FASTCALL Size();
79

    
80
                /** 
81
                 * Read some data from the stream into the supplied buffer.
82
                 * @param                buffer                Buffer to read the data into
83
                 * @param                count                How many bytes of data to read.
84
                 * @param                pRead                How many bytes of data were actually read.
85
                 * @return      bool                true, or false on failure.  Instance inherits CNCSError object containing error value.
86
                 */
87
        virtual bool NCS_FASTCALL Read(void* buffer, UINT32 count);
88
                /** 
89
                 * Write some data to the stream.
90
                 * @param                buffer                Buffer of data to write to the stream
91
                 * @param                count                How many bytes of data to write to the stream.
92
                 * @param                pWrote                How many bytes of data were actually written to the stream.
93
                 * @return      bool                true, or false on failure.  Instance inherits CNCSError object containing error value.
94
                 */
95
        virtual bool NCS_FASTCALL Write(void* buffer, UINT32 count);
96
                
97
                /** Is the stream a packet stream?  This means the SOD segment will be missing from
98
                 * the stream as parsed, and must be requested separately (ie, ECWP, JPIP)
99
                 * @return                bool                true this is a packet stream, otherwise false
100
                 */
101
        virtual bool NCS_FASTCALL IsPacketStream() { return(false); }
102
protected:
103
        void *m_pMemory;
104
        UINT32 m_nMemoryLength;
105
        bool        m_bSeekable;
106
        bool        m_bOwnMemory;
107
};
108

    
109
#endif // !NCSJPCMEMORYIOSTREAM_H