CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 public:
13  typedef std::pair<unsigned char const*, unsigned char const*> Range;
14 
16  MultiFileBlob();
17 
20 
22  void finalized(bool compress);
23 
25  // void read(const std::string& name, const std::string& fname);
27  // void write(const std::string& name, const std::string& fname) const;
28 
30  void read(const std::string& name, std::istream& is);
32  void write(const std::string& name, std::ostream& os) const;
33 
34  // return blob
35  Range rawBlob(const std::string& name) const;
36 
37  bool isCompressed() const { return compressed; }
38 
39  unsigned long long fullSize() const { return isize; }
40 
41  unsigned long long size(const std::string& name) const;
42 
43 private:
44  // expand locally;
45  void expand();
46 
47  // static unsigned int computeFileSize(const std::string & ifile);
48  // static unsigned int computeStreamSize(std::istream & is);
49 
50  std::vector<unsigned char> blob;
51  typedef std::map<std::string, unsigned long long> Positions;
53  bool compressed; // persistent status
54  unsigned long long isize;
55  bool expanded COND_TRANSIENT; // transient status
56 
58 };
59 
60 #endif
void write(const std::string &name, std::ostream &os) const
write to ostream
std::pair< unsigned char const *, unsigned char const * > Range
Definition: MultiFileBlob.h:13
std::vector< unsigned char > blob
Definition: MultiFileBlob.h:50
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:39
unsigned long long size(const std::string &name) const
unsigned long long isize
Definition: MultiFileBlob.h:54
bool isCompressed() const
Definition: MultiFileBlob.h:37
std::map< std::string, unsigned long long > Positions
Definition: MultiFileBlob.h:51
#define COND_TRANSIENT
Definition: Serializable.h:63
Positions positions
Definition: MultiFileBlob.h:52
#define COND_SERIALIZABLE
Definition: Serializable.h:39
Range rawBlob(const std::string &name) const