8#ifndef META_OCEAN_IO_SERIALIZATION_OUTPUT_DATA_SERIALIZER_H
9#define META_OCEAN_IO_SERIALIZATION_OUTPUT_DATA_SERIALIZER_H
20namespace Serialization
163 inline explicit FileStream(
const std::string& filename);
182 inline bool isValid()
const override;
218 stream_(filename.c_str(), std::ios::binary),
219 outputBitstream_(stream_)
232 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:156
OutputBitstream outputBitstream_
The output bitstream.
Definition OutputDataSerializer.h:190
bool isValid() const override
Returns whether this stream is valid.
Definition OutputDataSerializer.h:235
OutputBitstream & outputBitstream() override
Returns the output bitstream.
Definition OutputDataSerializer.h:230
~FileStream() override
Destructs the file stream.
Definition OutputDataSerializer.h:225
std::ofstream stream_
The file stream.
Definition OutputDataSerializer.h:187
FileStream(const std::string &filename)
Creates a new file stream with given filename.
Definition OutputDataSerializer.h:217
This class implements a file-based output data serializer.
Definition OutputDataSerializer.h:149
std::string filename_
The filename of the file to write.
Definition OutputDataSerializer.h:214
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
bool hasStopped() const override
Returns whether the serializer has stopped.
void threadRun() override
The thread run function.
UniqueStream stream_
The output stream.
Definition OutputDataSerializer.h:135
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.
ChannelConfigurationMap channelConfigurationMap_
The map mapping channel configurations to channel ids.
Definition OutputDataSerializer.h:141
bool start() override
Starts the serializer.
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:138
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