www.mooseframework.org
Public Member Functions | Public Attributes | List of all members
RegistryEntry< T > Struct Template Reference

#include <Registry.h>

Inheritance diagram for RegistryEntry< T >:
[legend]

Public Member Functions

 RegistryEntry (const RegistryEntryData &data)
 
virtual std::unique_ptr< MooseObjectbuild (const InputParameters &parameters) override
 proxy functions More...
 
virtual std::shared_ptr< ActionbuildAction (const InputParameters &parameters) override
 
virtual InputParameters buildParameters () override
 
std::string name () const
 resolve the name from _classname, _alias, and _name More...
 

Public Attributes

std::string _label
 label (usually app name - e.g. "YourAnimalApp") that the object or action is associated with. More...
 
std::string _classname
 name of the c++ class for the object. More...
 
std::string _alias
 an alternate name to register the object to factories under. More...
 
std::string _name
 name that the object will be registered to factories under. If unspecified, _alias is used. More...
 
std::string _file
 file path for the c++ file the object or action was added to the registry in. More...
 
int _line
 line number in the c++ file the object or action was added to the registry on. More...
 
std::string _deprecated_time
 time in "mm/dd/yyyy HH:MM" format that the object is/becomes deprecated, blank otherwise. More...
 
std::string _replaced_by
 class name for an object that replaces this object if deprecated, blank otherwise. More...
 

Detailed Description

template<typename T>
struct RegistryEntry< T >

Definition at line 136 of file Registry.h.

Constructor & Destructor Documentation

◆ RegistryEntry()

template<typename T >
RegistryEntry< T >::RegistryEntry ( const RegistryEntryData data)
inline

Definition at line 138 of file Registry.h.

138 : RegistryEntryBase(data) {}
RegistryEntryBase(const RegistryEntryData &data)
Definition: Registry.h:117

Member Function Documentation

◆ build()

template<typename T >
std::unique_ptr< MooseObject > RegistryEntry< T >::build ( const InputParameters parameters)
overridevirtual

proxy functions

Implements RegistryEntryBase.

Definition at line 273 of file Registry.h.

274 {
275  if constexpr (std::is_base_of_v<MooseObject, T>)
276  return std::make_unique<T>(parameters);
277  mooseError("The object to be built is not derived from MooseObject.");
278 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299

◆ buildAction()

template<typename T >
std::shared_ptr< Action > RegistryEntry< T >::buildAction ( const InputParameters parameters)
overridevirtual

Implements RegistryEntryBase.

Definition at line 282 of file Registry.h.

283 {
284  if constexpr (!std::is_base_of_v<Action, T>)
285  mooseError("The action to be built is not derived from Action.");
286  else
287  return std::make_shared<T>(parameters);
288 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299

◆ buildParameters()

template<typename T >
InputParameters RegistryEntry< T >::buildParameters ( )
overridevirtual

Implements RegistryEntryBase.

Definition at line 292 of file Registry.h.

293 {
294  auto params = T::validParams();
295  return params;
296 }
InputParameters validParams()

◆ name()

std::string RegistryEntryBase::name ( ) const
inlineinherited

resolve the name from _classname, _alias, and _name

Definition at line 124 of file Registry.h.

125  {
126  std::string name = _name;
127  if (name.empty())
128  name = _alias;
129  if (name.empty())
130  name = _classname;
131  return name;
132  }
std::string _classname
name of the c++ class for the object.
Definition: Registry.h:99
std::string _name
name that the object will be registered to factories under. If unspecified, _alias is used...
Definition: Registry.h:104
std::string name() const
resolve the name from _classname, _alias, and _name
Definition: Registry.h:124
std::string _alias
an alternate name to register the object to factories under.
Definition: Registry.h:102

Member Data Documentation

◆ _alias

std::string RegistryEntryData::_alias
inherited

an alternate name to register the object to factories under.

If unspecified, _classname is used.

Definition at line 102 of file Registry.h.

Referenced by RegistryEntryBase::name().

◆ _classname

std::string RegistryEntryData::_classname
inherited

name of the c++ class for the object.

Definition at line 99 of file Registry.h.

Referenced by RegistryEntryBase::name().

◆ _deprecated_time

std::string RegistryEntryData::_deprecated_time
inherited

time in "mm/dd/yyyy HH:MM" format that the object is/becomes deprecated, blank otherwise.

Definition at line 110 of file Registry.h.

◆ _file

std::string RegistryEntryData::_file
inherited

file path for the c++ file the object or action was added to the registry in.

Definition at line 106 of file Registry.h.

◆ _label

std::string RegistryEntryData::_label
inherited

label (usually app name - e.g. "YourAnimalApp") that the object or action is associated with.

Definition at line 97 of file Registry.h.

◆ _line

int RegistryEntryData::_line
inherited

line number in the c++ file the object or action was added to the registry on.

Definition at line 108 of file Registry.h.

◆ _name

std::string RegistryEntryData::_name
inherited

name that the object will be registered to factories under. If unspecified, _alias is used.

Definition at line 104 of file Registry.h.

Referenced by RegistryEntryBase::name().

◆ _replaced_by

std::string RegistryEntryData::_replaced_by
inherited

class name for an object that replaces this object if deprecated, blank otherwise.

Definition at line 112 of file Registry.h.


The documentation for this struct was generated from the following file: