INET Framework for OMNeT++/OMNEST
inet::SliceChunkSerializer Class Reference

#include <SliceChunkSerializer.h>

Inheritance diagram for inet::SliceChunkSerializer:
inet::ChunkSerializer

Public Member Functions

virtual void serialize (MemoryOutputStream &stream, const Ptr< const Chunk > &chunk, b offset, b length) const override
 Serializes a chunk into a stream by writing the bytes representing the chunk at the end of the stream. More...
 
virtual const Ptr< Chunkdeserialize (MemoryInputStream &stream, const std::type_info &typeInfo) const override
 Deserializes a chunk from a stream by reading the bytes at the current position of the stream. More...
 

Additional Inherited Members

- Static Public Attributes inherited from inet::ChunkSerializer
static b totalSerializedLength = b(0)
 
static b totalDeserializedLength = b(0)
 

Member Function Documentation

◆ deserialize()

const Ptr< Chunk > inet::SliceChunkSerializer::deserialize ( MemoryInputStream stream,
const std::type_info &  typeInfo 
) const
overridevirtual

Deserializes a chunk from a stream by reading the bytes at the current position of the stream.

The returned chunk will be an instance of the provided type. The current stream position is updated according to the length of the returned chunk.

Implements inet::ChunkSerializer.

24 {
25  throw cRuntimeError("Invalid operation");
26 }

◆ serialize()

void inet::SliceChunkSerializer::serialize ( MemoryOutputStream stream,
const Ptr< const Chunk > &  chunk,
b  offset,
b  length 
) const
overridevirtual

Serializes a chunk into a stream by writing the bytes representing the chunk at the end of the stream.

The offset and length parameters allow to write only a part of the data.

Implements inet::ChunkSerializer.

18 {
19  const auto& sliceChunk = staticPtrCast<const SliceChunk>(chunk);
20  Chunk::serialize(stream, sliceChunk->getChunk(), sliceChunk->getOffset() + offset, length == b(-1) ? sliceChunk->getLength() - offset : length);
21 }

The documentation for this class was generated from the following files:
inet::Chunk::serialize
static void serialize(MemoryOutputStream &stream, const Ptr< const Chunk > &chunk, b offset=b(0), b length=b(-1))
Serializes a chunk into the given stream.
Definition: Chunk.cc:175
inet::units::values::b
value< int64_t, units::b > b
Definition: Units.h:1241