helics
3.5.2
|
Functions related to message federates for the C api. More...
#include "helicsCore.h"
Go to the source code of this file.
Functions related to message federates for the C api.
void helicsEndpointAddDestinationFilter | ( | HelicsEndpoint | endpoint, |
const char * | filterName, | ||
HelicsError * | err | ||
) |
add a destination filter to an endpoint
endpoint | The endpoint to modify. | |
filterName | The name of the filter to add. | |
[in,out] | err | An error object to fill out in case of an error. |
void helicsEndpointAddDestinationTarget | ( | HelicsEndpoint | endpoint, |
const char * | targetEndpoint, | ||
HelicsError * | err | ||
) |
add a destination target to an endpoint, Specifying an endpoint to send undirected messages to
endpoint | The endpoint to modify. | |
targetEndpoint | the name of the endpoint to send messages to | |
[in,out] | err | An error object to fill out in case of an error. |
void helicsEndpointAddSourceFilter | ( | HelicsEndpoint | endpoint, |
const char * | filterName, | ||
HelicsError * | err | ||
) |
add a source Filter to an endpoint
endpoint | The endpoint to modify. | |
filterName | the name of the filter to add | |
[in,out] | err | An error object to fill out in case of an error. |
void helicsEndpointAddSourceTarget | ( | HelicsEndpoint | endpoint, |
const char * | targetEndpoint, | ||
HelicsError * | err | ||
) |
add a source target to an endpoint, Specifying an endpoint to receive undirected messages from
endpoint | The endpoint to modify. | |
targetEndpoint | the endpoint to get messages from | |
[in,out] | err | An error object to fill out in case of an error. |
void helicsEndpointClearMessages | ( | HelicsEndpoint | endpoint | ) |
Clear all stored messages stored from an endpoint.
This clears messages retrieved through helicsEndpointGetMessage or helicsEndpointCreateMessage
endpoint | The endpoint to clear the message for. |
HelicsMessage helicsEndpointCreateMessage | ( | HelicsEndpoint | endpoint, |
HelicsError * | err | ||
) |
Create a new empty message object.
The message is empty and isValid will return false since there is no data associated with the message yet.
endpoint | The endpoint object to associate the message with. | |
[in,out] | err | An error object to fill out in case of an error. |
Referenced by helicscpp::Endpoint::createMessage(), and helicscpp::Message::newMessageObject().
const char* helicsEndpointGetDefaultDestination | ( | HelicsEndpoint | endpoint | ) |
Get the default destination for an endpoint.
endpoint | The endpoint to set the destination for. |
Referenced by helicscpp::Endpoint::getDefaultDestination().
const char* helicsEndpointGetInfo | ( | HelicsEndpoint | end | ) |
Get the local information field of an endpoint.
end | The endpoint to query. |
Referenced by helicscpp::Endpoint::getInfo().
HelicsMessage helicsEndpointGetMessage | ( | HelicsEndpoint | endpoint | ) |
Receive a packet from a particular endpoint.
[in] | endpoint | The identifier for the endpoint. |
Referenced by helicscpp::Endpoint::getMessage().
const char* helicsEndpointGetName | ( | HelicsEndpoint | endpoint | ) |
Get the name of an endpoint.
endpoint | The endpoint object in question. |
Referenced by helicscpp::Endpoint::getName().
int helicsEndpointGetOption | ( | HelicsEndpoint | endpoint, |
int | option | ||
) |
Set a handle option on an endpoint.
endpoint | The endpoint to modify. |
option | Integer code for the option to set /ref helics_handle_options. |
References HELICS_FALSE.
const char* helicsEndpointGetTag | ( | HelicsEndpoint | endpoint, |
const char * | tagname | ||
) |
Get the data in a specified tag of an endpoint
endpoint | The endpoint to query. |
tagname | The name of the tag to query. |
const char* helicsEndpointGetType | ( | HelicsEndpoint | endpoint | ) |
Get the type specified for an endpoint.
endpoint | The endpoint object in question. |
Referenced by helicscpp::Endpoint::getType().
HelicsBool helicsEndpointHasMessage | ( | HelicsEndpoint | endpoint | ) |
Check if a given endpoint has any unread messages.
endpoint | The endpoint to check. |
References HELICS_FALSE, and HELICS_TRUE.
HelicsBool helicsEndpointIsValid | ( | HelicsEndpoint | endpoint | ) |
Check if an endpoint is valid.
endpoint | The endpoint object to check. |
References HELICS_FALSE, and HELICS_TRUE.
Referenced by helicscpp::Endpoint::isValid().
int helicsEndpointPendingMessageCount | ( | HelicsEndpoint | endpoint | ) |
Returns the number of pending receives for all endpoints of a particular federate.
endpoint | The endpoint to query. |
Referenced by helicscpp::Endpoint::pendingMessageCount().
void helicsEndpointRemoveTarget | ( | HelicsEndpoint | endpoint, |
const char * | targetEndpoint, | ||
HelicsError * | err | ||
) |
remove an endpoint from being targeted
endpoint | The endpoint to modify. | |
targetEndpoint | the name of the endpoint to send messages to | |
[in,out] | err | An error object to fill out in case of an error. |
void helicsEndpointSendBytes | ( | HelicsEndpoint | endpoint, |
const void * | data, | ||
int | inputDataLength, | ||
HelicsError * | err | ||
) |
Send a message to the targeted destination.
endpoint | The endpoint to send the data from. | |
data | The data to send. | |
inputDataLength | The length of the data to send. | |
[in,out] | err | A pointer to an error object for catching errors. |
Referenced by helicscpp::Endpoint::send().
void helicsEndpointSendBytesAt | ( | HelicsEndpoint | endpoint, |
const void * | data, | ||
int | inputDataLength, | ||
HelicsTime | time, | ||
HelicsError * | err | ||
) |
Send a message at a specific time to the targeted destinations
endpoint | The endpoint to send the data from. | |
data | The data to send. | |
inputDataLength | The length of the data to send. | |
time | The time the message should be sent. | |
[in,out] | err | A pointer to an error object for catching errors. |
Referenced by helicscpp::Endpoint::sendAt().
void helicsEndpointSendBytesTo | ( | HelicsEndpoint | endpoint, |
const void * | data, | ||
int | inputDataLength, | ||
const char * | dst, | ||
HelicsError * | err | ||
) |
Send a message to the specified destination.
endpoint | The endpoint to send the data from. | |
data | The data to send. | |
inputDataLength | The length of the data to send. | |
dst | The target destination. Use nullptr to send to the default destination. | |
[in,out] | err | A pointer to an error object for catching errors. |
Referenced by helicscpp::Endpoint::sendTo().
void helicsEndpointSendBytesToAt | ( | HelicsEndpoint | endpoint, |
const void * | data, | ||
int | inputDataLength, | ||
const char * | dst, | ||
HelicsTime | time, | ||
HelicsError * | err | ||
) |
Send a message to the specified destination at a specific time.
endpoint | The endpoint to send the data from. | |
data | The data to send. | |
inputDataLength | The length of the data to send. | |
dst | The target destination. Use nullptr to send to the default destination. | |
time | The time the message should be sent. | |
[in,out] | err | A pointer to an error object for catching errors. |
Referenced by helicscpp::Endpoint::sendToAt().
void helicsEndpointSendMessage | ( | HelicsEndpoint | endpoint, |
HelicsMessage | message, | ||
HelicsError * | err | ||
) |
Send a message object from a specific endpoint.
endpoint | The endpoint to send the data from. | |
message | The actual message to send which will be copied. | |
[in,out] | err | A pointer to an error object for catching errors. |
Referenced by helicscpp::Endpoint::sendMessage().
void helicsEndpointSendMessageZeroCopy | ( | HelicsEndpoint | endpoint, |
HelicsMessage | message, | ||
HelicsError * | err | ||
) |
Send a message object from a specific endpoint, the message will not be copied and the message object will no longer be valid after the call.
endpoint | The endpoint to send the data from. | |
message | The actual message to send which will be copied. | |
[in,out] | err | A pointer to an error object for catching errors. |
Referenced by helicscpp::Endpoint::sendMessageZeroCopy().
void helicsEndpointSetDefaultDestination | ( | HelicsEndpoint | endpoint, |
const char * | dst, | ||
HelicsError * | err | ||
) |
Set the default destination for an endpoint if no other endpoint is given.
endpoint | The endpoint to set the destination for. | |
dst | A string naming the desired default endpoint. | |
[in,out] | err | A pointer to an error object for catching errors. |
Referenced by helicscpp::Endpoint::setDefaultDestination().
void helicsEndpointSetInfo | ( | HelicsEndpoint | endpoint, |
const char * | info, | ||
HelicsError * | err | ||
) |
Set the data in the interface information field for an endpoint.
endpoint | The endpoint to set the information for | |
info | The string to store in the field | |
[in,out] | err | An error object to fill out in case of an error. |
Referenced by helicscpp::Endpoint::setInfo().
void helicsEndpointSetOption | ( | HelicsEndpoint | endpoint, |
int | option, | ||
int | value, | ||
HelicsError * | err | ||
) |
Set a handle option on an endpoint.
endpoint | The endpoint to modify. | |
option | Integer code for the option to set /ref helics_handle_options. | |
value | The value to set the option to. | |
[in,out] | err | An error object to fill out in case of an error. |
void helicsEndpointSetTag | ( | HelicsEndpoint | endpoint, |
const char * | tagname, | ||
const char * | tagvalue, | ||
HelicsError * | err | ||
) |
Set the data in a specific tag for an endpoint.
endpoint | The endpoint to query. | |
tagname | The string to set. | |
tagvalue | The string value to associate with a tag. | |
[in,out] | err | An error object to fill out in case of an error. |
void helicsEndpointSubscribe | ( | HelicsEndpoint | endpoint, |
const char * | key, | ||
HelicsError * | err | ||
) |
Subscribe an endpoint to a publication.
endpoint | The endpoint to use. | |
key | The name of the publication. | |
[in,out] | err | A pointer to an error object for catching errors. |
void helicsFederateClearMessages | ( | HelicsFederate | fed | ) |
Clear all stored messages from a federate.
This clears messages retrieved through helicsEndpointGetMessage or helicsFederateGetMessage
fed | The federate to clear the message for. |
References helics::getFedObject().
HelicsMessage helicsFederateCreateMessage | ( | HelicsFederate | fed, |
HelicsError * | err | ||
) |
Create a new empty message object.
The message is empty and isValid will return false since there is no data associated with the message yet.
fed | the federate object to associate the message with | |
[in,out] | err | An error object to fill out in case of an error. |
References helics::getFedObject().
Referenced by helicscpp::MessageFederate::createMessage(), and helicscpp::Message::newMessageObject().
HelicsEndpoint helicsFederateGetEndpoint | ( | HelicsFederate | fed, |
const char * | name, | ||
HelicsError * | err | ||
) |
Get an endpoint object from a name.
fed | The message federate object to use to get the endpoint. | |
name | The name of the endpoint. | |
[in,out] | err | The error object to complete if there is an error. |
The object will not be valid and err will contain an error code if no endpoint with the specified name exists.
References HELICS_ERROR_INVALID_ARGUMENT.
Referenced by helicscpp::MessageFederate::getEndpoint().
HelicsEndpoint helicsFederateGetEndpointByIndex | ( | HelicsFederate | fed, |
int | index, | ||
HelicsError * | err | ||
) |
Get an endpoint by its index, typically already created via registerInterfaces file or something of that nature.
fed | The federate object in which to create a publication. | |
index | The index of the publication to get. | |
[in,out] | err | A pointer to an error object for catching errors. |
The HelicsEndpoint returned will be NULL if given an invalid index.
References HELICS_ERROR_INVALID_ARGUMENT.
Referenced by helicscpp::MessageFederate::getEndpoint().
int helicsFederateGetEndpointCount | ( | HelicsFederate | fed | ) |
Get the number of endpoints in a federate.
fed | The message federate to query. |
Referenced by helicscpp::MessageFederate::getEndpointCount().
HelicsMessage helicsFederateGetMessage | ( | HelicsFederate | fed | ) |
Receive a communication message for any endpoint in the federate.
The return order will be in order of endpoint creation. So all messages that are available for the first endpoint, then all for the second, and so on. Within a single endpoint, the messages are ordered by time, then source_id, then order of arrival.
References helics::getFedObject().
Referenced by helicscpp::MessageFederate::getMessage().
HelicsBool helicsFederateHasMessage | ( | HelicsFederate | fed | ) |
Check if the federate has any outstanding messages.
fed | The federate to check. |
References HELICS_FALSE, and HELICS_TRUE.
Referenced by helicscpp::MessageFederate::hasMessage().
int helicsFederatePendingMessageCount | ( | HelicsFederate | fed | ) |
Returns the number of pending receives for the specified destination endpoint.
fed | The federate to get the number of waiting messages from. |
Referenced by helicscpp::MessageFederate::pendingMessageCount().
HelicsEndpoint helicsFederateRegisterEndpoint | ( | HelicsFederate | fed, |
const char * | name, | ||
const char * | type, | ||
HelicsError * | err | ||
) |
Create an endpoint.
The endpoint becomes part of the federate and is destroyed when the federate is freed so there are no separate free functions for endpoints.
fed | The federate object in which to create an endpoint must have been created with helicsCreateMessageFederate or helicsCreateCombinationFederate. | |
name | The identifier for the endpoint. This will be prepended with the federate name for the global identifier. | |
type | A string describing the expected type of the publication (may be NULL). | |
[in,out] | err | A pointer to an error object for catching errors. |
References helics::getFedObject().
Referenced by helicscpp::MessageFederate::registerEndpoint().
HelicsEndpoint helicsFederateRegisterGlobalEndpoint | ( | HelicsFederate | fed, |
const char * | name, | ||
const char * | type, | ||
HelicsError * | err | ||
) |
Create an endpoint.
The endpoint becomes part of the federate and is destroyed when the federate is freed so there are no separate free functions for endpoints.
fed | The federate object in which to create an endpoint must have been created with helicsCreateMessageFederate or helicsCreateCombinationFederate. | |
name | The identifier for the endpoint, the given name is the global identifier. | |
type | A string describing the expected type of the publication (may be NULL). | |
[in,out] | err | A pointer to an error object for catching errors. |
References helics::getFedObject().
Referenced by helicscpp::MessageFederate::registerGlobalEndpoint().
HelicsEndpoint helicsFederateRegisterGlobalTargetedEndpoint | ( | HelicsFederate | fed, |
const char * | name, | ||
const char * | type, | ||
HelicsError * | err | ||
) |
Create a global targeted endpoint, Targeted endpoints have specific destinations predefined and do not allow sending messages to other endpoints
The endpoint becomes part of the federate and is destroyed when the federate is freed so there are no separate free functions for endpoints.
fed | The federate object in which to create an endpoint must have been created with helicsCreateMessageFederate or helicsCreateCombinationFederate. | |
name | The identifier for the endpoint, the given name is the global identifier. | |
type | A string describing the expected type of the publication (may be NULL). | |
[in,out] | err | A pointer to an error object for catching errors. |
References helics::getFedObject().
HelicsEndpoint helicsFederateRegisterTargetedEndpoint | ( | HelicsFederate | fed, |
const char * | name, | ||
const char * | type, | ||
HelicsError * | err | ||
) |
Create a targeted endpoint. Targeted endpoints have specific destinations predefined and do not allow sending messages to other endpoints
The endpoint becomes part of the federate and is destroyed when the federate is freed so there are no separate free functions for endpoints.
fed | The federate object in which to create an endpoint must have been created with helicsCreateMessageFederate or helicsCreateCombinationFederate. | |
name | The identifier for the endpoint. This will be prepended with the federate name for the global identifier. | |
type | A string describing the expected type of the publication (may be NULL). | |
[in,out] | err | A pointer to an error object for catching errors. |
References helics::getFedObject().