CMS 3D CMS Logo

FileBlob.h
Go to the documentation of this file.
1 #ifndef CondFormats_FileBlob_h
2 #define CondFormats_FileBlob_h
3 
5 
6 #include <vector>
7 #include <string>
8 #include <iostream>
9 
10 class FileBlob {
11 public:
12  FileBlob(){};
14  FileBlob(const std::string &fname, bool zip);
16  FileBlob(std::istream &is, bool zip);
17 
18  ~FileBlob(){};
19 
21  void read(const std::string &);
23  void write(const std::string &) const;
24 
26  void read(std::istream &);
28  void write(std::ostream &) const;
29 
30  bool isCompressed() const { return compressed; };
31 
32  int size() const { return isize; };
34 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
35  std::unique_ptr<std::vector<unsigned char> > getUncompressedBlob() const;
36 #endif
37  void getUncompressedBlob(std::vector<unsigned char> &myblobcopy) const;
38 
39 private:
40  static unsigned int computeFileSize(const std::string &);
41  static unsigned int computeStreamSize(std::istream &);
42 
43  std::vector<unsigned char> blob;
44  bool compressed;
45  unsigned int isize;
46 
48 };
49 
50 #endif
bool isCompressed() const
Definition: FileBlob.h:30
std::vector< unsigned char > blob
Definition: FileBlob.h:43
static unsigned int computeFileSize(const std::string &)
Definition: FileBlob.cc:117
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
bool compressed
Definition: FileBlob.h:44
static unsigned int computeStreamSize(std::istream &)
Definition: FileBlob.cc:128
FileBlob()
Definition: FileBlob.h:12
int size() const
Definition: FileBlob.h:32
void write(const std::string &) const
write to real file
Definition: FileBlob.cc:111
~FileBlob()
Definition: FileBlob.h:18
#define COND_SERIALIZABLE
Definition: Serializable.h:38
string fname
main script
unsigned int isize
Definition: FileBlob.h:45
void read(const std::string &)
read from real file
Definition: FileBlob.cc:102
std::unique_ptr< std::vector< unsigned char > > getUncompressedBlob() const
i didn&#39;t want to do two copies ... hope this works.
Definition: FileBlob.cc:73