2 #if !defined(_DATAFILE_H_)
9 #include "tools/Filename.h"
10 #include "tools/AutoPtr.h"
11 #include "tools/AutoFilePtr.h"
14 #include "storage/CtrlInfo.h"
15 #include "storage/RawValue.h"
37 static const uint32_t
cookie = 0x41444631;
57 const stdString &basename,
bool for_write);
154 double period,
size_t num_samples);
180 const stdString &basename,
181 const stdString &filename,
bool for_write);
221 { FilenameLength = 40 };
289 void show(FILE *f,
bool full_detail);
292 bool get_prev_next(
const char *name,
FileOffset new_offset);
297 #endif // !defined(_DATAFILE_H_)
DataFile * reference()
Add reference to current DataFile.
Binary Data File.
Definition: DataFile.h:32
unsigned short DbrType
DbrType is used to hold dbr_time_xxx types.
Definition: RawValue.h:24
Meta-information for values: Units, limits, etc .
Definition: CtrlInfo.h:75
static void close_all()
Close all data files.
void write(const CtrlInfo &ctrlInfo, FileOffset offset)
Write ctrlInfo.
FileOffset getSize() const
Get current file size in bytes.
void addCtrlInfo(const CtrlInfo &info, FileOffset &offset)
Add CtrlInfo to the data file.
size_t refCount() const
Get reference count.
Definition: DataFile.h:63
static size_t clear_cache()
Close as many data files as possible.
void read(CtrlInfo &ctrlInfo, FileOffset offset)
Read ctrlInfo.
Writes data to storage.
Definition: DataWriter.h:21
const stdString & getDirname()
Get directory name of data file.
Definition: DataFile.h:129
bool is_writable() const
Returns true if DataFile is writable.
Definition: DataFile.h:78
static void show_all_sizes()
Show all size.
unsigned short DbrCount
DbrCount is used to hold the array size of CA channels.
Definition: RawValue.h:27
uint32_t FileOffset
FileOffset is used as a system independent type for, well, offsets into files.
Definition: StorageTypes.h:13
class DataHeader * addHeader(const stdString &name, DbrType dbr_type, DbrCount dbr_count, double period, size_t num_samples)
Add a new DataHeader to the file.
bool is_new_file
Indicates if this file was newly created.
Definition: DataFile.h:67
Auto-close FILE pointer wrapper.
Definition: AutoFilePtr.h:15
static const uint32_t cookie
== 'ADF1', Archive Data File 1
Definition: DataFile.h:37
bool isTaggedFile()
Does the file follow the 2-1-1 format w/ cookie and tags?
Definition: DataFile.h:70
void release()
De-reference a data file (Call instead of delete).
class DataHeader * getHeader(FileOffset offset)
Read header at given offset.
void reopen()
Closes and re-opens a DataFile.
const stdString & getBasename()
Get base name of data file.
Definition: DataFile.h:132
An implementation of the DataReader for raw data.
Definition: RawDataReaderEA3.h:22
const stdString & getFilename()
Get full name of data file.
Definition: DataFile.h:126
size_t getHeaderSize(const stdString &name, DbrType dbr_type, DbrCount dbr_count, size_t num_samples)
Get size of a header with given parameters.