EPICS ARCHIVER V4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
Public Member Functions | Static Public Attributes | List of all members
DataWriter Class Reference

Writes data to storage. More...

#include <DataWriter.h>

Public Member Functions

 DataWriter (Index &index, const stdString &channel_name, const CtrlInfo &ctrl_info, DbrType dbr_type, DbrCount dbr_count, double period, size_t num_samples)
 Create a writer for the given index. More...
 
 ~DataWriter ()
 Destructor. More...
 
epicsTime getLastStamp ()
 Returns the last time stamp in the archive. More...
 
bool add (const RawValue::Data *data)
 Add a value. More...
 
void write (DbrType type, DbrCount count, size_t size, const RawValue::Data *value, MemoryBuffer< dbr_time_string > &cvt_buffer, class DataFile *datafile, FileOffset offset)
 Write a value to binary file. More...
 
dbr_time_string * write1 (size_t size, MemoryBuffer< dbr_time_string > &cvt_buffer, class DataFile *datafile)
 write 1
 
void write2 (dbr_time_string *buffer, size_t size, const RawValue::Data *value)
 write 2
 
void write3 (dbr_time_string *buffer)
 write 3
 
void write4 (DbrType type, DbrCount count, dbr_time_string *buffer, size_t size, const RawValue::Data *value, class DataFile *datafile, FileOffset offset)
 write 4
 
void write5a (class DataFile *datafile, FileOffset offset)
 write 5a
 
void write5b (class DataFile *datafile, FileOffset offset)
 write 5b
 
void write6 (dbr_time_string *buffer, size_t size, class DataFile *datafile, FileOffset offset)
 write 6
 

Static Public Attributes

static FileOffset file_size_limit
 Data file size limit.
 
static stdString data_file_name_base
 Base name of data files. More...
 

Detailed Description

Writes data to storage.

The data writer interfaces between a series of RawValue values and the Index/DataFile.

Constructor & Destructor Documentation

DataWriter::DataWriter ( Index index,
const stdString &  channel_name,
const CtrlInfo ctrl_info,
DbrType  dbr_type,
DbrCount  dbr_count,
double  period,
size_t  num_samples 
)

Create a writer for the given index.

Parameters
index,:index file
channel_name,:name of the channel
ctrl_info,:meta information for the channel
dbr_type,:the dbr_time_xxx type
dbr_count,:array size
period,:estimated periodicity of the channel
num_samples,:estimated number of samples (helps w/ buffer allocation)
Exceptions
GenericExceptionon error.
DataWriter::~DataWriter ( )

Destructor.

Note: Since one might use another DataWriter to add to the same set of data files, the DataWriter does not clear the DataFile cache. Call DataFile::close_all() when done!

Member Function Documentation

bool DataWriter::add ( const RawValue::Data data)

Add a value.

Returns
Returns true if the sample was added, false if the sample goes back-in-time and is thus ignored.
Exceptions
GenericExceptionon error.
epicsTime DataWriter::getLastStamp ( )

Returns the last time stamp in the archive.

This allows you to avoid the back-in-time error by checking before adding. The result is a null time stamp in case there's nothing in the archive, yet.

void DataWriter::write ( DbrType  type,
DbrCount  count,
size_t  size,
const RawValue::Data value,
MemoryBuffer< dbr_time_string > &  cvt_buffer,
class DataFile datafile,
FileOffset  offset 
)

Write a value to binary file.

Requires a buffer for the memory-to-disk format conversions.

Exceptions
GenericExceptionon error.

Member Data Documentation

stdString DataWriter::data_file_name_base
static

Base name of data files.

If not set, the date and time is used.


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