|
Open Model Railroad Network (OpenMRN)
|
Specialization of the Buffer class that is designed for storing untyped data arrays. More...
#include <DataBuffer.hxx>
Public Member Functions | |
| void | set_size (uint16_t s) |
| Overrides the size of the data buffer. | |
| void | set_next (DataBuffer *n) |
| Sets the linking pointer of the DataBuffer to a target buffer. | |
| DataBuffer * | next () |
| uint8_t * | data () |
| DataBuffer * | ref () |
| DataBuffer * | ref_all (unsigned total_size, DataBuffer **tail=nullptr, unsigned *tail_size=nullptr) |
| Acquires one reference to all blocks of this buffer. | |
| void | unref_all (unsigned total_size) |
| Releases one reference to all blocks of this buffer. | |
| DataBuffer * | get_read_pointer (unsigned skip, uint8_t **ptr, unsigned *available) |
| Helper function to read out data from a linked data buffer. | |
Public Member Functions inherited from Buffer< uint8_t[]> | |
| Buffer< uint8_t > * | ref () |
| Add another reference to the buffer. | |
| void | unref () |
| Decrement count. | |
| uint8_t * | data () |
| get a pointer to the start of the data. | |
Public Member Functions inherited from BufferBase | |
| uint16_t | references () |
| void | set_done (BarrierNotifiable *done) |
| Specifies that a given BarrierNotifiable must be called when the Buffer is deallocated (unreffed to zero, meaning that all owners have freed it). | |
| BarrierNotifiable * | new_child () |
| Creates a new child notifiable of the current done notifiable. | |
| size_t | size () |
Public Member Functions inherited from QMember | |
| void | init () |
| Initiailize a QMember, in place of a public placement construction. | |
Private Member Functions | |
| DataBuffer (DataBufferPool *p) | |
Friends | |
| class | DataBufferPool |
Additional Inherited Members | |
Public Types inherited from Buffer< uint8_t[]> | |
| typedef uint8_t | value_type |
| The type of payload this buffer contains. | |
Protected Member Functions inherited from BufferBase | |
| Pool * | pool () |
| Get a pointer to the pool that this buffer belongs to. | |
| BufferBase (size_t size, Pool *pool) | |
| Constructor. | |
| ~BufferBase () | |
| Destructor. | |
| DISALLOW_COPY_AND_ASSIGN (BufferBase) | |
Protected Member Functions inherited from QMember | |
| QMember () | |
| Constructor. | |
| ~QMember () | |
| Destructor. | |
Protected Attributes inherited from BufferBase | |
| Pool * | pool_ |
| Reference to the pool from whence this buffer came. | |
| BarrierNotifiable * | done_ |
| Notifiable to call when the buffer has finished processing everywhere. | |
| uint16_t | size_ |
| size of data in bytes | |
| std::atomic_uint_least16_t | count_ |
| number of references in use | |
Protected Attributes inherited from QMember | |
| QMember * | next |
| pointer to the next member in the queue | |
Specialization of the Buffer class that is designed for storing untyped data arrays.
Adds the ability to treat the next pointers as links to consecutive data bytes, ref'ing and unref'ing a sequence of buffers in one go.
Definition at line 58 of file DataBuffer.hxx.
|
inlineprivate |
Definition at line 194 of file DataBuffer.hxx.
|
inline |
Definition at line 84 of file DataBuffer.hxx.
|
inline |
Helper function to read out data from a linked data buffer.
| skip | this is how many bytes from the beginning of the buffer will be skipped. |
| ptr | will be set to the pointer to the first non-skipped byte. |
| available | will contain the number of available consecutive bytes to read from that point on. |
Definition at line 165 of file DataBuffer.hxx.
|
inline |
Definition at line 78 of file DataBuffer.hxx.
|
inline |
Definition at line 90 of file DataBuffer.hxx.
|
inline |
Acquires one reference to all blocks of this buffer.
| total_size | the number of bytes starting from the beginning of *this. |
| tail | if non-null, will save the pointer to the tail buffer there. |
| tail_size | if non-null, will save the number of bytes that are in the tail buffer. |
Definition at line 102 of file DataBuffer.hxx.
|
inline |
Sets the linking pointer of the DataBuffer to a target buffer.
| n | next buffer to link to. |
Definition at line 72 of file DataBuffer.hxx.
|
inline |
Overrides the size of the data buffer.
The semantic meaning of the size() of DataBuffer is the number of bytes that are filled in inside data().
| s | new value of size. |
Definition at line 65 of file DataBuffer.hxx.
|
inline |
Releases one reference to all blocks of this buffer.
This includes one reference to the last block which may be a partially filled buffer. Calling with zero length will call release on the head block.
| total_size | the number of bytes starting from the beginning of *this. |
Definition at line 136 of file DataBuffer.hxx.
|
friend |
Definition at line 192 of file DataBuffer.hxx.