https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
 
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
 

Public Attributes

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

Detailed Description

template<typename T>
struct RegistryEntry< T >

Definition at line 160 of file Registry.h.

Constructor & Destructor Documentation

◆ RegistryEntry()

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

Definition at line 386 of file Registry.h.

386 : RegistryEntryBase(data)
387{
388 static_assert(std::is_base_of_v<MooseObject, T> || std::is_base_of_v<Action, T>,
389 "Not derived from MooseObject or Action");
390}

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

395{
396 if constexpr (std::is_base_of_v<MooseObject, T>)
397 return std::make_unique<T>(parameters);
398 mooseError(MooseUtils::prettyCppType<T>(), " to be built is not a MooseObject.");
399}
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 411 of file Registry.h.

412{
413 if constexpr (!std::is_base_of_v<Action, T>)
414 mooseError("The action to be built is not derived from Action.");
415 else
416 return std::make_shared<T>(parameters);
417}

◆ buildParameters()

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

Implements RegistryEntryBase.

Definition at line 421 of file Registry.h.

422{
423 auto params = T::validParams();
424 return params;
425}

◆ buildShared()

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

Implements RegistryEntryBase.

Definition at line 402 of file Registry.h.

403{
404 if constexpr (std::is_base_of_v<MooseObject, T>)
405 return std::make_shared<T>(parameters);
406 mooseError(MooseUtils::prettyCppType<T>(), " to be built is not a MooseObject.");
407}

◆ name()

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

resolve the name from _classname, _alias, and _name

Definition at line 148 of file Registry.h.

149 {
150 std::string name = _name;
151 if (name.empty())
152 name = _alias;
153 if (name.empty())
155 return name;
156 }
std::string name() const
resolve the name from _classname, _alias, and _name
Definition Registry.h:148
std::string _classname
name of the c++ class for the object.
Definition Registry.h:122
std::string _alias
an alternate name to register the object to factories under.
Definition Registry.h:125
std::string _name
name that the object will be registered to factories under. If unspecified, _alias is used.
Definition Registry.h:127

Referenced by RegistryEntryBase::name().

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 125 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 122 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 133 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 129 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 120 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 131 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 127 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 135 of file Registry.h.


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