Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00046 #ifndef CIFSTREM_H
00047 #define CIFSTREM_H
00048
00049 #include <fvar.hpp>
00050
00051 #if defined(__GNUC__) && (__GNUC__ < 3)
00052 #pragma interface
00053 #endif
00054
00055 #include <stdio.h>
00056
00057 #ifdef __WAT32__
00058 #include <iostream.h>
00059 #include <strstrea.h>
00060 #endif
00061 #ifdef __BCPLUSPLUS__
00062 #include <strstrea.h>
00063 #endif
00064 #ifdef __ZTC__
00065 #include <iomanip.hpp>
00066 #include <strstrea.hpp>
00067 #endif
00068 #ifdef __NDPX__
00069 #include <sstream.h>
00070 extern "C" {
00071 #include <dos.h>
00072 }
00073 #endif
00074 #if defined(__GNUC__)
00075 #if (__GNUC__ < 3)
00076 #include <strstream.h>
00077 #else
00078 #include <sstream>
00079 #endif
00080 #endif
00081
00082 #include <ctype.h>
00083 #include <stdlib.h>
00084 #include <string.h>
00085 #include <adstring.hpp>
00086
00087 #ifndef FVAR_HPP
00088 class dvar_vector;
00089 class dvector;
00090 class svector;
00091 class ivector;
00092 class lvector;
00093 class dvar_matrix;
00094 class d3_array;
00095 class d4_array;
00096 class dvar3_array;
00097 class dvar4_array;
00098 class s3_array;
00099 class dmatrix;
00100 class smatrix;
00101 class imatrix;
00102 class lmatrix;
00103 class prevariable;
00104 class dvariable;
00105 #endif
00106
00107 #ifndef DOUBLE
00108 class svector;
00109 class smatrix;
00110 class s3_array;
00111 #endif
00112
00113
00114 #define FILTER_BUF_SIZE 8000
00115 #define SIGNATURE_LENGTH 80
00116
00117 class cifstream : public ifstream
00118 {
00119 streambuf* bp;
00120 char COMMENT_CHAR;
00121 char comment_line[SIGNATURE_LENGTH+1];
00122 char signature_line[SIGNATURE_LENGTH+1];
00123 adstring file_name;
00124 int line;
00125 int field;
00126 int ignore_eof;
00127
00128 void filter(void);
00129 void get_field(char * s,int space_flag=0);
00130 void report_error(const char* s = NULL);
00131 void set_eof_bit(void);
00132
00133 public:
00134 #ifdef __BCPLUSPLUS__
00135 cifstream() : ifstream() { ; }
00136 #endif
00137 #ifdef __NDPX__
00138 cifstream() : ifstream() { ; }
00139 #endif
00140 #ifdef __ZTC__
00141 cifstream() : ios(&buffer), ifstream() { ; }
00142 #endif
00143
00144 #if defined(__BORLANDC__)
00145 #if (__BORLANDC__ > 0x0520)
00146 cifstream(const char*, int=0 , char cc = '#');
00147 #else
00148 cifstream(const char*, int = ios::nocreate, char cc = '#');
00149 #endif
00150 #else
00151 #if defined(__GNUC__)
00152 #if (__GNUC__ >= 3)
00153 cifstream(const char*, int = std::ios_base::in , char cc = '#');
00154 #else
00155 cifstream(const char*, int = ios::nocreate, char cc = '#');
00156 #endif
00157 #elif defined(_MSC_VER)
00158 cifstream(const char*, int = std::ios_base::in , char cc = '#');
00159 #else
00160 cifstream(const char*, int = ios::nocreate, char cc = '#');
00161 #endif
00162 #endif
00163
00164 ~cifstream(){}
00165
00166 #if defined(__BORLANDC__)
00167 # if (__BORLANDC__ > 0x0520)
00168 void open(const char*, int );
00169 # else
00170 void open(const char*, int = ios::nocreate);
00171 # endif
00172 #else // not BORLAND
00173 # if defined(__GNUC__)
00174 # if (__GNUC__ >= 3)
00175 void open(const char*, int);
00176 # else
00177 void open(const char*, int = ios::nocreate);
00178 # endif
00179 # elif defined(_MSC_VER)
00180 void open(const char*, int);
00181 # else
00182 void open(const char*, int = ios::nocreate);
00183 # endif
00184 #endif
00185
00186 adstring get_file_name(void);
00187 char* comment() { return comment_line; }
00188 char* signature();
00189
00190 cifstream& operator>>(const dvariable& z);
00191
00192 cifstream& operator >> (long long& i);
00193 cifstream& operator>>(const long& i);
00194 cifstream& operator>>(const int& i);
00195 cifstream& operator>>(const double& x);
00196 cifstream& operator>>(const float& x);
00197 cifstream& operator >> (char* x);
00198 cifstream& operator >> (const char* x);
00199 cifstream& operator >> (const adstring& x);
00200 cifstream& operator >> (adstring& x);
00201 cifstream& operator >> (const line_adstring& x);
00202 cifstream& getline(char*, int, char = '\n');
00203
00204 cifstream& operator>>(const dvar_vector& z);
00205 cifstream& operator>>(const dvector& z);
00206
00207 cifstream& operator>>(const lvector& z);
00208 cifstream& operator>>(const ivector& z);
00209
00210 void set_ignore_eof() {ignore_eof = 0;}
00211 void set_use_eof() {ignore_eof = 1;}
00212 };
00213
00214 cifstream& operator>>(cifstream& istr, const prevariable& z);
00215 cifstream& operator>>(cifstream& istr, const dvar_matrix& z);
00216 cifstream& operator>>(cifstream& istr, const d3_array& z);
00217 cifstream& operator>>(cifstream& istr, const d4_array& z);
00218 cifstream& operator>>(cifstream& istr, const d5_array& z);
00219 cifstream& operator>>(cifstream& istr, const dvar3_array& z);
00220 cifstream& operator>>(cifstream& istr, const dvar4_array& z);
00221 cifstream& operator>>(cifstream& istr, const dvar5_array& z);
00222
00223 cifstream& operator>>(cifstream& istr, const dmatrix& z);
00224
00225 cifstream& operator>>(cifstream& istr, const imatrix& z);
00226 cifstream& operator>>(cifstream& istr, const i3_array& z);
00227 cifstream& operator>>(cifstream& istr, const i4_array& z);
00228
00229
00230 #endif //#define CIFSTREM_H