| helics 3.6.1

helicsCallbacks.h
Go to the documentation of this file.
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
13 #ifndef HELICS_APISHARED_CALLBACK_FUNCTIONS_H_
14 #define HELICS_APISHARED_CALLBACK_FUNCTIONS_H_
15
16 #include "helicsCore.h"
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
37 HELICS_EXPORT void helicsBrokerSetLoggingCallback(HelicsBroker broker,
38 void (*logger)(int loglevel, const char* identifier, const char* message, void* userData),
39 void* userdata,
40 HelicsError* err);
41
56 HELICS_EXPORT void helicsCoreSetLoggingCallback(HelicsCore core,
57 void (*logger)(int loglevel, const char* identifier, const char* message, void* userData),
58 void* userdata,
59 HelicsError* err);
60
76 HELICS_EXPORT void
77 helicsFederateSetLoggingCallback(HelicsFederate fed,
78 void (*logger)(int loglevel, const char* identifier, const char* message, void* userData),
79 void* userdata,
80 HelicsError* err);
81
96 HELICS_EXPORT void helicsFilterSetCustomCallback(HelicsFilter filter,
97 HelicsMessage (*filtCall)(HelicsMessage message, void* userData),
98 void* userdata,
99 HelicsError* err);
100
118 HELICS_EXPORT void helicsTranslatorSetCustomCallback(HelicsTranslator translator,
119 void (*toMessageCall)(HelicsDataBuffer value, HelicsMessage message, void* userData),
120 void (*toValueCall)(HelicsMessage message, HelicsDataBuffer value, void* userData),
121 void* userdata,
122 HelicsError* err);
123
144 HELICS_EXPORT void
145 helicsFederateSetQueryCallback(HelicsFederate fed,
146 void (*queryAnswer)(const char* query, int querySize, HelicsQueryBuffer buffer, void* userdata),
147 void* userdata,
148 HelicsError* err);
149
166 HELICS_EXPORT void helicsFederateSetTimeRequestEntryCallback(
167 HelicsFederate fed,
168 void (*requestTime)(HelicsTime currentTime, HelicsTime requestTime, HelicsBool iterating, void* userdata),
169 void* userdata,
170 HelicsError* err);
171
186 HELICS_EXPORT void helicsFederateSetTimeUpdateCallback(HelicsFederate fed,
187 void (*timeUpdate)(HelicsTime newTime, HelicsBool iterating, void* userdata),
188 void* userdata,
189 HelicsError* err);
190
204 HELICS_EXPORT void
205 helicsFederateSetStateChangeCallback(HelicsFederate fed,
206 void (*stateChange)(HelicsFederateState newState, HelicsFederateState oldState, void* userdata),
207 void* userdata,
208 HelicsError* err);
209
210 // Definition of helicsFederateStateChangeCallback located in FederateExport since it makes use of some data only available in that
211 // compilation unit
212
228 HELICS_EXPORT void
229 helicsFederateSetTimeRequestReturnCallback(HelicsFederate fed,
230 void (*requestTimeReturn)(HelicsTime newTime, HelicsBool iterating, void* userdata),
231 void* userdata,
232 HelicsError* err);
233
249 HELICS_EXPORT void helicsFederateInitializingEntryCallback(HelicsFederate fed,
250 void (*initializingEntry)(HelicsBool iterating, void* userdata),
251 void* userdata,
252 HelicsError* err);
253
267 HELICS_EXPORT void
268 helicsFederateExecutingEntryCallback(HelicsFederate fed, void (*executingEntry)(void* userdata), void* userdata, HelicsError* err);
269
285 HELICS_EXPORT void helicsFederateCosimulationTerminationCallback(HelicsFederate fed,
286 void (*cosimTermination)(void* userdata),
287 void* userdata,
288 HelicsError* err);
289
303 HELICS_EXPORT void helicsFederateErrorHandlerCallback(HelicsFederate fed,
304 void (*errorHandler)(int errorCode, const char* errorString, void* userdata),
305 void* userdata,
306 HelicsError* err);
307
321 HELICS_EXPORT void helicsCallbackFederateNextTimeCallback(HelicsFederate fed,
322 HelicsTime (*timeUpdate)(HelicsTime time, void* userdata),
323 void* userdata,
324 HelicsError* err);
325
340 HELICS_EXPORT void helicsCallbackFederateNextTimeIterativeCallback(
341 HelicsFederate fed,
342 HelicsTime (*timeUpdate)(HelicsTime time, HelicsIterationResult result, HelicsIterationRequest* iteration, void* userdata),
343 void* userdata,
344 HelicsError* err);
345
346 // void setInitializeCallback(std::function<IterationRequest()> initializeCallback){initializationOperation=std::move(initializeCallback); }
360 HELICS_EXPORT void helicsCallbackFederateInitializeCallback(HelicsFederate fed,
361 HelicsIterationRequest (*initialize)(void* userdata),
362 void* userdata,
363 HelicsError* err);
364
378 HELICS_EXPORT void helicsQueryBufferFill(HelicsQueryBuffer buffer, const char* queryResult, int strSize, HelicsError* err);
379
380 #ifdef __cplusplus
381 } /* end of extern "C" { */
382 #endif
383
384 #endif
HelicsDataBuffer
void * HelicsDataBuffer
Definition: api-data.h:88
HelicsCore
void * HelicsCore
Definition: api-data.h:54
HelicsFilter
void * HelicsFilter
Definition: api-data.h:43
HelicsTime
double HelicsTime
Definition: api-data.h:106
HelicsIterationResult
HelicsIterationResult
Definition: api-data.h:137
HelicsTranslator
void * HelicsTranslator
Definition: api-data.h:48
HelicsMessage
void * HelicsMessage
Definition: api-data.h:100
HelicsBool
int HelicsBool
Definition: api-data.h:118
HelicsFederateState
HelicsFederateState
Definition: api-data.h:147
HelicsIterationRequest
HelicsIterationRequest
Definition: api-data.h:126
HelicsFederate
void * HelicsFederate
Definition: api-data.h:65
HelicsQueryBuffer
void * HelicsQueryBuffer
Definition: api-data.h:94
HelicsBroker
void * HelicsBroker
Definition: api-data.h:60
helicsFederateSetTimeRequestReturnCallback
void helicsFederateSetTimeRequestReturnCallback(HelicsFederate fed, void(*requestTimeReturn)(HelicsTime newTime, HelicsBool iterating, void *userdata), void *userdata, HelicsError *err)
Definition: FederateExport.cpp:1382
helicsFilterSetCustomCallback
void helicsFilterSetCustomCallback(HelicsFilter filter, HelicsMessage(*filtCall)(HelicsMessage message, void *userData), void *userdata, HelicsError *err)
Definition: MessageFiltersExport.cpp:578
helicsFederateExecutingEntryCallback
void helicsFederateExecutingEntryCallback(HelicsFederate fed, void(*executingEntry)(void *userdata), void *userdata, HelicsError *err)
Definition: FederateExport.cpp:1315
helicsFederateSetTimeRequestEntryCallback
void helicsFederateSetTimeRequestEntryCallback(HelicsFederate fed, void(*requestTime)(HelicsTime currentTime, HelicsTime requestTime, HelicsBool iterating, void *userdata), void *userdata, HelicsError *err)
Definition: FederateExport.cpp:1242
helicsFederateInitializingEntryCallback
void helicsFederateInitializingEntryCallback(HelicsFederate fed, void(*initializingEntry)(HelicsBool iterating, void *userdata), void *userdata, HelicsError *err)
Definition: FederateExport.cpp:1292
helicsFederateCosimulationTerminationCallback
void helicsFederateCosimulationTerminationCallback(HelicsFederate fed, void(*cosimTermination)(void *userdata), void *userdata, HelicsError *err)
Definition: FederateExport.cpp:1334
helicsFederateSetTimeUpdateCallback
void helicsFederateSetTimeUpdateCallback(HelicsFederate fed, void(*timeUpdate)(HelicsTime newTime, HelicsBool iterating, void *userdata), void *userdata, HelicsError *err)
Definition: helicsCallbacks.cpp:125
helicsTranslatorSetCustomCallback
void helicsTranslatorSetCustomCallback(HelicsTranslator translator, void(*toMessageCall)(HelicsDataBuffer value, HelicsMessage message, void *userData), void(*toValueCall)(HelicsMessage message, HelicsDataBuffer value, void *userData), void *userdata, HelicsError *err)
Definition: TranslatorExport.cpp:474
helicsFederateSetLoggingCallback
void helicsFederateSetLoggingCallback(HelicsFederate fed, void(*logger)(int loglevel, const char *identifier, const char *message, void *userData), void *userdata, HelicsError *err)
helicsBrokerSetLoggingCallback
void helicsBrokerSetLoggingCallback(HelicsBroker broker, void(*logger)(int loglevel, const char *identifier, const char *message, void *userData), void *userdata, HelicsError *err)
helicsCallbackFederateInitializeCallback
void helicsCallbackFederateInitializeCallback(HelicsFederate fed, HelicsIterationRequest(*initialize)(void *userdata), void *userdata, HelicsError *err)
Definition: FederateExport.cpp:1455
helicsCallbackFederateNextTimeCallback
void helicsCallbackFederateNextTimeCallback(HelicsFederate fed, HelicsTime(*timeUpdate)(HelicsTime time, void *userdata), void *userdata, HelicsError *err)
Definition: FederateExport.cpp:1406
helicsCallbackFederateNextTimeIterativeCallback
void helicsCallbackFederateNextTimeIterativeCallback(HelicsFederate fed, HelicsTime(*timeUpdate)(HelicsTime time, HelicsIterationResult result, HelicsIterationRequest *iteration, void *userdata), void *userdata, HelicsError *err)
helicsFederateErrorHandlerCallback
void helicsFederateErrorHandlerCallback(HelicsFederate fed, void(*errorHandler)(int errorCode, const char *errorString, void *userdata), void *userdata, HelicsError *err)
Definition: FederateExport.cpp:1356
helicsFederateSetStateChangeCallback
void helicsFederateSetStateChangeCallback(HelicsFederate fed, void(*stateChange)(HelicsFederateState newState, HelicsFederateState oldState, void *userdata), void *userdata, HelicsError *err)
Definition: FederateExport.cpp:1268
helicsFederateSetQueryCallback
void helicsFederateSetQueryCallback(HelicsFederate fed, void(*queryAnswer)(const char *query, int querySize, HelicsQueryBuffer buffer, void *userdata), void *userdata, HelicsError *err)
Definition: helicsCallbacks.cpp:98
helicsCoreSetLoggingCallback
void helicsCoreSetLoggingCallback(HelicsCore core, void(*logger)(int loglevel, const char *identifier, const char *message, void *userData), void *userdata, HelicsError *err)
helicsQueryBufferFill
void helicsQueryBufferFill(HelicsQueryBuffer buffer, const char *queryResult, int strSize, HelicsError *err)
Definition: helicsCallbacks.cpp:149
helicsCore.h
Common functions for the HELICS C api.
HelicsError
Definition: api-data.h:177