File indexing completed on 2024-09-07 04:35:36
0001 #ifndef CondFormats_FileBlob_h
0002 #define CondFormats_FileBlob_h
0003
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005
0006 #include <vector>
0007 #include <string>
0008 #include <iostream>
0009 #include <memory>
0010
0011 class FileBlob {
0012 public:
0013 FileBlob() {
0014 compressed = false;
0015 isize = 0;
0016 };
0017
0018 FileBlob(const std::string &fname, bool zip);
0019
0020 FileBlob(std::istream &is, bool zip);
0021
0022 ~FileBlob() {}
0023
0024
0025 void read(const std::string &);
0026
0027 void write(const std::string &) const;
0028
0029
0030 void read(std::istream &);
0031
0032 void write(std::ostream &) const;
0033
0034 bool isCompressed() const { return compressed; };
0035
0036 int size() const { return isize; };
0037
0038 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
0039 std::unique_ptr<std::vector<unsigned char> > getUncompressedBlob() const;
0040 #endif
0041 void getUncompressedBlob(std::vector<unsigned char> &myblobcopy) const;
0042
0043 private:
0044 static unsigned int computeFileSize(const std::string &);
0045 static unsigned int computeStreamSize(std::istream &);
0046
0047 std::vector<unsigned char> blob;
0048 bool compressed;
0049 unsigned int isize;
0050
0051 COND_SERIALIZABLE;
0052 };
0053
0054 #endif