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 #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
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE constexpr float zip(ConstView const &tracks, int32_t i)
Definition: TracksSoA.h:90
std::vector< unsigned char > blob
Definition: FileBlob.h:47
static unsigned int computeFileSize(const std::string &)
Definition: FileBlob.cc:119
bool compressed
Definition: FileBlob.h:48
static unsigned int computeStreamSize(std::istream &)
Definition: FileBlob.cc:130
FileBlob()
Definition: FileBlob.h:13
~FileBlob()
Definition: FileBlob.h:22
#define COND_SERIALIZABLE
Definition: Serializable.h:39
string fname
main script
int size() const
Definition: FileBlob.h:36
unsigned int isize
Definition: FileBlob.h:49
void read(const std::string &)
read from real file
Definition: FileBlob.cc:104
void write(const std::string &) const
write to real file
Definition: FileBlob.cc:113
bool isCompressed() const
Definition: FileBlob.h:34
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