22#include <unordered_map>
58 using std::runtime_error::runtime_error;
100 virtual std::shared_ptr<StreamType>
build()
const = 0;
107template<
typename STREAM_TYPE_CLASS>
111 std::shared_ptr<StreamType>
build()
const override
113 return std::make_shared<STREAM_TYPE_CLASS>();
127 virtual std::shared_ptr<Sample>
build()
const = 0;
134template<
typename SAMPLE_CLASS>
138 std::shared_ptr<Sample>
build()
const override
140 return std::make_shared<SAMPLE_CLASS>();
208 virtual void open(
const std::string& filename,
234 return ifhd::v201_v301::version_id;
326 virtual std::shared_ptr<const StreamType>
getStreamTypeBefore(uint64_t item_index, uint16_t stream_id) = 0;
337 virtual void seekTo(uint64_t item_index) = 0;
373 std::shared_ptr<adtf_file::Reader>
makeReader()
const override
375 return std::make_shared<T>();
389 void add(
const std::shared_ptr<const adtf_file::ReaderFactory>& factory);
395 void remove(
const std::string& reader_id);
404 std::shared_ptr<adtf_file::Reader>
makeReader(
const std::string& reader_id)
const;
422 std::shared_ptr<adtf_file::Reader>
426 std::shared_ptr<adtf_file::StreamTypeFactory> stream_type_factory = {},
427 std::optional<std::string> reader_id = {})
const;
443 const std::function<
bool(
const std::shared_ptr<Reader>&)>& capable_reader_callback,
446 std::shared_ptr<adtf_file::StreamTypeFactory> stream_type_factory = {})
const;
452 const std::unordered_map<std::string, std::shared_ptr<const ReaderFactory>>&
getFactories()
const;
455 std::unordered_map<std::string, std::shared_ptr<const ReaderFactory>> _factories;
Definition configuration.h:448
Extension class for file extension. These extension are i.e.:
Definition reader.h:72
uint32_t user_id
the user id (if needed)
Definition reader.h:79
uint32_t type_id
the type id (if needed)
Definition reader.h:81
const void * data
reference pointer to the data of the extension
Definition reader.h:87
std::string name
the name of the extension
Definition reader.h:75
uint32_t version_id
the version id (if needed)
Definition reader.h:83
uint16_t stream_id
the stream id the extension belongs to
Definition reader.h:77
size_t data_size
the extension size in bytes
Definition reader.h:85
class to create or read a file item. This file item is either a sample, streamtype or trigger.
Definition reader.h:172
std::shared_ptr< const StreamItem > stream_item
Definition reader.h:180
std::chrono::nanoseconds time_stamp
time stamp of the file item
Definition reader.h:177
uint16_t stream_id
stream id the file items belongs to
Definition reader.h:175
base interface class for all available objects of the ADTF File Library that can be added to the obje...
Definition object.h:38
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)
std::shared_ptr< adtf_file::Reader > makeReader(const std::string &reader_id) const
create an instance for the given reader_id
void add(const std::shared_ptr< const adtf_file::ReaderFactory > &factory)
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:367
std::shared_ptr< adtf_file::Reader > makeReader() const override
make a reader T.
Definition reader.h:373
Reader Factory interface to create a reader.
Definition reader.h:352
virtual std::shared_ptr< Reader > makeReader() const =0
Creates a reader.
virtual std::string getDescription() const
Definition reader.h:240
virtual std::vector< Stream > getStreams() const
Get the Streams.
Definition reader.h:258
virtual uint32_t getFileVersion() const
Definition reader.h:232
virtual std::string getReaderIdentifier() const =0
Get the Reader Identifier of the Reader.
virtual std::vector< Extension > getExtensions() const
Get the Extensions if any.
Definition reader.h:249
virtual std::optional< double > getProgress() const
Get the Progress, a relative file position between 0.0 and 1.0.
Definition reader.h:278
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...
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:269
Base class for a sample factory to create sample used by the Reader.
Definition reader.h:121
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:288
virtual uint64_t getItemIndexForStreamItemIndex(uint16_t stream_id, uint64_t stream_item_index)=0
virtual void seekTo(uint64_t item_index)=0
virtual uint64_t getItemIndexForTimeStamp(std::chrono::nanoseconds time_stamp)=0
virtual std::shared_ptr< const StreamType > getStreamTypeBefore(uint64_t item_index, uint16_t stream_id)=0
Base class for a streamtype factory to create streamtypes used by the Reader.
Definition reader.h:94
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:150
uint64_t item_count
the amount of stream items within the stream
Definition reader.h:157
std::string name
the stream name
Definition reader.h:155
std::chrono::nanoseconds timestamp_of_first_item
time stamp of the first stream item within the stream
Definition reader.h:159
uint16_t stream_id
the stream id
Definition reader.h:153
std::chrono::nanoseconds timestamp_of_last_item
time stamp of the last stream item within the stream
Definition reader.h:161
std::shared_ptr< const StreamType > initial_type
the initial stream type of the stream
Definition reader.h:163
SeekingNotSupported()
default CTOR
Definition reader.h:54
template class for a sample factory to create sample with implementation type SAMPLE_CLASS
Definition reader.h:136
std::shared_ptr< Sample > build() const override
Creates a sample.
Definition reader.h:138
template class for a streamtype factory to create streamtypes with implementation type STREAM_TYPE_CL...
Definition reader.h:109
std::shared_ptr< StreamType > build() const override
Creates a streamtype.
Definition reader.h:111
namespace for exceptions
Definition reader.h:39
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:132
utils5ext::exceptions::EndOfFile EndOfFile
Exception to indicate the end of file was reached.
Definition indexedfile_types.h:114