CMS 3D CMS Logo

MultiFileBlob.h
Go to the documentation of this file.
1 #ifndef CondFormats_MultiFileBlob_h
2 #define CondFormats_MultiFileBlob_h
3 
5 
6 #include <vector>
7 #include <string>
8 #include <map>
9 #include <iosfwd>
10 
12 
13  public:
14  typedef std::pair<unsigned char const *, unsigned char const *> Range;
15 
17  MultiFileBlob();
18 
21 
23  void finalized(bool compress);
24 
26  // void read(const std::string& name, const std::string& fname);
28  // void write(const std::string& name, const std::string& fname) const;
29 
31  void read(const std::string& name, std::istream & is);
33  void write(const std::string& name, std::ostream & os) const;
34 
35  // return blob
36  Range rawBlob(const std::string& name) const;
37 
38  bool isCompressed() const {return compressed;}
39 
40  unsigned long long fullSize() const {return isize;}
41 
42  unsigned long long size(const std::string& name) const;
43 
44 
45 
46 
47  private:
48  // expand locally;
49  void expand();
50 
51  // static unsigned int computeFileSize(const std::string & ifile);
52  // static unsigned int computeStreamSize(std::istream & is);
53 
54  std::vector<unsigned char> blob;
55  typedef std::map<std::string, unsigned long long> Positions;
56  Positions positions;
57  bool compressed; // persistent status
58  unsigned long long isize;
59  bool expanded COND_TRANSIENT; // transient status
60 
62 };
63 
64 #endif
void write(const std::string &name, std::ostream &os) const
write to ostream
std::vector< unsigned char > blob
Definition: MultiFileBlob.h:54
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:40
unsigned long long size(const std::string &name) const
std::pair< unsigned char const *, unsigned char const * > Range
Definition: MultiFileBlob.h:14
unsigned long long isize
Definition: MultiFileBlob.h:58
bool isCompressed() const
Definition: MultiFileBlob.h:38
std::map< std::string, unsigned long long > Positions
Definition: MultiFileBlob.h:55
#define COND_TRANSIENT
Definition: Serializable.h:61
Positions positions
Definition: MultiFileBlob.h:56
#define COND_SERIALIZABLE
Definition: Serializable.h:38
Range rawBlob(const std::string &name) const