adtf_file_library  0.13.1
Public Member Functions | List of all members
adtf_file::Reader Class Referenceabstract

#include <reader.h>

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

Public Member Functions

virtual std::string getReaderIdentifier () const =0
 Get the Reader Identifier of the Reader. More...
 
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 More...
 
virtual FileItem getNextItem ()=0
 
virtual uint32_t getFileVersion () const
 
virtual std::string getDescription () const
 
virtual std::vector< ExtensiongetExtensions () const
 Get the Extensions if any. More...
 
virtual std::vector< StreamgetStreams () const
 Get the Streams. More...
 
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. More...
 
virtual std::optional< double > getProgress () const
 Get the Progress, a relative file position between 0.0 and 1.0. More...
 
- Public Member Functions inherited from adtf_file::Configurable
virtual ~Configurable ()=default
 DTOR.
 
virtual const ConfigurationgetConfiguration () const
 
virtual void setConfiguration (const Configuration &configuration)
 

Detailed Description

This is the base class for implementing a file reader.

Please take a look at the trigonomerty reader example to get an idea on how to implement your own.

Member Function Documentation

◆ getDescription()

virtual std::string adtf_file::Reader::getDescription ( ) const
inlinevirtual
Returns
A descriptive text for the opened file.

Reimplemented in adtfdat_processing::TimeExtensionReader, adtfdat_processing::OffsetReaderWrapper, and adtf_file::ADTFDatFileReader.

◆ getExtensions()

virtual std::vector<Extension> adtf_file::Reader::getExtensions ( ) const
inlinevirtual

Get the Extensions if any.

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

Reimplemented in adtfdat_processing::TimeExtensionReader, adtfdat_processing::OffsetReaderWrapper, and adtf_file::ADTFDatFileReader.

◆ getFileVersion()

virtual uint32_t adtf_file::Reader::getFileVersion ( ) const
inlinevirtual

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 in adtfdat_processing::TimeExtensionReader, adtfdat_processing::OffsetReaderWrapper, and adtf_file::ADTFDatFileReader.

◆ getItemCount()

virtual std::optional<uint64_t> adtf_file::Reader::getItemCount ( ) const
inlinevirtual

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 in adtfdat_processing::TimeExtensionReader, adtfdat_processing::OffsetReaderWrapper, adtfdat_processing::MultiFileReader, and adtf_file::ADTFDatFileReader.

◆ getNextItem()

virtual FileItem adtf_file::Reader::getNextItem ( )
pure virtual

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

Implemented in adtfdat_processing::TimeExtensionReader, adtfdat_processing::OffsetReaderWrapper, adtfdat_processing::MultiFileReader, and adtf_file::ADTFDatFileReader.

◆ getProgress()

virtual std::optional<double> adtf_file::Reader::getProgress ( ) const
inlinevirtual

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 in adtfdat_processing::TimeExtensionReader, adtfdat_processing::OffsetReaderWrapper, adtfdat_processing::MultiFileReader, and adtf_file::ADTFDatFileReader.

◆ getReaderIdentifier()

virtual std::string adtf_file::Reader::getReaderIdentifier ( ) const
pure virtual

◆ getStreams()

virtual std::vector<Stream> adtf_file::Reader::getStreams ( ) const
inlinevirtual

Get the Streams.

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

Reimplemented in adtfdat_processing::TimeExtensionReader, adtfdat_processing::OffsetReaderWrapper, adtfdat_processing::MultiFileReader, and adtf_file::ADTFDatFileReader.

◆ open()

virtual void adtf_file::Reader::open ( const std::string &  filename,
std::shared_ptr< SampleFactory sample_factory,
std::shared_ptr< StreamTypeFactory stream_type_factory 
)
pure virtual

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

Implemented in adtf_file::ADTFDatFileReader, adtfdat_processing::OffsetReaderWrapper, adtfdat_processing::TimeExtensionReader, adtfdat_processing::ReferencedFilesReader, and adtfdat_processing::MultiFileReader.


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

Copyright © CARIAD SE.
Generated on Fri Apr 19 2024 by doxygen 1.9.1
GIT Commit Hash: 82d535f82776c20b12fc60740bdae991b62444a7