16#ifndef ROOT7_RNTupleZip
17#define ROOT7_RNTupleZip
30namespace Experimental {
42 using Buffer_t = std::array<unsigned char, kMAXZIPBUF>;
60 auto cxLevel = compression % 100;
62 fnWriter(from, nbytes, 0);
67 unsigned int nZipBlocks = 1 + (nbytes - 1) / kMAXZIPBUF;
68 char *source =
const_cast<char *
>(
static_cast<const char *
>(from));
69 int szTarget = kMAXZIPBUF;
70 char *target =
reinterpret_cast<char *
>(
fZipBuffer->data());
72 int szRemaining = nbytes;
74 for (
unsigned int i = 0; i < nZipBlocks; ++i) {
75 int szSource = std::min(
static_cast<int>(kMAXZIPBUF), szRemaining);
76 R__zipMultipleAlgorithm(cxLevel, &szSource, source, &szTarget, target, &szOutBlock, cxAlgorithm);
78 if ((szOutBlock == 0) || (szOutBlock >= szSource)) {
80 fnWriter(from, nbytes, 0);
84 fnWriter(target, szOutBlock, szZipData);
85 szZipData += szOutBlock;
87 szRemaining -= szSource;
96 size_t operator() (
const void *from,
size_t nbytes,
int compression) {
100 auto cxLevel = compression % 100;
107 int szSource = nbytes;
108 char *source =
const_cast<char *
>(
static_cast<const char *
>(from));
109 int szTarget = nbytes;
110 char *target =
reinterpret_cast<char *
>(
fZipBuffer->data());
112 R__zipMultipleAlgorithm(cxLevel, &szSource, source, &szTarget, target, &szOut, cxAlgorithm);
114 if ((szOut > 0) && (
static_cast<unsigned int>(szOut) < nbytes))
134 using Buffer_t = std::array<unsigned char, kMAXZIPBUF>;
146 void operator() (
const void *from,
size_t nbytes,
size_t dataLen,
void *to) {
147 if (dataLen == nbytes) {
148 memcpy(to, from, nbytes);
153 unsigned char *source =
const_cast<unsigned char *
>(
static_cast<const unsigned char *
>(from));
154 unsigned char *target =
static_cast<unsigned char *
>(to);
155 int szRemaining = dataLen;
163 R__ASSERT(
static_cast<unsigned int>(szSource) <= nbytes);
164 R__ASSERT(
static_cast<unsigned int>(szTarget) <= dataLen);
167 R__unzip(&szSource, source, &szTarget, target, &unzipBytes);
172 szRemaining -= unzipBytes;
173 }
while (szRemaining > 0);
180 void operator() (
void *fromto,
size_t nbytes,
size_t dataLen) {
typedef void((*Func_t)())
void R__unzip(Int_t *nin, UChar_t *bufin, Int_t *lout, char *bufout, Int_t *nout)
int R__unzip_header(Int_t *nin, UChar_t *bufin, Int_t *lout)
Helper class to compress data blocks in the ROOT compression frame format.
static constexpr size_t kMaxSingleBlock
const void * GetZipBuffer()
size_t operator()(const void *from, size_t nbytes, int compression, Writer_t fnWriter)
Returns the size of the compressed data.
std::array< unsigned char, kMAXZIPBUF > Buffer_t
std::unique_ptr< Buffer_t > fZipBuffer
std::function< void(const void *buffer, size_t nbytes, size_t offset)> Writer_t
Data might be overwritten, if a zipped block in the middle of a large input data stream turns out to ...
RNTupleCompressor(const RNTupleCompressor &other)=delete
RNTupleCompressor & operator=(const RNTupleCompressor &other)=delete
Helper class to uncompress data blocks in the ROOT compression frame format.
void operator()(const void *from, size_t nbytes, size_t dataLen, void *to)
The nbytes parameter provides the size ls of the from buffer.
RNTupleDecompressor & operator=(const RNTupleDecompressor &other)=delete
std::array< unsigned char, kMAXZIPBUF > Buffer_t
std::unique_ptr< Buffer_t > fUnzipBuffer
RNTupleDecompressor(const RNTupleDecompressor &other)=delete
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
EValues
Note: this is only temporarily a struct and will become a enum class hence the name.