| helics 3.6.1

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)
DataBuffer | clone ()
int | size ()
int | capacity ()
void * | data ()
bool | reserve (int32_t newCapacity)
int | stringSize ()
int | vectorSize ()
int | type () const
bool | isValid () const
std::string | toString ()
void | toString (std::string &str)
void | toNamedPoint (std::string &name, double *val)
int64_t | toInt ()
bool | toBoolean ()
double | toDouble ()
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)
HelicsDataBuffer | getHelicsDataBuffer ()

## Constructor & Destructor Documentation

## ◆ DataBuffer()

helicscpp::DataBuffer::DataBuffer | ( | HelicsDataBuffer | buffer | ) |
| inline explicit

create a dataBuffer object from an existing C API buffer

## ◆ ~DataBuffer()

helicscpp::DataBuffer::~DataBuffer | ( |  | ) |
| inline

destructor

## Member Function Documentation

## ◆ capacity()

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

get the size of the raw value

## ◆ clone()

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

  newDataType | the type that it is desired for the buffer to be converted to

Returns
  true if the conversion was successful

References HELICS_TRUE.

## ◆ data()

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

get a pointer to the raw data

Referenced by toComplexVector(), and toVector().

## ◆ getHelicsDataBuffer()

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

get the C API dataobject

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

## ◆ isValid()

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()

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

get the size of the raw value

Referenced by toNamedPoint(), and toString().

## ◆ stringSize()

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

get the size of the value as a string

Referenced by toString().

## ◆ toBoolean()

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

get the value as a boolean

References HELICS_TRUE.

## ◆ toComplex()

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

  data | pointer to space to store the current values
  maxlen | the maximum size of the allowed vector

Returns
  the actual size of the vector stored

References data().

## ◆ toDouble()

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

get the value as a double

## ◆ toInt()

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]

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

  data | pointer to space to store the current values
  maxlen | the 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()

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

get the type of data contained in the buffer

## ◆ vectorSize()

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:

- DataBuffer.hpp