https://mooseframework.inl.gov
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. More...
 
Registryoperator= (Registry const &)=delete
 
 Registry (Registry &&)=delete
 
Registryoperator= (Registry &&)=delete
 

Static Public Member Functions

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

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

Referenced by getRegistry().

284 {};

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

174  {
175  const auto info = std::make_shared<RegistryEntry<T>>(base_info);
176  getRegistry()._per_label_objects[info->_label].push_back(info);
177  getRegistry()._type_to_classname[typeid(T).name()] = info->name();
178  return 0;
179  }
std::string name(const ElemQuality q)
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23
MPI_Info info
std::map< std::string, std::string > _type_to_classname
Definition: Registry.h:321
std::map< std::string, std::vector< std::shared_ptr< RegistryEntryBase > > > _per_label_objects
Definition: Registry.h:314

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

186  {
187  const auto info = std::make_shared<RegistryEntry<T>>(base_info);
188  getRegistry()._per_label_actions[info->_label].push_back(info);
189  getRegistry()._type_to_classname[typeid(T).name()] = info->_classname;
190  return 0;
191  }
std::string name(const ElemQuality q)
std::map< std::string, std::vector< std::shared_ptr< RegistryEntryBase > > > _per_label_actions
Definition: Registry.h:315
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23
MPI_Info info
std::map< std::string, std::string > _type_to_classname
Definition: Registry.h:321

◆ 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 128 of file Registry.C.

Referenced by addDeprecatedAppDataFilePath().

129 {
130  // split the *App.C filename from its containing directory
131  const auto dir = MooseUtils::splitFileName(app_path).first;
132  // This works for both build/unity_src/ and src/base/ as the *App.C file location,
133  // in case __FILE__ doesn't get overriden in unity build
134  addDataFilePath(app_name, MooseUtils::pathjoin(dir, "../../data"));
135 }
std::pair< std::filesystem::path, std::filesystem::path > splitFileName(const T &full_file)
Function for splitting path and filename.
Definition: MooseUtils.h:261
std::filesystem::path pathjoin(const std::filesystem::path &p)
Definition: MooseUtils.C:59
static void addDataFilePath(const std::string &name, const std::string &in_tree_path)
register general search paths (folder name must be data)
Definition: Registry.C:91

◆ addDataFilePath()

void Registry::addDataFilePath ( const std::string &  name,
const std::string &  in_tree_path 
)
static

register general search paths (folder name must be data)

Definition at line 91 of file Registry.C.

Referenced by addAppDataFilePath().

92 {
93  if (!std::regex_search(name, std::regex("\\w+")))
94  mooseError("Unallowed characters in '", name, "'");
95 
96  // Enforce that the folder is called "data", because we rely on the installed path
97  // to be within PREFIX/share/<name>/data (see determineDataFilePath())
98  const std::string folder = std::filesystem::path(in_tree_path).filename().c_str();
99  if (folder != "data")
100  mooseError("While registering data file path '",
101  in_tree_path,
102  "' for '",
103  name,
104  "': The folder must be named 'data' and it is named '",
105  folder,
106  "'");
107 
108  // Find either the installed or in-tree path
109  const auto path = determineDataFilePath(name, in_tree_path);
110 
111  auto & dfp = getRegistry()._data_file_paths;
112  const auto it = dfp.find(name);
113  // Not registered yet
114  if (it == dfp.end())
115  dfp.emplace(name, path);
116  // Registered, but with a different value
117  else if (it->second != path)
118  mooseError("While registering data file path '",
119  path,
120  "' for '",
121  name,
122  "': the path '",
123  it->second,
124  "' is already registered");
125 }
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
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:182
std::map< std::string, std::string > _data_file_paths
Data file registry; name -> in-tree path.
Definition: Registry.h:318

◆ addDeprecatedAppDataFilePath()

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

deprecated method; use addAppDataFilePath instead

Definition at line 138 of file Registry.C.

139 {
140  const auto app_name = appNameFromAppPath(app_path);
141  mooseDeprecated("In ",
142  app_path,
143  ":\nregisterDataFilePath() is deprecated. Use registerAppDataFilePath(\"",
144  app_name,
145  "\") instead.");
146  addAppDataFilePath(app_name, app_path);
147 }
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.
Definition: Registry.C:209
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:128
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:353

◆ addKnownLabel()

char Registry::addKnownLabel ( const std::string &  label)
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().

85 {
86  getRegistry()._known_labels.insert(label);
87  return 0;
88 }
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23
std::set< std::string > _known_labels
Definition: Registry.h:316

◆ addRepository()

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

register a repository

Definition at line 160 of file Registry.C.

161 {
162  auto & repos = getRegistry()._repos;
163  const auto [it, inserted] = repos.emplace(repo_name, repo_url);
164  if (!inserted && it->second != repo_url)
165  mooseError("Registry::registerRepository(): The repository '",
166  repo_name,
167  "' is already registered with a different URL '",
168  it->second,
169  "'.");
170 }
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
std::map< std::string, std::string > _repos
Repository name -> repository URL; used for mooseDocumentedError.
Definition: Registry.h:320

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

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

228  {
230  }
std::map< std::string, std::vector< std::shared_ptr< RegistryEntryBase > > > _per_label_actions
Definition: Registry.h:315
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23

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

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

223  {
225  }
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23
std::map< std::string, std::vector< std::shared_ptr< RegistryEntryBase > > > _per_label_objects
Definition: Registry.h:314

◆ 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 209 of file Registry.C.

Referenced by addDeprecatedAppDataFilePath().

210 {
211  // This is for deprecated use only. It assumes that the application name
212  // (binary name) in the build follows our normal naming of FooBarApp -> foo_bar.
213  // We need to convert the application source file to the above, for example:
214  // /path/to/FooBarBazApp.C -> foo_bar_baz
215  // Ideally, we would instead have the user specify this manually so that
216  // there is no ambiguity.
217  std::smatch match;
218  if (std::regex_search(app_path, match, std::regex("\\/([a-zA-Z0-9_]+)App\\.C$")))
219  {
220  std::string name = match[1]; // FooBarBaz
221  name = std::regex_replace(name, std::regex("(?!^)([A-Z])"), "_$1"); // Foo_Bar_Baz
222  name = MooseUtils::toLower(name); // foo_bar_baz
223  return name;
224  }
225 
226  mooseError(
227  "Registry::appNameFromAppPath(): Failed to parse application name from '", app_path, "'");
228 }
std::string name(const ElemQuality q)
std::string toLower(const std::string &name)
Convert supplied string to lower case.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302

◆ 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 182 of file Registry.C.

Referenced by addDataFilePath().

183 {
184  // TODO: Track whether or not the application is installed in a better way
185  // than this, which will enable us to pick one or the other based on
186  // the install state. This probably also won't work with dynamic loading, where
187  // we can't necessarily get this information from the binary (as there could be
188  // multiple binary paths)
189 
190  // Installed data
191  const auto installed_path =
192  MooseUtils::pathjoin(Moose::getExecutablePath(), "..", "share", name, "data");
193  if (MooseUtils::checkFileReadable(installed_path, false, false, false))
194  return MooseUtils::canonicalPath(installed_path);
195 
196  // In tree data
197  if (MooseUtils::checkFileReadable(in_tree_path, false, false, false))
198  return MooseUtils::canonicalPath(in_tree_path);
199 
200  mooseError("Failed to determine data file path for '",
201  name,
202  "'. Paths searched:\n\n installed: ",
203  installed_path,
204  "\n in-tree: ",
205  in_tree_path);
206 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
std::string getExecutablePath()
This function returns the PATH of the running executable.
std::string canonicalPath(const std::string &path)
Gets the canonical path of the given path.
Definition: MooseUtils.C:1266
bool checkFileReadable(const std::string &filename, bool check_line_endings=false, bool throw_on_unreadable=true, bool check_for_git_lfs_pointer=true)
Checks to see if a file is readable (exists and permissions)
Definition: MooseUtils.C:250
std::filesystem::path pathjoin(const std::filesystem::path &p)
Definition: MooseUtils.C:59

◆ FRIEND_TEST() [1/4]

Registry::FRIEND_TEST ( RegistryTest  ,
determineFilePath   
)
private

◆ FRIEND_TEST() [2/4]

Registry::FRIEND_TEST ( RegistryTest  ,
determineFilePathFailed   
)
private

◆ FRIEND_TEST() [3/4]

Registry::FRIEND_TEST ( RegistryTest  ,
appNameFromAppPath   
)
private

◆ FRIEND_TEST() [4/4]

Registry::FRIEND_TEST ( RegistryTest  ,
appNameFromAppPathFailed   
)
private

◆ getClassName()

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

Definition at line 194 of file Registry.h.

195  {
196  return libmesh_map_find(getRegistry()._type_to_classname, typeid(T).name());
197  }
std::string name(const ElemQuality q)
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23
std::map< std::string, std::string > _type_to_classname
Definition: Registry.h:321

◆ 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 150 of file Registry.C.

151 {
152  const auto & dfps = getRegistry()._data_file_paths;
153  const auto it = dfps.find(name);
154  if (it == dfps.end())
155  mooseError("Registry::getDataFilePath(): A data file path for '", name, "' is not registered");
156  return it->second;
157 }
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
std::map< std::string, std::string > _data_file_paths
Data file registry; name -> in-tree path.
Definition: Registry.h:318

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

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

244  {
245  return getRegistry()._data_file_paths;
246  }
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23
std::map< std::string, std::string > _data_file_paths
Data file registry; name -> in-tree path.
Definition: Registry.h:318

◆ getRegisteredName()

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

returns the name() for a registered class

Definition at line 326 of file Registry.h.

327 {
328  mooseDeprecated("Use Registry::getClassName() instead.");
329  return getClassName<T>();
330 }
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:353

◆ getRegistry()

Registry & Registry::getRegistry ( )
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().

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

◆ getRepos()

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

Returns a map of all registered repositories.

Definition at line 259 of file Registry.h.

259 { return getRegistry()._repos; }
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23
std::map< std::string, std::string > _repos
Repository name -> repository URL; used for mooseDocumentedError.
Definition: Registry.h:320

◆ getRepositoryURL()

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

Returns the repository URL associated with repo_name.

Definition at line 173 of file Registry.C.

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

174 {
175  const auto & repos = getRegistry()._repos;
176  if (const auto it = repos.find(repo_name); it != repos.end())
177  return it->second;
178  mooseError("Registry::getRepositoryURL(): The repository '", repo_name, "' is not registered.");
179 }
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
std::map< std::string, std::string > _repos
Repository name -> repository URL; used for mooseDocumentedError.
Definition: Registry.h:320

◆ isRegisteredObj()

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

Definition at line 237 of file Registry.h.

Referenced by MooseObject::MooseObject().

238  {
239  return getRegistry()._name_to_entry.count(name);
240  }
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23
std::map< std::string, std::shared_ptr< RegistryEntryBase > > _name_to_entry
Definition: Registry.h:313

◆ objData()

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

Definition at line 57 of file Registry.C.

58 {
59  auto & r = getRegistry();
60 
61  if (const auto it = r._name_to_entry.find(name); it != r._name_to_entry.end())
62  return *it->second;
63  else
64  mooseError("Object ", name, " is not registered yet");
65 }
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302

◆ operator=() [1/2]

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

◆ operator=() [2/2]

Registry& Registry::operator= ( Registry &&  )
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 68 of file Registry.C.

Referenced by Moose::registerActions().

69 {
70  auto & r = getRegistry();
71 
72  for (const auto & label : labels)
73  {
74  r._known_labels.insert(label);
75  if (r._per_label_actions.count(label) == 0)
76  continue;
77 
78  for (const auto & obj : r._per_label_actions[label])
79  f.reg(obj);
80  }
81 }
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23
void reg(std::shared_ptr< RegistryEntryBase > obj)
Definition: ActionFactory.C:21

◆ 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 34 of file Registry.C.

Referenced by Moose::registerObjects().

35 {
36  auto & r = getRegistry();
37 
38  for (const auto & label : labels)
39  {
40  r._known_labels.insert(label);
41  if (r._per_label_objects.count(label) == 0)
42  continue;
43 
44  for (const auto & obj : r._per_label_objects[label])
45  {
46  const auto name = obj->name();
47  r._name_to_entry[name] = obj;
48 
49  f.reg(obj);
50  if (!obj->_alias.empty())
51  f.associateNameToClass(name, obj->_classname);
52  }
53  }
54 }
std::string name(const ElemQuality q)
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23
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:266

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

292  {
293  getRegistry()._data_file_paths = data_file_paths;
294  }
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23
std::map< std::string, std::string > _data_file_paths
Data file registry; name -> in-tree path.
Definition: Registry.h:318

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

301  {
302  getRegistry()._repos = repos;
303  }
static Registry & getRegistry()
Get the global Registry singleton.
Definition: Registry.C:23
std::map< std::string, std::string > _repos
Repository name -> repository URL; used for mooseDocumentedError.
Definition: Registry.h:320

Friends And Related Function Documentation

◆ DataFileUtilsTest

friend class DataFileUtilsTest
friend

Definition at line 277 of file Registry.h.

◆ RegistryTest

friend class RegistryTest
friend

Friends for unit testing.

Definition at line 276 of file Registry.h.

Member Data Documentation

◆ _data_file_paths

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

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

Definition at line 318 of file Registry.h.

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

◆ _known_labels

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

Definition at line 316 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 313 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 315 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 314 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 320 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 321 of file Registry.h.

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


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