The registry is used as a global singleton to collect information on all available MooseObject and Action classes for use in a moose app/simulation. More...
#include <Registry.h>
Public Member Functions | |
Registry (Registry const &)=delete | |
Don't allow creation through copy/move construction or assignment. More... | |
Registry & | operator= (Registry const &)=delete |
Registry (Registry &&)=delete | |
Registry & | operator= (Registry &&)=delete |
Static Public Member Functions | |
static Registry & | getRegistry () |
Get the global Registry singleton. More... | |
template<typename T > | |
static char | add (const RegistryEntryData &base_info) |
Adds information on a MooseObject to the registry. More... | |
template<typename T > | |
static char | addAction (const RegistryEntryData &base_info) |
Adds information on an Action object to the registry. More... | |
template<typename T > | |
static std::string | getClassName () |
static void | registerObjectsTo (Factory &f, const std::set< std::string > &labels) |
This registers all MooseObjects known to the registry that have the given label(s) with the factory f. More... | |
static void | registerActionsTo (ActionFactory &f, const std::set< std::string > &labels) |
This registers all Actions known to the registry that have the given label(s) with the factory f. More... | |
static char | addKnownLabel (const std::string &label) |
addKnownLabel whitelists a label as valid for purposes of the checkLabels function. More... | |
static void | addDataFilePath (const std::string &name, const std::string &in_tree_path) |
register general search paths (folder name must be data) More... | |
static void | addAppDataFilePath (const std::string &app_name, const std::string &app_path) |
register search paths for an application (path determined relative to app_path); app_path should be passed as FILE from the application source file More... | |
static void | addDeprecatedAppDataFilePath (const std::string &app_path) |
deprecated method; use addAppDataFilePath instead More... | |
static void | addRepository (const std::string &repo_name, const std::string &repo_url) |
register a repository More... | |
static const std::map< std::string, std::vector< std::shared_ptr< RegistryEntryBase > > > & | allObjects () |
Returns a per-label keyed map of all MooseObjects in the registry. More... | |
static const std::map< std::string, std::vector< std::shared_ptr< RegistryEntryBase > > > & | allActions () |
Returns a per-label keyed map of all Actions in the registry. More... | |
static const RegistryEntryBase & | objData (const std::string &name) |
static bool | isRegisteredObj (const std::string &name) |
static const std::map< std::string, std::string > & | getDataFilePaths () |
Returns a map of all registered data file paths (name -> path) More... | |
static std::string | getDataFilePath (const std::string &name) |
Gets a data path for the registered name. More... | |
static const std::string & | getRepositoryURL (const std::string &repo_name) |
Returns the repository URL associated with repo_name . More... | |
static const std::map< std::string, std::string > & | getRepos () |
Returns a map of all registered repositories. More... | |
template<typename T > | |
static std::string | getRegisteredName () |
returns the name() for a registered class More... | |
Private Member Functions | |
Registry () | |
Static Private Member Functions | |
static void | setDataFilePaths (const std::map< std::string, std::string > &data_file_paths) |
Manually set the data file paths. More... | |
static void | setRepos (const std::map< std::string, std::string > &repos) |
Manually set the repos. More... | |
static std::string | determineDataFilePath (const std::string &name, const std::string &in_tree_path) |
Internal helper for determing a root data file path (in-tree vs installed) More... | |
static std::string | appNameFromAppPath (const std::string &app_path) |
Internal helper for getting an application name from its path, for example: /path/to/FooBarBazApp.C -> foo_bar_baz, for use in addDeprecatedAppDataFilePath. More... | |
Private Attributes | |
std::map< std::string, std::shared_ptr< RegistryEntryBase > > | _name_to_entry |
std::map< std::string, std::vector< std::shared_ptr< RegistryEntryBase > > > | _per_label_objects |
std::map< std::string, std::vector< std::shared_ptr< RegistryEntryBase > > > | _per_label_actions |
std::set< std::string > | _known_labels |
std::map< std::string, std::string > | _data_file_paths |
Data file registry; name -> in-tree path. More... | |
std::map< std::string, std::string > | _repos |
Repository name -> repository URL; used for mooseDocumentedError. More... | |
std::map< std::string, std::string > | _type_to_classname |
class | RegistryTest |
Friends for unit testing. More... | |
class | DataFileUtilsTest |
FRIEND_TEST (RegistryTest, determineFilePath) | |
FRIEND_TEST (RegistryTest, determineFilePathFailed) | |
FRIEND_TEST (RegistryTest, appNameFromAppPath) | |
FRIEND_TEST (RegistryTest, appNameFromAppPathFailed) | |
The registry is used as a global singleton to collect information on all available MooseObject and Action classes for use in a moose app/simulation.
It must be global because we want+need to be able to register objects in global scope during static initialization time before other parts of the moose app execution have started running. This allows us to distribute registration across all the files that define the actual classes being registered so we don't have to have any central location with a bajillion includes that makes (especially incremental) compiles slow. The registry collects the app, name, and other information for each objects and makes it available to the moose object and action factories and others for general use. All public functions in this class modify and return data from the global singleton.
Definition at line 161 of file Registry.h.
|
delete |
Don't allow creation through copy/move construction or assignment.
|
delete |
|
inlineprivate |
|
inlinestatic |
Adds information on a MooseObject to the registry.
The _build_ptr, _build_action_ptr, and _params_ptr objects of the info object should all be nullptr - these are set automatically by the add function itself using the templated type T.
Definition at line 173 of file Registry.h.
|
inlinestatic |
Adds information on an Action object to the registry.
The _build_ptr, _build_action_ptr, and _params_ptr objects of the info object should all be nullptr - these are set automatically by the addAction function itself using the templated type T.
Definition at line 185 of file Registry.h.
|
static |
register search paths for an application (path determined relative to app_path); app_path should be passed as FILE from the application source file
Definition at line 128 of file Registry.C.
Referenced by addDeprecatedAppDataFilePath().
|
static |
register general search paths (folder name must be data)
Definition at line 91 of file Registry.C.
Referenced by addAppDataFilePath().
|
static |
deprecated method; use addAppDataFilePath instead
Definition at line 138 of file Registry.C.
|
static |
addKnownLabel whitelists a label as valid for purposes of the checkLabels function.
Definition at line 84 of file Registry.C.
Referenced by MooseApp::MooseApp().
|
static |
register a repository
Definition at line 160 of file Registry.C.
|
inlinestatic |
Returns a per-label keyed map of all Actions in the registry.
Definition at line 227 of file Registry.h.
Referenced by JsonSyntaxTree::JsonSyntaxTree(), and MooseApp::setupOptions().
|
inlinestatic |
Returns a per-label keyed map of all MooseObjects in the registry.
Definition at line 222 of file Registry.h.
Referenced by JsonSyntaxTree::JsonSyntaxTree(), and MooseApp::setupOptions().
|
staticprivate |
Internal helper for getting an application name from its path, for example: /path/to/FooBarBazApp.C -> foo_bar_baz, for use in addDeprecatedAppDataFilePath.
Definition at line 209 of file Registry.C.
Referenced by addDeprecatedAppDataFilePath().
|
staticprivate |
Internal helper for determing a root data file path (in-tree vs installed)
Definition at line 182 of file Registry.C.
Referenced by addDataFilePath().
|
private |
|
private |
|
private |
|
private |
|
inlinestatic |
Definition at line 194 of file Registry.h.
|
static |
Gets a data path for the registered name.
Finds either the installed path or the in-tree path.
Definition at line 150 of file Registry.C.
|
inlinestatic |
Returns a map of all registered data file paths (name -> path)
Definition at line 243 of file Registry.h.
Referenced by Moose::DataFileUtils::getPath(), and ConsoleUtils::outputDataFilePaths().
|
static |
returns the name() for a registered class
Definition at line 326 of file Registry.h.
|
static |
Get the global Registry singleton.
Definition at line 23 of file Registry.C.
Referenced by add(), addAction(), addDataFilePath(), addKnownLabel(), addRepository(), allActions(), allObjects(), getClassName(), getDataFilePath(), getDataFilePaths(), Moose::DataFileUtils::getPath(), getRepos(), getRepositoryURL(), isRegisteredObj(), objData(), registerActionsTo(), registerObjectsTo(), setDataFilePaths(), and setRepos().
|
inlinestatic |
Returns a map of all registered repositories.
Definition at line 259 of file Registry.h.
|
static |
Returns the repository URL associated with repo_name
.
Definition at line 173 of file Registry.C.
Referenced by moose::internal::formatMooseDocumentedError().
|
inlinestatic |
Definition at line 237 of file Registry.h.
Referenced by MooseObject::MooseObject().
|
static |
Definition at line 57 of file Registry.C.
|
static |
This registers all Actions known to the registry that have the given label(s) with the factory f.
Definition at line 68 of file Registry.C.
Referenced by Moose::registerActions().
This registers all MooseObjects known to the registry that have the given label(s) with the factory f.
Definition at line 34 of file Registry.C.
Referenced by Moose::registerObjects().
|
inlinestaticprivate |
Manually set the data file paths.
Used in unit testing.
Definition at line 291 of file Registry.h.
|
inlinestaticprivate |
Manually set the repos.
Used in unit testing
Definition at line 300 of file Registry.h.
|
friend |
Definition at line 277 of file Registry.h.
|
friend |
Friends for unit testing.
Definition at line 276 of file Registry.h.
|
private |
Data file registry; name -> in-tree path.
Definition at line 318 of file Registry.h.
Referenced by addDataFilePath(), getDataFilePath(), getDataFilePaths(), and setDataFilePaths().
|
private |
Definition at line 316 of file Registry.h.
Referenced by addKnownLabel().
|
private |
Definition at line 313 of file Registry.h.
Referenced by isRegisteredObj().
|
private |
Definition at line 315 of file Registry.h.
Referenced by addAction(), and allActions().
|
private |
Definition at line 314 of file Registry.h.
Referenced by add(), and allObjects().
|
private |
Repository name -> repository URL; used for mooseDocumentedError.
Definition at line 320 of file Registry.h.
Referenced by addRepository(), getRepos(), getRepositoryURL(), and setRepos().
|
private |
Definition at line 321 of file Registry.h.
Referenced by add(), addAction(), and getClassName().