![]() |
helics
3.0.1
|
#include <MessageFederateManager.hpp>
Public Member Functions | |
MessageFederateManager (Core *coreOb, MessageFederate *mFed, LocalFederateId id) | |
Endpoint & | registerEndpoint (const std::string &name, const std::string &type) |
Endpoint & | registerTargetedEndpoint (const std::string &name, const std::string &type) |
bool | hasMessage () const |
uint64_t | pendingMessageCount () const |
std::unique_ptr< Message > | getMessage () |
void | updateTime (Time newTime, Time oldTime) |
void | startupToInitializeStateTransition () |
void | initializeToExecuteStateTransition (IterationResult result) |
std::string | localQuery (const std::string &queryStr) const |
Endpoint & | getEndpoint (const std::string &name) |
const Endpoint & | getEndpoint (const std::string &name) const |
Endpoint & | getEndpoint (int index) |
const Endpoint & | getEndpoint (int index) 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 | ||
) |
construct from a pointer to a core and a specified federate id
void helics::MessageFederateManager::disconnect | ( | ) |
disconnect from the coreObject
Endpoint & helics::MessageFederateManager::getEndpoint | ( | const std::string & | name | ) |
get the id of a registered publication from its id
name | the publication id |
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 | ( | IterationResult | result | ) |
transition from initialize to execution State
References helics::initializationTime, helics::NEXT_STEP, helics::timeZero, and updateTime().
std::string helics::MessageFederateManager::localQuery | ( | const std::string & | 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::registerEndpoint | ( | const std::string & | name, |
const std::string & | type | ||
) |
register an endpoint
call is only valid in startup mode
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 | ( | const std::string & | name, |
const std::string & | type | ||
) |
register a targeted endpoint
call is only valid in startup mode
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().