|
ATLAS Offline Software
|
◆ compressBlob()
bool CoralUtilities::compressBlob |
( |
const char * |
in, |
|
|
coral::Blob & |
out |
|
) |
| |
Definition at line 20 of file blobaccess.cxx.
21 uLongf comprLen = compressBound(strlen(in));
23 blob.resize(comprLen);
24 unsigned char*
ptr =
static_cast<unsigned char*
>(
blob.startingAddress());
25 compress(
ptr, &comprLen,
reinterpret_cast<const unsigned char*
>(in), strlen(in));
26 blob.resize(comprLen);
◆ readBlobAsJson()
Definition at line 94 of file blobaccess.cxx.
101 std::cout <<
"ATTENTION: Cannot unpack Blob object as JSON!" << std::endl;
◆ readBlobAsString()
bool CoralUtilities::readBlobAsString |
( |
const coral::Blob & |
blob, |
|
|
std::string & |
out |
|
) |
| |
Definition at line 85 of file blobaccess.cxx.
86 std::unique_ptr<unsigned char[]> bf {};
89 const char* cstring =
reinterpret_cast<const char*
>(bf.get());
90 out.assign(cstring, len);
◆ readBlobAsTTree()
bool CoralUtilities::readBlobAsTTree |
( |
const coral::Blob & |
blob, |
|
|
std::unique_ptr< TTree > & |
out |
|
) |
| |
Definition at line 107 of file blobaccess.cxx.
108 const char* cstring =
reinterpret_cast<const char*
>(
blob.startingAddress());
110 sb.assign(cstring,
blob.size());
112 TMemFile
f(
"buffer",
reinterpret_cast<char*
>(bdata.data()), bdata.size());
114 f.GetObject(
"tree",
t);
◆ uncompressBlob()
bool CoralUtilities::uncompressBlob |
( |
const coral::Blob & |
blob, |
|
|
std::unique_ptr< unsigned char[]> & |
out, |
|
|
unsigned long & |
len |
|
) |
| |
Definition at line 61 of file blobaccess.cxx.
62 uLongf uncompLen = 50000;
63 std::unique_ptr<unsigned char[]> uncompBuf(
new unsigned char[uncompLen+1]);
66 actualLen = uncompLen;
67 int res(uncompress(uncompBuf.get(), &actualLen,
reinterpret_cast<const unsigned char*
>(
blob.startingAddress()),
static_cast<uLongf
>(
blob.size())));
68 if(
res == Z_OK )
break;
69 if(
res == Z_BUF_ERROR) {
71 std::cout <<
"ATTENTION: Increasing buffer to " << uncompLen << std::endl;
72 uncompBuf.reset(
new unsigned char[uncompLen+1]);
79 uncompBuf.get()[actualLen]=0;
80 out = std::move(uncompBuf);
◆ writeBlobFromJson()
◆ writeBlobFromString()
bool CoralUtilities::writeBlobFromString |
( |
const std::string_view |
in, |
|
|
coral::Blob & |
out |
|
) |
| |
◆ writeBlobFromTTree()
bool CoralUtilities::writeBlobFromTTree |
( |
TTree * |
tree, |
|
|
coral::Blob & |
out |
|
) |
| |
Definition at line 39 of file blobaccess.cxx.
40 TMemFile
fout(
"buffer",
"recreate");
42 tree->CloneTree(-1,
"fast")->Write();
44 uLongf comprLen =
fout.GetSize();
45 unsigned char *
buffer =
new unsigned char[comprLen];
48 blob.resize(comprLen);
49 char*
ptr =
reinterpret_cast<char*
>(
blob.startingAddress());
void compress(const AmgSymMatrix(N) &covMatrix, std::vector< float > &vec)
bool compressBlob(const char *, coral::Blob &)
std::vector< unsigned char > base64_decode(const std::string &)
bool readBlobAsString(const coral::Blob &, std::string &)
std::pair< std::vector< unsigned int >, bool > res
bool uncompressBlob(const coral::Blob &, std::unique_ptr< unsigned char[]> &, unsigned long &)
std::string base64_encode(const unsigned char *, unsigned int)
bool writeBlobFromString(const std::string_view, coral::Blob &)