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< MooseObjectbuildShared (const InputParameters &parameters) override
 
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 153 of file Registry.h.

Constructor & Destructor Documentation

◆ RegistryEntry()

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

Definition at line 359 of file Registry.h.

359  : RegistryEntryBase(data)
360 {
361  static_assert(std::is_base_of_v<MooseObject, T> || std::is_base_of_v<Action, T>,
362  "Not derived from MooseObject or Action");
363 }
RegistryEntryBase(const RegistryEntryData &data)
Definition: Registry.h:133

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

368 {
369  if constexpr (std::is_base_of_v<MooseObject, T>)
370  return std::make_unique<T>(parameters);
371  mooseError(MooseUtils::prettyCppType<T>(), " to be built is not a MooseObject.");
372 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311

◆ buildAction()

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

Implements RegistryEntryBase.

Definition at line 384 of file Registry.h.

385 {
386  if constexpr (!std::is_base_of_v<Action, T>)
387  mooseError("The action to be built is not derived from Action.");
388  else
389  return std::make_shared<T>(parameters);
390 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311

◆ buildParameters()

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

Implements RegistryEntryBase.

Definition at line 394 of file Registry.h.

395 {
396  auto params = T::validParams();
397  return params;
398 }
InputParameters validParams()

◆ buildShared()

template<typename T >
std::shared_ptr< MooseObject > RegistryEntry< T >::buildShared ( const InputParameters parameters)
overridevirtual

Implements RegistryEntryBase.

Definition at line 375 of file Registry.h.

376 {
377  if constexpr (std::is_base_of_v<MooseObject, T>)
378  return std::make_shared<T>(parameters);
379  mooseError(MooseUtils::prettyCppType<T>(), " to be built is not a MooseObject.");
380 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311

◆ name()

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

resolve the name from _classname, _alias, and _name

Definition at line 141 of file Registry.h.

142  {
143  std::string name = _name;
144  if (name.empty())
145  name = _alias;
146  if (name.empty())
147  name = _classname;
148  return name;
149  }
std::string _classname
name of the c++ class for the object.
Definition: Registry.h:115
std::string _name
name that the object will be registered to factories under. If unspecified, _alias is used...
Definition: Registry.h:120
std::string name() const
resolve the name from _classname, _alias, and _name
Definition: Registry.h:141
std::string _alias
an alternate name to register the object to factories under.
Definition: Registry.h:118

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 118 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 115 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 126 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 122 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 113 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 124 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 120 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 128 of file Registry.h.


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