ADTF File Library
Loading...
Searching...
No Matches
adtf_file::ADTFDatFileWriter Class Reference

Default ADTF DAT File Writer to write an ADTF DAT File (IFHD file with ADTF type and sample content). More...

#include <adtf_file_writer.h>

Inheritance diagram for adtf_file::ADTFDatFileWriter:
[legend]
Collaboration diagram for adtf_file::ADTFDatFileWriter:
[legend]

Public Types

enum  TargetADTFVersion { adtf2 = 2 , adtf3 = 3 , adtf3ns = 4 }
 Target Verion of the ADTF file to write. More...
 

Public Member Functions

 ADTFDatFileWriter (const std::string &file_name, std::chrono::nanoseconds history_duration, StreamTypeSerializers type_serializers, TargetADTFVersion target_adtf_version=adtf3ns, uint32_t writer_flags=0)
 CTOR for a new ADTF file for writing.
 
 ADTFDatFileWriter (const ADTFDatFileWriter &)=delete
 
 ADTFDatFileWriter (ADTFDatFileWriter &&)=default
 move CTOR
 
size_t createStream (const std::string &name, const StreamType &initial_type, const std::shared_ptr< SampleSerializer > &serializer)
 Create a Stream and retrieve the stream id for it.
 
void write (size_t stream_id, std::chrono::nanoseconds time_stamp, const StreamType &type)
 Writes a type to the file or the history.
 
void write (size_t stream_id, std::chrono::nanoseconds time_stamp, const WriteSample &sample)
 Writes a sample to the file or the history.
 
void writeTrigger (size_t stream_id, std::chrono::nanoseconds time_stamp)
 Writes a trigger to the file or the history.
 
void quitHistory ()
 quits the history.
 
std::shared_ptr< OutputStreamgetExtensionStream (const std::string &name, uint32_t user_id, uint32_t type_id, uint32_t file_version_id)
 Creates and gets a extension stream to write information into an extension.
 
void setFileDescription (const std::string &description)
 Set the File Description.
 

Detailed Description

Default ADTF DAT File Writer to write an ADTF DAT File (IFHD file with ADTF type and sample content).

Member Enumeration Documentation

◆ TargetADTFVersion

Target Verion of the ADTF file to write.

See also
adtf_file::ADTFDatFileWriter
Enumerator
adtf2 

target version is ADTF 2 file, containing samples only.

See also
adtf_file::StreamItem
adtf3 

target version is ADTF 3 file, containing samples, triggers and stream types.

See also
adtf_file::StreamItem
adtf3ns 

target version is ADTF 3 file, ontaining samples, triggers and stream types with nanosecond resolution.

See also
adtf_file::StreamItem

Constructor & Destructor Documentation

◆ ADTFDatFileWriter()

adtf_file::ADTFDatFileWriter::ADTFDatFileWriter ( const std::string & file_name,
std::chrono::nanoseconds history_duration,
StreamTypeSerializers type_serializers,
TargetADTFVersion target_adtf_version = adtf3ns,
uint32_t writer_flags = 0 )

CTOR for a new ADTF file for writing.

Parameters
file_namethe filename / filepath to create
history_durationtime for history of the file in nanoseconds
type_serializersther serializers for the stream type to use
target_adtf_versionthe target ADTF version the file to create for
writer_flagsWriting flags. See ifhd::v201_v301::OpenMode
Exceptions
exceptions::ErrorFileAccess,exceptions::ErrorFileAlreadyExists

Member Function Documentation

◆ createStream()

size_t adtf_file::ADTFDatFileWriter::createStream ( const std::string & name,
const StreamType & initial_type,
const std::shared_ptr< SampleSerializer > & serializer )

Create a Stream and retrieve the stream id for it.

Parameters
namethe name of the stream
initial_typethe initial stream type of the stream
serializerthe sample serializer to use for the stream
Returns
size_t the stream id

◆ getExtensionStream()

std::shared_ptr< OutputStream > adtf_file::ADTFDatFileWriter::getExtensionStream ( const std::string & name,
uint32_t user_id,
uint32_t type_id,
uint32_t file_version_id )

Creates and gets a extension stream to write information into an extension.

Parameters
namename of the extension
user_idthe user id for the extension
type_idthe type id for the extension
file_version_idthe file version id for the extension
Returns
std::shared_ptr<OutputStream> to write the extension to

◆ setFileDescription()

void adtf_file::ADTFDatFileWriter::setFileDescription ( const std::string & description)

Set the File Description.

Parameters
descriptionThe description to write to.

◆ write() [1/2]

void adtf_file::ADTFDatFileWriter::write ( size_t stream_id,
std::chrono::nanoseconds time_stamp,
const StreamType & type )

Writes a type to the file or the history.

Parameters
stream_idstream id the type belongs to
time_stampappearance time of the type
typethe type to write

◆ write() [2/2]

void adtf_file::ADTFDatFileWriter::write ( size_t stream_id,
std::chrono::nanoseconds time_stamp,
const WriteSample & sample )

Writes a sample to the file or the history.

Parameters
stream_idstream id the sample belongs to
time_stampappearance time of the sample
samplethe sample to write

◆ writeTrigger()

void adtf_file::ADTFDatFileWriter::writeTrigger ( size_t stream_id,
std::chrono::nanoseconds time_stamp )

Writes a trigger to the file or the history.

Parameters
stream_idstream id the trigger belongs to
time_stampappearance time of the trigger

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