https://mooseframework.inl.gov
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 144 of file Registry.h.

Constructor & Destructor Documentation

◆ RegistryEntry()

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

Definition at line 146 of file Registry.h.

146 : RegistryEntryBase(data) {}
RegistryEntryBase(const RegistryEntryData &data)
Definition: Registry.h:125

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

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

◆ buildAction()

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

Implements RegistryEntryBase.

Definition at line 343 of file Registry.h.

344 {
345  if constexpr (!std::is_base_of_v<Action, T>)
346  mooseError("The action to be built is not derived from Action.");
347  else
348  return std::make_shared<T>(parameters);
349 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302

◆ buildParameters()

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

Implements RegistryEntryBase.

Definition at line 353 of file Registry.h.

354 {
355  auto params = T::validParams();
356  return params;
357 }
InputParameters validParams()

◆ name()

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

resolve the name from _classname, _alias, and _name

Definition at line 132 of file Registry.h.

133  {
134  std::string name = _name;
135  if (name.empty())
136  name = _alias;
137  if (name.empty())
138  name = _classname;
139  return name;
140  }
std::string _classname
name of the c++ class for the object.
Definition: Registry.h:107
std::string _name
name that the object will be registered to factories under. If unspecified, _alias is used...
Definition: Registry.h:112
std::string name() const
resolve the name from _classname, _alias, and _name
Definition: Registry.h:132
std::string _alias
an alternate name to register the object to factories under.
Definition: Registry.h:110

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 110 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 107 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 118 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 114 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 105 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 116 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 112 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 120 of file Registry.h.


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