CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 #include <memory>
10 
11 class FileBlob {
12 public:
14  compressed = false;
15  isize = 0;
16  };
18  FileBlob(const std::string &fname, bool zip);
20  FileBlob(std::istream &is, bool zip);
21 
22  ~FileBlob(){};
23 
25  void read(const std::string &);
27  void write(const std::string &) const;
28 
30  void read(std::istream &);
32  void write(std::ostream &) const;
33 
34  bool isCompressed() const { return compressed; };
35 
36  int size() const { return isize; };
38 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
39  std::unique_ptr<std::vector<unsigned char> > getUncompressedBlob() const;
40 #endif
41  void getUncompressedBlob(std::vector<unsigned char> &myblobcopy) const;
42 
43 private:
44  static unsigned int computeFileSize(const std::string &);
45  static unsigned int computeStreamSize(std::istream &);
46 
47  std::vector<unsigned char> blob;
48  bool compressed;
49  unsigned int isize;
50 
52 };
53 
54 #endif
bool isCompressed() const
Definition: FileBlob.h:34
std::vector< unsigned char > blob
Definition: FileBlob.h:47
static unsigned int computeFileSize(const std::string &)
Definition: FileBlob.cc:119
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
bool compressed
Definition: FileBlob.h:48
static unsigned int computeStreamSize(std::istream &)
Definition: FileBlob.cc:130
FileBlob()
Definition: FileBlob.h:13
int size() const
Definition: FileBlob.h:36
void write(const std::string &) const
write to real file
Definition: FileBlob.cc:113
~FileBlob()
Definition: FileBlob.h:22
#define COND_SERIALIZABLE
Definition: Serializable.h:39
string fname
main script
unsigned int isize
Definition: FileBlob.h:49
void read(const std::string &)
read from real file
Definition: FileBlob.cc:104
std::unique_ptr< std::vector< unsigned char > > getUncompressedBlob() const
i didn&#39;t want to do two copies ... hope this works.
Definition: FileBlob.cc:75