8 #ifndef Sawyer_Buffer_H
9 #define Sawyer_Buffer_H
11 #include <Sawyer/Sawyer.h>
12 #include <Sawyer/SharedPointer.h>
13 #include <boost/serialization/access.hpp>
14 #include <boost/serialization/nvp.hpp>
24 template<
class A,
class T>
33 friend class boost::serialization::access;
36 void serialize(S &s,
const unsigned ) {
37 s & BOOST_SERIALIZATION_NVP(name_);
38 s & BOOST_SERIALIZATION_NVP(copyOnWrite_);
94 const std::string&
name()
const {
return name_; }
95 void name(
const std::string &s) { name_ = s; }
virtual void resize(Address n)=0
Change the size of the buffer.
void name(const std::string &s)
Property: Name.
virtual Address read(Value *buf, Address address, Address n) const =0
Reads data from a buffer.
virtual Address write(const Value *buf, Address address, Address n)=0
Writes data to a buffer.
virtual const Value * data() const =0
Data for the buffer.
const std::string & name() const
Property: Name.
SharedPointer< Buffer > Ptr
Reference counting smart pointer.
std::string generateSequentialName(size_t length=3)
Generate a sequential name.
void copyOnWrite(bool b)
Property: Copy on write.
virtual Address available(Address address) const =0
Distance to end of buffer.
virtual Ptr copy() const =0
Create a new copy of buffer data.
Base class for all buffers.
Reference-counting intrusive smart pointer.
Name space for the entire library.
Base class for reference counted objects.
virtual void sync()
Synchronize buffer with persistent storage.
A Address
Key type for addressing data.
virtual Address size() const
Size of buffer.
T Value
Type of values stored in the buffer.
bool copyOnWrite() const
Property: Copy on write.