Class StreamDataSerializer
Defined in File stream-data-serializer.h
Inheritance Relationships
Base Type
public gpa::serialization::MemoryBackedSerializer
(Class MemoryBackedSerializer)
Class Documentation
-
class StreamDataSerializer : public gpa::serialization::MemoryBackedSerializer
Public Functions
-
StreamDataSerializer(void const *buffer, uint64_t bufferLen)
-
~StreamDataSerializer()
-
virtual size_t WriteRawData(void const *src, size_t size) override
Writes the given raw data to the underlying data stream.
-
virtual size_t ReadRawData(void *dst, size_t size) override
Reads raw data from the current position in the underlying data stream into the given destination.
-
virtual bool EnsureWriteCapacity(size_t const size) override
Ensures that there is enough space available for writing to the underlying data stream.
- Returns
false if no space of the given size could be made available
-
virtual bool CheckAvailableData(size_t const size) const override
Checks if data is available for reading in the underlying data stream.
- Returns
true if data of the given size is available, false otherwise.
-
virtual void Clear() override
Resets the underlying memory stream such that it behaves as an empty one.
-
virtual bool Seek(int64_t offset, SeekOrigin origin = SeekOrigin::kBegin) override
Seeks to the offset in the buffer in bytes.
The offset is based on the given seek origin. A positive number is forward, a negative is backward. If the requested offset is out-of-bounds, the current position is unchanged.
- Returns
true on success and the current position is changed. TODO : allow Seek to resize buffer if outside buffer range
-
virtual size_t GetPosition() const override
Returns the offset the current read/write cursor is at.
See also
BufferSerializer::Seek
-
virtual uint64_t GetAbsolutePosition() const override
Access the offset of the current read/write cursor relative to the beginning of the underlying storage.
-
virtual void *Get(uint64_t offset) const override
Return a pointer to the address referenced by offset, relative to the start of the underlying storage.
- Parameters
offset -- Offset of memory address relative to start of storage
- Returns
If the offset refers to memory within the bounds of the storage as visible to the process, then the method returns a pointer to that memory; nullptr otherwise.
-
StreamDataSerializer(void const *buffer, uint64_t bufferLen)