| helics 3.6.1

Public Member Functions | Public Attributes | List of all members
helics::SmallBuffer Class Reference

## Public Member Functions
| SmallBuffer (const SmallBuffer &sb)
| SmallBuffer (SmallBuffer &&sb) noexcept
template<typename U , typename T = std::enable_if_t<std::is_constructible_v<std::string_view, U>>>
| SmallBuffer (U &&u)
| SmallBuffer (const void *data, size_t size)
| SmallBuffer (std::size_t size)
| SmallBuffer (std::size_t size, std::byte val)
| SmallBuffer (std::size_t size, unsigned char val)
| ~SmallBuffer ()
SmallBuffer & | operator= (const SmallBuffer &sb)
SmallBuffer & | operator= (SmallBuffer &&sb) noexcept
template<typename U , typename T = std::enable_if_t<std::is_constructible_v<std::string_view, U>>>
SmallBuffer & | operator= (U &&u)
std::byte * | data () const
std::byte * | begin ()
std::byte * | end ()
const std::byte * | begin () const
const std::byte * | end () const
std::byte | operator[] (size_t index) const
std::byte & | operator[] (size_t index)
std::byte | at (size_t index) const
std::byte & | at (size_t index)
void | assign (const void *start, const void *end)
void | assign (const void *start, std::size_t size)
void | append (const void *start, const void *end)
void | append (const void *start, std::size_t size)
void | append (std::string_view data)
void | push_back (char c)
void | pop_back ()
std::string_view | to_string () const
void | null_terminate ()
const char * | char_data () const
void | moveAssign (void *data, std::size_t size, std::size_t capacity)
void | spanAssign (void *data, std::size_t size, std::size_t capacity)
void | resize (size_t size)
void | resize (size_t size, std::byte val)
void | reserve (size_t size)
void | lock (bool lockStatus=true)
bool | isLocked () const
std::int8_t | errorState () const
bool | empty () const
std::size_t | size () const
std::size_t | capacity () const
void | clear ()
void | swap (SmallBuffer &sb2) noexcept
std::byte * | release ()

## Public Attributes
std::uint32_t | userKey {0}

## Constructor & Destructor Documentation

## ◆ SmallBuffer() [1/3]

helics::SmallBuffer::SmallBuffer | ( | std::size_t | size | ) |
| inline explicit

create a buffer with a specific size

References size().

## ◆ SmallBuffer() [2/3]

helics::SmallBuffer::SmallBuffer | ( | std::size_t | size,
|  | std::byte | val
| ) |  |
| inline

create a buffer with a specific size and contents

References size().

## ◆ SmallBuffer() [3/3]

helics::SmallBuffer::SmallBuffer | ( | std::size_t | size,
|  | unsigned char | val
| ) |  |
| inline

create a buffer with a specific size and contents

References size().

## ◆ ~SmallBuffer()

helics::SmallBuffer::~SmallBuffer | ( |  | ) |
| inline

destructor

## Member Function Documentation

## ◆ assign()

void helics::SmallBuffer::assign | ( | const void * | start,
|  | const void * | end
| ) |  |
| inline

assign some data to the SmallBuffer

References end().

Referenced by helics::PublicationInfo::CheckSetValue(), helics::ActionMessage::fromByteArray(), helics::CommonCore::send(), helics::CommonCore::sendAt(), helics::CommonCore::sendTo(), helics::CommonCore::sendToAt(), and helics::CommonCore::setValue().

## ◆ at() [1/2]

std::byte& helics::SmallBuffer::at | ( | size_t | index | ) |
| inline

get a value reference at a particular index with bounds checking

## ◆ at() [2/2]

std::byte helics::SmallBuffer::at | ( | size_t | index | ) | const
| inline

get the value at a particular index with bounds checking

## ◆ begin() [1/2]

std::byte* helics::SmallBuffer::begin | ( |  | ) |
| inline

get the start of the data

## ◆ begin() [2/2]

const std::byte* helics::SmallBuffer::begin | ( |  | ) | const
| inline

get a const iterator

## ◆ capacity()

std::size_t helics::SmallBuffer::capacity | ( |  | ) | const
| inline

get the current capacity of the buffer

Referenced by moveAssign(), and spanAssign().

## ◆ char_data()

const char* helics::SmallBuffer::char_data | ( |  | ) | const
| inline

get a pointer to the data as a `char *`

## ◆ clear()

void helics::SmallBuffer::clear | ( |  | ) |
| inline

clear the buffer

## ◆ data()

std::byte* helics::SmallBuffer::data | ( |  | ) | const
| inline

return a pointer to the data location

Referenced by moveAssign(), spanAssign(), helics::ActionMessage::to_json_string(), and helics::ActionMessage::toByteArray().

## ◆ empty()

bool helics::SmallBuffer::empty | ( |  | ) | const
| inline

check if the buffer is empty

Referenced by helics::Message::isValid().

## ◆ end() [1/2]

std::byte* helics::SmallBuffer::end | ( |  | ) |
| inline

end iterator

Referenced by assign().

## ◆ end() [2/2]

const std::byte* helics::SmallBuffer::end | ( |  | ) | const
| inline

get a const end iterator

## ◆ errorState()

std::int8_t helics::SmallBuffer::errorState | ( |  | ) | const
| inline

get the error condition

## ◆ moveAssign()

void helics::SmallBuffer::moveAssign | ( | void * | data,
|  | std::size_t | size,
|  | std::size_t | capacity
| ) |  |
| inline

move raw memory into the buffer and give it a preallocated buffer

References capacity(), data(), and size().

## ◆ null_terminate()

void helics::SmallBuffer::null_terminate | ( |  | ) |
| inline

ensure there is a null terminator after the last buffer character

## ◆ operator[]() [1/2]

std::byte& helics::SmallBuffer::operator[] | ( | size_t | index | ) |
| inline

get an assignable reference to an element

## ◆ operator[]() [2/2]

std::byte helics::SmallBuffer::operator[] | ( | size_t | index | ) | const
| inline

get an element

## ◆ release()

std::byte* helics::SmallBuffer::release | ( |  | ) |
| inline

release the memory from ownership

## ◆ size()

std::size_t helics::SmallBuffer::size | ( |  | ) | const
| inline

get the current size of the buffer

Referenced by moveAssign(), helics::prettyPrintString(), helics::ActionMessage::serializedByteCount(), SmallBuffer(), spanAssign(), helics::ActionMessage::to_json_string(), and helics::ActionMessage::toByteArray().

## ◆ spanAssign()

void helics::SmallBuffer::spanAssign | ( | void * | data,
|  | std::size_t | size,
|  | std::size_t | capacity
| ) |  |
| inline

use other managed memory

References capacity(), data(), and size().

## ◆ swap()

void helics::SmallBuffer::swap | ( | SmallBuffer & | sb2 | ) |
| inline noexcept

swap function

Referenced by helics::Message::swap().

## ◆ to_string()

std::string_view helics::SmallBuffer::to_string | ( |  | ) | const
| inline

interpret the data as a string

Referenced by helics::PublicationInfo::CheckSetValue(), helics::ActionMessage::from_json_string(), helics::ActionMessage::name(), helics::operator!=(), helics::operator==(), helics::BrokerBase::processBaseCommands(), helics::FederateState::sendCommand(), helics::ActionMessage::to_json_string(), and helics::Message::to_string().

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

- SmallBuffer.hpp