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 #ifndef ITstream_H
00036 #define ITstream_H
00037 
00038 #include <OpenFOAM/Istream.H>
00039 #include <OpenFOAM/tokenList.H>
00040 
00041 
00042 
00043 namespace Foam
00044 {
00045 
00046 
00047 
00048 
00049 
00050 class ITstream
00051 :
00052     public Istream,
00053     public tokenList
00054 {
00055     
00056 
00057         
00058         fileName name_;
00059 
00060         
00061         label tokenIndex_;
00062 
00063 
00064 public:
00065 
00066     
00067 
00068         
00069         ITstream
00070         (
00071             const string& name,
00072             const tokenList& tokens,
00073             streamFormat format=ASCII,
00074             versionNumber version=currentVersion
00075         )
00076         :
00077             Istream(format, version),
00078             tokenList(tokens),
00079             name_(name),
00080             tokenIndex_(0)
00081         {
00082             setOpened();
00083             setGood();
00084         }
00085 
00086 
00087         
00088         ITstream(const ITstream& its)
00089         :
00090             Istream(ASCII, currentVersion),
00091             tokenList(its),
00092             name_(its.name_),
00093             tokenIndex_(0)
00094         {
00095             setOpened();
00096             setGood();
00097         }
00098 
00099 
00100     
00101 
00102         virtual ~ITstream()
00103         {}
00104 
00105 
00106     
00107 
00108         
00109 
00110             
00111             const fileName& name() const
00112             {
00113                 return name_;
00114             }
00115 
00116             
00117             fileName& name()
00118             {
00119                 return name_;
00120             }
00121 
00122             
00123             label tokenIndex() const
00124             {
00125                 return tokenIndex_;
00126             }
00127 
00128             
00129             label& tokenIndex()
00130             {
00131                 return tokenIndex_;
00132             }
00133 
00134             
00135             label nRemainingTokens() const
00136             {
00137                 return size() - tokenIndex_;
00138             }
00139 
00140             
00141             ios_base::fmtflags flags() const
00142             {
00143                 return ios_base::fmtflags(0);
00144             }
00145 
00146 
00147         
00148 
00149             
00150             virtual Istream& read(token&);
00151 
00152             
00153             virtual Istream& read(char&);
00154 
00155             
00156             virtual Istream& read(word&);
00157 
00158             
00159             virtual Istream& read(string&);
00160 
00161             
00162             virtual Istream& read(label&);
00163 
00164             
00165             virtual Istream& read(floatScalar&);
00166 
00167             
00168             virtual Istream& read(doubleScalar&);
00169 
00170             
00171             virtual Istream& read(char*, std::streamsize);
00172 
00173             
00174             virtual Istream& rewind();
00175 
00176 
00177         
00178 
00179             
00180             ios_base::fmtflags flags(const ios_base::fmtflags)
00181             {
00182                 return ios_base::fmtflags(0);
00183             }
00184 
00185 
00186         
00187 
00188             
00189             void print(Ostream&) const;
00190 };
00191 
00192 
00193 
00194 
00195 } 
00196 
00197 
00198 
00199 #endif
00200 
00201