00001 #ifndef CondFormats_MultiFileBlob_h 00002 #define CondFormats_MultiFileBlob_h 00003 00004 #include <vector> 00005 #include <string> 00006 #include <map> 00007 #include <iosfwd> 00008 00009 class MultiFileBlob{ 00010 00011 public: 00012 typedef std::pair<unsigned char const *, unsigned char const *> Range; 00013 00015 MultiFileBlob(); 00016 00018 ~MultiFileBlob(); 00019 00021 void finalized(bool compress); 00022 00024 // void read(const std::string& name, const std::string& fname); 00026 // void write(const std::string& name, const std::string& fname) const; 00027 00029 void read(const std::string& name, std::istream & is); 00031 void write(const std::string& name, std::ostream & os) const; 00032 00033 // return blob 00034 Range rawBlob(const std::string& name) const; 00035 00036 bool isCompressed() const {return compressed;} 00037 00038 unsigned long long fullSize() const {return isize;} 00039 00040 unsigned long long size(const std::string& name) const; 00041 00042 00043 00044 00045 private: 00046 // expand locally; 00047 void expand(); 00048 00049 // static unsigned int computeFileSize(const std::string & ifile); 00050 // static unsigned int computeStreamSize(std::istream & is); 00051 00052 std::vector<unsigned char> blob; 00053 typedef std::map<std::string, unsigned long long> Positions; 00054 Positions positions; 00055 bool compressed; // persistent status 00056 unsigned long long isize; 00057 bool expanded; // transient status 00058 }; 00059 00060 #endif