11#include <Sawyer/Sawyer.h>
12#include <Sawyer/SharedPointer.h>
22template<
class A,
class T>
30#ifdef SAWYER_HAVE_BOOST_SERIALIZATION
32 friend class boost::serialization::access;
35 void serialize(S &s,
const unsigned ) {
36 s & BOOST_SERIALIZATION_NVP(name_);
37 s & BOOST_SERIALIZATION_NVP(copyOnWrite_);
41#ifdef SAWYER_HAVE_CEREAL
43 friend class cereal::access;
45 template<
class Archive>
46 void CEREAL_SAVE_FUNCTION_NAME(Archive &archive)
const {
47 archive(CEREAL_NVP(name_));
48 archive(CEREAL_NVP(copyOnWrite_));
51 template<
class Archive>
52 void CEREAL_LOAD_FUNCTION_NAME(Archive &archive) {
53 archive(CEREAL_NVP(name_));
54 archive(CEREAL_NVP(copyOnWrite_));
111 const std::string&
name()
const {
return name_; }
112 void name(
const std::string &s) { name_ = s; }
Base class for all buffers.
void name(const std::string &s)
Property: Name.
virtual Ptr copy() const =0
Create a new copy of buffer data.
virtual void sync()
Synchronize buffer with persistent storage.
virtual Address read(Value *buf, Address address, Address n) const =0
Reads data from a buffer.
void copyOnWrite(bool b)
Property: Copy on write.
A Address
Key type for addressing data.
virtual Address size() const
Size of buffer.
SharedPointer< Buffer > Ptr
Reference counting smart pointer.
virtual const Value * data() const =0
Data for the buffer.
virtual Address available(Address address) const =0
Distance to end of buffer.
T Value
Type of values stored in the buffer.
bool copyOnWrite() const
Property: Copy on write.
virtual Address write(const Value *buf, Address address, Address n)=0
Writes data to a buffer.
virtual void resize(Address n)=0
Change the size of the buffer.
const std::string & name() const
Property: Name.
Base class for reference counted objects.
Reference-counting intrusive smart pointer.
std::string generateSequentialName(size_t length=3)
Generate a sequential name.