22 #include <unordered_map>
84 virtual std::shared_ptr<StreamType>
build()
const = 0;
91 template <
typename STREAM_TYPE_CLASS>
95 std::shared_ptr<StreamType>
build()
const override
97 return std::make_shared<STREAM_TYPE_CLASS>();
111 virtual std::shared_ptr<Sample>
build()
const = 0;
118 template <
typename SAMPLE_CLASS>
122 std::shared_ptr<Sample>
build()
const override
124 return std::make_shared<SAMPLE_CLASS>();
190 virtual void open(
const std::string& filename,
213 return ifhd::v201_v301::version_id;
302 virtual std::shared_ptr<const StreamType>
getStreamTypeBefore(uint64_t item_index, uint16_t stream_id) = 0;
311 virtual void seekTo(uint64_t item_index) = 0;
345 std::shared_ptr<adtf_file::Reader>
makeReader()
const override
347 return std::make_shared<T>();
361 void add(
const std::shared_ptr<const adtf_file::ReaderFactory>& factory);
367 void remove(
const std::string& reader_id);
376 std::shared_ptr<adtf_file::Reader>
makeReader(
const std::string& reader_id)
const;
392 std::shared_ptr<adtf_file::Reader>
openReader(
const std::string& filename,
395 std::shared_ptr<adtf_file::StreamTypeFactory> stream_type_factory = {},
396 std::optional<std::string> reader_id = {})
const;
412 const std::function<
bool(
const std::shared_ptr<Reader>&)>& capable_reader_callback,
415 std::shared_ptr<adtf_file::StreamTypeFactory> stream_type_factory = {})
const;
421 const std::unordered_map<std::string, std::shared_ptr<const ReaderFactory>>&
getFactories()
const;
424 std::unordered_map<std::string, std::shared_ptr<const ReaderFactory>> _factories;
Definition: configuration.h:314
Extension class for file extension. These extension are i.e.:
Definition: reader.h:56
uint32_t user_id
the user id (if needed)
Definition: reader.h:63
uint32_t type_id
the type id (if needed)
Definition: reader.h:65
const void * data
reference pointer to the data of the extension
Definition: reader.h:71
std::string name
the name of the extension
Definition: reader.h:59
uint32_t version_id
the version id (if needed)
Definition: reader.h:67
uint16_t stream_id
the stream id the extension belongs to
Definition: reader.h:61
size_t data_size
the extension size in bytes
Definition: reader.h:69
class to create or read a file item. This file item is either a sample, streamtype or trigger.
Definition: reader.h:156
std::shared_ptr< const StreamItem > stream_item
Definition: reader.h:164
std::chrono::nanoseconds time_stamp
time stamp of the file item
Definition: reader.h:161
uint16_t stream_id
stream id the file items belongs to
Definition: reader.h:159
base interface class for all available objects of the ADTF File Library that can be added to the obje...
Definition: object.h:33
std::shared_ptr< adtf_file::Reader > openReader(const std::string &filename, const adtf_file::Configuration &configuration={}, std::shared_ptr< adtf_file::SampleFactory > sample_factory={}, std::shared_ptr< adtf_file::StreamTypeFactory > stream_type_factory={}, std::optional< std::string > reader_id={}) const
Creates an instance for the given reader_id, sets the given configuration and opens the reader with g...
const std::unordered_map< std::string, std::shared_ptr< const ReaderFactory > > & getFactories() const
Get the Factories.
void remove(const std::string &reader_id)
void add(const std::shared_ptr< const adtf_file::ReaderFactory > &factory)
std::shared_ptr< adtf_file::Reader > makeReader(const std::string &reader_id) const
create an instance for the given reader_id
void getCapableReaders(const std::string &filename, const std::function< bool(const std::shared_ptr< Reader > &)> &capable_reader_callback, const adtf_file::Configuration &configuration={}, std::shared_ptr< adtf_file::SampleFactory > sample_factory={}, std::shared_ptr< adtf_file::StreamTypeFactory > stream_type_factory={}) const
Get all capable readers can open the given file (filename). It will make and open all capable Reader ...
Default Reader factory implementation for readers using a standard default CTOR.
Definition: reader.h:339
std::shared_ptr< adtf_file::Reader > makeReader() const override
make a reader T.
Definition: reader.h:345
Reader Factory interface to create a reader.
Definition: reader.h:324
virtual std::shared_ptr< Reader > makeReader() const =0
Creates a reader.
virtual std::string getDescription() const
Definition: reader.h:219
virtual uint32_t getFileVersion() const
Definition: reader.h:211
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 ...
Definition: reader.h:248
virtual std::string getReaderIdentifier() const =0
Get the Reader Identifier of the Reader.
virtual std::optional< double > getProgress() const
Get the Progress, a relative file position between 0.0 and 1.0.
Definition: reader.h:257
virtual std::vector< Stream > getStreams() const
Get the Streams.
Definition: reader.h:237
virtual std::vector< Extension > getExtensions() const
Get the Extensions if any.
Definition: reader.h:228
virtual FileItem getNextItem()=0
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 streamtype...
Base class for a sample factory to create sample used by the Reader.
Definition: reader.h:105
virtual std::shared_ptr< Sample > build() const =0
Creates a sample.
Interface for seekable Reader, where the file position can be adapted.
Definition: reader.h:267
virtual uint64_t getItemIndexForStreamItemIndex(uint16_t stream_id, uint64_t stream_item_index)=0
virtual std::shared_ptr< const StreamType > getStreamTypeBefore(uint64_t item_index, uint16_t stream_id)=0
virtual void seekTo(uint64_t item_index)=0
virtual uint64_t getItemIndexForTimeStamp(std::chrono::nanoseconds time_stamp)=0
Base class for a streamtype factory to create streamtypes used by the Reader.
Definition: reader.h:78
virtual std::shared_ptr< StreamType > build() const =0
Creates a streamtype.
class to create and describe a stream within a adtf_file::Reader. Each stream has an identifier strea...
Definition: reader.h:134
uint64_t item_count
the amount of stream items within the stream
Definition: reader.h:141
std::string name
the stream name
Definition: reader.h:139
std::chrono::nanoseconds timestamp_of_first_item
time stamp of the first stream item within the stream
Definition: reader.h:143
uint16_t stream_id
the stream id
Definition: reader.h:137
std::chrono::nanoseconds timestamp_of_last_item
time stamp of the last stream item within the stream
Definition: reader.h:145
std::shared_ptr< const StreamType > initial_type
the initial stream type of the stream
Definition: reader.h:147
template class for a sample factory to create sample with implementation type SAMPLE_CLASS
Definition: reader.h:120
std::shared_ptr< Sample > build() const override
Creates a sample.
Definition: reader.h:122
template class for a streamtype factory to create streamtypes with implementation type STREAM_TYPE_CL...
Definition: reader.h:93
std::shared_ptr< StreamType > build() const override
Creates a streamtype.
Definition: reader.h:95
namespace for ADTF File library
Definition: adtf2_adtf_core_media_sample_deserializer.h:25
std::chrono::nanoseconds getLastTimeOfStreams(const std::vector< Stream > &streams)
Get the Last Time Of the given Streams.
Stream findStream(const Reader &reader, const std::string &stream_name)
std::chrono::nanoseconds getFirstTimeOfStreams(const std::vector< Stream > &streams)
Get the First Time Of the given Streams.
ReaderFactories getReaderFactories()
Get the Reader Factories from the Objects instance.
std::unordered_map< std::string, PropertyValue > Configuration
Configuration class as set of key - property value pairs This configuration is used to adjust the rea...
Definition: configuration.h:143
utils5ext::exceptions::EndOfFile EndOfFile
Exception to indicate the end of file was reached.
Definition: indexedfile_types.h:114