helics  2.8.1
Public Member Functions | Friends | List of all members
helics::data_block Class Reference

#include <core-data.hpp>

Public Member Functions

 data_block ()=default
 
 ~data_block ()=default
 
 data_block (size_t blockSize)
 
 data_block (size_t blockSize, char init)
 
 data_block (const data_block &db)=default
 
 data_block (data_block &&db)=default
 
 data_block (const char *s)
 
 data_block (const std::string &str)
 
 data_block (std::string &&str) noexcept
 
 data_block (const char *s, size_t len)
 
 data_block (const std::vector< char > &vdata)
 
template<class X >
 data_block (const std::vector< X > &vdata)
 
data_blockoperator= (const data_block &db)=default
 
data_blockoperator= (data_block &&db)=default
 
data_blockoperator= (std::string str)
 
data_blockoperator= (const char *s)
 
data_blockassign (const char *s, size_t len)
 
void swap (data_block &db2) noexcept
 
void append (const char *s, size_t len)
 
void append (const std::string &str)
 
bool operator== (const data_block &db) const
 
bool operator== (const std::string &str) const
 
bool operator< (const data_block &db) const
 
bool operator> (const data_block &db) const
 
char * data ()
 
const char * data () const
 
bool empty () const noexcept
 
size_t size () const
 
void resize (size_t newSize)
 
void resize (size_t newSize, char T)
 
void reserve (size_t space)
 
const std::string & to_string () const
 
char & operator[] (int index)
 
char operator[] (int index) const
 
auto begin ()
 
auto end ()
 
auto cbegin () const
 
auto cend () const
 
void push_back (char newchar)
 

Friends

class data_view
 let data view access the string directly
 
class ActionMessage
 let action Message access the string directly
 

Detailed Description

basic data object for use in the user API layer

An adapter over a string, many objects will be strings actually so this is just a wrapper for that common use case, and many other objects are small, so the small string optimization takes advantage of that

Constructor & Destructor Documentation

◆ data_block() [1/11]

helics::data_block::data_block ( )
default

default constructor

◆ ~data_block()

helics::data_block::~data_block ( )
default

default destructor

◆ data_block() [2/11]

helics::data_block::data_block ( size_t  blockSize)
inlineexplicit

size allocation constructor

◆ data_block() [3/11]

helics::data_block::data_block ( size_t  blockSize,
char  init 
)
inline

size and data

◆ data_block() [4/11]

helics::data_block::data_block ( const data_block db)
default

copy constructor

◆ data_block() [5/11]

helics::data_block::data_block ( data_block &&  db)
default

move constructor

◆ data_block() [6/11]

helics::data_block::data_block ( const char *  s)
inline

construct from char *

◆ data_block() [7/11]

helics::data_block::data_block ( const std::string &  str)
inline

construct from string

◆ data_block() [8/11]

helics::data_block::data_block ( std::string &&  str)
inlinenoexcept

move from string

◆ data_block() [9/11]

helics::data_block::data_block ( const char *  s,
size_t  len 
)
inline

char * and length

◆ data_block() [10/11]

helics::data_block::data_block ( const std::vector< char > &  vdata)
inline

construct from a vector object

◆ data_block() [11/11]

template<class X >
helics::data_block::data_block ( const std::vector< X > &  vdata)
inline

construct from an arbitrary vector

Member Function Documentation

◆ append() [1/2]

void helics::data_block::append ( const char *  s,
size_t  len 
)
inline

append the existing data with a additional data

◆ append() [2/2]

void helics::data_block::append ( const std::string &  str)
inline

append the existing data with a string

◆ assign()

data_block& helics::data_block::assign ( const char *  s,
size_t  len 
)
inline

assignment from string and length

References assign().

Referenced by assign(), and operator=().

◆ begin()

auto helics::data_block::begin ( )
inline

non const iterator

◆ cbegin()

auto helics::data_block::cbegin ( ) const
inline

const iterator

◆ cend()

auto helics::data_block::cend ( ) const
inline

const iterator end

◆ data() [1/2]

char* helics::data_block::data ( )
inline

return a pointer to the data

◆ data() [2/2]

const char* helics::data_block::data ( ) const
inline

if the object is const return a const pointer

◆ empty()

bool helics::data_block::empty ( ) const
inlinenoexcept

check if the block is empty

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

◆ end()

auto helics::data_block::end ( )
inline

non const iterator end

◆ operator<()

bool helics::data_block::operator< ( const data_block db) const
inline

less then operator to order the data_blocks if need be

◆ operator=() [1/4]

data_block& helics::data_block::operator= ( const char *  s)
inline

assign the data block from a const char *

References assign().

◆ operator=() [2/4]

data_block& helics::data_block::operator= ( const data_block db)
default

copy assignment operator

◆ operator=() [3/4]

data_block& helics::data_block::operator= ( data_block &&  db)
default

move assignment operator

◆ operator=() [4/4]

data_block& helics::data_block::operator= ( std::string  str)
inline

assign from a string

◆ operator==() [1/2]

bool helics::data_block::operator== ( const data_block db) const
inline

equality operator with another data block

◆ operator==() [2/2]

bool helics::data_block::operator== ( const std::string &  str) const
inline

equality operator with a string

◆ operator>()

bool helics::data_block::operator> ( const data_block db) const
inline

less then operator to order the data_blocks if need be

◆ operator[]() [1/2]

char& helics::data_block::operator[] ( int  index)
inline

bracket operator to get a character value

◆ operator[]() [2/2]

char helics::data_block::operator[] ( int  index) const
inline

bracket operator to get a character value

◆ push_back()

void helics::data_block::push_back ( char  newchar)
inline

add a character to the data

◆ reserve()

void helics::data_block::reserve ( size_t  space)
inline

reserve space in a data_block

◆ resize() [1/2]

void helics::data_block::resize ( size_t  newSize)
inline

resize the data storage

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

◆ resize() [2/2]

void helics::data_block::resize ( size_t  newSize,
char  T 
)
inline

resize the data storage

◆ size()

size_t helics::data_block::size ( ) const
inline

get the size of the data block

◆ swap()

void helics::data_block::swap ( data_block db2)
inlinenoexcept

swap function

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

◆ to_string()

const std::string& helics::data_block::to_string ( ) const
inline

get a string reference

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


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