Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

DDSFileHandler.h

Go to the documentation of this file.
00001 #ifndef DDSFILEHANDLER_H
00002 #define DDSFILEHANDLER_H
00003 
00005 //                                                                          //
00006 // DDSFileHandler                                                           //
00007 //                                                                          //
00008 // Package: DDS (Data Dispatcher System).                                   //
00009 //                                                                          //
00010 // S. Kasahara 5/2001                                                       //
00011 // Purpose: Interact with system to determine next available file for a     //
00012 //          given DDS::EDataSource.  Will construct and return the full     //
00013 //          file path name of the next file when requested.                 //
00015 #include <iosfwd> // ostream forward decl.
00016 #include <vector>
00017 
00018 #include "Dispatcher/DDS.h"
00019 
00020 class DDSFileHandler;
00021 
00022 std::ostream& operator << (std::ostream& ms, DDSFileHandler* dfh);
00023 
00024 class DDSFileHandler {
00025 
00026 public:
00027   // Typedefs and enumerations.
00028   typedef std::vector<std::string> FileIndex;
00029   typedef FileIndex::iterator FileIndexItr;
00030   typedef FileIndex::const_iterator FileIndexConstItr;
00031 
00032   // Constructor and destructor.
00033   DDSFileHandler (DDS::EDataSource datasource,bool offLine = false);   
00034   virtual ~DDSFileHandler (); // destructor       
00035 
00036   // State testing member functions.
00037   std::string GetCurrentFileName() const;
00038   DDS::EDataSource GetDataSource() const { return fDataSource; }
00039   std::string GetSymLinkTargetName();
00040   bool IsOffLine() const { return fOffLine; }
00041   bool IsValid() const { return fValid; }
00042   bool NewFileAvailable();
00043   std::ostream& Print(std::ostream& ms) const;
00044   
00045   // State changing member functions
00046   std::string GoToFile(std::string filename="");
00047   std::string GoToNextFile();
00048   std::string GoToSymLinkFile();
00049 
00050 private:
00051 
00052   // State testing member functions
00053   bool IsModifiedDirectory() const;
00054   bool IsModifiedSymLink() const;
00055 
00056   // State changing member functions
00057   Int_t BuildFileIndex();         
00058   std::string BuildFullFilePathName(std::string filename);         
00059 
00060   // Data members.
00061   DDS::EDataSource fDataSource; // source of data
00062   std::string fDataSourceEnv;   // env variable pointing to source directory
00063   std::string fDataSourceDir;         // directory of source data files
00064   std::string fLocalDataSourceDir;    // local directory of source data files
00065   std::string fSymLink;           // pathname of symbolic link to target file 
00066   std::string fSymLinkTarget;     // pathname of current target of sym link
00067   Long_t fSymLinkModTime;        // symbolic link modification time
00068   Long_t fSourceDirModTime;      // source directory modification time
00069   std::string fLastServedFile;   // last served file
00070   bool   fValid;                 // flag indicating validity of FileHandler
00071   FileIndex fFileIndex;          // index of files in source directory
00072   FileIndexItr fFileIndexItr;    // iterator points to current file in index 
00073   bool   fOffLine;               // file handler will use symlink offlinefile
00074  
00075   ClassDef(DDSFileHandler,0)  // MINOS Data Dispatcher File Handler
00076 };
00077 
00078 #endif              // DDSFILEHANDLER_H
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092 

Generated on Mon Feb 15 11:06:36 2010 for loon by  doxygen 1.3.9.1