22 class BufferAccumulator;
108 size_t elements(
void)
const;
115 void setElements(
const size_t numElements);
132 size_t getAlias(
void)
const;
139 size_t getEnd(
void)
const;
145 template <
typename ElementType>
146 ElementType as(
void)
const;
152 bool unique(
void)
const;
158 size_t useCount(
void)
const;
164 explicit operator bool(
void)
const;
173 template<
class Archive>
174 void serialize(Archive & ar,
const unsigned int version);
204 std::pair<BufferChunk, BufferChunk> convertComplex(
const DType &dtype,
const size_t numElems = 0)
const;
215 size_t convert(
const BufferChunk &outBuff,
const size_t numElems = 0)
const;
227 size_t convertComplex(
const BufferChunk &outBuffRe,
const BufferChunk &outBuffIm,
const size_t numElems = 0)
const;
233 void _incrNextBuffers(
void);
234 void _decrNextBuffers(
void);
272 length(dtype.size()*numElems),
281 address(buffer.getAddress()),
282 length(buffer.getLength()),
290 address(buffer.getBuffer().getAddress()),
291 length(buffer.getBuffer().getLength()),
292 _buffer(buffer.getBuffer()),
293 _managedBuffer(buffer),
300 address(other.address),
301 length(other.length),
303 _buffer(other._buffer),
304 _managedBuffer(other._managedBuffer)
310 address(std::move(other.address)),
311 length(std::move(other.length)),
312 dtype(std::move(other.dtype)),
313 _buffer(std::move(other._buffer)),
314 _managedBuffer(std::move(other._managedBuffer)),
315 _nextBuffers(std::move(other._nextBuffers))
317 other._nextBuffers = 0;
331 _buffer = other._buffer;
332 _managedBuffer = other._managedBuffer;
340 address = std::move(other.address);
341 length = std::move(other.length);
342 dtype = std::move(other.dtype);
343 _buffer = std::move(other._buffer);
344 _managedBuffer = std::move(other._managedBuffer);
345 _nextBuffers = std::move(other._nextBuffers);
346 other._nextBuffers = 0;
357 _managedBuffer.reset();
363 return this->length/this->dtype.size();
368 this->length = numElements*this->dtype.size();
378 return _managedBuffer;
383 if (_buffer.getAlias() == 0)
return 0;
384 if (address > _buffer.getAlias())
return address - _buffer.getLength();
385 else return address + _buffer.getLength();
390 return address + length;
393 template <
typename ElementType>
396 return reinterpret_cast<ElementType
>(address);
399 inline Pothos::BufferChunk::operator bool(
void)
const
401 return (address != 0) or bool(_buffer);
406 return this->useCount() == 1;
411 if (_managedBuffer)
return _managedBuffer.useCount();
412 return _buffer.useCount();
Definition: BufferAccumulator.hpp:31
size_t elements(void) const
Definition: BufferChunk.hpp:361
const SharedBuffer & getBuffer(void) const
Definition: BufferChunk.hpp:371
#define POTHOS_API
Definition: Config.hpp:41
ElementType as(void) const
Definition: BufferChunk.hpp:394
size_t getEnd(void) const
Definition: BufferChunk.hpp:388
size_t getAlias(void) const
Definition: BufferChunk.hpp:381
bool operator==(const ManagedBuffer &lhs, const ManagedBuffer &rhs)
Definition: ManagedBuffer.hpp:261
bool unique(void) const
Definition: BufferChunk.hpp:404
Definition: ManagedBuffer.hpp:31
size_t getAddress(void) const
Get the address of the first byte of the buffer.
Definition: SharedBuffer.hpp:129
size_t useCount(void) const
Definition: BufferChunk.hpp:409
BufferChunk(void)
Definition: BufferChunk.hpp:253
void setElements(const size_t numElements)
Definition: BufferChunk.hpp:366
void clear(void)
Definition: BufferChunk.hpp:350
BufferChunk & operator=(const BufferChunk &other)
BufferChunk copy assignment operator.
Definition: BufferChunk.hpp:325
void serialize(Archive &, Pothos::Detail::ObjectContainer &, const unsigned int)
Definition: Serialize.hpp:46
~BufferChunk(void)
BufferChunk destructor.
Definition: BufferChunk.hpp:320
Definition: SharedBuffer.hpp:21
const ManagedBuffer & getManagedBuffer(void) const
Definition: BufferChunk.hpp:376
DType dtype
Definition: BufferChunk.hpp:102
Definition: BufferChunk.hpp:30
size_t length
Definition: BufferChunk.hpp:97
size_t address
Definition: BufferChunk.hpp:92