IsisDlm  Version 0.2
FileRepository.h
Go to the documentation of this file.
00001 
00002 //_Title FileRepository.h Singleton file repository for ISIS DLM
00003 //
00004 //_Hist Sept 09 2004 Kris Becker, USGS
00005 //_Version: $Id: FileRepository.h,v 1.3 2004/11/02 15:38:53 kbecker Exp $
00006 //_End
00008 #if !defined(FileRepository_h)
00009 #define FileRepository_h
00010 #include <string>
00011 #include <list>
00012 #include "iFile.h"
00013 
00014 class Isis::Cube;
00015 class Isis::Pvl;
00016 
00017 namespace ISISDLM {
00018 
00019 
00037 class FileRepository {
00038   public:
00039     static const char* const ID;          
00040 
00050     static FileRepository *Instance();
00051 
00052     int size() const { return (_files.size()); }
00053 
00054     iFile::Iid addCube(const std::string &filename, Isis::Cube *cube,
00055                        bool readonly = true);
00056     iFile::Iid addPvl(const std::string &filename, Isis::Pvl *pvl,
00057                       bool readonly = true);
00058 
00059     iFile *getFile(iFile::Iid id);
00060     iFile *getNthFile(int nth = 0);
00061 
00062     bool removeFile(iFile::Iid id);
00063     void Purge();
00064 
00065   protected:
00066     FileRepository() { }
00067 
00068   private: 
00069     ~FileRepository();
00070     FileRepository(const FileRepository &k);
00071     FileRepository operator=(const FileRepository &k);
00072 
00073     static FileRepository *_instance;  
00074     std::list<iFile *> _files;         
00075 
00076 };
00077 
00078 
00079 }
00080 #endif