15 #ifdef HAVE_BOOST_THREAD 16 #include <boost/thread.hpp> 21 #if defined(__CINT__) || !defined(__EXCEPTIONS) 30 #ifdef __MARS__ // Needed by CINT to access the structures 37 typename std::list<S>::iterator
begin()
73 std::shared_ptr<char>
data;
84 std::shared_ptr<char>
src;
92 static uint32_t
DefaultNumThreads(
const uint32_t &_n=-2) {
static uint32_t n=0;
if (int32_t(_n)>-2) n=_n;
return n; }
93 static uint32_t
DefaultMaxMemory(
const uint32_t &_n=0) {
static uint32_t n=1000000;
if (_n>0) n=_n;
return n; }
94 static uint32_t
DefaultMaxNumTiles(
const uint32_t &_n=0) {
static uint32_t n=1000;
if (_n>0) n=_n;
return n; }
95 static uint32_t
DefaultNumRowsPerTile(
const uint32_t &_n=0) {
static uint32_t n=100;
if (_n>0) n=_n;
return n; }
101 zofits(uint32_t numTiles = DefaultMaxNumTiles(),
102 uint32_t rowPerTile = DefaultNumRowsPerTile(),
103 uint32_t maxUsableMem= DefaultMaxMemory()) :
ofits(),
104 fMemPool(0, size_t(maxUsableMem)*1000),
105 fWriteToDiskQueue(
std::bind(&
zofits::WriteBufferToDisk, this,
std::placeholders::_1), false)
107 InitMemberVariables(numTiles, rowPerTile,
size_t(maxUsableMem)*1000);
108 SetNumThreads(DefaultNumThreads());
116 uint32_t numTiles = DefaultMaxNumTiles(),
117 uint32_t rowPerTile = DefaultNumRowsPerTile(),
118 uint32_t maxUsableMem= DefaultMaxMemory()) :
ofits(),
119 fMemPool(0, size_t(maxUsableMem)*1000),
120 fWriteToDiskQueue(
std::bind(&
zofits::WriteBufferToDisk, this,
std::placeholders::_1), false)
122 InitMemberVariables(numTiles, rowPerTile,
size_t(maxUsableMem)*1000);
123 SetNumThreads(DefaultNumThreads());
128 uint32_t numTiles = DefaultMaxNumTiles(),
129 uint32_t rowPerTile = DefaultNumRowsPerTile(),
130 uint32_t maxUsableMem= DefaultMaxMemory()) :
ofits(),
131 fMemPool(0, size_t(maxUsableMem)*1000),
132 fWriteToDiskQueue(
std::bind(&
zofits::WriteBufferToDisk, this,
std::placeholders::_1), false)
134 InitMemberVariables(numTiles, rowPerTile,
size_t(maxUsableMem)*1000);
135 SetNumThreads(DefaultNumThreads());
148 fNumTiles = nt==0 ? 1 : nt;
149 fNumRowsPerTile = rpt;
155 fMaxUsableMem = maxUsableMem;
169 SetInt(
"ZNAXIS1", fRealRowWidth);
173 fCompressionQueues.front().setPromptExecution(fNumQueues==0);
174 fWriteToDiskQueue.setPromptExecution(fNumQueues==0);
179 for (
auto it=fCompressionQueues.begin(); it!= fCompressionQueues.end(); it++)
183 fWriteToDiskQueue.start();
187 fLatestWrittenTile = -1;
198 void open(
const char* filename,
bool addEXTNAMEKey=
true)
203 SetBool(
"ZTABLE",
true,
"Table is compressed");
204 SetInt(
"ZNAXIS1", 0,
"Width of uncompressed rows");
205 SetInt(
"ZNAXIS2", 0,
"Number of uncompressed rows");
206 SetInt(
"ZPCOUNT", 0,
"");
207 SetInt(
"ZHEAPPTR", 0,
"");
208 SetInt(
"ZTILELEN", fNumRowsPerTile,
"Number of rows per tile");
209 SetInt(
"THEAP", 0,
"");
210 SetStr(
"RAWSUM",
" 0",
"Checksum of raw little endian data");
211 SetFloat(
"ZRATIO", 0,
"Compression ratio");
212 SetInt(
"ZSHRINK", 1,
"Catalog shrink factor");
220 fRealColumns.clear();
226 void open(
const std::string &filename,
bool addEXTNAMEKey=
true)
228 open(filename.c_str(), addEXTNAMEKey);
242 return fRealRowWidth;
249 const uint32_t one_catalog_row_size = fTable.num_cols*2*
sizeof(uint64_t);
250 const uint32_t total_catalog_size = fNumTiles*one_catalog_row_size;
253 std::vector<char> swapped_catalog(total_catalog_size);
256 for (
auto it=fCatalog.cbegin(); it!=fCatalog.cend(); it++)
258 revcpy<sizeof(uint64_t)>(swapped_catalog.data() + shift, (
char*)(it->data()), fTable.num_cols*2);
259 shift += one_catalog_row_size;
262 if (fCatalogSize < fNumTiles)
263 memset(swapped_catalog.data()+shift, 0, total_catalog_size-shift);
266 if (fCatalogOffset == 0)
267 fCatalogOffset = tellp();
270 const off_t where_are_we = tellp();
273 seekp(fCatalogOffset);
274 write(swapped_catalog.data(), total_catalog_size);
276 if (where_are_we != fCatalogOffset)
281 fCatalogSum.add(swapped_catalog.data(), total_catalog_size);
295 fCatalog.emplace_back(CatalogRow());
296 fCatalog.back().resize(fTable.num_cols);
297 for (
auto it=fCatalog.back().begin(); it != fCatalog.back().end(); it++)
302 return fCatalog.back();
312 bool WriteRow(
const void* ptr,
size_t cnt,
bool =
true)
314 if (cnt != fRealRowWidth)
317 throw std::runtime_error(
"Wrong size of row given to WriteRow");
319 gLog <<
___err___ <<
"ERROR - Wrong size of row given to WriteRow" << std::endl;
328 std::rethrow_exception(fThreadsException);
332 char* target_location = fSmartBuffer.get() + fRealRowWidth*(fTable.num_rows%fNumRowsPerTile);
333 memcpy(target_location, ptr, fRealRowWidth);
339 const uint32_t rawOffset = (fTable.num_rows*fRealRowWidth)%4;
340 char*
buffer = fRawSumBuffer.data() + rawOffset;
341 auto ib = fRawSumBuffer.begin();
342 auto ie = fRawSumBuffer.rbegin();
353 memcpy(buffer, ptr, fRealRowWidth);
355 fRawSum.add(fRawSumBuffer,
false);
359 if (fTable.num_rows % fNumRowsPerTile != 0)
366 const auto imin = std::min_element(fCompressionQueues.begin(), fCompressionQueues.end());
368 if (!imin->emplace(InitNextCompression()))
371 throw std::runtime_error(
"The compression queues are not started. Did you close the file before writing this row?");
373 gLog <<
___err___ <<
"The compression queues are not started. Did you close the file before writing this row?" << std::endl;
386 SetInt(
"NAXIS2", (fTable.num_rows + fNumRowsPerTile-1)/fNumRowsPerTile);
387 SetInt(
"ZNAXIS2", fTable.num_rows);
398 target.
src = fSmartBuffer;
404 write_target.
tile_num = (fTable.num_rows-1)/fNumRowsPerTile;
405 write_target.
size = 0;
406 write_target.
data = fMemPool.malloc();
409 fSmartBuffer = fMemPool.malloc();
418 for (uint32_t
i=0;
i<fCatalogSize%fNumTiles;
i++)
422 if (fCatalogSize <= fNumTiles)
426 const uint32_t shrink_factor = fCatalogSize / fNumTiles;
429 uint32_t entry_id = 1;
430 auto it = fCatalog.begin();
432 for (; it != fCatalog.end(); it++)
434 if (entry_id >= fNumTiles)
437 const uint32_t target_id = entry_id*shrink_factor;
440 for (uint32_t
i=0;
i<target_id-entry_id;
i++)
448 const uint32_t num_tiles_to_remove = fCatalogSize-fNumTiles;
451 for (uint32_t
i=0;
i<num_tiles_to_remove;
i++)
458 fNumRowsPerTile *= shrink_factor;
460 SetInt(
"ZTILELEN", fNumRowsPerTile);
461 SetInt(
"ZSHRINK", shrink_factor);
463 return shrink_factor;
471 for (
auto it=fCompressionQueues.begin(); it != fCompressionQueues.end(); it++)
474 fWriteToDiskQueue.wait();
483 std::rethrow_exception(fThreadsException);
487 if (fErrno==0 && fTable.num_rows%fNumRowsPerTile!=0)
489 fWriteToDiskQueue.enablePromptExecution();
490 fCompressionQueues.front().enablePromptExecution();
491 fCompressionQueues.front().emplace(InitNextCompression());
496 int64_t heap_size = 0;
497 int64_t compressed_offset = 0;
498 for (
auto it=fCatalog.begin(); it!= fCatalog.end(); it++)
502 for (uint32_t j=0; j<it->size(); j++)
504 heap_size += (*it)[j].first;
505 (*it)[j].second = compressed_offset;
506 compressed_offset += (*it)[j].first;
507 if ((*it)[j].first == 0)
512 const uint32_t shrink_factor = ShrinkCatalog();
515 SetInt(
"ZNAXIS1", fRealRowWidth);
516 SetInt(
"ZNAXIS2", fTable.num_rows);
518 SetInt(
"ZHEAPPTR", fCatalogSize*fTable.num_cols*
sizeof(uint64_t)*2);
520 const uint32_t total_num_tiles_written = (fTable.num_rows + fNumRowsPerTile-1)/fNumRowsPerTile;
521 const uint32_t total_catalog_width = 2*
sizeof(int64_t)*fTable.num_cols;
523 SetInt(
"THEAP", total_num_tiles_written*total_catalog_width);
524 SetInt(
"NAXIS1", total_catalog_width);
525 SetInt(
"NAXIS2", total_num_tiles_written);
526 SetStr(
"RAWSUM", std::to_string((
long long int)(fRawSum.val())));
528 const float compression_ratio = (float)(fRealRowWidth*fTable.num_rows)/(float)heap_size;
529 SetFloat(
"ZRATIO", compression_ratio);
532 heap_size += (fCatalogSize - total_num_tiles_written)*fTable.num_cols*
sizeof(uint64_t)*2;
534 SetInt(
"PCOUNT", heap_size,
"size of special data area");
539 fDataSum += fCatalogSum;
541 const Checksum checksm = UpdateHeaderChecksum();
543 if (!fFilebuf.close())
544 setstate(ios_base::failbit);
546 fSmartBuffer = std::shared_ptr<char>();
549 if (shrink_factor != 1)
550 fNumRowsPerTile /= shrink_factor;
552 if ((checksm+fDataSum).valid())
555 std::ostringstream sout;
556 sout <<
"Checksum (" << std::hex << checksm.
val() <<
") invalid.";
558 throw std::runtime_error(sout.str());
566 bool AddColumn(uint32_t cnt,
char typechar,
const std::string& name,
const std::string& unit,
567 const std::string& comment=
"",
bool addHeaderKeys=
true)
569 return AddColumn(
FITS::kFactRaw, cnt, typechar, name, unit, comment, addHeaderKeys);
574 const std::string& unit,
const std::string& comment=
"",
bool addHeaderKeys=
true)
586 col.offset = fRealRowWidth;
588 fRealRowWidth += size*cnt;
590 fRealColumns.emplace_back(col, comp);
592 SetStr(
"ZFORM"+std::to_string((
long long int)(fRealColumns.size())), std::to_string((
long long int)(cnt))+typechar,
"format of "+name+
" "+
FITS::CommentFromType(typechar));
593 SetStr(
"ZCTYP"+std::to_string((
long long int)(fRealColumns.size())),
"FACT",
"Compression type: FACT");
605 throw std::runtime_error(
"Number of threads cannot be changed in the middle of writing a file");
607 gLog <<
___err___ <<
"ERROR - Number of threads cannot be changed in the middle of writing a file" << std::endl;
613 #ifdef HAVE_BOOST_THREAD 614 unsigned int num_available_cores = boost::thread::hardware_concurrency();
616 unsigned int num_available_cores = std::thread::hardware_concurrency();
617 if (num_available_cores == 0)
618 num_available_cores = sysconf(_SC_NPROCESSORS_ONLN);
621 if (num_available_cores == 0)
622 num_available_cores = 1;
625 if (num > num_available_cores)
626 num = num_available_cores>2 ? num_available_cores-2 : 1;
642 size_t total_block_head_size = 0;
643 for (
auto it=fRealColumns.begin(); it!=fRealColumns.end(); it++)
644 total_block_head_size += it->block_head.getSizeOnDisk();
646 const size_t chunk_size = fRealRowWidth*fNumRowsPerTile + total_block_head_size +
sizeof(
FITS::TileHeader) + 8;
647 fMemPool.setChunkSize(chunk_size);
648 fSmartBuffer = fMemPool.malloc();
649 fRawSumBuffer.resize(fRealRowWidth + 4-fRealRowWidth%4);
658 char* checkSumPointer = src+4;
659 int32_t extraBytes = 0;
660 uint32_t sizeToChecksum = sizeToWrite;
663 if (fCheckOffset != 0)
665 sizeToChecksum += fCheckOffset;
666 checkSumPointer -= fCheckOffset;
667 memset(checkSumPointer, 0, fCheckOffset);
671 if (sizeToChecksum%4 != 0)
673 extraBytes = 4 - (sizeToChecksum%4);
674 memset(checkSumPointer+sizeToChecksum, 0, extraBytes);
675 sizeToChecksum += extraBytes;
679 fDataSum.add(checkSumPointer, sizeToChecksum);
681 fCheckOffset = (4 - extraBytes)%4;
684 write(src+4, sizeToWrite);
697 const uint32_t thisRoundNumRows = (target.
num_rows%fNumRowsPerTile) ? target.
num_rows%fNumRowsPerTile : fNumRowsPerTile;
698 for (uint32_t
i=0;
i<thisRoundNumRows;
i++)
700 char* target_location = target.
src.get() + fRealRowWidth*
i;
701 DrsOffsetCalibrate(target_location);
715 fWriteToDiskQueue.emplace(target.
target, compressed_size);
721 fThreadsException = std::current_exception();
723 std::rethrow_exception(fThreadsException);
735 if (target.
tile_num != (uint32_t)(fLatestWrittenTile+1))
738 fLatestWrittenTile++;
745 if (!writeCompressedDataToDisk(target.
data.get(), target.
size))
751 fThreadsException = std::current_exception();
753 std::rethrow_exception(fThreadsException);
765 uint64_t
compressBuffer(
char* dest,
char* src, uint32_t num_rows, CatalogRow& catalog_row)
767 const uint32_t thisRoundNumRows = (num_rows%fNumRowsPerTile) ? num_rows%fNumRowsPerTile : fNumRowsPerTile;
777 for (uint32_t
i=0;
i<fRealColumns.size();
i++)
779 catalog_row[
i].second = compressedOffset;
781 if (fRealColumns[
i].col.num == 0)
787 const uint64_t previousOffset = compressedOffset;
797 compressedOffset += compressUNCOMPRESSED(dest + compressedOffset, src + offset, thisRoundNumRows*fRealColumns[
i].col.size*fRealColumns[
i].col.num);
801 applySMOOTHING(src + offset, thisRoundNumRows*fRealColumns[i].col.num);
806 compressedOffset += compressHUFFMAN16(dest + compressedOffset, src + offset, thisRoundNumRows, fRealColumns[i].col.size, fRealColumns[i].col.num);
808 compressedOffset += compressHUFFMAN16(dest + compressedOffset, src + offset, fRealColumns[i].col.num, fRealColumns[i].col.size, thisRoundNumRows);
819 UnApplySMOOTHING(src+offset, fRealColumns[
i].col.num*thisRoundNumRows);
824 compressedOffset += compressUNCOMPRESSED(dest + compressedOffset, src + offset, thisRoundNumRows*fRealColumns[
i].col.size*fRealColumns[
i].col.num);
827 he.
Memcpy(dest+previousOffset);
829 offset += thisRoundNumRows*fRealColumns[
i].col.size*fRealColumns[
i].col.num;
831 catalog_row[
i].first = compressedOffset - catalog_row[
i].second;
836 head.
Memcpy(dest + previousOffset);
838 offset += thisRoundNumRows*fRealColumns[
i].col.size*fRealColumns[
i].col.num;
839 catalog_row[
i].first = compressedOffset - catalog_row[
i].second;
845 return compressedOffset;
853 const uint32_t thisRoundNumRows = (num_rows%fNumRowsPerTile) ? num_rows%fNumRowsPerTile : fNumRowsPerTile;
856 for (uint32_t
i=0;
i<fRealColumns.size();
i++)
858 switch (fRealColumns[
i].block_head.getOrdering())
862 for (uint32_t k=0;k<thisRoundNumRows;k++)
864 memcpy(dest, src+k*fRealRowWidth+fRealColumns[
i].col.offset, fRealColumns[i].col.size*fRealColumns[i].col.num);
865 dest += fRealColumns[
i].col.size*fRealColumns[
i].col.num;
871 for (uint32_t j=0;j<fRealColumns[
i].col.num;j++)
872 for (uint32_t k=0;k<thisRoundNumRows;k++)
874 memcpy(dest, src+k*fRealRowWidth+fRealColumns[
i].col.offset+fRealColumns[
i].col.size*j, fRealColumns[
i].col.size);
875 dest += fRealColumns[
i].col.size;
889 memcpy(dest, src, size);
902 std::string huffmanOutput;
903 uint32_t previousHuffmanSize = 0;
907 return numRows*sizeOfElems*numRowElems + 1000;
909 if (sizeOfElems < 2 )
912 throw std::runtime_error(
"HUFMANN16 can only encode columns with 16-bit or longer types");
914 gLog <<
___err___ <<
"ERROR - HUFMANN16 can only encode columns with 16-bit or longer types" << std::endl;
919 uint32_t huffmanOffset = 0;
920 for (uint32_t j=0;j<numRowElems;j++)
923 reinterpret_cast<const uint16_t*>(&src[j*sizeOfElems*numRows]),
924 numRows*(sizeOfElems/2));
925 reinterpret_cast<uint32_t*
>(&dest[huffmanOffset])[0] = huffmanOutput.size() - previousHuffmanSize;
926 huffmanOffset +=
sizeof(uint32_t);
927 previousHuffmanSize = huffmanOutput.size();
930 const size_t totalSize = huffmanOutput.size() + huffmanOffset;
933 if (totalSize < numRows*sizeOfElems*numRowElems)
934 memcpy(&dest[huffmanOffset], huffmanOutput.data(), huffmanOutput.size());
945 int16_t* short_data =
reinterpret_cast<int16_t*
>(
data);
946 for (
int j=numElems-1;j>1;j--)
947 short_data[j] = short_data[j] - (short_data[j-1]+short_data[j-2])/2;
949 return numElems*
sizeof(int16_t);
958 int16_t* short_data =
reinterpret_cast<int16_t*
>(
data);
959 for (uint32_t j=2;j<numElems;j++)
960 short_data[j] = short_data[j] + (short_data[j-1]+short_data[j-2])/2;
962 return numElems*
sizeof(uint16_t);
997 #ifdef __MARS__ // Needed for the compilation ofthe dictionary int32_t fNumQueues
Current number of threads that will be used by this object.
Overriding of the begin() operator to get the smallest item in the list instead of the true begin...
CatalogEntry(int64_t f=0, int64_t s=0)
MemoryManager fMemPool
Actual memory manager, providing memory for the compression buffers.
std::vector< char > fRawSumBuffer
buffer used for checksuming the incoming data, before compression
std::shared_ptr< char > transposed_src
Transposed data.
uint32_t fNumRowsPerTile
Number of rows per tile.
RowOrdering_t getOrdering() const
CatalogRow & AddOneCatalogRow()
int64_t second
offset of this column in the tile, from the start of the heap area
bool WriteRow(const void *ptr, size_t cnt, bool=true)
void InitMemberVariables(const uint32_t nt=0, const uint32_t rpt=0, const uint64_t maxUsableMem=0)
bool WriteBufferToDisk(const WriteTarget &target)
CatalogRow & catalog_entry
Reference to the catalog entry to deal with.
uint32_t compressHUFFMAN16(char *dest, const char *src, uint32_t numRows, uint32_t sizeOfElems, uint32_t numRowElems)
zofits(uint32_t numTiles=DefaultMaxNumTiles(), uint32_t rowPerTile=DefaultNumRowsPerTile(), uint32_t maxUsableMem=DefaultMaxMemory())
void FlushNumRows()
update the real number of rows
Parameters required to write a tile to disk.
static uint32_t DefaultMaxMemory(const uint32_t &_n=0)
virtual bool AddColumn(uint32_t cnt, char typechar, const std::string &name, const std::string &unit, const std::string &comment="", bool addHeaderKeys=true)
zofits(const std::string &fname, uint32_t numTiles=DefaultMaxNumTiles(), uint32_t rowPerTile=DefaultNumRowsPerTile(), uint32_t maxUsableMem=DefaultMaxMemory())
WriteTarget target
Compressed data.
int64_t first
Size of this column in the tile.
std::shared_ptr< char > data
Memory block to write.
static uint32_t DefaultMaxNumTiles(const uint32_t &_n=0)
void Memcpy(char *dest) const
uint32_t GetNumTiles() const
uint32_t fCatalogSize
Actual catalog size (.size() is slow on large lists)
Checksum fRawSum
Raw sum (specific to FACT)
Checksum fCatalogSum
Checksum of the catalog.
int32_t fCheckOffset
offset to the data pointer to calculate the checksum
bool Encode(std::string &bufout, const uint16_t *bufin, size_t bufinlen)
bool SetNumThreads(uint32_t num)
uint32_t getSizeOnDisk() const
uint32_t UnApplySMOOTHING(char *data, uint32_t numElems)
static uint32_t DefaultNumThreads(const uint32_t &_n=-2)
static setter for the default number of threads to use. -1 means all available physical cores ...
uint64_t fMaxUsableMem
Maximum number of bytes that can be allocated by the memory manager.
virtual void DrsOffsetCalibrate(char *)
Applies the DrsOffsets calibration to the data. Does nothing as zofits knows nothing about drsoffsets...
std::shared_ptr< char > src
Original data.
uint16_t getNumProcs() const
static uint32_t SizeFromType(char type)
std::list< S >::iterator begin()
std::vector< Queue< CompressionTarget > > fCompressionQueues
Processing queues (=threads)
virtual void open(const char *filename, bool addEXTNAMEKey=true)
virtual bool WriteTableHeader(const char *name="DATA")
virtual bool WriteDrsOffsetsTable()
std::list< CatalogRow > CatalogType
uint32_t compressUNCOMPRESSED(char *dest, const char *src, uint32_t size)
uint32_t ShrinkCatalog()
Shrinks a catalog that is too long to fit into the reserved space at the beginning of the file...
void open(const char *filename, bool addEXTNAMEKey=true)
CompressionProcess_t getProc(uint32_t i) const
uint32_t applySMOOTHING(char *data, uint32_t numElems)
WriteTarget(const WriteTarget &t, uint32_t sz)
Queue< WriteTarget, QueueMin< WriteTarget > > fWriteToDiskQueue
Writing queue (=thread)
void copyTransposeTile(const char *src, char *dest, uint32_t num_rows)
int64_t first
Size of this column in the tile.
uint32_t num_rows
Number of rows to compress.
off_t fCatalogOffset
Offset of the catalog from the beginning of the file.
bool operator<(const Service &left, const Service &right)
uint64_t compressBuffer(char *dest, char *src, uint32_t num_rows, CatalogRow &catalog_row)
Compress a given buffer based on its source and destination.
int fErrno
propagate errno to main thread
Parameters required to compress a tile of data.
uint32_t fNumTiles
Number of pre-reserved tiles.
void SetNumTiles(uint32_t num)
std::vector< CompressedColumn > fRealColumns
Vector hosting the columns of the file.
static uint32_t DefaultNumRowsPerTile(const uint32_t &_n=0)
bool AddColumn(const FITS::Compression &comp, uint32_t cnt, char typechar, const std::string &name, const std::string &unit, const std::string &comment="", bool addHeaderKeys=true)
Overload of the simplified compressed version.
uint32_t tile_num
Tile index of the data (to make sure that they are written in the correct order)
uint32_t fRealRowWidth
Width in bytes of one uncompressed row.
std::exception_ptr fThreadsException
exception pointer to store exceptions coming from the threads
uint32_t size
Size to write.
CatalogType fCatalog
Catalog for this file.
void open(const std::string &filename, bool addEXTNAMEKey=true)
CompressionTarget(CatalogRow &r)
Regular columns augmented with compression informations.
Table::Column col
the regular column entry
int32_t GetNumThreads() const
Get and set the actual number of threads for this object.
void reallocateBuffers()
Allocates the required objects.
zofits(const char *fname, uint32_t numTiles=DefaultMaxNumTiles(), uint32_t rowPerTile=DefaultNumRowsPerTile(), uint32_t maxUsableMem=DefaultMaxMemory())
int64_t second
offset of this column in the tile, from the start of the heap area
uint32_t GetBytesPerRow() const
virtual bool WriteTableHeader(const char *name="DATA")
CompressionTarget InitNextCompression()
static std::string CommentFromType(char type)
bool writeCompressedDataToDisk(char *src, const uint32_t sizeToWrite)
CompressedColumn(const Table::Column &c, const FITS::Compression &h)
FITS::Compression block_head
the compression data associated with that column
int32_t fLatestWrittenTile
Index of the last tile written to disk (for correct ordering while using several threads) ...
bool CompressBuffer(const CompressionTarget &target)
CatalogEntry(int64_t f=0, int64_t s=0)
std::shared_ptr< char > fSmartBuffer
Smart pointer to the buffer where the incoming rows are written.
void SetBlockSize(uint64_t size)
std::vector< CatalogEntry > CatalogRow
bool AddColumn(uint32_t cnt, char typechar, const std::string &name, const std::string &unit, const std::string &comment="", bool addHeaderKeys=true)
Overload of the ofits method. Just calls the zofits specific one with default, uncompressed options f...