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 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
MultiFileBlob::size
unsigned long long size(const std::string &name) const
Definition: MultiFileBlob.cc:61
MultiFileBlob::expanded
bool expanded
Definition: MultiFileBlob.h:55
MultiFileBlob::finalized
void finalized(bool compress)
Definition: MultiFileBlob.cc:11
MultiFileBlob::read
void read(const std::string &name, std::istream &is)
read from real file give it name name
Definition: MultiFileBlob.cc:27
COND_SERIALIZABLE
#define COND_SERIALIZABLE
Definition: Serializable.h:39
COND_TRANSIENT
#define COND_TRANSIENT
Definition: Serializable.h:63
MultiFileBlob::expand
void expand()
Definition: MultiFileBlob.cc:66
MultiFileBlob
Definition: MultiFileBlob.h:11
MultiFileBlob::MultiFileBlob
MultiFileBlob()
Definition: MultiFileBlob.cc:7
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MultiFileBlob::isize
unsigned long long isize
Definition: MultiFileBlob.h:54
MultiFileBlob::~MultiFileBlob
~MultiFileBlob()
Definition: MultiFileBlob.cc:9
Serializable.h
MultiFileBlob::compressed
bool compressed
Definition: MultiFileBlob.h:53
MultiFileBlob::Positions
std::map< std::string, unsigned long long > Positions
Definition: MultiFileBlob.h:51
MultiFileBlob::positions
Positions positions
Definition: MultiFileBlob.h:52
MultiFileBlob::rawBlob
Range rawBlob(const std::string &name) const
Definition: MultiFileBlob.cc:45
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
MultiFileBlob::write
void write(const std::string &name, std::ostream &os) const
write to ostream
Definition: MultiFileBlob.cc:40
MultiFileBlob::Range
std::pair< unsigned char const *, unsigned char const * > Range
Definition: MultiFileBlob.h:13
MultiFileBlob::blob
std::vector< unsigned char > blob
Definition: MultiFileBlob.h:50
MultiFileBlob::fullSize
unsigned long long fullSize() const
Definition: MultiFileBlob.h:39
MultiFileBlob::isCompressed
bool isCompressed() const
Definition: MultiFileBlob.h:37