00001
00002
00003
00004 #ifndef FROOT_TFndFileManager
00005 #define FROOT_TFndFileManager
00006
00008
00009
00010
00011
00012
00013
00014
00015
00017
00018 #include "TNamed.h"
00019
00020 class TString;
00021 class TFile;
00022 class TObjArray;
00023
00024 class TFndFileManager : public TNamed
00025 {
00026
00027 protected:
00028 Bool_t fdebug;
00029 Bool_t fReady;
00030 Bool_t fAsciiLoaded;
00031 Bool_t fRootLoaded;
00032 const Char_t *fOriginalPath;
00033 TString *fPath;
00034 TString *fFileName;
00035
00036 FILE *fAsciiFile;
00037 TFile *fRootFile;
00038
00039
00040 public:
00041 TFndFileManager();
00042 TFndFileManager(const char *path, Bool_t debug = kFALSE);
00043 virtual ~TFndFileManager();
00044
00045 virtual void AppendToPath(Char_t *path);
00046 virtual void ResetPath() {fPath->Resize(0); *fPath+=fOriginalPath;}
00047
00048 Int_t Ascii(Char_t *filename, Char_t *option="r");
00049 Int_t Root(Char_t *filename, Char_t *option="OPEN");
00050
00051
00052 void RewindStream(){ rewind(fAsciiFile); }
00053 void ReplaceChar(Char_t *ori_char,Char_t *new_char);
00054 Char_t *GetFirstLine(){ rewind(fAsciiFile); return GetNextLine();}
00055
00056 const Int_t GetNumOfColumns(Char_t *delimiter);
00057 Char_t *GetNextLine();
00058 Char_t *GetLine(Int_t n);
00059 void GetFirstLine(Float_t *array,Int_t nvar,Char_t *delimiter=""){ rewind(fAsciiFile); GetNextLine(array,nvar,delimiter);}
00060 Int_t GetNextLine(Float_t *array,Int_t nvar,Char_t *delimiter="");
00061
00062
00063 Char_t *GetPath() {return (Char_t *)fPath->Data();}
00064 Char_t *GetFileName();
00065
00066 TFile *GetRootFile() {return fRootFile;}
00067 FILE *GetAsciiFile() {return fAsciiFile;}
00068
00069
00070 virtual void ReadAscii();
00071
00072 virtual void Close();
00073
00074 void Print(Option_t * = 0) const;
00075 virtual void HowTo();
00076
00077 private:
00078 void BuildFileName(Char_t *filename);
00079 Bool_t CheckExistence();
00080
00081 ClassDef(TFndFileManager,1)
00082 };
00083 #endif //FROOT_TFndFileManager