Proxy reader that reorders items within a sliding window to restore timestamp order. Only fixes out-of-order items. The logged file remains invalid in general. In contrast to 'sample_timestamp_sanitizer', which adjusts non-monotonic sample timestamps, this reader reorders the items but preserves the original sample data. Using the wrong reader may further corrupt the data.".
More...
#include <sorting_reader.h>
|
| void | open (const std::vector< adtf_file::Stream > &streams, bool sample_timestamps, std::chrono::seconds sorting_window, bool trigger_for_each_sample) |
| | prepare the sorting algorithm.
|
| |
| adtf_file::FileItem | getNextItem () final override |
| |
| 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::StreamType > | getStreamTypeBefore (uint64_t item_index, uint16_t stream_id) override |
| |
| void | seekTo (uint64_t item_index) override |
| |
| virtual void | open (const std::string &filename, std::shared_ptr< SampleFactory > sample_factory, std::shared_ptr< StreamTypeFactory > stream_type_factory)=0 |
| | opens a file by the given filename. The given factories must be used to create samples and streamtypes for the getNextItem call
|
| |
| virtual std::string | getReaderIdentifier () const =0 |
| | Get the Reader Identifier of the Reader.
|
| |
| virtual void | open (const std::string &filename, std::shared_ptr< SampleFactory > sample_factory, std::shared_ptr< StreamTypeFactory > stream_type_factory)=0 |
| | opens a file by the given filename. The given factories must be used to create samples and streamtypes for the getNextItem call
|
| |
| virtual uint32_t | getFileVersion () const |
| |
| virtual std::string | getDescription () const |
| |
| virtual std::vector< Extension > | getExtensions () const |
| | Get the Extensions if any.
|
| |
| virtual std::vector< Stream > | getStreams () const |
| | Get the Streams.
|
| |
| virtual std::optional< uint64_t > | getItemCount () const |
| | Get the Item Count. This gets the overall count of all items (samples, stream types and triggers) of all streams.
|
| |
| virtual std::optional< double > | getProgress () const |
| | Get the Progress, a relative file position between 0.0 and 1.0.
|
| |
|
virtual | ~Configurable ()=default |
| | DTOR.
|
| |
| virtual const Configuration & | getConfiguration () const |
| |
| virtual void | setConfiguration (const Configuration &configuration) |
| |
|
| virtual adtf_file::FileItem | getNextUnsortedItem ()=0 |
| |
|
virtual uint64_t | getUnsortedItemIndexForTimeStamp (std::chrono::nanoseconds time_stamp) |
| |
|
virtual std::shared_ptr< const adtf_file::StreamType > | getUnsortedStreamTypeBefore (uint64_t item_index, uint16_t stream_id) |
| |
|
virtual void | unsortedSeekTo (uint64_t item_index) |
| |
Proxy reader that reorders items within a sliding window to restore timestamp order. Only fixes out-of-order items. The logged file remains invalid in general. In contrast to 'sample_timestamp_sanitizer', which adjusts non-monotonic sample timestamps, this reader reorders the items but preserves the original sample data. Using the wrong reader may further corrupt the data.".
◆ getItemIndexForStreamItemIndex()
| uint64_t adtfdat_processing::SortingReader::getItemIndexForStreamItemIndex |
( |
uint16_t | stream_id, |
|
|
uint64_t | stream_item_index ) |
|
overridevirtual |
Find the index of the given stream item.
- Parameters
-
| [in] | stream_id | The stream id. |
| [in] | stream_item_index | The item index within the stream. |
- Returns
- The item index.
- Exceptions
-
| std::out_of_range | if given item_index is out of range |
| std::out_of_range | if given stream_id is out of range (must be at least 1) |
| std::runtime_error | if position was not found |
| any | other implementation dependent exceptions for the get call |
Implements adtf_file::SeekableReader.
◆ getItemIndexForTimeStamp()
| uint64_t adtfdat_processing::SortingReader::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_stamp | The timestamp. |
- Returns
- The item index.
- Exceptions
-
| std::runtime_error | if position was not found |
| any | other implementation dependent exceptions for the get call |
Implements adtf_file::SeekableReader.
◆ getNextItem()
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.
- Exceptions
-
| exceptions::EndOfFile | if end of file was reached |
| std::exception | based exception for any other implementation dependent case to identify error on getNextItem call |
Implements adtf_file::Reader.
◆ getNextUnsortedItem()
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.
- Exceptions
-
| exceptions::EndOfFile | if end of file was reached |
| std::exception | based exception for any other implementation dependent case to identify error on getNextUnsortedItem call |
Implemented in adtfdat_processing::SortingProxyReader.
◆ getStreamTypeBefore()
| std::shared_ptr< const adtf_file::StreamType > adtfdat_processing::SortingReader::getStreamTypeBefore |
( |
uint64_t | item_index, |
|
|
uint16_t | stream_id ) |
|
overridevirtual |
Returns the stream type that is valid
- Parameters
-
| [in] | item_index | The global index before which the stream type should be retrieved. |
| [in] | stream_id | The stream id for which the stream type should be retrieved. |
- Returns
- A shared pointer to the stream type.
- Exceptions
-
| std::out_of_range | if given item_index is out of range |
| std::out_of_range | if given stream_id is out of range (must be at least 1) |
| any | other implementation dependent exceptions for the get call |
Implements adtf_file::SeekableReader.
◆ open() [1/2]
| virtual void adtf_file::Reader::open |
( |
const std::string & | filename, |
|
|
std::shared_ptr< SampleFactory > | sample_factory, |
|
|
std::shared_ptr< StreamTypeFactory > | stream_type_factory ) |
opens a file by the given filename. The given factories must be used to create samples and streamtypes for the getNextItem call
- Parameters
-
| filename | The file to open |
| sample_factory | The sample factory to create samples for the getNextItem call. |
| stream_type_factory | The stream type factory to create streamtype for the getNextItem call. |
- Exceptions
-
| std::exception | based exception for any other implementation dependent case to identify error on open call |
◆ open() [2/2]
| void adtfdat_processing::SortingReader::open |
( |
const std::vector< adtf_file::Stream > & | streams, |
|
|
bool | sample_timestamps, |
|
|
std::chrono::seconds | sorting_window, |
|
|
bool | trigger_for_each_sample ) |
prepare the sorting algorithm.
- Parameters
-
| streams | the list of streams |
| sample_timestamps | use sample timestamp or chunk timestamp |
| sorting_window | definition for the timing window in seconds |
| trigger_for_each_sample | whether or not to create a trigger for each sample |
- Exceptions
-
| std::exception | based exception for any other implementation dependent case to identify error on open call |
◆ seekTo()
| void adtfdat_processing::SortingReader::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_index | The index to seek to. |
- Exceptions
-
| std::out_of_range | if given item_index is out of range (check for getItemCount()) |
| any | other implementation dependent exceptions for the seek call |
Implements adtf_file::SeekableReader.
The documentation for this class was generated from the following file: