CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
10 class FileBlob{
11 
12  public:
13  FileBlob() {};
15  FileBlob(const std::string & fname, bool zip);
17  FileBlob(std::istream & is, bool zip);
18 
19  ~FileBlob(){};
20 
22  void read(const std::string&);
24  void write(const std::string&) const;
25 
27  void read(std::istream &);
29  void write(std::ostream &) const;
30 
31  bool isCompressed() const {return compressed;};
32 
33  int size() const {return isize;};
35 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
36  std::unique_ptr<std::vector<unsigned char> > getUncompressedBlob() const;
37 #endif
38  void getUncompressedBlob( std::vector<unsigned char>& myblobcopy ) const;
39 
40  private:
41  static unsigned int computeFileSize(const std::string &);
42  static unsigned int computeStreamSize(std::istream &);
43 
44  std::vector<unsigned char> blob;
45  bool compressed;
46  unsigned int isize;
47 
49 };
50 
51 #endif
bool isCompressed() const
Definition: FileBlob.h:31
tuple zip
Definition: archive.py:476
std::vector< unsigned char > blob
Definition: FileBlob.h:44
static unsigned int computeFileSize(const std::string &)
Definition: FileBlob.cc:123
bool compressed
Definition: FileBlob.h:45
static unsigned int computeStreamSize(std::istream &)
Definition: FileBlob.cc:132
FileBlob()
Definition: FileBlob.h:13
int size() const
Definition: FileBlob.h:33
void write(const std::string &) const
write to real file
Definition: FileBlob.cc:117
~FileBlob()
Definition: FileBlob.h:19
#define COND_SERIALIZABLE
Definition: Serializable.h:37
string fname
main script
unsigned int isize
Definition: FileBlob.h:46
void read(const std::string &)
read from real file
Definition: FileBlob.cc:110
std::unique_ptr< std::vector< unsigned char > > getUncompressedBlob() const
i didn&#39;t want to do two copies ... hope this works.
Definition: FileBlob.cc:74