helics  3.0.1
Functions
helicsCallbacks.h File Reference

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

#include "helicsCore.h"

Go to the source code of this file.

Functions

void helicsBrokerSetLoggingCallback (HelicsBroker broker, void(*logger)(int loglevel, const char *identifier, const char *message, void *userData), void *userdata, HelicsError *err)
 
void helicsCoreSetLoggingCallback (HelicsCore core, void(*logger)(int loglevel, const char *identifier, const char *message, void *userData), void *userdata, HelicsError *err)
 
void helicsFederateSetLoggingCallback (HelicsFederate fed, void(*logger)(int loglevel, const char *identifier, const char *message, void *userData), void *userdata, HelicsError *err)
 
void helicsFilterSetCustomCallback (HelicsFilter filter, void(*filtCall)(HelicsMessage message, void *userData), void *userdata, HelicsError *err)
 
void helicsFederateSetQueryCallback (HelicsFederate fed, void(*queryAnswer)(const char *query, int querySize, HelicsQueryBuffer buffer, void *userdata), void *userdata, HelicsError *err)
 
void helicsQueryBufferFill (HelicsQueryBuffer buffer, const char *str, int strSize, HelicsError *err)
 

Detailed Description

Functions dealing with callbacks for the shared library.

Function Documentation

◆ helicsBrokerSetLoggingCallback()

void helicsBrokerSetLoggingCallback ( HelicsBroker  broker,
void(*)(int loglevel, const char *identifier, const char *message, void *userData)  logger,
void *  userdata,
HelicsError 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.
[in,out]errA pointer to an error object for catching errors.

◆ helicsCoreSetLoggingCallback()

void helicsCoreSetLoggingCallback ( HelicsCore  core,
void(*)(int loglevel, const char *identifier, const char *message, void *userData)  logger,
void *  userdata,
HelicsError 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.
[in,out]errA pointer to an error object for catching errors.

◆ helicsFederateSetLoggingCallback()

void helicsFederateSetLoggingCallback ( HelicsFederate  fed,
void(*)(int loglevel, const char *identifier, const char *message, void *userData)  logger,
void *  userdata,
HelicsError 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.
[in,out]errA pointer to an error object for catching errors.

◆ helicsFederateSetQueryCallback()

void helicsFederateSetQueryCallback ( HelicsFederate  fed,
void(*)(const char *query, int querySize, HelicsQueryBuffer buffer, void *userdata)  queryAnswer,
void *  userdata,
HelicsError 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.
[in,out]errA pointer to an error object for catching errors.

◆ helicsFilterSetCustomCallback()

void helicsFilterSetCustomCallback ( HelicsFilter  filter,
void(*)(HelicsMessage message, void *userData)  filtCall,
void *  userdata,
HelicsError 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.
[in,out]errA pointer to an error object for catching errors.

◆ helicsQueryBufferFill()

void helicsQueryBufferFill ( HelicsQueryBuffer  buffer,
const char *  str,
int  strSize,
HelicsError 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.
[in,out]errA pointer to an error object for catching errors.

References HELICS_ERROR_INVALID_OBJECT.