26#include <lal/LALDatatypes.h>
27#include <lal/LALConstants.h>
28#include <lal/HeapToplist.h>
30#define MAXFILENAMELENGTH 256
int create_fstat_toplist(toplist_t **list, UINT8 length)
creates a toplist with length elements, returns -1 on error (usually out of memory),...
int fstat_cpt_file_destroy(FstatCheckpointFile **cptf)
destroys a FstatCheckpointFile
int fstat_cpt_file_create(FstatCheckpointFile **cptf, CHAR *filename, UINT4 bufsize, UINT4 maxsize, toplist_t *tl)
creates a FstatCheckpointFile
int fstat_cpt_file_flush(FstatCheckpointFile *cptf)
flushes the checkpoint file (only useful if buffered)
int fstat_cpt_file_compact(FstatCheckpointFile *cptf)
compact a toplist file if the length has reached maxbytes
int fstat_cpt_file_open(FstatCheckpointFile *cptf)
opens a file for checkpointing the desired toplist
int fstat_cpt_file_close(FstatCheckpointFile *cptf)
closes the file, reduces the precision, sorts the toplist, finally rewrites the file (sorted and comp...
int write_hs_oputput(const char *filename, toplist_t *tl)
write the final output file:
int fstat_cpt_file_info(FstatCheckpointFile *cptf, CHAR **filename, UINT4 *bytes, UINT4 *checksum)
returns information for checkpointing
void free_fstat_toplist(toplist_t **list)
frees the space occupied by the toplist
int write_fstat_toplist_item_to_fp(FstatOutputEntry line, FILE *fp, UINT4 *checksum)
File IO.
int write_fstat_toplist_to_fp(toplist_t *list, FILE *fp, UINT4 *checksum)
Writes the toplist to an (already open) filepointer Returns the number of written charactes sets the ...
int read_hs_checkpoint(const char *filename, toplist_t *tl, UINT4 *counter)
tries to read a checkpoint
int fstat_cpt_file_read(FstatCheckpointFile *cptf, UINT4 checksum, UINT4 maxbytes)
reads a written checkpointed toplist back into memory
int insert_into_fstat_toplist(toplist_t *list, FstatOutputEntry line)
Inserts an element in to the toplist either if there is space left or the element is larger than the ...
int final_write_fstat_toplist_to_file(toplist_t *list, const char *filename, UINT4 *checksum)
meant for the final writing of the toplist
int read_fstat_toplist_from_fp(toplist_t *list, FILE *fp, UINT4 *checksum, UINT4 maxbytes)
reads a (created!) toplist from an open filepointer sets the checksum if non-NULL reads maximum maxby...
void sort_fstat_toplist(toplist_t *list)
sorts the toplist with an internal sorting function, used before finally writing it
int atomic_write_fstat_toplist_to_file(toplist_t *list, const char *filename, UINT4 *checksum)
writes the given toplitst to a temporary file, then renames the temporary file to filename.
int write_hs_checkpoint(const char *filename, toplist_t *tl, UINT4 counter, BOOLEAN do_sync)
new, simpler checkpointing for HierarchicalSearch
int fstat_cpt_file_add(FstatCheckpointFile *cptf, FstatOutputEntry line)
adds an item to the toplist and keeps the file consistent, i.e.
a toplist as a checkpointed file
CHAR * buffer
write buffer if needed
FILE * fp
FILE* currently associated.
UINT4 maxsize
the file must not grow larger than that
CHAR * filename
name of the toplist file
UINT4 bytes
counts the bytes in the file
toplist_t * list
toplist this file reflects
UINT4 bufsize
buffer size if needed
UINT4 checksum
keeps the checksum
Type to hold the fields that will be output in unclustered output file
REAL8 Alpha
Skyposition: longitude in equatorial coords, radians.
REAL8 Delta
skyposition: latitude
REAL8 Freq
Frequency at maximum (?) of the cluster.
REAL8 f1dot
spindown value f1dot = df/dt