helics  2.8.1
Classes | Functions
helics::CoreFactory Namespace Reference

Classes

class  CoreBuilder
 
class  CoreTypeBuilder
 

Functions

void defineCoreBuilder (std::shared_ptr< CoreBuilder > cb, const std::string &name, int code)
 
std::shared_ptr< CoremakeCore (core_type type, const std::string &name)
 
std::shared_ptr< Corecreate (const std::string &initializationString)
 
std::shared_ptr< Corecreate (core_type type, const std::string &configureString)
 
std::shared_ptr< Corecreate (core_type type, const std::string &coreName, const std::string &configureString)
 
std::shared_ptr< Corecreate (std::vector< std::string > args)
 
std::shared_ptr< Corecreate (core_type type, std::vector< std::string > args)
 
std::shared_ptr< Corecreate (core_type type, const std::string &coreName, std::vector< std::string > args)
 
std::shared_ptr< Corecreate (int argc, char *argv[])
 
std::shared_ptr< Corecreate (core_type type, int argc, char *argv[])
 
std::shared_ptr< Corecreate (core_type type, const std::string &coreName, int argc, char *argv[])
 
std::shared_ptr< CoreFindOrCreate (core_type type, const std::string &coreName, std::vector< std::string > args)
 
std::shared_ptr< CoreFindOrCreate (core_type type, const std::string &coreName, const std::string &configureString)
 
std::shared_ptr< CoreFindOrCreate (core_type type, const std::string &coreName, int argc, char *argv[])
 
std::shared_ptr< CorefindCore (const std::string &name)
 
std::shared_ptr< CorefindJoinableCoreOfType (core_type type)
 
bool registerCore (const std::shared_ptr< Core > &core, core_type type)
 
size_t cleanUpCores ()
 
size_t cleanUpCores (std::chrono::milliseconds delay)
 
void terminateAllCores ()
 
void abortAllCores (int errorCode, const std::string &errorString)
 
size_t getCoreCount ()
 
bool copyCoreIdentifier (const std::string &copyFromName, const std::string &copyToName)
 
void unregisterCore (const std::string &name)
 
void addAssociatedCoreType (const std::string &name, core_type type)
 
void displayHelp (core_type type)
 
template<class CoreTYPE >
std::shared_ptr< CoreBuilderaddCoreType (const std::string &coreTypeName, int code)
 
HELICS_SHARED_DEPRECATED_CORE bool registerCore (const std::shared_ptr< Core > &core)
 

Detailed Description

Factory for building Core API instances. available core types

Function Documentation

◆ abortAllCores()

void helics::CoreFactory::abortAllCores ( int  errorCode,
const std::string &  errorString 
)

abort all cores

References abortAllCores(), cleanUpCores(), and helics::local_core_id().

Referenced by abortAllCores().

◆ addAssociatedCoreType()

void helics::CoreFactory::addAssociatedCoreType ( const std::string &  name,
core_type  type 
)

add a type associated with a core

References addAssociatedCoreType().

Referenced by addAssociatedCoreType().

◆ addCoreType()

template<class CoreTYPE >
std::shared_ptr<CoreBuilder> helics::CoreFactory::addCoreType ( const std::string &  coreTypeName,
int  code 
)

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

◆ cleanUpCores() [1/2]

HELICS_SHARED_DEPRECATED_CORE size_t helics::CoreFactory::cleanUpCores ( )

clean up unused cores

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

Returns
the number of cores still operating

References cleanUpCores().

Referenced by abortAllCores(), cleanUpCores(), helics::cleanupHelicsLibrary(), helics::Federate::Federate(), helicsCloseLibrary(), helicsCoreFree(), helicsFederateFree(), registerCore(), and terminateAllCores().

◆ cleanUpCores() [2/2]

HELICS_SHARED_DEPRECATED_CORE size_t helics::CoreFactory::cleanUpCores ( std::chrono::milliseconds  delay)

clean up unused cores

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

Parameters
delaythe delay time in milliseconds to wait for the cores to finish before destroying
Returns
the number of cores still operating

References cleanUpCores().

◆ copyCoreIdentifier()

HELICS_SHARED_DEPRECATED_CORE bool helics::CoreFactory::copyCoreIdentifier ( const std::string &  copyFromName,
const std::string &  copyToName 
)

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

Returns
true if the copyFromName was found and the copy successful

References copyCoreIdentifier().

Referenced by copyCoreIdentifier().

◆ create() [1/8]

HELICS_SHARED_DEPRECATED_CORE std::shared_ptr< Core > helics::CoreFactory::create ( core_type  type,
const std::string &  initializationString 
)

Creates a Core API object of the specified type.

Invokes initialize() on the instantiated Core object.

◆ create() [2/8]

HELICS_SHARED_DEPRECATED_CORE std::shared_ptr< Core > helics::CoreFactory::create ( core_type  type,
const std::string &  coreName,
const std::string &  initializationString 
)

create a core from a type, name, and initializationString

Parameters
typethe type of core to create
coreNamethe name for the core
configureStringa string containing arguments for configuration of the core

create a core from a type, name, and initializationString

Parameters
typethe type of core to create
coreNamethe name for the core
initializationStringa string containing arguments for the core

◆ create() [3/8]

HELICS_SHARED_DEPRECATED_CORE std::shared_ptr< Core > helics::CoreFactory::create ( core_type  type,
const std::string &  coreName,
int  argc,
char *  argv[] 
)

create a core from a type, name, and arguments

Parameters
typethe type of core to create
coreNamethe name for the core
argcthe number of arguments
argvthe actual argument parameters
Returns
a pointer to the created core

◆ create() [4/8]

HELICS_SHARED_DEPRECATED_CORE std::shared_ptr< Core > helics::CoreFactory::create ( core_type  type,
const std::string &  coreName,
std::vector< std::string >  args 
)

create a core from a type, name, and arguments

Parameters
typethe type of core to create
coreNamethe name for the core
argsa vector of reversed command line arguments
Returns
a pointer to the created core

◆ create() [5/8]

HELICS_SHARED_DEPRECATED_CORE std::shared_ptr< Core > helics::CoreFactory::create ( core_type  type,
int  argc,
char *  argv[] 
)

create a core from a type and command line arguments

Parameters
typethe type of core to create
argcthe number of command line arguments
argvthe actual string parameters for the command line

◆ create() [6/8]

HELICS_SHARED_DEPRECATED_CORE std::shared_ptr< Core > helics::CoreFactory::create ( core_type  type,
std::vector< std::string >  args 
)

create a core from a type and command line arguments

Parameters
typethe type of core to create
argsa vector of reversed command line arguments

◆ create() [7/8]

HELICS_SHARED_DEPRECATED_CORE std::shared_ptr< Core > helics::CoreFactory::create ( int  argc,
char *  argv[] 
)

create a core from arguments

an argument of '–coretype' must be specified to define the type, otherwise the default type is used

Parameters
argcthe number of arguments
argvthe actual argument parameters
Returns
a pointer to the created core

◆ create() [8/8]

HELICS_SHARED_DEPRECATED_CORE std::shared_ptr< Core > helics::CoreFactory::create ( std::vector< std::string >  args)

create a core from arguments

an argument of '–coretype' must be specified to define the type, otherwise the default type is used

Parameters
argsa vector of reversed command line arguments
Returns
a pointer to the created core

◆ displayHelp()

void helics::CoreFactory::displayHelp ( core_type  type = core_type::UNRECOGNIZED)

display the help listing for a particular core_type

◆ findCore()

HELICS_SHARED_DEPRECATED_CORE std::shared_ptr< Core > helics::CoreFactory::findCore ( const std::string &  name)

locate a registered Core by name

Parameters
namethe name of the core to find
Returns
a shared_ptr to the testCore

References findCore().

Referenced by helics::CoreApp::CoreApp(), findCore(), FindOrCreate(), and helics::CommonCore::unregister().

◆ findJoinableCoreOfType()

HELICS_SHARED_DEPRECATED_CORE std::shared_ptr< Core > helics::CoreFactory::findJoinableCoreOfType ( core_type  type)

try to find a joinable core of a specific type

References findJoinableCoreOfType().

Referenced by helics::Federate::Federate(), and findJoinableCoreOfType().

◆ FindOrCreate() [1/3]

HELICS_SHARED_DEPRECATED_CORE std::shared_ptr< Core > helics::CoreFactory::FindOrCreate ( core_type  type,
const std::string &  coreName,
const std::string &  initializationString 
)

tries to find a named core if it fails it creates a new one

References findCore(), FindOrCreate(), and registerCore().

◆ FindOrCreate() [2/3]

HELICS_SHARED_DEPRECATED_CORE std::shared_ptr< Core > helics::CoreFactory::FindOrCreate ( core_type  type,
const std::string &  coreName,
int  argc,
char *  argv[] 
)

tries to find a named core if it fails it creates a new one

References findCore(), FindOrCreate(), and registerCore().

◆ FindOrCreate() [3/3]

HELICS_SHARED_DEPRECATED_CORE std::shared_ptr< Core > helics::CoreFactory::FindOrCreate ( core_type  type,
const std::string &  coreName,
std::vector< std::string >  args 
)

tries to find a named core if it fails it creates a new one

References findCore(), FindOrCreate(), and registerCore().

Referenced by helics::Federate::Federate(), FindOrCreate(), helicsCreateCore(), and helicsCreateCoreFromArgs().

◆ getCoreCount()

size_t helics::CoreFactory::getCoreCount ( )

get the current number of cores

References getCoreCount().

Referenced by getCoreCount().

◆ registerCore() [1/2]

HELICS_SHARED_DEPRECATED_CORE bool helics::CoreFactory::registerCore ( const std::shared_ptr< Core > &  core)

register a testCore so it can be found by others

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

Parameters
corea pointer to a testCore object that should be found globally
Returns
true if the registration was successful false otherwise

◆ registerCore() [2/2]

bool helics::CoreFactory::registerCore ( const std::shared_ptr< Core > &  core,
core_type  type 
)

register a testCore so it can be found by others

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

Parameters
corea pointer to a testCore object that should be found globally
Returns
true if the registration was successful false otherwise

References cleanUpCores(), and registerCore().

Referenced by FindOrCreate(), and registerCore().

◆ terminateAllCores()

void helics::CoreFactory::terminateAllCores ( )

terminate All existing cores

References cleanUpCores(), and terminateAllCores().

Referenced by terminateAllCores().

◆ unregisterCore()

HELICS_SHARED_DEPRECATED_CORE void helics::CoreFactory::unregisterCore ( const std::string &  name)

remove a Core from the registry

Parameters
namethe name of the Core to unregister

References unregisterCore().

Referenced by helics::CommonCore::unregister(), and unregisterCore().