helics  2.8.1
Functions
helicsCallbacks.h File Reference

Functions dealing with callbacks for the shared library. More...

#include "helics.h"

Go to the source code of this file.

Functions

void helicsBrokerSetLoggingCallback (helics_broker broker, void(*logger)(int loglevel, const char *identifier, const char *message, void *userData), void *userdata, helics_error *err)
 
void helicsCoreSetLoggingCallback (helics_core core, void(*logger)(int loglevel, const char *identifier, const char *message, void *userData), void *userdata, helics_error *err)
 
void helicsFederateSetLoggingCallback (helics_federate fed, void(*logger)(int loglevel, const char *identifier, const char *message, void *userData), void *userdata, helics_error *err)
 
void helicsFilterSetCustomCallback (helics_filter filter, void(*filtCall)(helics_message_object message, void *userData), void *userdata, helics_error *err)
 
void helicsFederateSetQueryCallback (helics_federate fed, void(*queryAnswer)(const char *query, int querySize, helics_query_buffer buffer, void *userdata), void *userdata, helics_error *err)
 
void helicsQueryBufferFill (helics_query_buffer buffer, const char *str, int strSize, helics_error *err)
 

Detailed Description

Functions dealing with callbacks for the shared library.

Function Documentation

◆ helicsBrokerSetLoggingCallback()

void helicsBrokerSetLoggingCallback ( helics_broker  broker,
void(*)(int loglevel, const char *identifier, const char *message, void *userData)  logger,
void *  userdata,
helics_error err 
)

Set the logging callback to a broker.

Add a logging callback function to a broker. The logging callback will be called when a message flows into a broker from the core or from a broker.

Parameters
brokerThe broker object in which to set the callback.
loggerA callback with signature void(int, const char *, const char *, void *); the function arguments are loglevel, an identifier, a message string, and a pointer to user data.
userdataA pointer to user data that is passed to the function when executing. @forcpponly
[in,out]errA pointer to an error object for catching errors. @endforcpponly

◆ helicsCoreSetLoggingCallback()

void helicsCoreSetLoggingCallback ( helics_core  core,
void(*)(int loglevel, const char *identifier, const char *message, void *userData)  logger,
void *  userdata,
helics_error err 
)

Set the logging callback for a core.

Add a logging callback function to a core. The logging callback will be called when a message flows into a core from the core or from a broker.

Parameters
coreThe core object in which to set the callback.
loggerA callback with signature void(int, const char *, const char *, void *); The function arguments are loglevel, an identifier, a message string, and a pointer to user data.
userdataA pointer to user data that is passed to the function when executing. @forcpponly
[in,out]errA pointer to an error object for catching errors. @endforcpponly

◆ helicsFederateSetLoggingCallback()

void helicsFederateSetLoggingCallback ( helics_federate  fed,
void(*)(int loglevel, const char *identifier, const char *message, void *userData)  logger,
void *  userdata,
helics_error err 
)

Set the logging callback for a federate.

Add a logging callback function to a federate. The logging callback will be called when a message flows into a federate from the core or from a federate.

Parameters
fedThe federate object in which to create a subscription must have been created with helicsCreateValueFederate or helicsCreateCombinationFederate.
loggerA callback with signature void(int, const char *, const char *, void *); The function arguments are loglevel, an identifier string, a message string, and a pointer to user data.
userdataA pointer to user data that is passed to the function when executing. @forcpponly
[in,out]errA pointer to an error object for catching errors. @endforcpponly

◆ helicsFederateSetQueryCallback()

void helicsFederateSetQueryCallback ( helics_federate  fed,
void(*)(const char *query, int querySize, helics_query_buffer buffer, void *userdata)  queryAnswer,
void *  userdata,
helics_error err 
)

Set callback for queries executed against a federate.

There are many queries that HELICS understands directly, but it is occasionally useful to have a federate be able to respond to specific queries with answers specific to a federate.

Parameters
fedThe federate to set the callback for.
queryAnswerA callback with signature const char *(const char *query, int querySize,int *answerSize, void *userdata); The function arguments are the query string requesting an answer along with its size, the string is not guaranteed to be null terminated answerSize is an outputParameter intended to filled out by the userCallback and should contain the length of the return string. The return pointer can be NULL if no answer is given and HELICS will generate the appropriate response.
userdataA pointer to user data that is passed to the function when executing. @forcpponly
[in,out]errA pointer to an error object for catching errors. @endforcpponly

References fed.

◆ helicsFilterSetCustomCallback()

void helicsFilterSetCustomCallback ( helics_filter  filter,
void(*)(helics_message_object message, void *userData)  filtCall,
void *  userdata,
helics_error err 
)

Set a general callback for a custom filter.

Add a custom filter callback for creating a custom filter operation in the C shared library.

Parameters
filterThe filter object to set the callback for.
filtCallA callback with signature helics_message_object(helics_message_object, void *); The function arguments are the message to filter and a pointer to user data. The filter should return a new message.
userdataA pointer to user data that is passed to the function when executing. @forcpponly
[in,out]errA pointer to an error object for catching errors. @endforcpponly

◆ helicsQueryBufferFill()

void helicsQueryBufferFill ( helics_query_buffer  buffer,
const char *  str,
int  strSize,
helics_error err 
)

Set the data for a query callback.

There are many queries that HELICS understands directly, but it is occasionally useful to have a federate be able to respond to specific queries with answers specific to a federate.

Parameters
bufferThe buffer received in a helicsQueryCallback.
strPointer to the data to fill the buffer with.
strSizeThe size of the string. @forcpponly
[in,out]errA pointer to an error object for catching errors. @endforcpponly

References helics_error_invalid_object.