Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
|
Class for wrapping a raw pointer to a buffer of shared memory. More...
#include <cheetah/psrdada/detail/RawBytes.h>
Public Member Functions | |
RawBytes (char *ptr, std::size_t total, std::size_t used=0) | |
Create a new RawBytes instance. More... | |
RawBytes (RawBytes const &)=delete | |
std::size_t | total_bytes () const |
Get the total number of bytes in the buffer. | |
std::size_t | used_bytes () const |
Get the number of currently used bytes in the buffer. | |
void | used_bytes (std::size_t) |
Set the number of currently used bytes in the buffer. More... | |
char * | ptr () const |
Get a raw pointer to the start of the buffer. | |
Class for wrapping a raw pointer to a buffer of shared memory.
This class is used to wrap pointers to shared memory returned by calls to the lower-level DADA API.
This class is used to wrap buffers acquired by both reading and writing clients. For writing clients, it is necessary to set the number of bytes written using the used_bytes() method after writing. This value is used when releasing the buffer.
Definition at line 45 of file RawBytes.h.
ska::cheetah::psrdada::detail::RawBytes::RawBytes | ( | char * | ptr, |
std::size_t | total, | ||
std::size_t | used = 0 |
||
) |
Create a new RawBytes instance.
ptr | The pointer to the buffer to wrap | |
[in] | total | The total number of bytes in the buffer |
[in] | used | The number of bytes currently used in the buffer |
Definition at line 33 of file RawBytes.cpp.
void ska::cheetah::psrdada::detail::RawBytes::used_bytes | ( | std::size_t | used | ) |
Set the number of currently used bytes in the buffer.
For writing clients, this method should be called after all writes are complete so that the number of used_bytes can be passed to reading clients.
Definition at line 54 of file RawBytes.cpp.