CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MultiFileBlob.h
Go to the documentation of this file.
1 #ifndef CondFormats_MultiFileBlob_h
2 #define CondFormats_MultiFileBlob_h
3 
4 #include <vector>
5 #include <string>
6 #include <map>
7 #include <iosfwd>
8 
10 
11  public:
12  typedef std::pair<unsigned char const *, unsigned char const *> Range;
13 
15  MultiFileBlob();
16 
19 
21  void finalized(bool compress);
22 
24  // void read(const std::string& name, const std::string& fname);
26  // void write(const std::string& name, const std::string& fname) const;
27 
29  void read(const std::string& name, std::istream & is);
31  void write(const std::string& name, std::ostream & os) const;
32 
33  // return blob
34  Range rawBlob(const std::string& name) const;
35 
36  bool isCompressed() const {return compressed;}
37 
38  unsigned long long fullSize() const {return isize;}
39 
40  unsigned long long size(const std::string& name) const;
41 
42 
43 
44 
45  private:
46  // expand locally;
47  void expand();
48 
49  // static unsigned int computeFileSize(const std::string & ifile);
50  // static unsigned int computeStreamSize(std::istream & is);
51 
52  std::vector<unsigned char> blob;
53  typedef std::map<std::string, unsigned long long> Positions;
55  bool compressed; // persistent status
56  unsigned long long isize;
57  bool expanded; // transient status
58 };
59 
60 #endif
void write(const std::string &name, std::ostream &os) const
write to ostream
std::vector< unsigned char > blob
Definition: MultiFileBlob.h:52
void finalized(bool compress)
void read(const std::string &name, std::istream &is)
read from real file give it name name
unsigned long long fullSize() const
Definition: MultiFileBlob.h:38
unsigned long long size(const std::string &name) const
std::pair< unsigned char const *, unsigned char const * > Range
Definition: MultiFileBlob.h:12
unsigned long long isize
Definition: MultiFileBlob.h:56
bool isCompressed() const
Definition: MultiFileBlob.h:36
std::map< std::string, unsigned long long > Positions
Definition: MultiFileBlob.h:53
Positions positions
Definition: MultiFileBlob.h:54
Range rawBlob(const std::string &name) const