FACT++  1.0
zofits Class Reference

#include <zofits.h>

+ Inheritance diagram for zofits:
+ Collaboration diagram for zofits:

Classes

struct  CatalogEntry
 
struct  CompressedColumn
 Regular columns augmented with compression informations. More...
 
struct  CompressionTarget
 Parameters required to compress a tile of data. More...
 
struct  QueueMin
 Overriding of the begin() operator to get the smallest item in the list instead of the true begin. More...
 
struct  WriteTarget
 Parameters required to write a tile to disk. More...
 

Public Member Functions

 zofits (uint32_t numTiles=DefaultMaxNumTiles(), uint32_t rowPerTile=DefaultNumRowsPerTile(), uint32_t maxUsableMem=DefaultMaxMemory())
 
 zofits (const char *fname, uint32_t numTiles=DefaultMaxNumTiles(), uint32_t rowPerTile=DefaultNumRowsPerTile(), uint32_t maxUsableMem=DefaultMaxMemory())
 
 zofits (const std::string &fname, uint32_t numTiles=DefaultMaxNumTiles(), uint32_t rowPerTile=DefaultNumRowsPerTile(), uint32_t maxUsableMem=DefaultMaxMemory())
 
void InitMemberVariables (const uint32_t nt=0, const uint32_t rpt=0, const uint64_t maxUsableMem=0)
 
virtual bool WriteTableHeader (const char *name="DATA")
 
void open (const char *filename, bool addEXTNAMEKey=true)
 
void open (const std::string &filename, bool addEXTNAMEKey=true)
 
virtual bool WriteDrsOffsetsTable ()
 
uint32_t GetBytesPerRow () const
 
bool WriteCatalog ()
 
virtual void DrsOffsetCalibrate (char *)
 Applies the DrsOffsets calibration to the data. Does nothing as zofits knows nothing about drsoffsets. More...
 
CatalogRowAddOneCatalogRow ()
 
bool WriteRow (const void *ptr, size_t cnt, bool=true)
 
void FlushNumRows ()
 update the real number of rows More...
 
CompressionTarget InitNextCompression ()
 
uint32_t ShrinkCatalog ()
 Shrinks a catalog that is too long to fit into the reserved space at the beginning of the file. More...
 
bool close ()
 
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 for this column. More...
 
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. More...
 
int32_t GetNumThreads () const
 Get and set the actual number of threads for this object. More...
 
bool SetNumThreads (uint32_t num)
 
uint32_t GetNumTiles () const
 
void SetNumTiles (uint32_t num)
 
- Public Member Functions inherited from ofits
 ofits ()
 
 ofits (const char *fname)
 
virtual ~ofits ()
 
bool is_open ()
 
bool is_open () const
 
void AllowCommentsTrimming (bool allow)
 
bool SetKeyComment (const std::string &key, const std::string &comment)
 
bool CopyKeys (const fits &fin, bool update=false)
 
bool SetRaw (const std::string &key, const std::string &val, const std::string &comment)
 
bool SetBool (const std::string &key, bool b, const std::string &comment="")
 
bool AddEmpty (const std::string &key, const std::string &comment="")
 
bool SetStr (const std::string &key, std::string s, const std::string &comment="")
 
bool SetInt (const std::string &key, int64_t i, const std::string &comment="")
 
bool SetFloat (const std::string &key, double f, int p, const std::string &comment="")
 
bool SetFloat (const std::string &key, double f, const std::string &comment="")
 
bool SetHex (const std::string &key, uint64_t i, const std::string &comment="")
 
bool AddComment (const std::string &comment)
 
bool AddHistory (const std::string &comment)
 
void End ()
 
bool AddColumnShort (uint32_t cnt, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnInt (uint32_t cnt, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnLong (uint32_t cnt, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnFloat (uint32_t cnt, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnDouble (uint32_t cnt, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnChar (uint32_t cnt, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnByte (uint32_t cnt, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnBool (uint32_t cnt, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnShort (const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnInt (const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnLong (const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnFloat (const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnDouble (const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnChar (const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnByte (const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnBool (const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnShort (const FITS::Compression &comp, uint32_t cnt, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnInt (const FITS::Compression &comp, uint32_t cnt, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnLong (const FITS::Compression &comp, uint32_t cnt, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnFloat (const FITS::Compression &comp, uint32_t cnt, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnDouble (const FITS::Compression &comp, uint32_t cnt, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnChar (const FITS::Compression &comp, uint32_t cnt, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnByte (const FITS::Compression &comp, uint32_t cnt, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnBool (const FITS::Compression &comp, uint32_t cnt, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnShort (const FITS::Compression &comp, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnInt (const FITS::Compression &comp, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnLong (const FITS::Compression &comp, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnFloat (const FITS::Compression &comp, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnDouble (const FITS::Compression &comp, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnChar (const FITS::Compression &comp, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnByte (const FITS::Compression &comp, const std::string &name, const std::string &unit="", const std::string &comment="")
 
bool AddColumnBool (const FITS::Compression &comp, const std::string &name, const std::string &unit="", const std::string &comment="")
 
Checksum WriteHeader (std::ostream &fout)
 
Checksum WriteHeader ()
 
void FlushHeader ()
 
Checksum WriteFitsHeader ()
 
template<size_t N>
void revcpy (char *dest, const char *src, int num)
 
template<typename N >
bool WriteRow (const std::vector< N > &vec)
 
size_t GetNumRows () const
 
void AlignTo2880Bytes ()
 
Checksum UpdateHeaderChecksum ()
 
std::pair< std::string, int > GetChecksumData ()
 
void SetDefaultKeys ()
 

Static Public Member Functions

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 More...
 
static uint32_t DefaultMaxMemory (const uint32_t &_n=0)
 
static uint32_t DefaultMaxNumTiles (const uint32_t &_n=0)
 
static uint32_t DefaultNumRowsPerTile (const uint32_t &_n=0)
 

Protected Member Functions

void reallocateBuffers ()
 Allocates the required objects. More...
 
bool writeCompressedDataToDisk (char *src, const uint32_t sizeToWrite)
 
bool CompressBuffer (const CompressionTarget &target)
 
bool WriteBufferToDisk (const WriteTarget &target)
 
uint64_t compressBuffer (char *dest, char *src, uint32_t num_rows, CatalogRow &catalog_row)
 Compress a given buffer based on its source and destination. More...
 
void copyTransposeTile (const char *src, char *dest, uint32_t num_rows)
 
uint32_t compressUNCOMPRESSED (char *dest, const char *src, uint32_t size)
 
uint32_t compressHUFFMAN16 (char *dest, const char *src, uint32_t numRows, uint32_t sizeOfElems, uint32_t numRowElems)
 
uint32_t applySMOOTHING (char *data, uint32_t numElems)
 
uint32_t UnApplySMOOTHING (char *data, uint32_t numElems)
 
- Protected Member Functions inherited from ofits
std::vector< Table::Column >::const_iterator findcol (const std::string &name)
 

Protected Attributes

MemoryManager fMemPool
 Actual memory manager, providing memory for the compression buffers. More...
 
int32_t fNumQueues
 Current number of threads that will be used by this object. More...
 
uint64_t fMaxUsableMem
 Maximum number of bytes that can be allocated by the memory manager. More...
 
int32_t fLatestWrittenTile
 Index of the last tile written to disk (for correct ordering while using several threads) More...
 
std::vector< Queue< CompressionTarget > > fCompressionQueues
 Processing queues (=threads) More...
 
Queue< WriteTarget, QueueMin< WriteTarget > > fWriteToDiskQueue
 Writing queue (=thread) More...
 
CatalogType fCatalog
 Catalog for this file. More...
 
uint32_t fCatalogSize
 Actual catalog size (.size() is slow on large lists) More...
 
uint32_t fNumTiles
 Number of pre-reserved tiles. More...
 
uint32_t fNumRowsPerTile
 Number of rows per tile. More...
 
off_t fCatalogOffset
 Offset of the catalog from the beginning of the file. More...
 
Checksum fCatalogSum
 Checksum of the catalog. More...
 
Checksum fRawSum
 Raw sum (specific to FACT) More...
 
int32_t fCheckOffset
 offset to the data pointer to calculate the checksum More...
 
std::vector< CompressedColumnfRealColumns
 Vector hosting the columns of the file. More...
 
uint32_t fRealRowWidth
 Width in bytes of one uncompressed row. More...
 
std::shared_ptr< char > fSmartBuffer
 Smart pointer to the buffer where the incoming rows are written. More...
 
std::vector< char > fRawSumBuffer
 buffer used for checksuming the incoming data, before compression More...
 
std::exception_ptr fThreadsException
 exception pointer to store exceptions coming from the threads More...
 
int fErrno
 propagate errno to main thread More...
 
- Protected Attributes inherited from ofits
std::filebuf fFilebuf
 
Table fTable
 
std::vector< char > fOutputBuffer
 
Checksum fDataSum
 
Checksum fHeaderSum
 
bool fCommentTrimming
 
bool fManualExtName
 

Private Types

typedef std::vector< CatalogEntryCatalogRow
 
typedef std::list< CatalogRowCatalogType
 

Private Member Functions

struct zofits::CatalogEntry __attribute__ ((__packed__))
 

Private Attributes

struct zofits::WriteTarget __attribute__
 

Detailed Description

Definition at line 28 of file zofits.h.


The documentation for this class was generated from the following file: