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, const bool app=true, const std::optional< std::string > &info={}) |
| register general search paths; "app" is whether or not the path is an app path 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 | addMissingDataFilePath (const std::string &name, const std::string &info) |
| register a data file path as missing, along with info about how it can be added 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 void | addAppCitation (const std::string &app_name, const std::string &key, const std::string &bibtex) |
Register a citation (the full BibTeX bibtex text, identified by key) tied to the app app_name; emitted by –citations when any object registered to that app is constructed. 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... | |
| static const std::map< std::string, std::map< std::string, std::string > > & | getCitations () |
| Returns the registered citations, keyed by app/module name and then by BibTeX key (app/module name -> (BibTeX key -> BibTeX entry text)) More... | |
| static const std::map< std::string, std::string > & | getCitations (const std::string &app_name) |
Returns the citations (BibTeX key -> BibTeX entry text) tied to app_name, or an empty map if no citations are registered for it. 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... | |
| static void | checkDataFilePathName (const std::string &name) |
| Check a data file path for valid characters. More... | |
| static void | addDataFilePathCapability (const std::string &name, const std::optional< std::string > &path={}, const std::optional< std::string > &extra_info={}) |
| Add a data file path capability. 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 |
| std::map< std::string, std::map< std::string, std::string > > | _app_citations |
| App/module name -> (citation key -> BibTeX entry text) for that app. More... | |
| 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) | |
| FRIEND_TEST (RegistryTest, addDataFilePathCapability) | |
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 171 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 183 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 195 of file Registry.h.
|
static |
Register a citation (the full BibTeX bibtex text, identified by key) tied to the app app_name; emitted by –citations when any object registered to that app is constructed.
The framework registers its paper under "MooseApp", so apps composed of MooseApp inherit it.
Definition at line 198 of file Registry.C.
Referenced by Moose::registerAll().
|
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 144 of file Registry.C.
Referenced by addDeprecatedAppDataFilePath().
|
static |
register general search paths; "app" is whether or not the path is an app path
Definition at line 92 of file Registry.C.
Referenced by addAppDataFilePath().
|
staticprivate |
Add a data file path capability.
Definition at line 277 of file Registry.C.
Referenced by addDataFilePath(), and addMissingDataFilePath().
|
static |
deprecated method; use addAppDataFilePath instead
Definition at line 154 of file Registry.C.
|
static |
addKnownLabel whitelists a label as valid for purposes of the checkLabels function.
Definition at line 85 of file Registry.C.
|
static |
register a data file path as missing, along with info about how it can be added
Definition at line 137 of file Registry.C.
|
static |
register a repository
Definition at line 176 of file Registry.C.
|
inlinestatic |
Returns a per-label keyed map of all Actions in the registry.
Definition at line 248 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 243 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 246 of file Registry.C.
Referenced by addDeprecatedAppDataFilePath().
|
staticprivate |
Check a data file path for valid characters.
Definition at line 268 of file Registry.C.
Referenced by addDataFilePath(), and addMissingDataFilePath().
|
staticprivate |
Internal helper for determing a root data file path (in-tree vs installed)
Definition at line 219 of file Registry.C.
Referenced by addDataFilePath().
|
private |
|
private |
|
private |
|
private |
|
private |
|
inlinestatic |
Returns the registered citations, keyed by app/module name and then by BibTeX key (app/module name -> (BibTeX key -> BibTeX entry text))
Definition at line 284 of file Registry.h.
Referenced by MooseApp::requestCitations().
|
static |
Returns the citations (BibTeX key -> BibTeX entry text) tied to app_name, or an empty map if no citations are registered for it.
Most apps/modules register none, so the empty result is a normal case: callers iterate over all constructed objects' labels and gather whatever citations exist.
Definition at line 210 of file Registry.C.
|
inlinestatic |
Definition at line 204 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 166 of file Registry.C.
|
inlinestatic |
Returns a map of all registered data file paths (name -> path)
Definition at line 264 of file Registry.h.
Referenced by Moose::DataFileUtils::getPath(), and ConsoleUtils::outputDataFilePaths().
|
static |
returns the name() for a registered class
Definition at line 372 of file Registry.h.
|
static |
Get the global Registry singleton.
Definition at line 24 of file Registry.C.
Referenced by add(), addAction(), addAppCitation(), addDataFilePath(), addKnownLabel(), addRepository(), allActions(), allObjects(), getCitations(), 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 280 of file Registry.h.
|
static |
Returns the repository URL associated with repo_name.
Definition at line 189 of file Registry.C.
Referenced by moose::internal::formatMooseDocumentedError().
|
inlinestatic |
Definition at line 258 of file Registry.h.
Referenced by MooseObject::MooseObject(), and MooseApp::requestCitations().
|
static |
Definition at line 58 of file Registry.C.
Referenced by MooseApp::requestCitations().
|
static |
This registers all Actions known to the registry that have the given label(s) with the factory f.
Definition at line 69 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 35 of file Registry.C.
Referenced by Moose::registerObjects().
|
inlinestaticprivate |
Manually set the data file paths.
Used in unit testing.
Definition at line 327 of file Registry.h.
|
inlinestaticprivate |
Manually set the repos.
Used in unit testing
Definition at line 336 of file Registry.h.
|
friend |
Definition at line 311 of file Registry.h.
|
friend |
Friends for unit testing.
Definition at line 310 of file Registry.h.
|
private |
App/module name -> (citation key -> BibTeX entry text) for that app.
Definition at line 367 of file Registry.h.
Referenced by addAppCitation(), and getCitations().
|
private |
Data file registry; name -> in-tree path.
Definition at line 362 of file Registry.h.
Referenced by addDataFilePath(), getDataFilePath(), getDataFilePaths(), and setDataFilePaths().
|
private |
Definition at line 360 of file Registry.h.
Referenced by addKnownLabel().
|
private |
Definition at line 357 of file Registry.h.
Referenced by isRegisteredObj().
|
private |
Definition at line 359 of file Registry.h.
Referenced by addAction(), and allActions().
|
private |
Definition at line 358 of file Registry.h.
Referenced by add(), and allObjects().
|
private |
Repository name -> repository URL; used for mooseDocumentedError.
Definition at line 364 of file Registry.h.
Referenced by addRepository(), getRepos(), getRepositoryURL(), and setRepos().
|
private |
Definition at line 365 of file Registry.h.
Referenced by add(), addAction(), and getClassName().
1.8.14