8#ifndef Sawyer_NullBuffer_H
9#define Sawyer_NullBuffer_H
11#include <Sawyer/Buffer.h>
12#include <Sawyer/Sawyer.h>
21template<
class A,
class T>
31#ifdef SAWYER_HAVE_BOOST_SERIALIZATION
33 friend class boost::serialization::access;
38 void serialize(S &s,
const unsigned ) {
39 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Super);
40 s & BOOST_SERIALIZATION_NVP(size_);
44#ifdef SAWYER_HAVE_CEREAL
46 friend class cereal::access;
48 template<
class Archive>
49 void CEREAL_SAVE_FUNCTION_NAME(Archive &archive)
const {
50 archive(cereal::base_class<Super>());
51 archive(CEREAL_NVP(size_));
54 template<
class Archive>
55 void CEREAL_LOAD_FUNCTION_NAME(Archive &archive) {
56 archive(cereal::base_class<Super>());
57 archive(CEREAL_NVP(size_));
62 NullBuffer():
Super(
".NullBuffer"), size_(0) {}
78 return start < size_ ? size_ - start : 0;
Base class for all buffers.
virtual Address size() const
Size of buffer.
SharedPointer< Buffer > Ptr
Reference counting smart pointer.
const Value * data() const
Data for the buffer.
Address read(Value *buf, Address address, Address n) const
Reads data from a buffer.
Buffer< A, T >::Ptr copy() const
Create a new copy of buffer data.
Address write(const Value *, Address, Address)
Writes data to a buffer.
static Buffer< A, T >::Ptr instance(Address size)
Construct a new buffer.
void resize(Address newSize)
Change the size of the buffer.
Address available(Address start) const
Distance to end of buffer.
A Address
Type of addresses.
Buffer< A, T > Super
Type of base class.
Reference-counting intrusive smart pointer.