15 #include "../core/SmallBuffer.hpp"
16 #include "data_view.hpp"
18 #include "helics_cxx_export.h"
28 constexpr
size_t getBinaryLength(
double )
32 constexpr
size_t getBinaryLength(std::int64_t )
36 constexpr
size_t getBinaryLength(std::complex<double> )
40 inline size_t getBinaryLength(std::string_view val)
42 return val.size() + 8;
44 inline size_t getBinaryLength(
const std::vector<double>& val)
46 return val.size() *
sizeof(double) + 8;
48 inline size_t getBinaryLength(
const double* ,
size_t size)
50 return size *
sizeof(double) + 8;
53 inline size_t getBinaryLength(
const NamedPoint& np)
55 return np.name.size() + 16;
58 inline size_t getBinaryLength(
const std::vector<std::complex<double>>& cv)
60 return cv.size() *
sizeof(double) * 2 + 8;
62 inline size_t getBinaryLength(
const std::complex<double>* ,
size_t size)
64 return size *
sizeof(double) * 2 + 8;
67 HELICS_CXX_EXPORT
size_t convertToBinary(std::byte* data,
double val);
69 HELICS_CXX_EXPORT
size_t convertToBinary(std::byte* data, std::int64_t val);
71 HELICS_CXX_EXPORT
size_t convertToBinary(std::byte* data, std::complex<double> val);
73 HELICS_CXX_EXPORT
size_t convertToBinary(std::byte* data, std::string_view val);
75 HELICS_CXX_EXPORT
size_t convertToBinary(std::byte* data,
const NamedPoint& val);
77 HELICS_CXX_EXPORT
size_t convertToBinary(std::byte* data,
const std::vector<double>& val);
79 HELICS_CXX_EXPORT
size_t convertToBinary(std::byte* data,
const double* val,
size_t size);
81 HELICS_CXX_EXPORT
size_t convertToBinary(std::byte* data,
82 const std::vector<std::complex<double>>& val);
84 HELICS_CXX_EXPORT
size_t convertToBinary(std::byte* data,
85 const std::complex<double>* val,
89 HELICS_CXX_EXPORT
DataType detectType(
const std::byte* data);
91 HELICS_CXX_EXPORT
void convertFromBinary(
const std::byte* data,
double& val);
92 HELICS_CXX_EXPORT
void convertFromBinary(
const std::byte* data, std::int64_t& val);
93 HELICS_CXX_EXPORT
void convertFromBinary(
const std::byte* data, std::complex<double>& val);
94 HELICS_CXX_EXPORT
void convertFromBinary(
const std::byte* data,
char* val);
95 HELICS_CXX_EXPORT
void convertFromBinary(
const std::byte* data, std::string& val);
96 HELICS_CXX_EXPORT
void convertFromBinary(
const std::byte* data, std::string_view& val);
97 HELICS_CXX_EXPORT
void convertFromBinary(
const std::byte* data, NamedPoint& val);
99 HELICS_CXX_EXPORT
void convertFromBinary(
const std::byte* data, std::vector<double>& val);
100 HELICS_CXX_EXPORT
void convertFromBinary(
const std::byte* data,
double* val);
102 HELICS_CXX_EXPORT
void convertFromBinary(
const std::byte* data,
103 std::vector<std::complex<double>>& val);
108 HELICS_CXX_EXPORT
size_t getDataSize(
const std::byte* data);
127 store.resize(detail::getBinaryLength(val));
128 detail::convertToBinary(store.
data(), val);
134 store.resize(detail::getBinaryLength(vals, size));
135 detail::convertToBinary(store.
data(), vals, size);
150 detail::convertFromBinary(block.
bytes(), val);
157 detail::convertFromBinary(block.
bytes(), val);
161 static std::string
type() {
return typeNameString<X>(); }
167 using baseType = std::vector<std::string>;
185 std::vector<std::string> val;
191 static std::string
type() {
return "string_vector"; }
Definition: SmallBuffer.hpp:25
std::byte * data() const
Definition: SmallBuffer.hpp:160
static std::string type()
Definition: ValueConverter.hpp:191
static SmallBuffer convert(const std::vector< std::string > &val)
Definition: ValueConverter.hpp:169
static std::vector< std::string > interpret(const data_view &block)
Definition: ValueConverter.hpp:183
Definition: ValueConverter.hpp:113
static void interpret(const data_view &block, X &val)
Definition: ValueConverter.hpp:155
static SmallBuffer convert(const X &val)
Definition: ValueConverter.hpp:117
static void convert(const X *vals, size_t size, SmallBuffer &store)
Definition: ValueConverter.hpp:132
static SmallBuffer convert(const X *vals, size_t size)
Definition: ValueConverter.hpp:139
static void convert(const X &val, SmallBuffer &store)
Definition: ValueConverter.hpp:125
static std::string type()
Definition: ValueConverter.hpp:161
static X interpret(const data_view &block)
Definition: ValueConverter.hpp:147
Definition: data_view.hpp:22
const std::byte * bytes() const noexcept
Definition: data_view.hpp:109
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
DataType
Definition: helicsTypes.hpp:273