svn-gvsig-desktop / tags / v1_1_1_Build_1016 / libraries / libjni-ecw / include / NCSJPCNode.h @ 33925
History | View | Annotate | Download (5.35 KB)
1 |
/********************************************************
|
---|---|
2 |
** Copyright 2003 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/NCSJPCNode.h $
|
15 |
** CREATED: 14/03/2003 3:27:34 PM
|
16 |
** AUTHOR: Simon Cope
|
17 |
** PURPOSE: CNCSJPCNode class header
|
18 |
** EDITS: [xx] ddMmmyy NAME COMMENTS
|
19 |
*******************************************************/
|
20 |
|
21 |
#ifndef NCSJPCNODE_H
|
22 |
#define NCSJPCNODE_H
|
23 |
|
24 |
#ifndef NCSJPCBUFFER_H
|
25 |
#include "NCSJPCBuffer.h" |
26 |
#endif // NCSJPCBUFFER_H |
27 |
|
28 |
/**
|
29 |
* CNCSJPCMarker class - the base JPC codestream marker.
|
30 |
*
|
31 |
* @author Simon Cope
|
32 |
* @version $Revision: 3538 $ $Author: nacho $ $Date: 2006-01-09 12:56:54 +0100 (Mon, 09 Jan 2006) $
|
33 |
*/
|
34 |
class NCSJPC_EXPORT_ALL CNCSJPCNode: public CNCSJPCBuffer, public CNCSError { |
35 |
public:
|
36 |
class NCSJPC_EXPORT_ALL CNCSJPCNodeTracker { |
37 |
public:
|
38 |
CNCSJPCNodeTracker(char *pClassName, size_t nNodeSize);
|
39 |
virtual ~CNCSJPCNodeTracker(); |
40 |
|
41 |
void Add();
|
42 |
void Remove();
|
43 |
void AddMem(UINT64 nSize);
|
44 |
void RemoveMem(UINT64 nSize);
|
45 |
|
46 |
INT32 m_nNodesTotal; // Total # nodes allocated
|
47 |
INT64 m_nMemTotal; // Total Mem allocated
|
48 |
char m_szNodeName[32]; // Name of this node |
49 |
INT32 m_nNodeSize; // Size of a single node
|
50 |
|
51 |
static INT32 sm_nNodesTotal; // Total # nodes allocated globally |
52 |
static INT64 sm_nMemTotal; // Total # nodes allocated globally |
53 |
static std::vector<CNCSJPCNodeTracker*> *sm_pTrackers;
|
54 |
}; |
55 |
/** Default constructor, initialises members */
|
56 |
CNCSJPCNode(); |
57 |
/** Virtual destructor */
|
58 |
virtual ~CNCSJPCNode(); |
59 |
|
60 |
typedef void *ContextID; |
61 |
|
62 |
class NCSJPC_EXPORT_ALL Context { |
63 |
public:
|
64 |
Context(); |
65 |
virtual ~Context(); |
66 |
virtual UINT32 NrInputs(); |
67 |
virtual class CNCSJPCNode *GetInput(UINT32 n); |
68 |
virtual void SetInput(UINT32 n, CNCSJPCNode *pNode);
|
69 |
virtual void SetInputBuffers(UINT32 nInput, UINT8 nBuffers);
|
70 |
virtual CNCSJPCBuffer *GetInputBuffer(UINT32 nInput, UINT8 nBuffer); |
71 |
virtual CNCSJPCBuffer *FindInputBuffer(UINT32 nInput, UINT32 &nBuffer, CNCSJPCRect &r, bool &bFound, CNCSJPCBuffer::Type eType);
|
72 |
virtual void AddInput(CNCSJPCNode *pNode);
|
73 |
Context operator=(const Context &src);
|
74 |
private:
|
75 |
class NCSJPC_EXPORT_ALL CNCSJPCNodeInput { |
76 |
public:
|
77 |
class CNCSJPCNode *m_pNode; |
78 |
CNCSJPCBufferCache m_Buffers; |
79 |
|
80 |
virtual ~CNCSJPCNodeInput(); |
81 |
}; |
82 |
/** Link to input nodes */
|
83 |
std::vector<CNCSJPCNodeInput>m_Inputs; |
84 |
}; |
85 |
|
86 |
/**
|
87 |
* Link a node as the unput to this node.
|
88 |
* @param nCtx Read context
|
89 |
* @param nInputs Number of inputs to this node
|
90 |
* @param pInput First CNCSJPCNode to use as input to this node.
|
91 |
* @param ... Additional inputs where required (eg, MCT)
|
92 |
* @return bool true on success, else false on error.
|
93 |
*/
|
94 |
virtual bool Link(ContextID nCtx, UINT16 nInputs, CNCSJPCNode *pInput, ...);
|
95 |
/**
|
96 |
* Add a node as an input to this node.
|
97 |
* @param nCtx Read context
|
98 |
* @param pNode Input node to add
|
99 |
* @return bool true on success, else false on error.
|
100 |
*/
|
101 |
virtual bool AddInput(ContextID nCtx, CNCSJPCNode *pInput) { GetContext(nCtx)->AddInput(pInput); return(true); }; |
102 |
/**
|
103 |
* UnLink a node as the unput to this node.
|
104 |
* @param nCtx Read context
|
105 |
* @return bool true on success, else false on error.
|
106 |
*/
|
107 |
virtual bool UnLink(ContextID nCtx, UINT16 nInputs = 0); |
108 |
|
109 |
/**
|
110 |
* Read a BufferType line from the input.
|
111 |
* @param nCtx Read context
|
112 |
* @param pDst Destination buffer.
|
113 |
* @param iComponent Output Component
|
114 |
* @return bool true on succes, else false.
|
115 |
*/
|
116 |
virtual bool ReadLine(ContextID nCtx, CNCSJPCBuffer *pDst, UINT16 iComponent);
|
117 |
|
118 |
virtual bool ReadInputLines(ContextID nCtx, UINT32 ninputs, ...);
|
119 |
/**
|
120 |
* Write a BufferType line to the output.
|
121 |
* @param nCtx Context
|
122 |
* @param pSrc Source buffer.
|
123 |
* @param iComponent Output Component
|
124 |
* @return bool true on succes, else false.
|
125 |
*/
|
126 |
virtual bool WriteLine(ContextID nCtx, CNCSJPCBuffer *pSrc, UINT16 iComponent) { return(false); }; |
127 |
|
128 |
/**
|
129 |
* Get the input error
|
130 |
* @param nCtx Context id for input
|
131 |
* @return CNCSError CNCSError value of the input to this node.
|
132 |
*/
|
133 |
CNCSError GetError(ContextID nCtx); |
134 |
|
135 |
protected:
|
136 |
class ContextAutoPtr: public std::auto_ptr<Context> { |
137 |
public:
|
138 |
ContextAutoPtr() {}; |
139 |
ContextAutoPtr(Context *s): std::auto_ptr<Context>(s) {}; |
140 |
ContextAutoPtr(const ContextAutoPtr &s) {
|
141 |
ContextAutoPtr P(s.get()); |
142 |
*this = P; |
143 |
}; |
144 |
~ContextAutoPtr() {}; |
145 |
}; |
146 |
std::map<ContextID, ContextAutoPtr> *m_pContext;/*std::auto_ptr<Context>*/
|
147 |
|
148 |
/**
|
149 |
* Get the context for the given ContextID
|
150 |
* @param nCtx ContextID to retrive context
|
151 |
* @param bAutoConstruct Autoconstruct a new context for this ContextID if one doesn't exist
|
152 |
* @return Context* Context for given ID.
|
153 |
*/
|
154 |
virtual Context *GetContext(ContextID nCtx, bool bAutoConstruct = true); |
155 |
/**
|
156 |
* Get the context for the given ContextID
|
157 |
* @param nCtx ContextID to set
|
158 |
* @param pCtx Context to set
|
159 |
* @return Context* Context for given ID.
|
160 |
*/
|
161 |
virtual void SetContext(ContextID nCtx, Context *pCtx);
|
162 |
private:
|
163 |
}; |
164 |
|
165 |
#endif // !NCSJPCNODE_H |
166 |
|