| helics 3.6.1

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

`#include <CoreApp.hpp>`

## Public Member Functions
| CoreApp ()=default
| CoreApp (std::vector< std::string > args)
| CoreApp (CoreType ctype, std::vector< std::string > args)
| CoreApp (CoreType ctype, std::string_view coreName, std::vector< std::string > args)
| CoreApp (int argc, char *argv[])
| CoreApp (CoreType ctype, std::string_view coreName, int argc, char *argv[])
| CoreApp (CoreType ctype, int argc, char *argv[])
| CoreApp (std::string_view argString)
| CoreApp (CoreType ctype, std::string_view argString)
| CoreApp (CoreType ctype, std::string_view coreName, std::string_view argString)
| CoreApp (std::shared_ptr< Core > cr)
bool | isConnected () const
bool | connect ()
bool | isOpenToNewFederates () const
void | forceTerminate ()
bool | waitForDisconnect (std::chrono::milliseconds waitTime=std::chrono::milliseconds(0))
void | linkEndpoints (std::string_view source, std::string_view target)
void | dataLink (std::string_view source, std::string_view target)
void | addSourceFilterToEndpoint (std::string_view filter, std::string_view endpoint)
void | addDestinationFilterToEndpoint (std::string_view filter, std::string_view endpoint)
void | addAlias (std::string_view interfaceName, std::string_view alias)
void | makeConnections (const std::string &file)
const std::string & | getIdentifier () const
const std::string & | getAddress () const
std::string | query (std::string_view target, std::string_view queryStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST)
void | setTag (std::string_view tag, std::string_view value="true")
const std::string & | getTag (std::string_view tag) const
void | setGlobal (std::string_view valueName, std::string_view value="true")
void | sendCommand (std::string_view target, std::string_view commandStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST)
void | setLogFile (std::string_view logFile)
void | setLoggingLevel (int loglevel)
void | setReadyToInit ()
void | haltInit ()
CoreApp * | operator-> ()
const CoreApp * | operator-> () const
std::shared_ptr< Core > | getCopyofCorePointer () const
void | reset ()
void | globalError (int32_t errorCode, std::string_view errorString)

## Detailed Description

class implementing a Core object. This object is meant to a be a very simple core executor with a similar interface to the other apps

## Constructor & Destructor Documentation

## ◆ CoreApp() [1/11]

helics::CoreApp::CoreApp | ( |  | ) |
| default

default constructor

## ◆ CoreApp() [2/11]

helics::CoreApp::CoreApp | ( | std::vector< std::string > | args | ) |
| explicit

construct from command line arguments in a vector

Parameters

  args | the command line arguments to pass in a reverse vector

References helics::DEFAULT.

## ◆ CoreApp() [3/11]

helics::CoreApp::CoreApp | ( | CoreType | ctype,
|  | std::vector< std::string > | args
| ) |  |

construct from command line arguments in a vector

Parameters

  ctype | the type of core to create
  args | the command line arguments to pass in a reverse vector

## ◆ CoreApp() [4/11]

helics::CoreApp::CoreApp | ( | CoreType | ctype,
|  | std::string_view | coreName,
|  | std::vector< std::string > | args
| ) |  |

construct from command line arguments in a vector

Parameters

  ctype | the type of core to create
  coreName | the name of the core to use
  args | the command line arguments to pass in a reverse vector

## ◆ CoreApp() [5/11]

helics::CoreApp::CoreApp | ( | int | argc,
|  | char * | argv[]
| ) |  |

construct from command line arguments

Parameters

  argc | the number of arguments
  argv | the strings in the input

References helics::DEFAULT.

## ◆ CoreApp() [6/11]

helics::CoreApp::CoreApp | ( | CoreType | ctype,
|  | std::string_view | coreName,
|  | int | argc,
|  | char * | argv[]
| ) |  |

construct from command line arguments

Parameters

  ctype | the type of core to create
  coreName | the name of the core to use
  argc | the number of arguments
  argv | the strings in the input

## ◆ CoreApp() [7/11]

helics::CoreApp::CoreApp | ( | CoreType | ctype,
|  | int | argc,
|  | char * | argv[]
| ) |  |

construct from command line arguments

Parameters

  ctype | the type of core to create
  argc | the number of arguments
  argv | the strings in the input

## ◆ CoreApp() [8/11]

helics::CoreApp::CoreApp | ( | std::string_view | argString | ) |
| explicit

construct from command line arguments parsed as a single string

Parameters

  argString | a merged string with all the arguments

References helics::CoreFactory::findCore().

## ◆ CoreApp() [9/11]

helics::CoreApp::CoreApp | ( | CoreType | ctype,
|  | std::string_view | argString
| ) |  |

construct from command line arguments parsed as a single string

Parameters

  ctype | the type of core to create
  argString | a merged string with all the arguments

## ◆ CoreApp() [10/11]

helics::CoreApp::CoreApp | ( | CoreType | ctype,
|  | std::string_view | coreName,
|  | std::string_view | argString
| ) |  |

construct from command line arguments parsed as a single string

Parameters

  ctype | the type of core to create
  coreName | the name of the core to use or create
  argString | a merged string with all the arguments

## ◆ CoreApp() [11/11]

helics::CoreApp::CoreApp | ( | std::shared_ptr< Core > | cr | ) |
| explicit

create a CoreApp from a core pointer

## Member Function Documentation

## ◆ addAlias()

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

add an alias for an interface

## ◆ addDestinationFilterToEndpoint()

void helics::CoreApp::addDestinationFilterToEndpoint | ( | std::string_view | filter,
|  | std::string_view | endpoint
| ) |  |

add a destination Filter to an endpoint

## ◆ addSourceFilterToEndpoint()

void helics::CoreApp::addSourceFilterToEndpoint | ( | std::string_view | filter,
|  | std::string_view | endpoint
| ) |  |

add a source Filter to an endpoint

## ◆ connect()

bool helics::CoreApp::connect | ( |  | ) |

connect the Core to its broker

## ◆ dataLink()

void helics::CoreApp::dataLink | ( | std::string_view | source,
|  | std::string_view | target
| ) |  |

link a publication and input

## ◆ forceTerminate()

void helics::CoreApp::forceTerminate | ( |  | ) |

forcibly disconnect the core

Referenced by helics::CoreKeeper::forceTerminate().

## ◆ getAddress()

const std::string & helics::CoreApp::getAddress | ( |  | ) | const

get the network address of the core

## ◆ getCopyofCorePointer()

std::shared_ptr<Core> helics::CoreApp::getCopyofCorePointer | ( |  | ) | const
| inline

get a copy of the core pointer

Referenced by helics::make_cloning_filter(), and helics::make_filter().

## ◆ getIdentifier()

const std::string & helics::CoreApp::getIdentifier | ( |  | ) | const

get the identifier of the core

## ◆ getTag()

const std::string & helics::CoreApp::getTag | ( | std::string_view | tag | ) | const

get the value of a specific tag (key-value pair) for a core

the tag is an arbitrary user defined string and value; the tags for a core are queryable

Parameters

  tag | the name of the tag to get the value for

Returns
  a std::string containing the value of the tag, if the tag is not defined the value is an empty string

References helics::gLocalCoreId().

## ◆ globalError()

void helics::CoreApp::globalError | ( | int32_t | errorCode,
|  | std::string_view | errorString
| ) |  |

generate a global error on a core

References helics::gLocalCoreId().

## ◆ haltInit()

void helics::CoreApp::haltInit | ( |  | ) |

tell the core to pause init even if otherwise ready

References helics::gLocalCoreId(), and HELICS_FLAG_DELAY_INIT_ENTRY.

## ◆ isConnected()

bool helics::CoreApp::isConnected | ( |  | ) | const

check if the Core is running

Referenced by helics::CoreKeeper::isConnected(), and helics::CoreKeeper::~CoreKeeper().

## ◆ isOpenToNewFederates()

bool helics::CoreApp::isOpenToNewFederates | ( |  | ) | const

check if the broker is ready to accept new federates or cores

## ◆ linkEndpoints()

void helics::CoreApp::linkEndpoints | ( | std::string_view | source,
|  | std::string_view | target
| ) |  |

link two endpoints together with source and destination

## ◆ makeConnections()

void helics::CoreApp::makeConnections | ( | const std::string & | file | ) |

make connections from a core using a file

## ◆ query()

std::string helics::CoreApp::query | ( | std::string_view | target,
|  | std::string_view | queryStr,
|  | HelicsSequencingModes | mode = `HELICS_SEQUENCING_MODE_FAST`
| ) |  |

make a query at the core

Parameters

  target | the target of the query "federation", "parent", "core","broker" or a specific named object
  queryStr | the query to make
  mode | defaults to fast (asynchronous) meaning the query goes into priority channels, ordered (synchronous) means slower queries but has more ordering guarantees

Returns
  a string containing the query results

make a query at the core

References helics::generateJsonErrorResponse().

## ◆ reset()

void helics::CoreApp::reset | ( |  | ) |

reset the app to default state

## ◆ sendCommand()

void helics::CoreApp::sendCommand | ( | std::string_view | target,
|  | std::string_view | commandStr,
|  | HelicsSequencingModes | mode = `HELICS_SEQUENCING_MODE_FAST`
| ) |  |

send a command to a specific target

the format is somewhat unspecified; target is the name of an object, typically one of "federation", "broker", "core", or the name of a specific object/core/broker

Parameters

  target | the specific target of the command
  commandStr | the actual command
  mode | defaults to fast (asynchronous) meaning the command goes into priority channels, ordered (synchronous) means slower commands but has more ordering guarantees

## ◆ setGlobal()

void helics::CoreApp::setGlobal | ( | std::string_view | valueName,
|  | std::string_view | value = `"true"`
| ) |  |

set a federation global value

this overwrites any previous value for this name globals can be queried with a target of "global" or "global_value" and queryStr of the value to Query

Parameters

  valueName | the name of the global to set
  value | the value of the global

## ◆ setLogFile()

void helics::CoreApp::setLogFile | ( | std::string_view | logFile | ) |

set the log file to use for the core

## ◆ setLoggingLevel()

void helics::CoreApp::setLoggingLevel | ( | int | loglevel | ) |

set the minimum log level to use in the core

## ◆ setReadyToInit()

void helics::CoreApp::setReadyToInit | ( |  | ) |

tell the core that is ready to enter initialization mode

## ◆ setTag()

void helics::CoreApp::setTag | ( | std::string_view | tag,
|  | std::string_view | value = `"true"`
| ) |  |

set a tag (key-value pair) for a core

the tag is an arbitrary user defined string and value; the tags for a core are queryable through a "tags" query or "tag/<tagname>"

Parameters

  tag | the name of the tag to set the value for
  value | the value for the given tag

References helics::gLocalCoreId().

## ◆ waitForDisconnect()

bool helics::CoreApp::waitForDisconnect | ( | std::chrono::milliseconds | waitTime = `std::chrono::milliseconds(0)` | ) |

wait for the core to normally disconnect for a certain amount of time

Referenced by helics::CoreKeeper::~CoreKeeper().

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

- application_api/CoreApp.hpp
- CoreApp.cpp