helics  3.5.1
Public Member Functions | Protected Attributes | List of all members
helicscpp::Core Class Reference

Public Member Functions

 Core () HELICS_NOTHROW
 
 Core (const std::string &type, const std::string &name, const std::string &initString)
 
 Core (const std::string &type, const std::string &name, int argc, char **argv)
 
 Core (HelicsCore cr) HELICS_NOTHROW
 
 ~Core ()
 
 operator HelicsCore ()
 
HelicsCore baseObject () const
 
bool isConnected () const
 
 Core (const Core &cr)
 
Coreoperator= (const Core &cr)
 
void setReadyToInit ()
 
void disconnect ()
 
bool waitForDisconnect (int msToWait=-1)
 
const char * getIdentifier () const
 
const char * getAddress () const
 
Filter registerFilter (HelicsFilterTypes type, const std::string &name=std::string())
 
CloningFilter registerCloningFilter (const std::string &deliveryEndpoint)
 
void setGlobal (const std::string &valueName, const std::string &value)
 
void addAlias (const std::string &interfaceName, const std::string &alias)
 
void globalError (int errorCode, const std::string &errorString)
 
void sendCommand (const std::string &target, const std::string &command)
 
std::string query (const std::string &target, const std::string &queryStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST) const
 

Protected Attributes

HelicsCore core
 reference to the underlying core object
 

Constructor & Destructor Documentation

◆ Core() [1/5]

helicscpp::Core::Core ( )
inline

Default constructor

◆ Core() [2/5]

helicscpp::Core::Core ( const std::string &  type,
const std::string &  name,
const std::string &  initString 
)
inline

construct with type, core name and initialization string

References core, and helicsCreateCore().

◆ Core() [3/5]

helicscpp::Core::Core ( const std::string &  type,
const std::string &  name,
int  argc,
char **  argv 
)
inline

construct with type, core name and command line arguments

References core, and helicsCreateCoreFromArgs().

◆ Core() [4/5]

helicscpp::Core::Core ( HelicsCore  cr)
inlineexplicit

construct a core from a core pointer

◆ ~Core()

helicscpp::Core::~Core ( )
inline

destructor

References core, and helicsCoreFree().

◆ Core() [5/5]

helicscpp::Core::Core ( const Core cr)
inline

copy constructor

References core, and helicsCoreClone().

Member Function Documentation

◆ addAlias()

void helicscpp::Core::addAlias ( const std::string &  interfaceName,
const std::string &  alias 
)
inline

add a global alias for an interface

Parameters
interfaceNamethe given name of the interface
aliasthe new name by which the interface can be referenced

References core, and helicsCoreAddAlias().

◆ baseObject()

HelicsCore helicscpp::Core::baseObject ( ) const
inline

explicitly get the base HelicsCore object

References core.

◆ disconnect()

void helicscpp::Core::disconnect ( )
inline

disconnect the core from its broker

References core, and helicsCoreDisconnect().

◆ getAddress()

const char* helicscpp::Core::getAddress ( ) const
inline

get the connection network or connection address for the core

References core, and helicsCoreGetAddress().

◆ getIdentifier()

const char* helicscpp::Core::getIdentifier ( ) const
inline

get an identifier string for the core

References core, and helicsCoreGetIdentifier().

◆ isConnected()

bool helicscpp::Core::isConnected ( ) const
inline

check if the core is connected to the broker

References core, HELICS_FALSE, and helicsCoreIsConnected().

◆ operator HelicsCore()

helicscpp::Core::operator HelicsCore ( )
inline

implicit operator so the object can be used with the c api functions natively

References core.

◆ operator=()

Core& helicscpp::Core::operator= ( const Core cr)
inline

copy assignment

References core, and helicsCoreClone().

◆ query()

std::string helicscpp::Core::query ( const std::string &  target,
const std::string &  queryStr,
HelicsSequencingModes  mode = HELICS_SEQUENCING_MODE_FAST 
) const
inline

make a query of the core

this call is blocking until the value is returned which may take some time depending on the size of the federation and the specific string being queried

Parameters
targetthe target of the query can be "federation", "federate", "broker", "core", or a specific name of a federate, core, or broker
queryStra string with the query, see other documentation for specific properties to query, can be defined by the federate
modethe ordering mode to use for the query (fast-priority channels, ordered for normal channels ordered with all other messages)
Returns
a string with the value requested. this is either going to be a vector of strings value or a JSON string stored in the first element of the vector. The string "#invalid" is returned if the query was not valid

References core, HELICS_SEQUENCING_MODE_FAST, helicsCreateQuery(), helicsQueryCoreExecute(), helicsQueryFree(), and helicsQuerySetOrdering().

◆ registerCloningFilter()

CloningFilter helicscpp::Core::registerCloningFilter ( const std::string &  deliveryEndpoint)
inline

create a cloning Filter on the specified federate

cloning filters copy a message and send it to multiple locations source and destination can be added through other functions

Parameters
deliveryEndpointthe specified endpoint to deliver the message
Returns
a HelicsFilter object

References core, and helicsCoreRegisterCloningFilter().

◆ registerFilter()

Filter helicscpp::Core::registerFilter ( HelicsFilterTypes  type,
const std::string &  name = std::string() 
)
inline

create a destination Filter on the specified federate

filters can be created through a federate or a core , linking through a federate allows a few extra features of name matching to function on the federate interface but otherwise equivalent behavior

Parameters
typethe type of filter to create
namethe name of the filter (can be NULL)
Returns
a HelicsFilter object

References core, and helicsCoreRegisterFilter().

◆ sendCommand()

void helicscpp::Core::sendCommand ( const std::string &  target,
const std::string &  command 
)
inline

send an asynchronous command to another object

Parameters
targetthe name of the target of the command
commandthe command message to send

References core, and helicsCoreSendCommand().

◆ setGlobal()

void helicscpp::Core::setGlobal ( const std::string &  valueName,
const std::string &  value 
)
inline

set a global federation value

Parameters
valueNamethe name of the global value to set
valueactual value of the global variable

References core, and helicsCoreSetGlobal().

◆ setReadyToInit()

void helicscpp::Core::setReadyToInit ( )
inline

set the core to ready to enter init

this function only needs to be called for cores that don't have any federates but may have filters for cores with federates it won't do anything

References core, and helicsCoreSetReadyToInit().

◆ waitForDisconnect()

bool helicscpp::Core::waitForDisconnect ( int  msToWait = -1)
inline

waits in the current thread until the broker is disconnected

Parameters
msToWaitthe timeout to wait for disconnect (-1) implies no timeout
Returns
true if the disconnect was successful false if it timed out

References core, HELICS_FALSE, and helicsCoreWaitForDisconnect().


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