helics  2.8.1
Classes | Functions
helics::BrokerFactory Namespace Reference

Classes

class  BrokerBuilder
 
class  BrokerTypeBuilder
 

Functions

void defineBrokerBuilder (std::shared_ptr< BrokerBuilder > cb, const std::string &name, int code)
 
std::shared_ptr< BrokermakeBroker (core_type type, const std::string &name)
 
std::shared_ptr< Brokercreate (core_type type, const std::string &configureString)
 
std::shared_ptr< Brokercreate (core_type type, const std::string &brokerName, const std::string &configureString)
 
std::shared_ptr< Brokercreate (core_type type, int argc, char *argv[])
 
std::shared_ptr< Brokercreate (core_type type, const std::string &brokerName, int argc, char *argv[])
 
std::shared_ptr< Brokercreate (core_type type, std::vector< std::string > args)
 
std::shared_ptr< Brokercreate (core_type type, const std::string &brokerName, std::vector< std::string > args)
 
std::shared_ptr< BrokerfindBroker (const std::string &brokerName)
 
std::shared_ptr< BrokergetConnectedBroker ()
 
std::shared_ptr< BrokergetBrokerByIndex (size_t index)
 
std::shared_ptr< BrokerfindJoinableBrokerOfType (core_type type)
 
std::vector< std::shared_ptr< Broker > > getAllBrokers ()
 
bool brokersActive ()
 
bool registerBroker (const std::shared_ptr< Broker > &broker, core_type type)
 
size_t cleanUpBrokers ()
 
size_t cleanUpBrokers (std::chrono::milliseconds delay)
 
void terminateAllBrokers ()
 
void abortAllBrokers (int errorCode, const std::string &errorString)
 
bool copyBrokerIdentifier (const std::string &copyFromName, const std::string &copyToName)
 
void unregisterBroker (const std::string &name)
 
void addAssociatedBrokerType (const std::string &name, core_type type)
 
void displayHelp (core_type type)
 
template<class BrokerTYPE >
std::shared_ptr< BrokerBuilderaddBrokerType (const std::string &brokerTypeName, int code)
 
HELICS_SHARED_DEPRECATED bool registerBroker (const std::shared_ptr< Broker > &broker)
 

Detailed Description

Factory for building Core API instances.

Function Documentation

◆ abortAllBrokers()

void helics::BrokerFactory::abortAllBrokers ( int  errorCode,
const std::string &  errorString 
)

abort all brokers

References cleanUpBrokers(), and getAllBrokers().

◆ addAssociatedBrokerType()

void helics::BrokerFactory::addAssociatedBrokerType ( const std::string &  name,
core_type  type 
)

add a type associated with a broker

◆ addBrokerType()

template<class BrokerTYPE >
std::shared_ptr<BrokerBuilder> helics::BrokerFactory::addBrokerType ( const std::string &  brokerTypeName,
int  code 
)

template function to create a builder and link it into the library

References defineBrokerBuilder().

◆ brokersActive()

HELICS_SHARED_DEPRECATED bool helics::BrokerFactory::brokersActive ( )

check if there are any active Brokers

Referenced by helics::apps::BrokerServer::hasActiveBrokers().

◆ cleanUpBrokers() [1/2]

HELICS_SHARED_DEPRECATED size_t helics::BrokerFactory::cleanUpBrokers ( )

clean up unused brokers

when brokers are unregistered they get put in a holding area that gets cleaned up when a new broker is registered or when the clean up function is called this prevents some odd threading issues

Returns
the number of brokers still operating

Referenced by abortAllBrokers(), helics::cleanupHelicsLibrary(), helicsBrokerFree(), helicsCloseLibrary(), registerBroker(), and terminateAllBrokers().

◆ cleanUpBrokers() [2/2]

HELICS_SHARED_DEPRECATED size_t helics::BrokerFactory::cleanUpBrokers ( std::chrono::milliseconds  delay)

clean up unused brokers

when brokers are unregistered they get put in a holding area that gets cleaned up when a new broker is registered or when the clean up function is called this prevents some odd threading issues

Parameters
delaythe number of milliseconds to wait to ensure stuff is cleaned up
Returns
the number of brokers still operating

◆ copyBrokerIdentifier()

HELICS_SHARED_DEPRECATED bool helics::BrokerFactory::copyBrokerIdentifier ( const std::string &  copyFromName,
const std::string &  copyToName 
)

make a copy of the broker pointer to allow access to the new name

Returns
true if successful

◆ create() [1/4]

HELICS_SHARED_DEPRECATED std::shared_ptr< Broker > helics::BrokerFactory::create ( core_type  type,
const std::string &  broker_name,
std::vector< std::string >  args 
)

Create a broker from command line arguments in a vector

References registerBroker().

◆ create() [2/4]

HELICS_SHARED_DEPRECATED std::shared_ptr< Broker > helics::BrokerFactory::create ( core_type  type,
const std::string &  initializationString 
)

Creates a Broker object of the specified type.

Invokes initialize() on the instantiated Core object.

Referenced by create(), helicsCreateBroker(), and helicsCreateBrokerFromArgs().

◆ create() [3/4]

HELICS_SHARED_DEPRECATED std::shared_ptr< Broker > helics::BrokerFactory::create ( core_type  type,
int  argc,
char *  argv[] 
)

Create a broker from command line arguments

References create().

◆ create() [4/4]

HELICS_SHARED_DEPRECATED std::shared_ptr< Broker > helics::BrokerFactory::create ( core_type  type,
std::vector< std::string >  args 
)

Create a broker from command line arguments in a vector

References create().

◆ defineBrokerBuilder()

void helics::BrokerFactory::defineBrokerBuilder ( std::shared_ptr< BrokerBuilder cb,
const std::string &  name,
int  code 
)

define a new Broker Builder from the builder give a name and build code

Referenced by addBrokerType().

◆ displayHelp()

HELICS_SHARED_DEPRECATED void helics::BrokerFactory::displayHelp ( core_type  type = core_type::UNRECOGNIZED)

display the help listing for a particular core_type

References helics::DEFAULT, helics::TCP_SS, and helics::UNRECOGNIZED.

◆ findBroker()

HELICS_SHARED_DEPRECATED std::shared_ptr< Broker > helics::BrokerFactory::findBroker ( const std::string &  brokerName)

locate a coreBroker by name

Parameters
brokerNamethe name of the broker
Returns
a shared_ptr to the Broker

References getBrokerByIndex(), and getConnectedBroker().

Referenced by helics::BrokerApp::BrokerApp(), helics::NetworkBrokerData::commandLineParser(), and helics::CoreBroker::unregister().

◆ findJoinableBrokerOfType()

HELICS_SHARED_DEPRECATED std::shared_ptr< Broker > helics::BrokerFactory::findJoinableBrokerOfType ( core_type  type)

try to find a joinable broker of a specific type

◆ getAllBrokers()

HELICS_SHARED_DEPRECATED std::vector< std::shared_ptr< Broker > > helics::BrokerFactory::getAllBrokers ( )

◆ getBrokerByIndex()

std::shared_ptr< Broker > helics::BrokerFactory::getBrokerByIndex ( size_t  index)

get a broker by index (0 based)

Parameters
indexthe index counter value of the broker
Returns
a shared_ptr to the Broker

Referenced by findBroker().

◆ getConnectedBroker()

std::shared_ptr< Broker > helics::BrokerFactory::getConnectedBroker ( )

get the first available Connected broker

Returns
a shared_ptr to the Broker

Referenced by findBroker().

◆ registerBroker() [1/2]

HELICS_SHARED_DEPRECATED bool helics::BrokerFactory::registerBroker ( const std::shared_ptr< Broker > &  broker)

register a coreBroker so it can be found by others

also cleans up any leftover brokers that were previously unregistered this can be controlled by calling cleanUpBrokers earlier if desired

Parameters
brokera pointer to a Broker object that should be able to be found globally
Returns
true if the registration was successful false otherwise

◆ registerBroker() [2/2]

bool helics::BrokerFactory::registerBroker ( const std::shared_ptr< Broker > &  broker,
core_type  type 
)

register a coreBroker so it can be found by others

also cleans up any leftover brokers that were previously unregistered this can be controlled by calling cleanUpBrokers earlier if desired

Parameters
brokera pointer to a Broker object that should be able to be found globally
typethe core type associated with a broker
Returns
true if the registration was successful false otherwise

References cleanUpBrokers().

Referenced by create().

◆ terminateAllBrokers()

void helics::BrokerFactory::terminateAllBrokers ( )

terminate all running Brokers

References cleanUpBrokers(), and getAllBrokers().

◆ unregisterBroker()

HELICS_SHARED_DEPRECATED void helics::BrokerFactory::unregisterBroker ( const std::string &  name)

remove a broker from the registry

Parameters
namethe name of the broker to unregister

Referenced by helics::CoreBroker::unregister().