helics  3.5.2
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)
 
EndpointregisterEndpoint (std::string_view name, std::string_view type)
 
EndpointregisterTargetedEndpoint (std::string_view name, std::string_view type)
 
EndpointregisterDataSink (std::string_view name)
 
bool hasMessage () const
 
uint64_t pendingMessageCount () const
 
std::unique_ptr< MessagegetMessage ()
 
void updateTime (Time newTime, Time oldTime)
 
void startupToInitializeStateTransition ()
 
void initializeToExecuteStateTransition (iteration_time result)
 
std::string localQuery (std::string_view queryStr) const
 
EndpointgetEndpoint (std::string_view name)
 
const EndpointgetEndpoint (std::string_view name) const
 
EndpointgetEndpoint (int index)
 
const EndpointgetEndpoint (int index) const
 
EndpointgetDataSink (std::string_view name)
 
const EndpointgetDataSink (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< MessagegetMessage (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
namethe 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
namethe 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
eptthe 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
namethe 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
namethe name of the endpoint
typethe 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
namethe name of the endpoint
typethe 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
eptthe endpoint id to register the callback for
callbackthe 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
callbackthe 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
newTimethe newTime of the federate
oldTimethe 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: