#include <MultiFileBlob.h>
Public Types | |
typedef std::pair< unsigned char const *, unsigned char const * > | Range |
Public Member Functions | |
void | finalized (bool compress) |
unsigned long long | fullSize () const |
bool | isCompressed () const |
MultiFileBlob () | |
Range | rawBlob (const std::string &name) const |
void | read (const std::string &name, std::istream &is) |
read from real file give it name name | |
unsigned long long | size (const std::string &name) const |
void | write (const std::string &name, std::ostream &os) const |
write to ostream | |
~MultiFileBlob () | |
Private Types | |
typedef std::map< std::string, unsigned long long > | Positions |
Private Member Functions | |
void | expand () |
Private Attributes | |
std::vector< unsigned char > | blob |
bool | compressed |
bool | expanded |
unsigned long long | isize |
Positions | positions |
Definition at line 9 of file MultiFileBlob.h.
typedef std::map<std::string, unsigned long long> MultiFileBlob::Positions [private] |
Definition at line 53 of file MultiFileBlob.h.
typedef std::pair<unsigned char const *, unsigned char const *> MultiFileBlob::Range |
Definition at line 12 of file MultiFileBlob.h.
MultiFileBlob::MultiFileBlob | ( | ) |
Definition at line 7 of file MultiFileBlob.cc.
: compressed(false), isize(0), expanded(false) {}
MultiFileBlob::~MultiFileBlob | ( | ) |
Definition at line 10 of file MultiFileBlob.cc.
{}
void MultiFileBlob::expand | ( | ) | [private] |
Definition at line 68 of file MultiFileBlob.cc.
References blob, compressed, expanded, isize, and dbtoconf::out.
Referenced by rawBlob().
{ if (expanded) return; if (!compressed) { expanded=true; return; } std::vector<unsigned char> out(isize); uLongf destLen = out.size(); int zerr = uncompress(&out.front(), &destLen, &blob.front(), blob.size()); if (zerr!=0 || out.size()!=destLen) edm::LogError("FileBlob")<< "uncompressing error " << zerr << " original size was " << isize << " new size is " << destLen; blob.swap(out); expanded=true; }
void MultiFileBlob::finalized | ( | bool | compress | ) |
Definition at line 12 of file MultiFileBlob.cc.
References blob, compressed, expanded, isize, and dbtoconf::out.
{ if (!compress) return; if (0==isize) return; compressed=true; expanded=false; std::vector<unsigned char> out(isize); uLongf destLen = compressBound(isize); int zerr = compress2(&out.front(), &destLen, &blob.front(), isize, 9); if (zerr!=0) edm::LogError("MultiFileBlob")<< "Compression error " << zerr; out.resize(destLen); blob.swap(out); }
unsigned long long MultiFileBlob::fullSize | ( | ) | const [inline] |
bool MultiFileBlob::isCompressed | ( | ) | const [inline] |
MultiFileBlob::Range MultiFileBlob::rawBlob | ( | const std::string & | name | ) | const |
Definition at line 47 of file MultiFileBlob.cc.
References b, blob, expand(), isize, pos, and positions.
Referenced by size(), and write().
{ const_cast<MultiFileBlob*>(this)->expand(); Positions::const_iterator pos = positions.find(name); if (pos==positions.end()) { edm::LogError("MultiFileBlob:")<< name << "not in this object"; return Range(0,0); } unsigned long long b = (*pos).second; unsigned long long e = isize; pos++; if (pos!=positions.end()) e= (*pos).second; return Range(&blob[b],&blob[e]); }
void MultiFileBlob::read | ( | const std::string & | name, |
std::istream & | is | ||
) |
read from real file give it name name
write name to real file read from istream
Definition at line 28 of file MultiFileBlob.cc.
References blob, trackerHits::c, isize, mergeVDriftHistosByStation::name, pos, and positions.
unsigned long long MultiFileBlob::size | ( | const std::string & | name | ) | const |
Definition at line 63 of file MultiFileBlob.cc.
References csvReporter::r, and rawBlob().
void MultiFileBlob::write | ( | const std::string & | name, |
std::ostream & | os | ||
) | const |
write to ostream
Definition at line 41 of file MultiFileBlob.cc.
References csvReporter::r, and rawBlob().
std::vector<unsigned char> MultiFileBlob::blob [private] |
Definition at line 52 of file MultiFileBlob.h.
Referenced by expand(), finalized(), rawBlob(), and read().
bool MultiFileBlob::compressed [private] |
Definition at line 55 of file MultiFileBlob.h.
Referenced by expand(), finalized(), and isCompressed().
bool MultiFileBlob::expanded [private] |
Definition at line 57 of file MultiFileBlob.h.
Referenced by expand(), and finalized().
unsigned long long MultiFileBlob::isize [private] |
Definition at line 56 of file MultiFileBlob.h.
Referenced by expand(), finalized(), fullSize(), rawBlob(), and read().
Positions MultiFileBlob::positions [private] |
Definition at line 54 of file MultiFileBlob.h.