FACT++  1.0
CompressedFitsWriter Class Reference
+ Inheritance diagram for CompressedFitsWriter:
+ Collaboration diagram for CompressedFitsWriter:

Public Member Functions

 CompressedFitsWriter (uint32_t numTiles=100, uint32_t numRowsPerTile=100)
 Default constructor. 100 tiles of 100 rows each are assigned by default. More...
 
virtual ~CompressedFitsWriter ()
 default destructor More...
 
bool addColumn (const ColumnEntry &column)
 add one column to the file More...
 
bool setHeaderKey (const HeaderEntry &)
 sets a given header key More...
 
bool changeHeaderKey (const string &origName, const string &newName)
 
bool open (const string &fileName, const string &tableName="Data")
 open a new fits file More...
 
bool close ()
 close the opened file More...
 
bool writeBinaryRow (const char *bufferToWrite)
 write one row of data, already placed in bufferToWrite. Does the byte-swapping More...
 
uint32_t getRowWidth ()
 
void setDrsCalib (int16_t *data)
 assign a given (already loaded) drs calibration More...
 
bool setNumWorkingThreads (uint32_t num)
 set the number of worker threads compressing the data. More...
 
 CompressedFitsWriter (uint32_t numTiles=100, uint32_t numRowsPerTile=100)
 Default constructor. 100 tiles of 100 rows each are assigned by default. More...
 
virtual ~CompressedFitsWriter ()
 default destructor More...
 
bool addColumn (const ColumnEntry &column)
 add one column to the file More...
 
bool setHeaderKey (const HeaderEntry &)
 sets a given header key More...
 
bool changeHeaderKey (const string &origName, const string &newName)
 
bool open (const string &fileName, const string &tableName="Data")
 open a new fits file More...
 
bool close ()
 close the opened file More...
 
bool writeBinaryRow (const char *bufferToWrite)
 write one row of data, already placed in bufferToWrite. Does the byte-swapping More...
 
uint32_t getRowWidth ()
 
void setDrsCalib (int16_t *data)
 assign a given (already loaded) drs calibration More...
 
bool setNumWorkingThreads (uint32_t num)
 set the number of worker threads compressing the data. More...
 
- Public Member Functions inherited from CompressedFitsFile
 CompressedFitsFile (uint32_t numTiles=100, uint32_t numRowsPerTile=100)
 default constructor. Assigns a default number of rows and tiles More...
 
virtual ~CompressedFitsFile ()
 default destructor More...
 
vector< HeaderEntry > & getHeaderEntries ()
 get the header of the file More...
 
 CompressedFitsFile (uint32_t numTiles=100, uint32_t numRowsPerTile=100)
 default constructor. Assigns a default number of rows and tiles More...
 
virtual ~CompressedFitsFile ()
 default destructor More...
 
vector< HeaderEntry > & getHeaderEntries ()
 get the header of the file More...
 

Private Member Functions

uint64_t compressBuffer (uint32_t threadIndex)
 compresses one buffer of data, the one given by threadIndex More...
 
bool writeCompressedDataToDisk (uint32_t threadID, uint32_t sizeToWrite)
 writes an already compressed buffer to disk More...
 
void addHeaderChecksum (Checksum &checksum)
 add the header checksum to the datasum More...
 
void writeHeader (bool closingFile=false)
 write the header. If closingFile is set to true, checksum is calculated More...
 
void writeCatalog (bool closingFile=false)
 write the compressed data catalog. If closingFile is set to true, checksum is calculated More...
 
void writeDrsCalib ()
 Write the drs calibration to disk, if any. More...
 
void copyTransposeTile (uint32_t index)
 Copy and transpose (or semi-transpose) one tile of data. More...
 
uint32_t compressUNCOMPRESSED (char *dest, const char *src, uint32_t numRows, uint32_t sizeOfElems, uint32_t numRowElems)
 Specific compression functions. More...
 
uint32_t compressHUFFMAN (char *dest, const char *src, uint32_t numRows, uint32_t sizeOfElems, uint32_t numRowElems)
 
uint32_t compressSMOOTHMAN (char *dest, char *src, uint32_t numRows, uint32_t sizeOfElems, uint32_t numRowElems)
 
uint32_t applySMOOTHING (char *dest, char *src, uint32_t numRows, uint32_t sizeOfElems, uint32_t numRowElems)
 
uint64_t compressBuffer (uint32_t threadIndex)
 compresses one buffer of data, the one given by threadIndex More...
 
bool writeCompressedDataToDisk (uint32_t threadID, uint32_t sizeToWrite)
 writes an already compressed buffer to disk More...
 
void addHeaderChecksum (Checksum &checksum)
 add the header checksum to the datasum More...
 
void writeHeader (bool closingFile=false)
 write the header. If closingFile is set to true, checksum is calculated More...
 
void writeCatalog (bool closingFile=false)
 write the compressed data catalog. If closingFile is set to true, checksum is calculated More...
 
void writeDrsCalib ()
 Write the drs calibration to disk, if any. More...
 
void copyTransposeTile (uint32_t index)
 Copy and transpose (or semi-transpose) one tile of data. More...
 
uint32_t compressUNCOMPRESSED (char *dest, const char *src, uint32_t numRows, uint32_t sizeOfElems, uint32_t numRowElems)
 Specific compression functions. More...
 
uint32_t compressHUFFMAN (char *dest, const char *src, uint32_t numRows, uint32_t sizeOfElems, uint32_t numRowElems)
 
uint32_t compressSMOOTHMAN (char *dest, char *src, uint32_t numRows, uint32_t sizeOfElems, uint32_t numRowElems)
 
uint32_t applySMOOTHING (char *dest, char *src, uint32_t numRows, uint32_t sizeOfElems, uint32_t numRowElems)
 

Static Private Member Functions

static void * threadFunction (void *context)
 the main function compressing the data More...
 
static void * threadFunction (void *context)
 the main function compressing the data More...
 

Private Attributes

vector< HeaderEntry_defaultHeader
 FIXME this was a bad idea. Move everything to the regular header. More...
 
int32_t _checkOffset
 offset to the data pointer to calculate the checksum More...
 
int16_t * _drsCalibData
 array of the Drs baseline mean More...
 
int32_t _threadLooper
 Which thread will deal with the upcoming bunch of data ? More...
 
pthread_mutex_t _mutex
 mutex for compressing threads More...
 

Static Private Attributes

static string _emptyBlock
 an empty block to be apened at the end of a file so that its length is a multiple of 2880 More...
 
static string _fitsHeader
 the default header to be written in every fits file More...
 

Additional Inherited Members

- Public Types inherited from CompressedFitsFile
enum  FitsCompression { UNCOMPRESSED, SMOOTHMAN, UNCOMPRESSED, SMOOTHMAN }
 
enum  FitsCompression { UNCOMPRESSED, SMOOTHMAN, UNCOMPRESSED, SMOOTHMAN }
 
- Protected Types inherited from CompressedFitsFile
typedef pair< int64_t, int64_t > CatalogEntry
 
typedef vector< CatalogEntryCatalogRow
 
typedef vector< CatalogRowCatalogType
 
typedef pair< int64_t, int64_t > CatalogEntry
 
typedef vector< CatalogEntryCatalogRow
 
typedef vector< CatalogRowCatalogType
 
- Protected Member Functions inherited from CompressedFitsFile
bool reallocateBuffers ()
 protected function to allocate the intermediate buffers More...
 
bool reallocateBuffers ()
 protected function to allocate the intermediate buffers More...
 
- Protected Attributes inherited from CompressedFitsFile
vector< HeaderEntry_header
 Header keys. More...
 
vector< ColumnEntry_columns
 Columns in the file. More...
 
uint32_t _numTiles
 Number of tiles (i.e. groups of rows) More...
 
uint32_t _numRowsPerTile
 Number of rows per tile. More...
 
uint32_t _totalNumRows
 Total number of raws. More...
 
uint32_t _rowWidth
 Total number of bytes in one row. More...
 
bool _headerFlushed
 Flag telling whether the header record is synchronized with the data on disk. More...
 
char * _buffer
 Memory buffer to store rows while they are not compressed. More...
 
Checksum _checksum
 Checksum for asserting the consistency of the data. More...
 
fstream _file
 The actual file streamer for accessing disk data. More...
 
CatalogType _catalog
 Catalog, i.e. the main table that points to the compressed data. More...
 
uint64_t _heapPtr
 the address in the file of the heap area More...
 
vector< char * > _transposedBuffer
 Memory buffer to store rows while they are transposed. More...
 
vector< char * > _compressedBuffer
 Memory buffer to store rows while they are compressed. More...
 
uint32_t _numThreads
 The number of threads that will be used to compress. More...
 
uint32_t _threadIndex
 A variable to assign threads indices. More...
 
vector< pthread_t > _thread
 The thread handler of the compressor. More...
 
vector< uint32_t > _threadNumRows
 Total number of rows for thread to compress. More...
 
vector< uint32_t > _threadStatus
 Flag telling whether the buffer to be transposed (and compressed) is full or empty. More...
 
- Static Protected Attributes inherited from CompressedFitsFile
static const uint32_t _THREAD_WAIT_ = 0
 Thread doing nothing. More...
 
static const uint32_t _THREAD_COMPRESS_ = 1
 Thread working, compressing. More...
 
static const uint32_t _THREAD_DECOMPRESS_ = 2
 Thread working, decompressing. More...
 
static const uint32_t _THREAD_WRITE_ = 3
 Thread writing data to disk. More...
 
static const uint32_t _THREAD_READ_ = 4
 Thread reading data from disk. More...
 
static const uint32_t _THREAD_EXIT_ = 5
 Thread exiting. More...
 
static HeaderEntry _dummyHeaderEntry
 Dummy entry for returning if requested on is not found. More...
 

Detailed Description

Definition at line 386 of file fitsCompressor.cc.


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