helics  3.0.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, const std::string &coreName, std::vector< std::string > args)
 
 CoreApp (int argc, char *argv[])
 
 CoreApp (CoreType ctype, const std::string &coreName, int argc, char *argv[])
 
 CoreApp (CoreType ctype, int argc, char *argv[])
 
 CoreApp (const std::string &argString)
 
 CoreApp (CoreType ctype, const std::string &argString)
 
 CoreApp (CoreType ctype, const std::string &coreName, const std::string &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 (const std::string &source, const std::string &target)
 
void dataLink (const std::string &source, const std::string &target)
 
void addSourceFilterToEndpoint (const std::string &filter, const std::string &endpoint)
 
void addDestinationFilterToEndpoint (const std::string &filter, const std::string &endpoint)
 
void makeConnections (const std::string &file)
 
const std::string & getIdentifier () const
 
const std::string & getAddress () const
 
std::string query (const std::string &target, const std::string &queryStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST)
 
void setTag (const std::string &tag, const std::string &value)
 
const std::string & getTag (const std::string &tag) const
 
void setGlobal (const std::string &valueName, const std::string &value)
 
void sendCommand (const std::string &target, const std::string &commandStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST)
 
void setLogFile (const std::string &logFile)
 
void setLoggingLevel (int loglevel)
 
void setReadyToInit ()
 
void haltInit ()
 
CoreAppoperator-> ()
 
const CoreAppoperator-> () const
 
std::shared_ptr< CoregetCopyofCorePointer () const
 
void reset ()
 
void globalError (int32_t errorCode, const std::string &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
argsthe 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
ctypethe type of core to create
argsthe command line arguments to pass in a reverse vector

◆ CoreApp() [4/11]

helics::CoreApp::CoreApp ( CoreType  ctype,
const std::string &  coreName,
std::vector< std::string >  args 
)

construct from command line arguments in a vector

Parameters
ctypethe type of core to create
coreNamethe name of the core to use
argsthe 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
argcthe number of arguments
argvthe strings in the input

References helics::DEFAULT.

◆ CoreApp() [6/11]

helics::CoreApp::CoreApp ( CoreType  ctype,
const std::string &  coreName,
int  argc,
char *  argv[] 
)

construct from command line arguments

Parameters
ctypethe type of core to create
coreNamethe name of the core to use
argcthe number of arguments
argvthe strings in the input

◆ CoreApp() [7/11]

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

construct from command line arguments

Parameters
ctypethe type of core to create
argcthe number of arguments
argvthe strings in the input

◆ CoreApp() [8/11]

helics::CoreApp::CoreApp ( const std::string &  argString)
explicit

construct from command line arguments parsed as a single string

Parameters
argStringa merged string with all the arguments

References helics::CoreFactory::findCore().

◆ CoreApp() [9/11]

helics::CoreApp::CoreApp ( CoreType  ctype,
const std::string &  argString 
)

construct from command line arguments parsed as a single string

Parameters
ctypethe type of core to create
argStringa merged string with all the arguments

◆ CoreApp() [10/11]

helics::CoreApp::CoreApp ( CoreType  ctype,
const std::string &  coreName,
const std::string &  argString 
)

construct from command line arguments parsed as a single string

Parameters
ctypethe type of core to create
coreNamethe name of the core to use or create
argStringa 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

◆ addDestinationFilterToEndpoint()

void helics::CoreApp::addDestinationFilterToEndpoint ( const std::string &  filter,
const std::string &  endpoint 
)

add a destination Filter to an endpoint

◆ addSourceFilterToEndpoint()

void helics::CoreApp::addSourceFilterToEndpoint ( const std::string &  filter,
const std::string &  endpoint 
)

add a source Filter to an endpoint

◆ connect()

bool helics::CoreApp::connect ( )

connect the Core to its broker

◆ dataLink()

void helics::CoreApp::dataLink ( const std::string &  source,
const std::string &  target 
)

link a publication and input

◆ forceTerminate()

void helics::CoreApp::forceTerminate ( )

forceably 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 ( const std::string &  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
tagthe 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,
const std::string &  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 ( const std::string &  source,
const std::string &  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 ( const std::string &  target,
const std::string &  queryStr,
HelicsSequencingModes  mode = HELICS_SEQUENCING_MODE_FAST 
)

make a query at the core

Parameters
targetthe target of the query "federation", "parent", "core","broker" or a specific named object
queryStrthe query to make
modedefaults 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 ( const std::string &  target,
const std::string &  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
targetthe specific target of the command
commandStrthe actual command
modedefaults 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 ( const std::string &  valueName,
const std::string &  value 
)

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
valueNamethe name of the global to set
valuethe value of the global

◆ setLogFile()

void helics::CoreApp::setLogFile ( const std::string &  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 ( const std::string &  tag,
const std::string &  value 
)

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
tagthe name of the tag to set the value for
valuethe 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: