| helics 3.6.1

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

`#include <HandleManager.hpp>`

## Public Member Functions
| HandleManager ()=default
BasicHandleInfo & | addHandle (GlobalFederateId fed_id, InterfaceType what, std::string_view key, std::string_view type, std::string_view units)
BasicHandleInfo & | addHandle (GlobalFederateId fed_id, InterfaceHandle local_id, InterfaceType what, std::string_view key, std::string_view type, std::string_view units)
void | addHandle (const BasicHandleInfo &otherHandle)
void | addHandleAtIndex (const BasicHandleInfo &otherHandle, int32_t index)
void | removeHandle (GlobalHandle handle)
void | removeFederateHandles (GlobalFederateId fedToRemove)
BasicHandleInfo * | getHandleInfo (int32_t index)
const BasicHandleInfo * | getHandleInfo (int32_t index) const
BasicHandleInfo * | getHandleInfo (InterfaceHandle handle)
const BasicHandleInfo * | getHandleInfo (InterfaceHandle handle) const
BasicHandleInfo * | findHandle (GlobalHandle id)
const BasicHandleInfo * | findHandle (GlobalHandle id) const
void | setHandleOption (InterfaceHandle handle, int32_t option, int32_t val)
int32_t | getHandleOption (InterfaceHandle handle, int32_t option) const
BasicHandleInfo * | getInterfaceHandle (std::string_view name, InterfaceType type)
const BasicHandleInfo * | getInterfaceHandle (std::string_view name, InterfaceType type) const
BasicHandleInfo * | getInterfaceHandle (InterfaceHandle handle, InterfaceType type)
const BasicHandleInfo * | getInterfaceHandle (InterfaceHandle handle, InterfaceType type) const
LocalFederateId | getLocalFedID (InterfaceHandle handle) const
BasicHandleInfo & | operator[] (size_t index)
const BasicHandleInfo & | operator[] (size_t index) const
void | addAlias (std::string_view interfaceName, std::string_view alias)
auto | begin ()
auto | end ()
auto | begin () const
auto | end () const
auto | size () const
std::vector< GlobalHandle > | regexSearch (const std::string &regexExpression, InterfaceType type) const
const std::unordered_map< std::string_view, std::vector< std::string_view > > & | getAliases () const

## Detailed Description

class for managing a coordinating the different types of handles used in helics

this class is not designed to be thread safe that would require a wrapper around it

## Constructor & Destructor Documentation

## ◆ HandleManager()

helics::HandleManager::HandleManager | ( |  | ) |
| default

default constructor

## Member Function Documentation

## ◆ addAlias()

void helics::HandleManager::addAlias | ( | std::string_view | interfaceName,
|  | std::string_view | alias
| ) |  |

add an alias for an interface*

Parameters

  interfaceName | the name of the interface to add an alias for
  alias | the new name by which an interface can be referenced

Exceptions

  std::runtime_error | if an alias is duplicated

aliases should be reciprocal

## ◆ addHandle() [1/2]

BasicHandleInfo & helics::HandleManager::addHandle | ( | GlobalFederateId | fed_id,
|  | InterfaceHandle | local_id,
|  | InterfaceType | what,
|  | std::string_view | key,
|  | std::string_view | type,
|  | std::string_view | units
| ) |  |

add a handle to manage

## ◆ addHandle() [2/2]

BasicHandleInfo & helics::HandleManager::addHandle | ( | GlobalFederateId | fed_id,
|  | InterfaceType | what,
|  | std::string_view | key,
|  | std::string_view | type,
|  | std::string_view | units
| ) |  |

add a handle to manage

References helics::InterfaceHandle::baseValue().

Referenced by addHandleAtIndex().

## ◆ addHandleAtIndex()

void helics::HandleManager::addHandleAtIndex | ( | const BasicHandleInfo & | otherHandle,
|  | int32_t | index
| ) |  |

add a handle at the specified index

References addHandle(), and helics::isValidIndex().

## ◆ findHandle() [1/2]

BasicHandleInfo * helics::HandleManager::findHandle | ( | GlobalHandle | id | ) |

find a handle from both the federate and local id

## ◆ findHandle() [2/2]

const BasicHandleInfo * helics::HandleManager::findHandle | ( | GlobalHandle | id | ) | const

find a const handle from both the federate and local id

## ◆ getAliases()

const std::unordered_map<std::string_view, std::vector<std::string_view> >& helics::HandleManager::getAliases | ( |  | ) | const
| inline

get all the aliases

## ◆ getHandleInfo() [1/4]

BasicHandleInfo * helics::HandleManager::getHandleInfo | ( | int32_t | index | ) |

get a handle by index

References helics::isValidIndex().

## ◆ getHandleInfo() [2/4]

const BasicHandleInfo * helics::HandleManager::getHandleInfo | ( | int32_t | index | ) | const

get a const handle by index

References helics::isValidIndex().

## ◆ getHandleInfo() [3/4]

BasicHandleInfo * helics::HandleManager::getHandleInfo | ( | InterfaceHandle | handle | ) |

get a handle by local interface handle

References helics::InterfaceHandle::baseValue(), and helics::isValidIndex().

## ◆ getHandleInfo() [4/4]

const BasicHandleInfo * helics::HandleManager::getHandleInfo | ( | InterfaceHandle | handle | ) | const

get a const handle by local interface handle

References helics::InterfaceHandle::baseValue(), and helics::isValidIndex().

## ◆ getInterfaceHandle() [1/4]

BasicHandleInfo * helics::HandleManager::getInterfaceHandle | ( | InterfaceHandle | handle,
|  | InterfaceType | type
| ) |  |

get an endpoint by index

Returns
  nullptr if the index doesn't point to a valid endpoint

References helics::InterfaceHandle::baseValue(), and helics::isValidIndex().

## ◆ getInterfaceHandle() [2/4]

const BasicHandleInfo * helics::HandleManager::getInterfaceHandle | ( | InterfaceHandle | handle,
|  | InterfaceType | type
| ) |  | const

get a const endpoint by index

Returns
  nullptr if the index doesn't point to a valid endpoint

References helics::InterfaceHandle::baseValue(), and helics::isValidIndex().

## ◆ getInterfaceHandle() [3/4]

BasicHandleInfo * helics::HandleManager::getInterfaceHandle | ( | std::string_view | name,
|  | InterfaceType | type
| ) |  |

get an endpoint from its name

References helics::SINK, and helics::TRANSLATOR.

## ◆ getInterfaceHandle() [4/4]

const BasicHandleInfo * helics::HandleManager::getInterfaceHandle | ( | std::string_view | name,
|  | InterfaceType | type
| ) |  | const

get an endpoint from its name

References helics::SINK, and helics::TRANSLATOR.

## ◆ removeFederateHandles()

void helics::HandleManager::removeFederateHandles | ( | GlobalFederateId | fedToRemove | ) |

remove all handles from a specific federate

References removeHandle().

## ◆ removeHandle()

void helics::HandleManager::removeHandle | ( | GlobalHandle | handle | ) |

remove the information at the specified handle

References helics::ENDPOINT, helics::FILTER, helics::INPUT, helics::PUBLICATION, helics::SINK, and helics::TRANSLATOR.

Referenced by removeFederateHandles().

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

- HandleManager.hpp
- HandleManager.cpp