8#ifndef META_OCEAN_IO_SERIALIZATION_OUTPUT_DATA_SERIALIZER_H
9#define META_OCEAN_IO_SERIALIZATION_OUTPUT_DATA_SERIALIZER_H
20namespace Serialization
169 inline explicit FileStream(
const std::string& filename);
188 inline bool isValid()
const override;
224 stream_(filename.c_str(), std::ios::binary),
225 outputBitstream_(stream_)
238 return outputBitstream_;
This class implements an output bitstream.
Definition Bitstream.h:215
This class implements the base class for data serializers.
Definition DataSerializer.h:36
std::unordered_map< ChannelConfiguration, ChannelId, ChannelConfiguration::Hash > ChannelConfigurationMap
Definition of a map mapping channel configurations to channel ids.
Definition DataSerializer.h:208
uint32_t ChannelId
Definition of a channel id.
Definition DataSerializer.h:40
This class implements a file stream for file output data serializers.
Definition OutputDataSerializer.h:162
OutputBitstream outputBitstream_
The output bitstream.
Definition OutputDataSerializer.h:196
bool isValid() const override
Returns whether this stream is valid.
Definition OutputDataSerializer.h:241
OutputBitstream & outputBitstream() override
Returns the output bitstream.
Definition OutputDataSerializer.h:236
~FileStream() override
Destructs the file stream.
Definition OutputDataSerializer.h:231
std::ofstream stream_
The file stream.
Definition OutputDataSerializer.h:193
FileStream(const std::string &filename)
Creates a new file stream with given filename.
Definition OutputDataSerializer.h:223
This class implements a file-based output data serializer.
Definition OutputDataSerializer.h:155
std::string filename_
The filename of the file to write.
Definition OutputDataSerializer.h:220
UniqueStream createStream() const override
Creates the output stream.
virtual bool setFilename(const std::string &filename)
Sets the filename of the file to write.
This class implements an abstract stream for output data serializers.
Definition OutputDataSerializer.h:36
virtual ~Stream()=default
Destructs the stream.
virtual OutputBitstream & outputBitstream()=0
Returns the output bitstream.
virtual bool isValid() const =0
Returns whether this stream is valid.
This class implements an output data serializer.
Definition OutputDataSerializer.h:29
void threadRun() override
The thread run function.
UniqueStream stream_
The output stream.
Definition OutputDataSerializer.h:138
bool addSample(const DataSerializer::ChannelId channelId, UniqueDataSample &&sample)
Adds a new sample to the serializer.
DataSerializer::ChannelId addChannel(const std::string &sampleType, const std::string &name, const std::string &contentType)
Adds a new channel to the serializer.
std::queue< SamplePair > SampleQueue
Definition of a FIFO queue holding sample pairs.
Definition OutputDataSerializer.h:61
SampleQueue sampleQueue_
The queue holding samples which are pending to be written.
Definition OutputDataSerializer.h:147
ChannelConfigurationMap channelConfigurationMap_
The map mapping channel configurations to channel ids.
Definition OutputDataSerializer.h:144
bool start() override
Starts the serializer.
bool hasFinished() const override
Returns whether the serializer has stopped and all remaining samples have been processed.
bool stop() override
Stops the serializer.
virtual UniqueStream createStream() const =0
Creates the output stream.
ChannelId nextChannelId_
The next channel id to be assigned.
Definition OutputDataSerializer.h:141
virtual bool writeHeader(OutputBitstream &outputBitstream)
Writes the header to the output bitstream.
bool isStarted() const override
Returns whether the serializer has been started.
std::unique_ptr< Stream > UniqueStream
Definition of a unique pointer holding a stream.
Definition OutputDataSerializer.h:58
std::unique_ptr< DataSample > UniqueDataSample
Definition of a unique pointer holding a DataSample.
Definition DataSample.h:39
The namespace covering the entire Ocean framework.
Definition Accessor.h:15