Statistics
| Revision:

svn-gvsig-desktop / tags / v1_10_0_Build_1258 / libraries / libjni-readecw-linux / include / NCSJPCPacket.h @ 42039

History | View | Annotate | Download (4.95 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/NCSJPCPacketHeader.h $
15
** CREATED:  18/12/2002 3:27:34 PM
16
** AUTHOR:   Simon Cope
17
** PURPOSE:  CNCSJPCPacket class header
18
** EDITS:    [xx] ddMmmyy NAME COMMENTS
19
 *******************************************************/
20

    
21
#ifndef NCSJPCPACKETHEADER_H
22
#define NCSJPCPACKETHEADER_H
23

    
24
#include "NCSJPCMarker.h"
25

    
26
        /**
27
         * CNCSJPCPacket class - the JPC Packet Header Type.
28
         * 
29
         * @author       Simon Cope
30
         * @version      $Revision: 1458 $ $Author: igbrotru $ $Date: 2005-02-15 08:52:16 +0100 (Tue, 15 Feb 2005) $ 
31
         */        
32
class NCSJPC_EXPORT_ALL CNCSJPCPacket {
33
public:
34
                /** Packet Number */
35
        NCSJPCPacketId        m_nPacket;
36
                /** Packet length */
37
        INT32        m_nLength;
38
                /** Total Packet data length */
39
        INT32        m_nDataLength;
40
                /** Packet offset */
41
        UINT64        m_nOffset;
42
                /** Absolute Packet Data offset in codestream */
43
        UINT64        m_nDataOffset;
44

    
45
                /** Default constructor, initialises members */
46
        CNCSJPCPacket();
47

    
48
                /** 
49
                 * Parse the fields from the JPC codestream.
50
                 * @param                JPC                        CNCSJPC to use to parse file.
51
                 * @param                Stream                IOStream to use to parse file.
52
                 * @return      CNCSError        NCS_SUCCESS, or Error code on failure.
53
                 */
54
        virtual CNCSError ParseHeader(class CNCSJPC &JPC, 
55
                                                                  CNCSJPCIOStream &Stream, 
56
                                                                  class CNCSJPCProgression *pProgression,
57
                                                                  bool bParseData = true,
58
                                                                  bool *pbNonZeroLength = NULL);
59
        virtual CNCSError UnParseHeader(CNCSJPC &JPC, 
60
                                                                        CNCSJPCIOStream &Stream, 
61
                                                                        CNCSJPCProgression *pProgression, 
62
                                                                        bool bParseData);
63
        virtual CNCSError ParseBody(class CNCSJPC &JPC, 
64
                                                                CNCSJPCIOStream &Stream, 
65
                                                                class CNCSJPCProgression *pProgression,
66
                                                                bool bNonZeroLength);        
67
        virtual CNCSError UnParseBody(class CNCSJPC &JPC, 
68
                                                                  CNCSJPCIOStream &Stream, 
69
                                                                  class CNCSJPCProgression *pProgression,
70
                                                                  bool bNonZeroLength);
71
protected:
72
                /** 
73
                 * Parse A segment length from the JPC codestream.
74
                 * @param                Stream                IOStream to use to parse file.
75
                 * @param                pCB                        CodeBlock this segment belongs too
76
                 * @param                nPassesIncluded Number of passes included in this segment
77
                 * @param                Length                Length of segment returned
78
                 * @return      CNCSError        NCS_SUCCESS, or Error code on failure.
79
                 */
80
        CNCSError ParseSegment(CNCSJPCIOStream &Stream, class CNCSJPCCodeBlock *pCB, UINT32 nPassesIncluded, UINT32 &Length);
81
        CNCSError UnParseSegment(CNCSJPCIOStream &Stream, class CNCSJPCCodeBlock *pCB, UINT32 nPassesIncluded, UINT32 &Length);
82
};
83

    
84

    
85
//typedef std::list<CNCSJPCPacket> CNCSJPCPacketListVector;
86

    
87
        /**
88
         * CNCSJPCPacketList class - self parsing list of JPC Packet Headers.
89
         * 
90
         * @author       Simon Cope
91
         * @version      $Revision: 1458 $ $Author: igbrotru $ $Date: 2005-02-15 08:52:16 +0100 (Tue, 15 Feb 2005) $ 
92
         */        
93
class NCSJPC_EXPORT_ALL CNCSJPCPacketList {
94
public:
95
                /** Do we have offsets yet */
96
        bool        m_bHaveOffsets;
97
                /** Default constructor, initialises members */
98
        CNCSJPCPacketList();
99
                /** Virtual destructor */
100
        virtual ~CNCSJPCPacketList();
101

    
102
                /** 
103
                 * Parse the headers from the JPC codestream.
104
                 * @param                JPC                        CNCSJPC to use to parse file.
105
                 * @param                Stream                IOStream to use to parse file.
106
                 * @param                bComplete   Progression order is complete
107
                 * @param                nBytes                Number of bytes of headers to parse
108
                 * @param                nHeaders        Total number of headers to parse, -1 == ignore
109
                 * @return      CNCSError        NCS_SUCCESS, or Error code on failure.
110
                 */
111
        virtual CNCSError Parse(class CNCSJPC &JPC, CNCSJPCIOStream &Stream, bool &bComplete, UINT64 nBytes, INT32 nHeaders = -1);
112

    
113
                /** 
114
                 * Parse a header from the JPC codestream.
115
                 * @param                bComplete   Progression order is complete
116
                 * @param                nCurPacket        Current packet #
117
                 * @return      CNCSError        NCS_SUCCESS, or Error code on failure.
118
                 */
119
        virtual CNCSError ParseHeader(bool &bComplete, UINT32 nCurPacket);
120
        virtual CNCSError GenDynamicPLTs(class CNCSJPCTilePartHeader *pMainTP);
121
                /** 
122
                 * UnParse the headers to the JPC codestream.
123
                 * @param                Stream                IOStream to use to parse file.
124
                 * @param                JPC                        CNCSJPC to use to parse file.
125
                 * @return      CNCSError        NCS_SUCCESS, or Error code on failure.
126
                 */
127
        virtual CNCSError UnParse(class CNCSJPC &JPC, CNCSJPCIOStream &Stream);
128

    
129
        void clear() { m_Packets.clear(); };
130
        void push_back(CNCSJPCPacket &packet) { m_Packets.push_back(packet); };
131
protected:
132
        std::vector<CNCSJPCPacket> m_Packets;
133
                /** Codestream class pointer */
134
        class CNCSJPC *m_pJPC;
135
                /** Pointer to IOStream */
136
        class CNCSJPCIOStream *m_pStream;
137
                /** Number of bytes of headers to read */
138
        UINT64 m_nBytes;
139
                /** Number of headers to read */
140
        INT32 m_nHeaders;
141
};
142

    
143
#endif // !NCSJPCPACKETHEADER_H