00001 // ---------------------------------------------------------------------------- 00002 // CVS $Id: SIO_stream.h,v 1.4 2005/12/09 19:01:47 jeremy Exp $ 00003 // ---------------------------------------------------------------------------- 00004 // => Controller for a single SIO stream. 00005 // ---------------------------------------------------------------------------- 00006 // 00007 // General Description: 00008 // 00009 // SIO_stream manages operations of a single SIO stream. 00010 // 00011 // ---------------------------------------------------------------------------- 00012 00013 #ifndef SIO_STREAM_H 00014 #define SIO_STREAM_H 1 00015 00016 #include <map> 00017 #include <string> 00018 00019 #include <stdio.h> 00020 00021 #include "SIO_definitions.h" 00022 #include "SIO_functions.h" 00023 #include "SIO_record.h" 00024 00025 typedef std::map< void*, void* > pointedAtMap_c; 00026 typedef std::map< void*, void* >::iterator pointedAtMap_i; 00027 00028 typedef std::multimap< void*, void* > pointerToMap_c; 00029 typedef std::multimap< void*, void* >::iterator pointerToMap_i; 00030 00031 struct z_stream_s; 00032 00033 // ---------------------------------------------------------------------------- 00034 // Class SIO_stream. 00035 // ---------------------------------------------------------------------------- 00036 class SIO_stream 00037 { 00038 public: 00039 unsigned int close(); 00040 unsigned int flush(); 00041 void dump( unsigned int, unsigned int ); 00042 std::string* getName(); 00043 std::string* getFilename(); 00044 SIO_stream_mode getMode(); 00045 SIO_stream_state getState(); 00046 SIO_verbosity getVerbosity(); 00047 unsigned int open( const char *, SIO_stream_mode ); 00048 unsigned int read( SIO_record** ); 00049 SIO_verbosity setVerbosity( SIO_verbosity ); 00050 unsigned int write( const char* ); 00051 unsigned int write( SIO_record* ); 00052 00053 private: 00054 SIO_stream( const char *, unsigned int, SIO_verbosity ); 00055 ~SIO_stream(); 00056 00057 unsigned int write( SIO_record*, const char* ); 00058 00059 unsigned char* bufloc; // Buffer pointer (beginning) 00060 unsigned char* buffer; // Buffer pointer (current) 00061 unsigned char* bufmax; // Buffer pointer (end) 00062 unsigned char* recmax; // Record pointer (end) 00063 unsigned char* blkmax; // Block pointer (end) 00064 00065 unsigned char* cmploc; // Compression buffer pointer (beg) 00066 unsigned char* cmpmax; // Compression buffer pointer (end) 00067 struct z_stream_s* z_strm; // Compression buffer control 00068 00069 std::string name; // Stream's name 00070 std::string filename; // Stream's associated file 00071 FILE* handle; // File handle 00072 00073 std::string rec_name; // Record name being read 00074 std::string blk_name; // Block name being read 00075 00076 pointedAtMap_c* pointedAt; // Map of 'pointed at' 00077 pointerToMap_c* pointerTo; // Multimap of 'pointer to' 00078 00079 SIO_stream_mode mode; // Stream mode 00080 unsigned int reserve; // Reserved size of buffer 00081 SIO_stream_state state; // Stream state 00082 SIO_verbosity verbosity; // Reporting level 00083 00084 friend class SIO_streamManager; // Access to constructor/destructor 00085 friend class SIO_record; // Access to buffer 00086 friend class SIO_functions; // Access to buffer and pointer maps 00087 }; 00088 00089 #endif 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109
1.3.9.1