| helics 3.6.1

Public Member Functions | Friends | List of all members
helics::Endpoint Class Reference

`#include <Endpoints.hpp>`

Inheritance diagram for helics::Endpoint:

## Public Member Functions
| Endpoint ()=default
| Endpoint (MessageFederate *mFed, std::string_view name, InterfaceHandle hid)
| Endpoint (MessageFederate *mFed, std::string_view name, std::string_view type=std::string_view{})
template<class FedPtr >
| Endpoint (FedPtr &mFed, std::string_view name, std::string_view type=std::string_view{})
| Endpoint (InterfaceVisibility locality, MessageFederate *mFed, std::string_view name, std::string_view type=std::string_view{})
template<class FedPtr >
| Endpoint (InterfaceVisibility locality, FedPtr &mFed, std::string_view name, std::string_view type=std::string_view{})
const std::string & | getType () const
void | send (const char *data, size_t data_size) const
void | subscribe (std::string_view key)
void | sendTo (const char *data, size_t data_size, std::string_view dest) const
void | sendAt (const char *data, size_t data_size, Time sendTime) const
void | sendTo (const data_view &data, std::string_view dest) const
void | sendToAt (const data_view &data, std::string_view dest, Time sendTime) const
void | sendToAt (const char *data, size_t data_size, std::string_view dest, Time sendTime) const
void | send (const void *data, size_t data_size) const
void | send (const data_view &data) const
void | sendAt (const data_view &data, Time sendTime) const
void | send (std::unique_ptr< Message > mess) const
void | send (const Message &mess) const
std::unique_ptr< Message > | getMessage () const
bool | hasMessage () const
std::uint64_t | pendingMessageCount () const
void | setCallback (const std::function< void(const Endpoint &, Time)> &callback)
void | addSourceFilter (std::string_view filterName)
void | addDestinationFilter (std::string_view filterName)
void | setDefaultDestination (std::string_view target)
void | addSourceEndpoint (std::string_view endpointName)
void | addDestinationEndpoint (std::string_view endpointName)
const std::string & | getDefaultDestination () const
virtual const std::string & | getDisplayName () const override
Public Member Functions inherited from helics::Interface
| Interface (Federate *federate, InterfaceHandle hid, std::string_view actName)
| Interface (Core *core, InterfaceHandle hid, std::string_view actName)
InterfaceHandle | getHandle () const
| operator InterfaceHandle () const
bool | isValid () const
bool | operator< (const Interface &inp) const
bool | operator> (const Interface &inp) const
bool | operator== (const Interface &inp) const
bool | operator!= (const Interface &inp) const
const std::string & | getLocalName () const
const std::string & | getName () const
const std::string & | getTarget () const
void | addSourceTarget (std::string_view newTarget, InterfaceType hint=InterfaceType::UNKNOWN)
void | addDestinationTarget (std::string_view newTarget, InterfaceType hint=InterfaceType::UNKNOWN)
void | removeTarget (std::string_view targetToRemove)
void | addAlias (std::string_view alias)
const std::string & | getInfo () const
void | setInfo (std::string_view info)
void | setTag (std::string_view tag, std::string_view value)
const std::string & | getTag (std::string_view tag) const
virtual void | setOption (int32_t option, int32_t value=1)
virtual int32_t | getOption (int32_t option) const
const std::string & | getInjectionType () const
const std::string & | getExtractionType () const
const std::string & | getInjectionUnits () const
const std::string & | getExtractionUnits () const
const std::string & | getSourceTargets () const
const std::string & | getDestinationTargets () const
std::size_t | getSourceTargetCount () const
std::size_t | getDestinationTargetCount () const
void | close ()
void | disconnectFromCore ()

## Friends
class | MessageFederateManager

## Additional Inherited Members
Protected Attributes inherited from helics::Interface
Core * | mCore {nullptr}
| pointer to the core object
InterfaceHandle | handle {}
| the id as generated by the Federate
std::string | mName
| the name or key of the interface

## Detailed Description

class to manage an endpoint

## Constructor & Destructor Documentation

## ◆ Endpoint() [1/3]

helics::Endpoint::Endpoint | ( |  | ) |
| default

default constructor

## ◆ Endpoint() [2/3]

helics::Endpoint::Endpoint | ( | InterfaceVisibility | locality,
|  | MessageFederate * | mFed,
|  | std::string_view | name,
|  | std::string_view | type = `std::string_view{}`
| ) |  |

constructor to build an endpoint object

Parameters

  locality | visibility of the endpoint either global or local
  mFed | the MessageFederate to use
  name | the name of the endpoint
  type | a named type associated with the endpoint

References helics::MessageFederate::registerEndpoint(), and helics::MessageFederate::registerGlobalEndpoint().

## ◆ Endpoint() [3/3]

template<class FedPtr >

helics::Endpoint::Endpoint | ( | InterfaceVisibility | locality,
|  | FedPtr & | mFed,
|  | std::string_view | name,
|  | std::string_view | type = `std::string_view{}`
| ) |  |
| inline

constructor to build an endpoint object

Parameters

  locality | visibility of the endpoint either global or local
  mFed | the MessageFederate to use
  name | the name of the endpoint
  type | a named type associated with the endpoint

## Member Function Documentation

## ◆ addDestinationFilter()

void helics::Endpoint::addDestinationFilter | ( | std::string_view | filterName | ) |

add a named filter to an endpoint for all message going to the endpoint

add a named filter to an endpoint for all messages going to the endpoint

## ◆ addSourceFilter()

void helics::Endpoint::addSourceFilter | ( | std::string_view | filterName | ) |

add a named filter to an endpoint for all message coming from the endpoint

add a named filter to an endpoint for all messages coming from the endpoint

## ◆ getDefaultDestination()

const std::string & helics::Endpoint::getDefaultDestination | ( |  | ) | const

get the target destination for the endpoint TODO(PT):: make this work

## ◆ getDisplayName()

virtual const std::string& helics::Endpoint::getDisplayName | ( |  | ) | const
| inline override virtual

get the display name for an input

the name is the given local name or if empty the name of the target

Implements helics::Interface.

## ◆ getMessage()

std::unique_ptr< Message > helics::Endpoint::getMessage | ( |  | ) | const

get an available message if there is no message the returned object is empty

## ◆ hasMessage()

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

check if there is a message available

## ◆ pendingMessageCount()

std::uint64_t helics::Endpoint::pendingMessageCount | ( |  | ) | const

Get the number of available messages

check if there is a message available

## ◆ send() [1/5]

void helics::Endpoint::send | ( | const char * | data,
|  | size_t | data_size
| ) |  | const

send a data block and length to the endpoint targets

Parameters

  data | pointer to data location
  data_size | the length of the data

## ◆ send() [2/5]

void helics::Endpoint::send | ( | const data_view & | data | ) | const
| inline

send a data_view to the target destination

a data view can convert from many different formats so this function should be catching many of the common use cases

Parameters

  data | the information to send

References helics::data_view::data(), send(), and helics::data_view::size().

Referenced by send().

## ◆ send() [3/5]

void helics::Endpoint::send | ( | const Message & | mess | ) | const
| inline

send a message object

this is to send a pre-built message

Parameters

  mess | a reference to an actual message object

References send().

Referenced by send().

## ◆ send() [4/5]

void helics::Endpoint::send | ( | const void * | data,
|  | size_t | data_size
| ) |  | const

send a data block and length to the target destination

Parameters

  data | pointer to data location
  data_size | the length of the data

## ◆ send() [5/5]

void helics::Endpoint::send | ( | std::unique_ptr< Message > | mess | ) | const

send a pointer to a message object

## ◆ sendAt() [1/2]

void helics::Endpoint::sendAt | ( | const char * | data,
|  | size_t | data_size,
|  | Time | sendTime
| ) |  | const

send a data block and length

Parameters

  sendTime | the time to send the message
  data | pointer to data location
  data_size | the length of the data

## ◆ sendAt() [2/2]

void helics::Endpoint::sendAt | ( | const data_view & | data,
|  | Time | sendTime
| ) |  | const
| inline

send a data_view to the specified target destination

a data view can convert from many different formats so this function should be catching many of the common use cases

Parameters

  data | a representation to send
  sendTime | the time the message should be sent

References helics::data_view::data(), and helics::data_view::size().

## ◆ sendTo() [1/2]

void helics::Endpoint::sendTo | ( | const char * | data,
|  | size_t | data_size,
|  | std::string_view | dest
| ) |  | const

send a data block and length

Parameters

  dest | string name of the destination
  data | pointer to data location
  data_size | the length of the data

## ◆ sendTo() [2/2]

void helics::Endpoint::sendTo | ( | const data_view & | data,
|  | std::string_view | dest
| ) |  | const
| inline

send a data_view

a data view can convert from many different formats so this function should be catching many of the common use cases

Parameters

  dest | string name of the destination
  data | the information to send

References helics::data_view::data(), and helics::data_view::size().

## ◆ sendToAt() [1/2]

void helics::Endpoint::sendToAt | ( | const char * | data,
|  | size_t | data_size,
|  | std::string_view | dest,
|  | Time | sendTime
| ) |  | const

send a data block and length to a destination at a particular time

Parameters

  data | pointer to data location
  data_size | the length of the data
  dest | string name of the destination
  sendTime | the time to send the message

## ◆ sendToAt() [2/2]

void helics::Endpoint::sendToAt | ( | const data_view & | data,
|  | std::string_view | dest,
|  | Time | sendTime
| ) |  | const
| inline

send a data_view

a data view can convert from many different formats so this function should be catching many of the common use cases

Parameters

  data | data representation to send
  dest | string name of the destination
  sendTime | the time the message should be sent

References helics::data_view::data(), and helics::data_view::size().

## ◆ setCallback()

void helics::Endpoint::setCallback | ( | const std::function< void(const Endpoint &, Time)> & | callback | ) |

register a callback for an update notification

the callback is called in the just before the time request function returns

Parameters

  callback | a function with signature void(endpoint_id_t, Time) time is the time the value was updated This callback is a notification callback and doesn't return the value

## ◆ setDefaultDestination()

void helics::Endpoint::setDefaultDestination | ( | std::string_view | target | ) |

set a target destination for unspecified messages

## ◆ subscribe()

void helics::Endpoint::subscribe | ( | std::string_view | key | ) |

subscribe the endpoint to a particular publication

References helics::PUBLICATION.

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

- Endpoints.hpp
- Endpoints.cpp