| helics 3.6.1

Classes | Public Member Functions | Static Public Member Functions | List of all members
helics::MessageFederateManager Class Reference

`#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)

## Detailed Description

class handling the implementation details of a value Federate

the functions will parallel those in message Federate and contain the actual implementation details

## Constructor & Destructor Documentation

## ◆ MessageFederateManager()

helics::MessageFederateManager::MessageFederateManager | ( | Core * | coreOb,
|  | MessageFederate * | mFed,
|  | LocalFederateId | id,
|  | bool | singleThreaded
| ) |  |

construct from a pointer to a core and a specified federate id

## Member Function Documentation

## ◆ disconnect()

void helics::MessageFederateManager::disconnect | ( |  | ) |

disconnect from the coreObject

## ◆ getDataSink()

Endpoint & helics::MessageFederateManager::getDataSink | ( | std::string_view | name | ) |

get a data sink from its name

Parameters

  name | the data sink

Returns
  an invalid endpoint if name is not recognized otherwise returns the requested endpoint object

## ◆ getEndpoint()

Endpoint & helics::MessageFederateManager::getEndpoint | ( | std::string_view | name | ) |

get an endpoint object from its name

Parameters

  name | the endpoint

Returns
  ivalid_publication_id if name is not recognized otherwise returns the publication_id

## ◆ getEndpointCount()

int helics::MessageFederateManager::getEndpointCount | ( |  | ) | const

get the number of registered endpoints

## ◆ getMessage()

std::unique_ptr< Message > helics::MessageFederateManager::getMessage | ( | const Endpoint & | ept | ) |
| static

receive a packet from a particular endpoint

Parameters

  ept | the identifier for the endpoint

Returns
  a message object

## ◆ hasMessage()

bool helics::MessageFederateManager::hasMessage | ( |  | ) | const

check if the federate has any outstanding messages

## ◆ initializeToExecuteStateTransition()

void helics::MessageFederateManager::initializeToExecuteStateTransition | ( | iteration_time | result | ) |

transition from initialize to execution State

References helics::iteration_time::grantedTime, helics::initializationTime, and updateTime().

## ◆ localQuery()

std::string helics::MessageFederateManager::localQuery | ( | std::string_view | queryStr | ) | const

generate results for a local query

## ◆ pendingMessageCount() [1/2]

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.

## ◆ pendingMessageCount() [2/2]

uint64_t helics::MessageFederateManager::pendingMessageCount | ( | const Endpoint & | ept | ) |
| static

Returns the number of pending receives for the specified destination endpoint.

## ◆ registerDataSink()

Endpoint & helics::MessageFederateManager::registerDataSink | ( | std::string_view | name | ) |

register a data sink

Parameters

  name | the name of the data sink

References helics::Core::registerDataSink().

## ◆ registerEndpoint()

Endpoint & helics::MessageFederateManager::registerEndpoint | ( | std::string_view | name,
|  | std::string_view | type
| ) |  |

register an endpoint

Parameters

  name | the name of the endpoint
  type | the defined type of the interface for endpoint checking if requested

References helics::Core::registerEndpoint().

## ◆ registerTargetedEndpoint()

Endpoint & helics::MessageFederateManager::registerTargetedEndpoint | ( | std::string_view | name,
|  | std::string_view | type
| ) |  |

register a targeted endpoint

Parameters

  name | the name of the endpoint
  type | the defined type of the interface for endpoint checking if requested

References helics::Core::registerTargetedEndpoint().

## ◆ setEndpointNotificationCallback() [1/2]

void helics::MessageFederateManager::setEndpointNotificationCallback | ( | const Endpoint & | ept,
|  | const std::function< void(Endpoint &, Time)> & | callback
| ) |  |
| static

register a callback function to call when the specified endpoint receives a message

Parameters

  ept | the endpoint id to register the callback for
  callback | the function to call

## ◆ setEndpointNotificationCallback() [2/2]

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

Parameters

  callback | the function to call

## ◆ startupToInitializeStateTransition()

void helics::MessageFederateManager::startupToInitializeStateTransition | ( |  | ) |

transition from Startup To the Initialize State

## ◆ updateTime()

void helics::MessageFederateManager::updateTime | ( | Time | newTime,
|  | Time | oldTime
| ) |  |

update the time from oldTime to newTime

Parameters

  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().

The documentation for this class was generated from the following files:

- MessageFederateManager.hpp
- MessageFederateManager.cpp