27class MutableBuffer :
public BufferBase {
29 MutableBuffer() =
default;
35 void *
data()
const {
return data_; }
40 size_t size()
const {
return size_; }
43 void *data_ =
nullptr;
50class ConstBuffer :
public BufferBase {
52 ConstBuffer() =
default;
65 const void *
data()
const {
return data_; }
70 size_t size()
const {
return size_; }
73 const void *data_ =
nullptr;
99template <
typename PodType,
size_t N>
101 return MutableBuffer(
static_cast<void *
>(arr),
sizeof(PodType) * N);
107template <
typename PodType,
size_t N>
109 return ConstBuffer(
static_cast<const void *
>(arr),
sizeof(PodType) * N);
115template <
typename PodType,
size_t N>
117 return MutableBuffer(
static_cast<void *
>(arr.data()),
sizeof(PodType) * N);
123template <
typename PodType,
size_t N>
125 return ConstBuffer(
static_cast<const void *
>(arr.data()),
126 sizeof(PodType) * N);
132template <
typename PodType>
135 sizeof(PodType) * vec.size());
141template <
typename PodType>
143 return ConstBuffer(
static_cast<const void *
>(vec.data()),
144 sizeof(PodType) * vec.size());
151 return MutableBuffer(
static_cast<void *
>(str.data()), str.size());
158 return ConstBuffer(
static_cast<const void *
>(str.data()), str.size());
165 return ConstBuffer(
static_cast<const void *
>(strv.data()), strv.size());
178template <
typename PodType,
size_t N>
180 return ConstBuffer(
static_cast<const void *
>(sp.data()),
181 sp.size() *
sizeof(PodType));
187template <
typename PodType,
size_t N>
190 sp.size() *
sizeof(PodType));
size_t size() const
Get the byte size of the buffer.
const void * data() const
Get the data of the buffer.
void * data() const
Get the data of the buffer.
size_t size() const
Get the byte size of the buffer.
The main namespace for the Condy library.
MutableBuffer buffer(void *data, size_t size)
Create a buffer object from various data sources.