https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Registry Class Reference

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.
 
Registryoperator= (Registry const &)=delete
 
 Registry (Registry &&)=delete
 
Registryoperator= (Registry &&)=delete
 

Static Public Member Functions

static RegistrygetRegistry ()
 Get the global Registry singleton.
 
template<typename T >
static char add (const RegistryEntryData &base_info)
 Adds information on a MooseObject to the registry.
 
template<typename T >
static char addAction (const RegistryEntryData &base_info)
 Adds information on an Action object to the registry.
 
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.
 
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.
 
static char addKnownLabel (const std::string &label)
 addKnownLabel whitelists a label as valid for purposes of the checkLabels function.
 
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
 
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
 
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
 
static void addDeprecatedAppDataFilePath (const std::string &app_path)
 deprecated method; use addAppDataFilePath instead
 
static void addRepository (const std::string &repo_name, const std::string &repo_url)
 register a repository
 
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.
 
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.
 
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.
 
static const RegistryEntryBaseobjData (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)
 
static std::string getDataFilePath (const std::string &name)
 Gets a data path for the registered name.
 
static const std::string & getRepositoryURL (const std::string &repo_name)
 Returns the repository URL associated with repo_name.
 
static const std::map< std::string, std::string > & getRepos ()
 Returns a map of all registered repositories.
 
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))
 
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.
 
template<typename T >
static std::string getRegisteredName ()
 returns the name() for a registered class
 

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.
 
static void setRepos (const std::map< std::string, std::string > &repos)
 Manually set the repos.
 
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)
 
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.
 
static void checkDataFilePathName (const std::string &name)
 Check a data file path for valid characters.
 
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.
 

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.
 
std::map< std::string, std::string > _repos
 Repository name -> repository URL; used for mooseDocumentedError.
 
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.
 
class RegistryTest
 Friends for unit testing.
 
class DataFileUtilsTest
 
 FRIEND_TEST (RegistryTest, determineFilePath)
 
 FRIEND_TEST (RegistryTest, determineFilePathFailed)
 
 FRIEND_TEST (RegistryTest, appNameFromAppPath)
 
 FRIEND_TEST (RegistryTest, appNameFromAppPathFailed)
 
 FRIEND_TEST (RegistryTest, addDataFilePathCapability)
 

Detailed Description

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 178 of file Registry.h.

Constructor & Destructor Documentation

◆ Registry() [1/3]

Registry::Registry ( Registry const &  )
delete

Don't allow creation through copy/move construction or assignment.

◆ Registry() [2/3]

Registry::Registry ( Registry &&  )
delete

◆ Registry() [3/3]

Registry::Registry ( )
inlineprivate

Definition at line 327 of file Registry.h.

327{}

Referenced by getRegistry().

Member Function Documentation

◆ add()

template<typename T >
static char Registry::add ( const RegistryEntryData base_info)
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 190 of file Registry.h.

191 {
192 const auto info = std::make_shared<RegistryEntry<T>>(base_info);
193 getRegistry()._per_label_objects[info->_label].push_back(info);
194 getRegistry()._type_to_classname[typeid(T).name()] = info->name();
195 return 0;
196 }
static Registry & getRegistry()
Get the global Registry singleton.
Definition Registry.C:24
std::map< std::string, std::vector< std::shared_ptr< RegistryEntryBase > > > _per_label_objects
Definition Registry.h:365
std::map< std::string, std::string > _type_to_classname
Definition Registry.h:372
MPI_Info info
std::string name(const ElemQuality q)

◆ addAction()

template<typename T >
static char Registry::addAction ( const RegistryEntryData base_info)
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 202 of file Registry.h.

203 {
204 const auto info = std::make_shared<RegistryEntry<T>>(base_info);
205 getRegistry()._per_label_actions[info->_label].push_back(info);
206 getRegistry()._type_to_classname[typeid(T).name()] = info->_classname;
207 return 0;
208 }
std::map< std::string, std::vector< std::shared_ptr< RegistryEntryBase > > > _per_label_actions
Definition Registry.h:366

◆ addAppCitation()

void Registry::addAppCitation ( const std::string &  app_name,
const std::string &  key,
const std::string &  bibtex 
)
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.

201{
202 auto & app_citations = getRegistry()._app_citations[app_name];
203 const auto [it, inserted] = app_citations.emplace(key, bibtex);
204 if (!inserted && it->second != bibtex)
206 "Registry: the citation '", key, "' is already registered with different BibTeX text.");
207}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
std::map< std::string, std::map< std::string, std::string > > _app_citations
App/module name -> (citation key -> BibTeX entry text) for that app.
Definition Registry.h:374

Referenced by Moose::registerAll().

◆ addAppDataFilePath()

void Registry::addAppDataFilePath ( const std::string &  app_name,
const std::string &  app_path 
)
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.

145{
146 // split the *App.C filename from its containing directory
147 const auto dir = MooseUtils::splitFileName(app_path).first;
148 // This works for both build/unity_src/ and src/base/ as the *App.C file location,
149 // in case __FILE__ doesn't get overriden in unity build
150 addDataFilePath(app_name, MooseUtils::pathjoin(dir, "../../data"));
151}
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
Definition Registry.C:92
std::filesystem::path pathjoin(const std::filesystem::path &p)
Definition MooseUtils.C:70

Referenced by addDeprecatedAppDataFilePath().

◆ addDataFilePath()

void Registry::addDataFilePath ( const std::string &  name,
const std::string &  in_tree_path,
const bool  app = true,
const std::optional< std::string > &  info = {} 
)
static

register general search paths; "app" is whether or not the path is an app path

Definition at line 92 of file Registry.C.

96{
98
99 // Enforce that the folder is called "data", because we rely on the installed path
100 // to be within PREFIX/share/<name>/data (see determineDataFilePath())
101 if (is_app)
102 {
103 const std::string folder = std::filesystem::path(in_tree_path).filename().c_str();
104 if (folder != "data")
105 mooseError("While registering data file path '",
106 in_tree_path,
107 "' for '",
108 name,
109 "': The folder must be named 'data' and it is named '",
110 folder,
111 "'");
112 }
113
114 // Find either the installed or in-tree path
115 const auto path = determineDataFilePath(name, in_tree_path);
116
117 auto & dfp = getRegistry()._data_file_paths;
118 const auto it = dfp.find(name);
119 // Not registered yet
120 if (it == dfp.end())
121 {
122 dfp.emplace(name, path);
123 addDataFilePathCapability(name, path, info);
124 }
125 // Registered, but with a different value
126 else if (it->second != path)
127 mooseError("While registering data file path '",
128 path,
129 "' for '",
130 name,
131 "': the path '",
132 it->second,
133 "' is already registered");
134}
static void checkDataFilePathName(const std::string &name)
Check a data file path for valid characters.
Definition Registry.C:268
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.
Definition Registry.C:277
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)
Definition Registry.C:219
std::map< std::string, std::string > _data_file_paths
Data file registry; name -> in-tree path.
Definition Registry.h:369

Referenced by addAppDataFilePath().

◆ addDataFilePathCapability()

void Registry::addDataFilePathCapability ( const std::string &  name,
const std::optional< std::string > &  path = {},
const std::optional< std::string > &  extra_info = {} 
)
staticprivate

Add a data file path capability.

Definition at line 277 of file Registry.C.

280{
281 std::string doc = "Named data path '" + name + "' is ";
282 if (path)
283 doc += "available at '" + *path + "'";
284 else
285 doc += "not available";
286 if (extra_info)
287 doc += "; " + *extra_info;
288 doc += ".";
289
290 auto & capabilities = Moose::internal::Capabilities::getCapabilities({});
291 capabilities.add("data_" + name, bool(path), doc);
292}
static Capabilities & getCapabilities(const GetCapabilitiesPassKey)
Get the singleton Capabilities.
Capability & add(const std::string_view name, const Moose::Capability::Value &value, const std::string_view doc)
Add a capability.

Referenced by addDataFilePath(), and addMissingDataFilePath().

◆ addDeprecatedAppDataFilePath()

void Registry::addDeprecatedAppDataFilePath ( const std::string &  app_path)
static

deprecated method; use addAppDataFilePath instead

Definition at line 154 of file Registry.C.

155{
156 const auto app_name = appNameFromAppPath(app_path);
157 mooseDeprecated("In ",
158 app_path,
159 ":\nregisterDataFilePath() is deprecated. Use registerAppDataFilePath(\"",
160 app_name,
161 "\") instead.");
162 addAppDataFilePath(app_name, app_path);
163}
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition MooseError.h:363
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 p...
Definition Registry.C:144
static std::string appNameFromAppPath(const std::string &app_path)
Internal helper for getting an application name from its path, for example: /path/to/FooBarBazApp....
Definition Registry.C:246

◆ addKnownLabel()

char Registry::addKnownLabel ( const std::string &  label)
static

addKnownLabel whitelists a label as valid for purposes of the checkLabels function.

Definition at line 85 of file Registry.C.

86{
87 getRegistry()._known_labels.insert(label);
88 return 0;
89}
std::set< std::string > _known_labels
Definition Registry.h:367

◆ addMissingDataFilePath()

void Registry::addMissingDataFilePath ( const std::string &  name,
const std::string &  info 
)
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.

138{
141}

◆ addRepository()

void Registry::addRepository ( const std::string &  repo_name,
const std::string &  repo_url 
)
static

register a repository

Definition at line 176 of file Registry.C.

177{
178 auto & repos = getRegistry()._repos;
179 const auto [it, inserted] = repos.emplace(repo_name, repo_url);
180 if (!inserted && it->second != repo_url)
181 mooseError("Registry::registerRepository(): The repository '",
182 repo_name,
183 "' is already registered with a different URL '",
184 it->second,
185 "'.");
186}
std::map< std::string, std::string > _repos
Repository name -> repository URL; used for mooseDocumentedError.
Definition Registry.h:371

◆ allActions()

static const std::map< std::string, std::vector< std::shared_ptr< RegistryEntryBase > > > & Registry::allActions ( )
inlinestatic

Returns a per-label keyed map of all Actions in the registry.

Definition at line 255 of file Registry.h.

256 {
258 }

Referenced by JsonSyntaxTree::JsonSyntaxTree(), and MooseApp::setupOptions().

◆ allObjects()

static const std::map< std::string, std::vector< std::shared_ptr< RegistryEntryBase > > > & Registry::allObjects ( )
inlinestatic

Returns a per-label keyed map of all MooseObjects in the registry.

Definition at line 250 of file Registry.h.

251 {
253 }

Referenced by JsonSyntaxTree::JsonSyntaxTree(), and MooseApp::setupOptions().

◆ appNameFromAppPath()

std::string Registry::appNameFromAppPath ( const std::string &  app_path)
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.

247{
248 // This is for deprecated use only. It assumes that the application name
249 // (binary name) in the build follows our normal naming of FooBarApp -> foo_bar.
250 // We need to convert the application source file to the above, for example:
251 // /path/to/FooBarBazApp.C -> foo_bar_baz
252 // Ideally, we would instead have the user specify this manually so that
253 // there is no ambiguity.
254 std::smatch match;
255 if (std::regex_search(app_path, match, std::regex("\\/([a-zA-Z0-9_]+)App\\.C$")))
256 {
257 std::string name = match[1]; // FooBarBaz
258 name = std::regex_replace(name, std::regex("(?!^)([A-Z])"), "_$1"); // Foo_Bar_Baz
259 name = MooseUtils::toLower(name); // foo_bar_baz
260 return name;
261 }
262
264 "Registry::appNameFromAppPath(): Failed to parse application name from '", app_path, "'");
265}
std::string toLower(std::string name)
Convert supplied string to lower case.

Referenced by addDeprecatedAppDataFilePath().

◆ checkDataFilePathName()

void Registry::checkDataFilePathName ( const std::string &  name)
staticprivate

Check a data file path for valid characters.

Definition at line 268 of file Registry.C.

269{
270 if (!std::regex_search(name, std::regex("[a-z0-9_]+")))
271 mooseError("Unallowed characters in data file path name '",
272 name,
273 "'; allowed characters = a-z, 0-9, _");
274}

Referenced by addDataFilePath(), and addMissingDataFilePath().

◆ determineDataFilePath()

std::string Registry::determineDataFilePath ( const std::string &  name,
const std::string &  in_tree_path 
)
staticprivate

Internal helper for determing a root data file path (in-tree vs installed)

Definition at line 219 of file Registry.C.

220{
221 // TODO: Track whether or not the application is installed in a better way
222 // than this, which will enable us to pick one or the other based on
223 // the install state. This probably also won't work with dynamic loading, where
224 // we can't necessarily get this information from the binary (as there could be
225 // multiple binary paths)
226
227 // Installed data
228 const auto installed_path =
229 MooseUtils::pathjoin(Moose::getExecutablePath(), "..", "share", name, "data");
230 if (MooseUtils::checkFileReadable(installed_path, false, false, false))
231 return MooseUtils::canonicalPath(installed_path);
232
233 // In tree data
234 if (MooseUtils::checkFileReadable(in_tree_path, false, false, false))
235 return MooseUtils::canonicalPath(in_tree_path);
236
237 mooseError("Failed to determine data file path for '",
238 name,
239 "'. Paths searched:\n\n installed: ",
240 installed_path,
241 "\n in-tree: ",
242 in_tree_path);
243}
std::string canonicalPath(const std::string &path)
bool checkFileReadable(const std::string &filename, bool check_line_endings, bool throw_on_unreadable, bool check_for_git_lfs_pointer)
Definition MooseUtils.C:265
std::string getExecutablePath()
Gets the directory the running executable is on Mac OS X and linux.

Referenced by addDataFilePath().

◆ FRIEND_TEST() [1/5]

Registry::FRIEND_TEST ( RegistryTest  ,
addDataFilePathCapability   
)
private

◆ FRIEND_TEST() [2/5]

Registry::FRIEND_TEST ( RegistryTest  ,
appNameFromAppPath   
)
private

◆ FRIEND_TEST() [3/5]

Registry::FRIEND_TEST ( RegistryTest  ,
appNameFromAppPathFailed   
)
private

◆ FRIEND_TEST() [4/5]

Registry::FRIEND_TEST ( RegistryTest  ,
determineFilePath   
)
private

◆ FRIEND_TEST() [5/5]

Registry::FRIEND_TEST ( RegistryTest  ,
determineFilePathFailed   
)
private

◆ getCitations() [1/2]

static const std::map< std::string, std::map< std::string, std::string > > & Registry::getCitations ( )
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 291 of file Registry.h.

292 {
294 }

Referenced by MooseApp::collectCitations().

◆ getCitations() [2/2]

const std::map< std::string, std::string > & Registry::getCitations ( const std::string &  app_name)
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.

211{
212 static const std::map<std::string, std::string> empty;
213 const auto & app_citations = getRegistry()._app_citations;
214 const auto it = app_citations.find(app_name);
215 return it != app_citations.end() ? it->second : empty;
216}

◆ getClassName()

template<typename T >
static std::string Registry::getClassName ( )
inlinestatic

Definition at line 211 of file Registry.h.

212 {
213 return libmesh_map_find(getRegistry()._type_to_classname, typeid(T).name());
214 }

◆ getDataFilePath()

std::string Registry::getDataFilePath ( const std::string &  name)
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.

167{
168 const auto & dfps = getRegistry()._data_file_paths;
169 const auto it = dfps.find(name);
170 if (it == dfps.end())
171 mooseError("Registry::getDataFilePath(): A data file path for '", name, "' is not registered");
172 return it->second;
173}

◆ getDataFilePaths()

static const std::map< std::string, std::string > & Registry::getDataFilePaths ( )
inlinestatic

Returns a map of all registered data file paths (name -> path)

Definition at line 271 of file Registry.h.

272 {
274 }

Referenced by Moose::DataFileUtils::getPath(), and ConsoleUtils::outputDataFilePaths().

◆ getRegisteredName()

template<typename T >
std::string Registry::getRegisteredName ( )
static

returns the name() for a registered class

Definition at line 379 of file Registry.h.

380{
381 mooseDeprecated("Use Registry::getClassName() instead.");
382 return getClassName<T>();
383}

◆ getRegistry()

Registry & Registry::getRegistry ( )
static

Get the global Registry singleton.

Definition at line 24 of file Registry.C.

25{
26 // We need a naked new here (_not_ a smart pointer or object instance) due to what seems like a
27 // bug in clang's static object destruction when using dynamic library loading.
28 static Registry * registry_singleton = nullptr;
29 if (!registry_singleton)
30 registry_singleton = new Registry();
31 return *registry_singleton;
32}
The registry is used as a global singleton to collect information on all available MooseObject and Ac...
Definition Registry.h:179

Referenced by add(), addAction(), addAppCitation(), addDataFilePath(), addKnownLabel(), addRepository(), allActions(), allObjects(), getCitations(), getCitations(), getClassName(), getDataFilePath(), getDataFilePaths(), Moose::DataFileUtils::getPath(), getRepos(), getRepositoryURL(), isRegisteredObj(), objData(), registerActionsTo(), registerObjectsTo(), setDataFilePaths(), and setRepos().

◆ getRepos()

static const std::map< std::string, std::string > & Registry::getRepos ( )
inlinestatic

Returns a map of all registered repositories.

Definition at line 287 of file Registry.h.

287{ return getRegistry()._repos; }

◆ getRepositoryURL()

const std::string & Registry::getRepositoryURL ( const std::string &  repo_name)
static

Returns the repository URL associated with repo_name.

Definition at line 189 of file Registry.C.

190{
191 const auto & repos = getRegistry()._repos;
192 if (const auto it = repos.find(repo_name); it != repos.end())
193 return it->second;
194 mooseError("Registry::getRepositoryURL(): The repository '", repo_name, "' is not registered.");
195}

Referenced by moose::internal::formatMooseDocumentedError().

◆ isRegisteredObj()

static bool Registry::isRegisteredObj ( const std::string &  name)
inlinestatic
Returns
true if an object with the given name is registered

Definition at line 265 of file Registry.h.

266 {
267 return getRegistry()._name_to_entry.count(name);
268 }
std::map< std::string, std::shared_ptr< RegistryEntryBase > > _name_to_entry
Definition Registry.h:364

Referenced by MooseApp::collectCitations(), and MooseObject::MooseObject().

◆ objData()

const RegistryEntryBase & Registry::objData ( const std::string &  name)
static

Definition at line 58 of file Registry.C.

59{
60 auto & r = getRegistry();
61
62 if (const auto it = r._name_to_entry.find(name); it != r._name_to_entry.end())
63 return *it->second;
64 else
65 mooseError("Object ", name, " is not registered yet");
66}

Referenced by MooseApp::collectCitations().

◆ operator=() [1/2]

Registry & Registry::operator= ( Registry &&  )
delete

◆ operator=() [2/2]

Registry & Registry::operator= ( Registry const &  )
delete

◆ registerActionsTo()

void Registry::registerActionsTo ( ActionFactory f,
const std::set< std::string > &  labels 
)
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.

70{
71 auto & r = getRegistry();
72
73 for (const auto & label : labels)
74 {
75 r._known_labels.insert(label);
76 if (r._per_label_actions.count(label) == 0)
77 continue;
78
79 for (const auto & obj : r._per_label_actions[label])
80 f.reg(obj);
81 }
82}

◆ registerObjectsTo()

void Registry::registerObjectsTo ( Factory f,
const std::set< std::string > &  labels 
)
static

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.

36{
37 auto & r = getRegistry();
38
39 for (const auto & label : labels)
40 {
41 r._known_labels.insert(label);
42 if (r._per_label_objects.count(label) == 0)
43 continue;
44
45 for (const auto & obj : r._per_label_objects[label])
46 {
47 const auto name = obj->name();
48 r._name_to_entry[name] = obj;
49
50 f.reg(obj);
51 if (!obj->_alias.empty())
52 f.associateNameToClass(name, obj->_classname);
53 }
54 }
55}
void reg(std::shared_ptr< RegistryEntryBase > obj)
Definition Factory.C:23
void associateNameToClass(const std::string &name, const std::string &class_name)
Associates an object name with a class name.
Definition Factory.C:290

◆ setDataFilePaths()

static void Registry::setDataFilePaths ( const std::map< std::string, std::string > &  data_file_paths)
inlinestaticprivate

Manually set the data file paths.

Used in unit testing.

Definition at line 334 of file Registry.h.

335 {
336 getRegistry()._data_file_paths = data_file_paths;
337 }

◆ setRepos()

static void Registry::setRepos ( const std::map< std::string, std::string > &  repos)
inlinestaticprivate

Manually set the repos.

Used in unit testing

Definition at line 343 of file Registry.h.

344 {
345 getRegistry()._repos = repos;
346 }

Friends And Related Symbol Documentation

◆ DataFileUtilsTest

friend class DataFileUtilsTest
friend

Definition at line 318 of file Registry.h.

◆ RegistryTest

friend class RegistryTest
friend

Friends for unit testing.

Definition at line 317 of file Registry.h.

Member Data Documentation

◆ _app_citations

std::map<std::string, std::map<std::string, std::string> > Registry::_app_citations
private

App/module name -> (citation key -> BibTeX entry text) for that app.

Definition at line 374 of file Registry.h.

Referenced by addAppCitation(), getCitations(), and getCitations().

◆ _data_file_paths

std::map<std::string, std::string> Registry::_data_file_paths
private

Data file registry; name -> in-tree path.

Definition at line 369 of file Registry.h.

Referenced by addDataFilePath(), getDataFilePath(), getDataFilePaths(), and setDataFilePaths().

◆ _known_labels

std::set<std::string> Registry::_known_labels
private

Definition at line 367 of file Registry.h.

Referenced by addKnownLabel().

◆ _name_to_entry

std::map<std::string, std::shared_ptr<RegistryEntryBase> > Registry::_name_to_entry
private

Definition at line 364 of file Registry.h.

Referenced by isRegisteredObj().

◆ _per_label_actions

std::map<std::string, std::vector<std::shared_ptr<RegistryEntryBase> > > Registry::_per_label_actions
private

Definition at line 366 of file Registry.h.

Referenced by addAction(), and allActions().

◆ _per_label_objects

std::map<std::string, std::vector<std::shared_ptr<RegistryEntryBase> > > Registry::_per_label_objects
private

Definition at line 365 of file Registry.h.

Referenced by add(), and allObjects().

◆ _repos

std::map<std::string, std::string> Registry::_repos
private

Repository name -> repository URL; used for mooseDocumentedError.

Definition at line 371 of file Registry.h.

Referenced by addRepository(), getRepos(), getRepositoryURL(), and setRepos().

◆ _type_to_classname

std::map<std::string, std::string> Registry::_type_to_classname
private

Definition at line 372 of file Registry.h.

Referenced by add(), addAction(), and getClassName().


The documentation for this class was generated from the following files: