helics
3.5.2
|
#include <MessageFederateManager.hpp>
Public Member Functions | |
MessageFederateManager (Core *coreOb, MessageFederate *mFed, LocalFederateId id, bool singleThreaded) | |
Endpoint & | registerEndpoint (std::string_view name, std::string_view type) |
Endpoint & | registerTargetedEndpoint (std::string_view name, std::string_view type) |
Endpoint & | registerDataSink (std::string_view name) |
bool | hasMessage () const |
uint64_t | pendingMessageCount () const |
std::unique_ptr< Message > | getMessage () |
void | updateTime (Time newTime, Time oldTime) |
void | startupToInitializeStateTransition () |
void | initializeToExecuteStateTransition (iteration_time result) |
std::string | localQuery (std::string_view queryStr) const |
Endpoint & | getEndpoint (std::string_view name) |
const Endpoint & | getEndpoint (std::string_view name) const |
Endpoint & | getEndpoint (int index) |
const Endpoint & | getEndpoint (int index) const |
Endpoint & | getDataSink (std::string_view name) |
const Endpoint & | getDataSink (std::string_view name) const |
void | setEndpointNotificationCallback (const std::function< void(Endpoint &, Time)> &callback) |
void | disconnect () |
int | getEndpointCount () const |
Static Public Member Functions | |
static bool | hasMessage (const Endpoint &ept) |
static uint64_t | pendingMessageCount (const Endpoint &ept) |
static std::unique_ptr< Message > | getMessage (const Endpoint &ept) |
static void | setEndpointNotificationCallback (const Endpoint &ept, const std::function< void(Endpoint &, Time)> &callback) |
class handling the implementation details of a value Federate
the functions will parallel those in message Federate and contain the actual implementation details
helics::MessageFederateManager::MessageFederateManager | ( | Core * | coreOb, |
MessageFederate * | mFed, | ||
LocalFederateId | id, | ||
bool | singleThreaded | ||
) |
construct from a pointer to a core and a specified federate id
void helics::MessageFederateManager::disconnect | ( | ) |
disconnect from the coreObject
Endpoint & helics::MessageFederateManager::getDataSink | ( | std::string_view | name | ) |
get a data sink from its name
name | the data sink |
Endpoint & helics::MessageFederateManager::getEndpoint | ( | std::string_view | name | ) |
get an endpoint object from its name
name | the endpoint |
int helics::MessageFederateManager::getEndpointCount | ( | ) | const |
get the number of registered endpoints
|
static |
receive a packet from a particular endpoint
ept | the identifier for the endpoint |
bool helics::MessageFederateManager::hasMessage | ( | ) | const |
check if the federate has any outstanding messages
void helics::MessageFederateManager::initializeToExecuteStateTransition | ( | iteration_time | result | ) |
transition from initialize to execution State
References helics::iteration_time::grantedTime, helics::initializationTime, and updateTime().
std::string helics::MessageFederateManager::localQuery | ( | std::string_view | queryStr | ) | const |
generate results for a local query
uint64_t helics::MessageFederateManager::pendingMessageCount | ( | ) | const |
Returns the number of pending receives for the specified destination endpoint.
Returns the number of pending receives for the specified destination endpoint.
this function is not preferred in multi-threaded contexts due to the required locking prefer to just use getMessage until it returns an invalid Message.
|
static |
Returns the number of pending receives for the specified destination endpoint.
Endpoint & helics::MessageFederateManager::registerDataSink | ( | std::string_view | name | ) |
register a data sink
name | the name of the data sink |
References helics::Core::registerDataSink().
Endpoint & helics::MessageFederateManager::registerEndpoint | ( | std::string_view | name, |
std::string_view | type | ||
) |
register an endpoint
name | the name of the endpoint |
type | the defined type of the interface for endpoint checking if requested |
References helics::Core::registerEndpoint().
Endpoint & helics::MessageFederateManager::registerTargetedEndpoint | ( | std::string_view | name, |
std::string_view | type | ||
) |
register a targeted endpoint
name | the name of the endpoint |
type | the defined type of the interface for endpoint checking if requested |
References helics::Core::registerTargetedEndpoint().
|
static |
register a callback function to call when the specified endpoint receives a message
ept | the endpoint id to register the callback for |
callback | the function to call |
void helics::MessageFederateManager::setEndpointNotificationCallback | ( | const std::function< void(Endpoint &, Time)> & | callback | ) |
register a callback function to call when any endpoint receives a message
there can only be one generic callback
callback | the function to call |
void helics::MessageFederateManager::startupToInitializeStateTransition | ( | ) |
transition from Startup To the Initialize State
update the time from oldTime to newTime
newTime | the newTime of the federate |
oldTime | the oldTime of the federate |
find the id
References helics::Core::receiveAny(), and helics::Core::receiveCountAny().
Referenced by initializeToExecuteStateTransition().