17#ifndef AGXDATA_BYTESTREAM_H
18#define AGXDATA_BYTESTREAM_H
60 size_t getCurrentOffset()
const;
78 BytePtr popBytes(
size_t numBytes);
84 void consume(
const T& value);
90 void write(
const T& value);
95 void write(
const Byte *buffer,
size_t numBytes);
96 void write(
const char *buffer,
size_t numBytes);
101 void read(
Byte *buffer,
size_t numBytes);
102 void read(
char *buffer,
size_t numBytes);
143 template <
typename T>
146 agxVerify((
size_t)(m_end - m_head) >=
sizeof(T));
148 ::memcpy((
void *)&element, (
const void *)m_head,
sizeof(T));
152 template <
typename T>
155 T element = this->topElement<T>();
161 template <
typename T>
164 T element = this->popElement<T>();
168 template <
typename T>
171 agxVerify((
size_t)(m_end - m_head) >=
sizeof(T));
172 ::memcpy((
void *)m_head, (
const void *)&value,
sizeof(T));
178 agxVerify((
size_t)(m_end-m_head) >= numBytes);
187 agxVerify((
size_t)(m_end-m_head) >= numBytes);
188 ::memcpy((
void *)m_head, (
const void *)buffer, numBytes);
194 this->
write((
const Byte *)buffer, numBytes);
199 agxVerify((
size_t)(m_end-m_head) >= numBytes);
200 ::memcpy((
void *)buffer, (
const void *)m_head, numBytes);
206 this->
read((
Byte *)buffer, numBytes);
AGXCORE_EXPORT agx::String operator+(const std::string &str, const agx::Name &name)
Utility class for parsing/writing a byte stream.
void read(Byte *buffer, size_t numBytes)
Read a buffer.
void consume(const T &value)
Consume an expected value from the stream.
size_t getCurrentOffset() const
BytePtr popBytes(size_t numBytes)
ByteStream operator+(size_t offset) const
void write(const T &value)
Write a value to the head of the stream and advance the head.
ByteStream & operator+=(size_t offset)
Contains classes for low level data storage for AGX.