PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
kcenon::pacs::network::pooled_buffer Class Reference

Pooled byte buffer for PDU data. More...

#include <pdu_buffer_pool.h>

Collaboration diagram for kcenon::pacs::network::pooled_buffer:
Collaboration graph

Public Member Functions

 pooled_buffer ()=default
 
void clear () noexcept
 Clear the buffer contents (keeps capacity)
 
void resize (std::size_t new_size)
 Resize the buffer.
 
void reserve (std::size_t capacity)
 Reserve capacity.
 
auto size () const noexcept -> std::size_t
 Get the current size.
 
auto capacity () const noexcept -> std::size_t
 Get the current capacity.
 
auto data () noexcept -> uint8_t *
 Get raw pointer to data.
 
auto data () const noexcept -> const uint8_t *
 Get const raw pointer to data.
 
auto vector () noexcept -> std::vector< uint8_t > &
 Get reference to underlying vector.
 
auto vector () const noexcept -> const std::vector< uint8_t > &
 Get const reference to underlying vector.
 
auto operator[] (std::size_t index) -> uint8_t &
 Array access operator.
 
auto operator[] (std::size_t index) const -> const uint8_t &
 Const array access operator.
 

Private Attributes

std::vector< uint8_t > data_
 

Detailed Description

Pooled byte buffer for PDU data.

Wraps a std::vector<uint8_t> with pooled allocation semantics. The buffer can be resized without reallocating if the capacity is sufficient.

Definition at line 75 of file pdu_buffer_pool.h.

Constructor & Destructor Documentation

◆ pooled_buffer()

kcenon::pacs::network::pooled_buffer::pooled_buffer ( )
default

Member Function Documentation

◆ capacity()

auto kcenon::pacs::network::pooled_buffer::capacity ( ) const -> std::size_t
inlinenodiscardnoexcept

Get the current capacity.

Returns
Capacity in bytes
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/pdu_buffer_pool.h.

Definition at line 108 of file pdu_buffer_pool.h.

108 {
109 return data_.capacity();
110 }

References data_.

Referenced by reserve().

Here is the caller graph for this function:

◆ clear()

void kcenon::pacs::network::pooled_buffer::clear ( )
inlinenoexcept

Clear the buffer contents (keeps capacity)

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/pdu_buffer_pool.h.

Definition at line 82 of file pdu_buffer_pool.h.

82{ data_.clear(); }

References data_.

◆ data() [1/2]

auto kcenon::pacs::network::pooled_buffer::data ( ) const -> const uint8_t*
inlinenodiscardnoexcept

Get const raw pointer to data.

Returns
Const pointer to data

Definition at line 122 of file pdu_buffer_pool.h.

122 {
123 return data_.data();
124 }

References data_.

◆ data() [2/2]

auto kcenon::pacs::network::pooled_buffer::data ( ) -> uint8_t*
inlinenodiscardnoexcept

Get raw pointer to data.

Returns
Pointer to data
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/pdu_buffer_pool.h.

Definition at line 116 of file pdu_buffer_pool.h.

116{ return data_.data(); }

References data_.

◆ operator[]() [1/2]

auto kcenon::pacs::network::pooled_buffer::operator[] ( std::size_t index) -> uint8_t&
inlinenodiscard

Array access operator.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/pdu_buffer_pool.h.

Definition at line 145 of file pdu_buffer_pool.h.

145 {
146 return data_[index];
147 }

References data_.

◆ operator[]() [2/2]

auto kcenon::pacs::network::pooled_buffer::operator[] ( std::size_t index) const -> const uint8_t&
inlinenodiscard

Const array access operator.

Definition at line 152 of file pdu_buffer_pool.h.

152 {
153 return data_[index];
154 }

References data_.

◆ reserve()

void kcenon::pacs::network::pooled_buffer::reserve ( std::size_t capacity)
inline

Reserve capacity.

Parameters
capacityCapacity to reserve
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/pdu_buffer_pool.h.

Definition at line 94 of file pdu_buffer_pool.h.

94{ data_.reserve(capacity); }
auto capacity() const noexcept -> std::size_t
Get the current capacity.

References capacity(), and data_.

Here is the call graph for this function:

◆ resize()

void kcenon::pacs::network::pooled_buffer::resize ( std::size_t new_size)
inline

Resize the buffer.

Parameters
new_sizeNew size in bytes
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/pdu_buffer_pool.h.

Definition at line 88 of file pdu_buffer_pool.h.

88{ data_.resize(new_size); }

References data_.

◆ size()

auto kcenon::pacs::network::pooled_buffer::size ( ) const -> std::size_t
inlinenodiscardnoexcept

Get the current size.

Returns
Size in bytes
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/pdu_buffer_pool.h.

Definition at line 100 of file pdu_buffer_pool.h.

100 {
101 return data_.size();
102 }

References data_.

◆ vector() [1/2]

auto kcenon::pacs::network::pooled_buffer::vector ( ) const -> const std::vector<uint8_t>&
inlinenodiscardnoexcept

Get const reference to underlying vector.

Returns
Const reference to vector

Definition at line 138 of file pdu_buffer_pool.h.

138 {
139 return data_;
140 }

References data_.

◆ vector() [2/2]

auto kcenon::pacs::network::pooled_buffer::vector ( ) -> std::vector<uint8_t>&
inlinenodiscardnoexcept

Get reference to underlying vector.

Returns
Reference to vector
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/pdu_buffer_pool.h.

Definition at line 130 of file pdu_buffer_pool.h.

130 {
131 return data_;
132 }

References data_.

Member Data Documentation

◆ data_

std::vector<uint8_t> kcenon::pacs::network::pooled_buffer::data_
private

The documentation for this class was generated from the following file: