NCSJPCVilIOStream.h
Go to the documentation of this file.
1 // vil_j2k: Written by Rob Radtke (rob@) and Harry Voorhees (hlv@) of
2 // Stellar Science Ltd. Co. (stellarscience.com) for
3 // Air Force Research Laboratory, 2005.
4 // Do not remove the following notice
5 // Modifications approved for public release, distribution unlimited
6 // DISTAR Case 14074
7 //
8 #ifndef NCSJPCVILIOSTREAM_H
9 #define NCSJPCVILIOSTREAM_H
10 
11 #include <NCSJPCIOStream.h>
12 
13 #include <vil/vil_stream.h>
14 
15 /**
16  * Wrapper class that allows you to effectively "convert" a vil_stream
17  * to a CNCSJPCIOStream. This class is used by vil_j2k_image to read JPEG 2000
18  * imagery. A couple of notes:
19  * 1) This stream's home position (ie. the place it goes when you call Seek(0,START),
20  * is the current position of the stream that is passed to Open() at the time of that call.
21  * \sa Open() for more info.
22  *
23  * Known Issues:
24  * 1) As of 2/24/05, the writing capability of this class has not been tested. In
25  * theory it should work just fine though.
26  *
27  * 2) It is necessary to provide a unique string name to an open CNCSJPCIO
28  * stream. The original code always used the same name "VIL". The result is
29  * that all resources access the same J2K data, since the ecw library
30  * accesses streams by name. Only one stream with the same name can exist,
31  * which is the first one opened with that name. The fix is to provide a
32  * unique name, based on a static unsigned short integer that is maintained
33  * and appended to the stream name prefix. JLM April 13, 2009
34  */
35 class CNCSJPCVilIOStream : public CNCSJPCIOStream
36 {
37 public:
40 
41  /**
42  * Pass me the stream you want me to wrap. stream->tell() at the time
43  * of this function call will become my home position. see \sa mHomePos for
44  * more details on what that means.
45  */
46  virtual CNCSError Open( vil_stream* stream, bool bWrite = false );
47 
48  virtual CNCSError Close();
49 
50  virtual bool NCS_FASTCALL Seek ();
51 
52  virtual bool NCS_FASTCALL Seek (INT64 offset, Origin origin = CURRENT);
53 
54  virtual INT64 NCS_FASTCALL Tell();
55 
56  virtual INT64 NCS_FASTCALL Size();
57 
58  virtual bool NCS_FASTCALL Read (void* buffer, UINT32 count);
59 
60  virtual bool NCS_FASTCALL Write (void* buffer, UINT32 count);
61 
62 protected:
63  /**
64  * The stream I get all my data from (and write too)
65  */
67  /**
68  * This position is my home position (ie. mVilStream->tell() when it was
69  * passed into me). All Seek()'s with an origin of START will be relative
70  * to me. Tell() is the position relative to this position etc.
71  */
73 
74  static unsigned short mId; /*unique id */
75 };
76 
77 #endif //NCSJPCVILIOSTREAM_H
Stream interface for VIL image loaders.
virtual CNCSError Close()
virtual bool NCS_FASTCALL Seek()
vil_stream * mVilStream
The stream I get all my data from (and write too)
virtual bool NCS_FASTCALL Write(void *buffer, UINT32 count)
Stream interface for VIL image loaders.
Definition: vil_stream.h:21
static unsigned short mId
virtual bool NCS_FASTCALL Read(void *buffer, UINT32 count)
virtual CNCSError Open(vil_stream *stream, bool bWrite=false)
Pass me the stream you want me to wrap.
vil_streampos mHomePos
This position is my home position (ie.
virtual INT64 NCS_FASTCALL Size()
vxl_int_32 vil_streampos
Definition: vil_stream.h:16
Wrapper class that allows you to effectively "convert" a vil_stream to a CNCSJPCIOStream.
virtual INT64 NCS_FASTCALL Tell()