EPICS ARCHIVER V4
|
Binary Data File. More...
#include <DataFile.h>
Public Member Functions | |
DataFile * | reference () |
Add reference to current DataFile. | |
size_t | refCount () const |
Get reference count. | |
bool | isTaggedFile () |
Does the file follow the 2-1-1 format w/ cookie and tags? | |
void | release () |
De-reference a data file (Call instead of delete). More... | |
bool | is_writable () const |
Returns true if DataFile is writable. | |
FileOffset | getSize () const |
Get current file size in bytes. More... | |
void | reopen () |
Closes and re-opens a DataFile. More... | |
const stdString & | getFilename () |
Get full name of data file. | |
const stdString & | getDirname () |
Get directory name of data file. | |
const stdString & | getBasename () |
Get base name of data file. | |
class DataHeader * | getHeader (FileOffset offset) |
Read header at given offset. More... | |
size_t | getHeaderSize (const stdString &name, DbrType dbr_type, DbrCount dbr_count, size_t num_samples) |
Get size of a header with given parameters. | |
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. More... | |
void | addCtrlInfo (const CtrlInfo &info, FileOffset &offset) |
Add CtrlInfo to the data file. More... | |
void | write (const CtrlInfo &ctrlInfo, FileOffset offset) |
Write ctrlInfo. | |
void | read (CtrlInfo &ctrlInfo, FileOffset offset) |
Read ctrlInfo. | |
Static Public Member Functions | |
static DataFile * | reference (const stdString &dirname, const stdString &basename, bool for_write) |
Reference a data file. More... | |
static void | show_all_sizes () |
Show all size. | |
static size_t | clear_cache () |
Close as many data files as possible. More... | |
static void | close_all () |
Close all data files. More... | |
Public Attributes | |
bool | is_new_file |
Indicates if this file was newly created. | |
Static Public Attributes | |
static const uint32_t | cookie = 0x41444631 |
== 'ADF1', Archive Data File 1 | |
Friends | |
class | DataHeader |
class | DataWriter |
class | RawDataReaderEA3 |
Binary Data File.
The DataFile class handles access to the binary data files. One important feature is reference counting and caching. When the ArchiveEngine adds samples, it is very likely to add samples for several channels to the same collection of data files.
void DataFile::addCtrlInfo | ( | const CtrlInfo & | info, |
FileOffset & | offset | ||
) |
Add CtrlInfo to the data file.
info | info |
offset | is set to offset of the info |
GenericException | in case of error. |
class DataHeader* DataFile::addHeader | ( | const stdString & | name, |
DbrType | dbr_type, | ||
DbrCount | dbr_count, | ||
double | period, | ||
size_t | num_samples | ||
) |
Add a new DataHeader to the file.
GenericException | in case of error. |
|
static |
Close as many data files as possible.
Closes all data files that are fully released. For example, the SpreadsheetReader will invoke this in its destructor. Since there might be other readers still open, only the application can decide when to close all files, which it should do via close_all.
|
static |
Close all data files.
The application should invoke this at times where it assumes that all readers/writers are done to check consistency and prevent files left dangling open.
GenericException | if data files are referenced (because there's still a reader?). |
class DataHeader* DataFile::getHeader | ( | FileOffset | offset | ) |
Read header at given offset.
GenericException | in case of error. |
FileOffset DataFile::getSize | ( | ) | const |
Get current file size in bytes.
GenericException | on file seek error. |
|
static |
Reference a data file.
Either opens a new one, or returns another reference to a file that is in the DataFile cache.
dirname,: | Path/directory up to the filename |
basename,: | filename inside dirname |
for_write,: | open for writing or read-only? |
The reference call will normalize the dirname/basename/filename. As an example, it's acceptable to pass a basename that still contains pieces of a pathname, which will then be moved into the dirname.
GenericException | on error. |
void DataFile::release | ( | ) |
De-reference a data file (Call instead of delete).
void DataFile::reopen | ( | ) |
Closes and re-opens a DataFile.
For synchr. with a file that's actively written by another prog. is might help to reopen.
GenericException | on error. |