helics 3.7.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
helicscpp::DataBuffer Class Reference

Public Member Functions

 DataBuffer (int capacity)
 
 DataBuffer (HelicsDataBuffer buffer)
 
 DataBuffer (void *buffer, int32_t datasize, int32_t capacity)
 
 ~DataBuffer ()
 
void fill (double val)
 
void fill (int64_t val)
 
void fill (const std::string &val)
 
void fill (const char *val)
 
void fill (const std::vector< double > &val)
 
void fill (const std::complex< double > val)
 
void fill (const double *vals, int size)
 
void fill (const std::string &name, double val)
 
void fill (bool val)
 
void fill (char val)
 
HELICS_NODISCARD DataBuffer clone ()
 
HELICS_NODISCARD int size ()
 
HELICS_NODISCARD int capacity ()
 
HELICS_NODISCARD void * data ()
 
bool reserve (int32_t newCapacity)
 
HELICS_NODISCARD int stringSize ()
 
HELICS_NODISCARD int vectorSize ()
 
HELICS_NODISCARD int type () const
 
HELICS_NODISCARD bool isValid () const
 
HELICS_NODISCARD std::string toString ()
 
void toString (std::string &str)
 
void toNamedPoint (std::string &name, double *val)
 
HELICS_NODISCARD int64_t toInt ()
 
HELICS_NODISCARD bool toBoolean ()
 
HELICS_NODISCARD double toDouble ()
 
HELICS_NODISCARD std::complex< double > toComplex ()
 
int toVector (double *data, int maxlen)
 
void toVector (std::vector< double > &data)
 
int toComplexVector (double *data, int maxlen)
 
bool convertToType (int newDataType)
 
HELICS_NODISCARD HelicsDataBuffer getHelicsDataBuffer ()
 

Constructor & Destructor Documentation

◆ DataBuffer()

helicscpp::DataBuffer::DataBuffer ( HelicsDataBuffer  buffer)
inlineexplicit

create a dataBuffer object from an existing C API buffer

◆ ~DataBuffer()

helicscpp::DataBuffer::~DataBuffer ( )
inline

destructor

Member Function Documentation

◆ capacity()

HELICS_NODISCARD int helicscpp::DataBuffer::capacity ( )
inline

get the size of the raw value

◆ clone()

HELICS_NODISCARD DataBuffer helicscpp::DataBuffer::clone ( )
inline

make a deep copy of the buffer

◆ convertToType()

bool helicscpp::DataBuffer::convertToType ( int  newDataType)
inline

convert the data in a data buffer to a different type representation

Parameters
newDataTypethe type that it is desired for the buffer to be converted to
Returns
true if the conversion was successful

References HELICS_TRUE.

◆ data()

HELICS_NODISCARD void * helicscpp::DataBuffer::data ( )
inline

get a pointer to the raw data

Referenced by toComplexVector(), toVector(), and toVector().

◆ getHelicsDataBuffer()

HELICS_NODISCARD HelicsDataBuffer helicscpp::DataBuffer::getHelicsDataBuffer ( )
inline

get the C API dataobject

Referenced by helicscpp::Message::data(), and helicscpp::Publication::publish().

◆ isValid()

HELICS_NODISCARD bool helicscpp::DataBuffer::isValid ( ) const
inline

check if the buffer is valid

References HELICS_TRUE.

◆ reserve()

bool helicscpp::DataBuffer::reserve ( int32_t  newCapacity)
inline

reserve a capacity in the buffer

References HELICS_TRUE.

◆ size()

HELICS_NODISCARD int helicscpp::DataBuffer::size ( )
inline

get the size of the raw value

Referenced by toNamedPoint(), toString(), and toString().

◆ stringSize()

HELICS_NODISCARD int helicscpp::DataBuffer::stringSize ( )
inline

get the size of the value as a string

Referenced by toString(), and toString().

◆ toBoolean()

HELICS_NODISCARD bool helicscpp::DataBuffer::toBoolean ( )
inline

get the value as a boolean

References HELICS_TRUE.

◆ toComplex()

HELICS_NODISCARD std::complex< double > helicscpp::DataBuffer::toComplex ( )
inline

get the value as a complex number

◆ toComplexVector()

int helicscpp::DataBuffer::toComplexVector ( double *  data,
int  maxlen 
)
inline

get the current value as a vector of doubles in alternating real and imaginary

Parameters
datapointer to space to store the current values
maxlenthe maximum size of the allowed vector
Returns
the actual size of the vector stored

References data().

◆ toDouble()

HELICS_NODISCARD double helicscpp::DataBuffer::toDouble ( )
inline

get the value as a double

◆ toInt()

HELICS_NODISCARD int64_t helicscpp::DataBuffer::toInt ( )
inline

get the current value as a 64 bit integer

◆ toNamedPoint()

void helicscpp::DataBuffer::toNamedPoint ( std::string &  name,
double *  val 
)
inline

get the current value as a named point

References size().

◆ toString() [1/2]

HELICS_NODISCARD std::string helicscpp::DataBuffer::toString ( )
inline

get the current value as a string

References size(), and stringSize().

◆ toString() [2/2]

void helicscpp::DataBuffer::toString ( std::string &  str)
inline

get the current value as a string

References size(), and stringSize().

◆ toVector() [1/2]

int helicscpp::DataBuffer::toVector ( double *  data,
int  maxlen 
)
inline

get the current value as a vector of doubles

Parameters
datapointer to space to store the current values
maxlenthe maximum size of the allowed vector
Returns
the actual size of the vector stored

References data().

◆ toVector() [2/2]

void helicscpp::DataBuffer::toVector ( std::vector< double > &  data)
inline

get the current value and store it in a std::vector<double>

References data().

◆ type()

HELICS_NODISCARD int helicscpp::DataBuffer::type ( ) const
inline

get the type of data contained in the buffer

◆ vectorSize()

HELICS_NODISCARD int helicscpp::DataBuffer::vectorSize ( )
inline

get the size of the value as a vector


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