| helics 3.6.1

helicsData.h
1 /*
2 Copyright (c) 2017-2025,
3 Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC. See the top-level NOTICE for
4 additional details. All rights reserved.
5 SPDX-License-Identifier: BSD-3-Clause
6 */
7
8 #ifndef HELICS_APISHAREDDATA_FUNCTIONS_H_
9 #define HELICS_APISHAREDDATA_FUNCTIONS_H_
10
11 #include "api-data.h"
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 #include "helics_export.h"
18
20 HELICS_EXPORT HelicsDataBuffer helicsCreateDataBuffer(int32_t initialCapacity);
21
23 HELICS_EXPORT HelicsBool helicsDataBufferIsValid(HelicsDataBuffer data);
24
26 HELICS_EXPORT HelicsDataBuffer helicsWrapDataInBuffer(void* data, int dataSize, int dataCapacity);
27
29 HELICS_EXPORT void helicsDataBufferFree(HelicsDataBuffer data);
30
32 HELICS_EXPORT int32_t helicsDataBufferSize(HelicsDataBuffer data);
33
35 HELICS_EXPORT int32_t helicsDataBufferCapacity(HelicsDataBuffer data);
36
38 HELICS_EXPORT void* helicsDataBufferData(HelicsDataBuffer data);
39
42 HELICS_EXPORT HelicsBool helicsDataBufferReserve(HelicsDataBuffer data, int32_t newCapacity);
43
47 HELICS_EXPORT HelicsDataBuffer helicsDataBufferClone(HelicsDataBuffer data);
48
54 HELICS_EXPORT int32_t helicsDataBufferFillFromInteger(HelicsDataBuffer data, int64_t value);
55
61 HELICS_EXPORT int32_t helicsDataBufferFillFromDouble(HelicsDataBuffer data, double value);
62
68 HELICS_EXPORT int32_t helicsDataBufferFillFromString(HelicsDataBuffer data, const char* value);
69
76 HELICS_EXPORT int32_t helicsDataBufferFillFromRawString(HelicsDataBuffer data, const char* str, int stringSize);
77
83 HELICS_EXPORT int32_t helicsDataBufferFillFromBoolean(HelicsDataBuffer data, HelicsBool value);
84
90 HELICS_EXPORT int32_t helicsDataBufferFillFromChar(HelicsDataBuffer data, char value);
91
97 HELICS_EXPORT int32_t helicsDataBufferFillFromTime(HelicsDataBuffer data, HelicsTime value);
98
105 HELICS_EXPORT int32_t helicsDataBufferFillFromComplex(HelicsDataBuffer data, double real, double imag);
106
112 HELICS_EXPORT int32_t helicsDataBufferFillFromComplexObject(HelicsDataBuffer data, HelicsComplex value);
113
119 HELICS_EXPORT int32_t helicsDataBufferFillFromVector(HelicsDataBuffer data, const double* value, int dataSize);
120
126 HELICS_EXPORT int32_t helicsDataBufferFillFromNamedPoint(HelicsDataBuffer data, const char* name, double value);
127
133 HELICS_EXPORT int32_t helicsDataBufferFillFromComplexVector(HelicsDataBuffer data, const double* value, int dataSize);
134
136 HELICS_EXPORT int helicsDataBufferType(HelicsDataBuffer data);
137
139 HELICS_EXPORT int64_t helicsDataBufferToInteger(HelicsDataBuffer data);
140
142 HELICS_EXPORT double helicsDataBufferToDouble(HelicsDataBuffer data);
143
145 HELICS_EXPORT HelicsBool helicsDataBufferToBoolean(HelicsDataBuffer data);
146
148 HELICS_EXPORT char helicsDataBufferToChar(HelicsDataBuffer data);
149
151 HELICS_EXPORT int helicsDataBufferStringSize(HelicsDataBuffer data);
152
153 /* convert a data buffer to a string including a null terminator
154 NOTE: data may contain null bytes prior to the end but actualLength will be the number of characters in the string
155 outputString[actualLength] is a null terminator*/
156 HELICS_EXPORT void helicsDataBufferToString(HelicsDataBuffer data, char* outputString, int maxStringLen, int* actualLength);
157
158 /* convert a data buffer to a Raw string with no null terminator
159 */
160 HELICS_EXPORT void helicsDataBufferToRawString(HelicsDataBuffer data, char* outputString, int maxStringLen, int* actualLength);
161
163 HELICS_EXPORT HelicsTime helicsDataBufferToTime(HelicsDataBuffer data);
164
166 HELICS_EXPORT HelicsComplex helicsDataBufferToComplexObject(HelicsDataBuffer data);
167
169 HELICS_EXPORT void helicsDataBufferToComplex(HelicsDataBuffer data, double* real, double* imag);
170
172 HELICS_EXPORT int helicsDataBufferVectorSize(HelicsDataBuffer data);
173
175 HELICS_EXPORT void helicsDataBufferToVector(HelicsDataBuffer data, double values[], int maxlen, int* actualSize);
176
183 HELICS_EXPORT void helicsDataBufferToComplexVector(HelicsDataBuffer data, double values[], int maxlen, int* actualSize);
184
185 HELICS_EXPORT void
186 helicsDataBufferToNamedPoint(HelicsDataBuffer data, char* outputString, int maxStringLength, int* actualLength, double* val);
187
192 HELICS_EXPORT HelicsBool helicsDataBufferConvertToType(HelicsDataBuffer data, int newDataType);
193
194 #ifdef __cplusplus
195 } /* end of extern "C" { */
196 #endif
197
198 #endif /*HELICS_APISHAREDDATA_FUNCTIONS_H_ */
api-data.h
Data structures for the C api.
HelicsDataBuffer
void * HelicsDataBuffer
Definition: api-data.h:88
HelicsTime
double HelicsTime
Definition: api-data.h:106
HelicsBool
int HelicsBool
Definition: api-data.h:118
HelicsComplex
Definition: api-data.h:166