helics  3.5.2
Classes | Functions
helics::CoreFactory Namespace Reference

Classes

class  CoreBuilder
 
class  CoreTypeBuilder
 

Functions

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

Detailed Description

Factory for building Core API instances. available core types

Function Documentation

◆ abortAllCores()

void helics::CoreFactory::abortAllCores ( int  errorCode,
std::string_view  errorString 
)

abort all cores

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

Referenced by abortAllCores().

◆ addAssociatedCoreType()

void helics::CoreFactory::addAssociatedCoreType ( std::string_view  name,
CoreType  type 
)

add a type associated with a core

References addAssociatedCoreType().

Referenced by addAssociatedCoreType().

◆ addCoreType()

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

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

◆ cleanUpCores() [1/2]

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(), helicsCloseLibrary(), helicsCoreFree(), helicsFederateFree(), and terminateAllCores().

◆ cleanUpCores() [2/2]

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()

bool helics::CoreFactory::copyCoreIdentifier ( std::string_view  copyFromName,
std::string_view  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]

std::shared_ptr< Core > helics::CoreFactory::create ( CoreType  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() [2/8]

std::shared_ptr< Core > helics::CoreFactory::create ( CoreType  type,
std::string_view  configureString 
)

Creates a Core API object of the specified type.

Invokes initialize() on the instantiated Core object.

◆ create() [3/8]

std::shared_ptr< Core > helics::CoreFactory::create ( CoreType  type,
std::string_view  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

References registerCore().

◆ create() [4/8]

std::shared_ptr< Core > helics::CoreFactory::create ( CoreType  type,
std::string_view  coreName,
std::string_view  configureString 
)

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

References registerCore().

◆ create() [5/8]

std::shared_ptr< Core > helics::CoreFactory::create ( CoreType  type,
std::string_view  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

References registerCore().

◆ create() [6/8]

std::shared_ptr< Core > helics::CoreFactory::create ( CoreType  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]

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]

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 ( CoreType  type = CoreType::UNRECOGNIZED)

display the help listing for a particular CoreType

◆ findCore()

std::shared_ptr< Core > helics::CoreFactory::findCore ( std::string_view  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()

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

try to find a joinable core of a specific type

References findJoinableCoreOfType().

Referenced by findJoinableCoreOfType().

◆ FindOrCreate() [1/3]

std::shared_ptr< Core > helics::CoreFactory::FindOrCreate ( CoreType  type,
std::string_view  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() [2/3]

std::shared_ptr< Core > helics::CoreFactory::FindOrCreate ( CoreType  type,
std::string_view  coreName,
std::string_view  configureString 
)

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

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

◆ FindOrCreate() [3/3]

std::shared_ptr< Core > helics::CoreFactory::FindOrCreate ( CoreType  type,
std::string_view  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 FindOrCreate(), helicsCreateCore(), and helicsCreateCoreFromArgs().

◆ getAvailableCoreTypes()

std::vector< std::string > helics::CoreFactory::getAvailableCoreTypes ( )

generate a vector of the currently available core types

References getAvailableCoreTypes().

Referenced by getAvailableCoreTypes(), and helics::core::systemInfo().

◆ getCoreCount()

size_t helics::CoreFactory::getCoreCount ( )

get the current number of cores

References getCoreCount().

Referenced by getCoreCount().

◆ getEmptyCore()

std::shared_ptr< Core > helics::CoreFactory::getEmptyCore ( )

get a shared pointer to an empty core

References getEmptyCore().

Referenced by helics::Federate::disconnect(), helics::Federate::Federate(), getEmptyCore(), and helics::Federate::operator=().

◆ getEmptyCorePtr()

Core * helics::CoreFactory::getEmptyCorePtr ( )

get a pointer to an emptyCore

References getEmptyCorePtr().

Referenced by helics::Interface::close(), helics::Interface::disconnectFromCore(), and getEmptyCorePtr().

◆ registerCore()

bool helics::CoreFactory::registerCore ( const std::shared_ptr< Core > &  core,
CoreType  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
typethe type of core to create
Returns
true if the registration was successful false otherwise

References registerCore().

Referenced by create(), FindOrCreate(), and registerCore().

◆ terminateAllCores()

void helics::CoreFactory::terminateAllCores ( )

terminate All existing cores

References cleanUpCores(), and terminateAllCores().

Referenced by terminateAllCores().

◆ unregisterCore()

void helics::CoreFactory::unregisterCore ( std::string_view  name)

remove a Core from the registry

Parameters
namethe name of the Core to unregister

References unregisterCore().

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