ADTF File Library
Loading...
Searching...
No Matches
multiplexer.h
Go to the documentation of this file.
1
16
17#pragma once
18
19#include <string>
20#include <functional>
21#include <unordered_map>
22
24#include <adtf_file/reader.h>
25
26namespace adtfdat_processing
27{
28
33{
34public:
42 OffsetReaderWrapper(const std::shared_ptr<Reader> original_reader,
43 std::chrono::nanoseconds offset,
44 std::chrono::nanoseconds start_offset,
45 std::chrono::nanoseconds end_offset);
46
47 std::string getReaderIdentifier() const override;
48 uint32_t getFileVersion() const override;
49 std::string getDescription() const override;
50
51 void open(const std::string& filename,
52 std::shared_ptr<adtf_file::SampleFactory> sample_factory,
53 std::shared_ptr<adtf_file::StreamTypeFactory> stream_type_factory) override;
54
55 void setConfiguration(const adtf_file::Configuration& configuration) override;
57
58 std::vector<adtf_file::Extension> getExtensions() const override;
59 std::vector<adtf_file::Stream> getStreams() const override;
60
62 std::optional<uint64_t> getItemCount() const override;
63 std::optional<double> getProgress() const override;
64
65private:
66 std::shared_ptr<Reader> _original_reader;
67 std::chrono::nanoseconds _offset;
68 std::chrono::nanoseconds _start_offset;
69 std::chrono::nanoseconds _end_offset;
70
71 adtf_file::FileItem _next_item;
72 std::unordered_map<uint16_t, std::shared_ptr<const adtf_file::StreamItem>> _last_stream_types;
73};
74
79{
80public:
89 Multiplexer(const std::string& destination_file_name,
92 bool skip_stream_types_and_triggers = false,
93 bool store_checksums = false);
94
102 void addStream(const std::shared_ptr<adtf_file::Reader> reader,
103 const std::string& stream_name,
104 const std::string& destination_stream_name,
105 const std::shared_ptr<adtf_file::SampleSerializer> serializer);
106
116 void addExtension(const std::string& name,
117 const void* extension_data,
118 size_t extension_size,
119 uint32_t user_id = 0,
120 uint32_t type_id = 0,
121 uint32_t version_id = 0);
122
129 void process(const std::function<bool(double)>& progress_handler);
130
131private:
132 std::optional<double> calculateProgress();
133
134private:
136 bool _skip_stream_types_and_triggers;
137 std::unordered_map<std::shared_ptr<adtf_file::Reader>, std::unordered_map<uint16_t, size_t>>
138 _stream_mapping;
139};
140}
Default ADTF DAT File Writer to write an ADTF DAT File (IFHD file with ADTF type and sample content).
Definition adtf_file_writer.h:268
TargetADTFVersion
Target Verion of the ADTF file to write.
Definition adtf_file_writer.h:305
@ adtf3ns
target version is ADTF 3 file, ontaining samples, triggers and stream types with nanosecond resolutio...
Definition adtf_file_writer.h:320
class to create or read a file item. This file item is either a sample, streamtype or trigger.
Definition reader.h:172
Definition reader.h:189
void addStream(const std::shared_ptr< adtf_file::Reader > reader, const std::string &stream_name, const std::string &destination_stream_name, const std::shared_ptr< adtf_file::SampleSerializer > serializer)
void addExtension(const std::string &name, const void *extension_data, size_t extension_size, uint32_t user_id=0, uint32_t type_id=0, uint32_t version_id=0)
void process(const std::function< bool(double)> &progress_handler)
Multiplexer(const std::string &destination_file_name, adtf_file::ADTFDatFileWriter::TargetADTFVersion target_adtf_version=adtf_file::ADTFDatFileWriter::TargetADTFVersion::adtf3ns, bool skip_stream_types_and_triggers=false, bool store_checksums=false)
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 ...
std::vector< adtf_file::Extension > getExtensions() const override
Get the Extensions if any.
std::optional< double > getProgress() const override
Get the Progress, a relative file position between 0.0 and 1.0.
std::string getDescription() const override
OffsetReaderWrapper(const std::shared_ptr< Reader > original_reader, std::chrono::nanoseconds offset, std::chrono::nanoseconds start_offset, std::chrono::nanoseconds end_offset)
std::string getReaderIdentifier() const override
Get the Reader Identifier of the Reader.
adtf_file::FileItem getNextItem() override
void open(const std::string &filename, 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 streamtype...
std::vector< adtf_file::Stream > getStreams() const override
Get the Streams.
void setConfiguration(const adtf_file::Configuration &configuration) override
uint32_t getFileVersion() const override
const adtf_file::Configuration & getConfiguration() const override
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
namespace for ADTF DAT Processing library.
Definition ddl_helpers.h:38