ADTF File Library
Loading...
Searching...
No Matches
adtfdat_processing::SampleTimestampSanitizerReader Class Reference

Proxy Reader that ensures sample timestamps are monotonically increasing without reordering samples. Only fixes non-monotonic sample timestamps. The logged file remains invalid in general. In contrast to 'sorted_by_timestamps', which reorders items, this reader adjusts timestamps, but preserves the original order. Using the wrong reader may further corrupt the data.". More...

#include <sample_timestamp_sanitizer_reader.h>

Inheritance diagram for adtfdat_processing::SampleTimestampSanitizerReader:
[legend]
Collaboration diagram for adtfdat_processing::SampleTimestampSanitizerReader:
[legend]

Public Member Functions

 SampleTimestampSanitizerReader ()
 CTOR.
 
std::string getReaderIdentifier () const override
 Get the Reader Identifier of the Reader.
 
void open (const std::string &file_name, std::shared_ptr< adtf_file::SampleFactory > sample_factory, std::shared_ptr< adtf_file::StreamTypeFactory > stream_type_factory) override
 opens a file by the given filename. The given factories must be used to create samples and streamtypes for the getNextItem call
 
uint32_t getFileVersion () const override
 
std::string getDescription () const override
 
std::vector< adtf_file::StreamgetStreams () const override
 Get the Streams.
 
std::vector< adtf_file::ExtensiongetExtensions () const override
 Get the Extensions if any.
 
adtf_file::FileItem getNextItem () override
 
std::optional< uint64_t > getItemCount () const override
 Get the Item Count. This gets the overall count of all items (samples, stream types and triggers) of all streams.
 
std::optional< double > getProgress () const override
 Get the Progress, a relative file position between 0.0 and 1.0.
 
uint64_t getItemIndexForTimeStamp (std::chrono::nanoseconds time_stamp) override
 
uint64_t getItemIndexForStreamItemIndex (uint16_t stream_id, uint64_t stream_item_index) override
 
std::shared_ptr< const adtf_file::StreamTypegetStreamTypeBefore (uint64_t item_index, uint16_t stream_id) override
 
void seekTo (uint64_t item_index) override
 
- Public Member Functions inherited from adtf_file::Configurable
virtual ~Configurable ()=default
 DTOR.
 
virtual const ConfigurationgetConfiguration () const
 
virtual void setConfiguration (const Configuration &configuration)
 

Detailed Description

Proxy Reader that ensures sample timestamps are monotonically increasing without reordering samples. Only fixes non-monotonic sample timestamps. The logged file remains invalid in general. In contrast to 'sorted_by_timestamps', which reorders items, this reader adjusts timestamps, but preserves the original order. Using the wrong reader may further corrupt the data.".

Member Function Documentation

◆ getDescription()

std::string adtfdat_processing::SampleTimestampSanitizerReader::getDescription ( ) const
overridevirtual
Returns
A descriptive text for the opened file.

Reimplemented from adtf_file::Reader.

◆ getExtensions()

std::vector< adtf_file::Extension > adtfdat_processing::SampleTimestampSanitizerReader::getExtensions ( ) const
overridevirtual

Get the Extensions if any.

Returns
std::vector<Extension> A vector of all available extensions.

Reimplemented from adtf_file::Reader.

◆ getFileVersion()

uint32_t adtfdat_processing::SampleTimestampSanitizerReader::getFileVersion ( ) const
overridevirtual

The file version with respect to ADTF DAT Format. When implementing a reader yourself

  • use ifhd::v201_v301::version_id if you do not explicitly create trigger items.
  • use ifhd::v500::version_id otherwise.
    Returns
    the file format version.

Reimplemented from adtf_file::Reader.

◆ getItemCount()

std::optional< uint64_t > adtfdat_processing::SampleTimestampSanitizerReader::getItemCount ( ) const
overridevirtual

Get the Item Count. This gets the overall count of all items (samples, stream types and triggers) of all streams.

Remarks
if it is not possible to retrieve the item count, return std::nullopt instead.
Returns
std::optional<uint64_t>

Reimplemented from adtf_file::Reader.

◆ getItemIndexForStreamItemIndex()

uint64_t adtfdat_processing::SampleTimestampSanitizerReader::getItemIndexForStreamItemIndex ( uint16_t stream_id,
uint64_t stream_item_index )
overridevirtual

Find the index of the given stream item.

Parameters
[in]stream_idThe stream id.
[in]stream_item_indexThe item index within the stream.
Returns
The item index.
Remarks
The SeekableReader class is an interface where implementation should at least throw following exceptions in case of error:
Exceptions
std::out_of_rangeif given item_index is out of range
std::out_of_rangeif given stream_id is out of range (must be at least 1)
std::runtime_errorif position was not found
anyother implementation dependent exceptions for the get call

Implements adtf_file::SeekableReader.

◆ getItemIndexForTimeStamp()

uint64_t adtfdat_processing::SampleTimestampSanitizerReader::getItemIndexForTimeStamp ( std::chrono::nanoseconds time_stamp)
overridevirtual

Find the index of the first item that has a timestamp greator or equal to the one specified.

Parameters
[in]time_stampThe timestamp.
Returns
The item index.
Remarks
The SeekableReader class is an interface where implementation should at least throw following exceptions in case of error:
Exceptions
std::runtime_errorif position was not found
anyother implementation dependent exceptions for the get call

Implements adtf_file::SeekableReader.

◆ getNextItem()

adtf_file::FileItem adtfdat_processing::SampleTimestampSanitizerReader::getNextItem ( )
overridevirtual

Returns the next item of the file and increase the item index to the next one. These can be samples, streamtypes or trigger.

Returns
The next item.
Remarks
Use the given factories from the open call to create sample and streamtypes.
The Reader class is an interface where implementation should at least throw following exceptions in case of error:
Exceptions
exceptions::EndOfFileif end of file was reached
std::exceptionbased exception for any other implementation dependent case to identify error on getNextItem call

Implements adtf_file::Reader.

◆ getProgress()

std::optional< double > adtfdat_processing::SampleTimestampSanitizerReader::getProgress ( ) const
overridevirtual

Get the Progress, a relative file position between 0.0 and 1.0.

Returns
std::optional<double> The relative value between 0.0 and 1.0 where internal file position is.

Reimplemented from adtf_file::Reader.

◆ getReaderIdentifier()

std::string adtfdat_processing::SampleTimestampSanitizerReader::getReaderIdentifier ( ) const
overridevirtual

Get the Reader Identifier of the Reader.

Returns
the reader identifier

Implements adtf_file::Reader.

◆ getStreams()

std::vector< adtf_file::Stream > adtfdat_processing::SampleTimestampSanitizerReader::getStreams ( ) const
overridevirtual

Get the Streams.

Returns
std::vector<Stream> A vector of all available streams.

Reimplemented from adtf_file::Reader.

◆ getStreamTypeBefore()

std::shared_ptr< const adtf_file::StreamType > adtfdat_processing::SampleTimestampSanitizerReader::getStreamTypeBefore ( uint64_t item_index,
uint16_t stream_id )
overridevirtual

Returns the stream type that is valid

Parameters
[in]item_indexThe global index before which the stream type should be retrieved.
[in]stream_idThe stream id for which the stream type should be retrieved.
Returns
A shared pointer to the stream type.
Remarks
The SeekableReader class is an interface where implementation should at least throw following exceptions in case of error:
Exceptions
std::out_of_rangeif given item_index is out of range
std::out_of_rangeif given stream_id is out of range (must be at least 1)
anyother implementation dependent exceptions for the get call

Implements adtf_file::SeekableReader.

◆ open()

void adtfdat_processing::SampleTimestampSanitizerReader::open ( const std::string & filename,
std::shared_ptr< adtf_file::SampleFactory > sample_factory,
std::shared_ptr< adtf_file::StreamTypeFactory > stream_type_factory )
overridevirtual

opens a file by the given filename. The given factories must be used to create samples and streamtypes for the getNextItem call

Parameters
filenameThe file to open
sample_factoryThe sample factory to create samples for the getNextItem call.
stream_type_factoryThe stream type factory to create streamtype for the getNextItem call.
Remarks
The Reader class is an interface where implementation should at least throw following exceptions in case of error:
Exceptions
std::exceptionbased exception for any other implementation dependent case to identify error on open call

Implements adtf_file::Reader.

◆ seekTo()

void adtfdat_processing::SampleTimestampSanitizerReader::seekTo ( uint64_t item_index)
overridevirtual

Seek to the given index, such that getNextItem() will return the item corresponding to the index on the next call.

Parameters
[in]item_indexThe index to seek to.
Remarks
The SeekableReader class is an interface where implementation should at least throw following exceptions in case of error:
Exceptions
std::out_of_rangeif given item_index is out of range (check for getItemCount())
anyother implementation dependent exceptions for the seek call

Implements adtf_file::SeekableReader.


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