00001 // vil_j2k: Written by Rob Radtke (rob@) and Harry Voorhees (hlv@) of 00002 // Stellar Science Ltd. Co. (stellarscience.com) for 00003 // Air Force Research Laboratory, 2005. 00004 00005 #ifndef NCSJPCVILIOSTREAM_H 00006 #define NCSJPCVILIOSTREAM_H 00007 00008 #include <NCSJPCIOStream.h> 00009 00010 #include <vil/vil_stream.h> 00011 00012 /** 00013 * Wrapper class that allows you to effectively "convert" a vil_stream 00014 * to a CNCSJPCIOStream. This class is used by vil_j2k_image to read JPEG 2000 00015 * imagery. A couple of notes: 00016 * 1) This stream's home position (ie. the place it goes when you call Seek(0,START), 00017 * is the current position of the stream that is passed to Open() at the time of that call. 00018 * \sa Open() for more info. 00019 * 00020 * Known Issues: 00021 * 1) As of 2/24/05, the writing capability of this class has not been tested. In 00022 * theory it should work just fine though. 00023 */ 00024 class CNCSJPCVilIOStream : public CNCSJPCIOStream 00025 { 00026 public: 00027 CNCSJPCVilIOStream(); 00028 00029 /** 00030 * Pass me the stream you want me to wrap. stream->tell() at the time 00031 * of this function call will become my home position. see \sa mHomePos for 00032 * more details on what that means. 00033 */ 00034 virtual CNCSError Open( vil_stream* stream ); 00035 00036 virtual CNCSError Close(); 00037 00038 virtual bool NCS_FASTCALL Seek (); 00039 00040 virtual bool NCS_FASTCALL Seek (INT64 offset, Origin origin = CURRENT); 00041 00042 virtual INT64 NCS_FASTCALL Tell(); 00043 00044 virtual INT64 NCS_FASTCALL Size(); 00045 00046 virtual bool NCS_FASTCALL Read (void* buffer, UINT32 count); 00047 00048 virtual bool NCS_FASTCALL Write (void* buffer, UINT32 count); 00049 00050 protected: 00051 /** 00052 * The stream I get all my data from (and write too) 00053 */ 00054 vil_stream* mVilStream; 00055 /** 00056 * This position is my home position (ie. mVilStream->tell() when it was 00057 * passed into me). All Seek()'s with an origin of START will be relative 00058 * to me. Tell() is the position relative to this position etc. 00059 */ 00060 vil_streampos mHomePos; 00061 }; 00062 00063 #endif //NCSJPCVILIOSTREAM_H
1.5.1