00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 #ifndef _RECORD_H_
00010 #define _RECORD_H_
00011 
00012 #include <string>
00013 #include <fstream>
00014 #include "agfioError.h"
00015 
00017 class Record
00018 {
00019 
00020 private:
00021   int       size;          
00022   ifstream  input;         
00023   string    filename;      
00024   string    *record_buf;   
00025 
00026 protected:
00027   virtual void
00028   preprocess() {}
00029 
00030   virtual void
00031   postprocess() {}
00032 
00033   virtual void
00034   read_entry() = 0;
00035 
00036 public:
00041   class RangeError : public agfioError
00042   {
00043   public:
00044     RangeError(const string &s);
00045   };
00046 
00051   Record(int n);
00052 
00053   ~Record();
00054 
00061   bool
00062   open(const string &filename);
00063 
00072   bool
00073   readline(string& line);
00074 
00081   void
00082   put_ith(int i, const string& v);
00083 
00089   string
00090   get_ith(int i);
00091 
00093   string
00094   get_filename();
00095 
00097   int
00098   get_size();
00099 
00101   void
00102   clear_record_buf();
00103 
00110   bool
00111   good();
00112 
00119   bool
00120   eof();
00121 };
00122 
00123 
00124 #endif