26#include "neml2/base/OptionSet.h"
30#include "neml2/base/Registry.h"
74 const std::string &
name()
const {
return _input_options.name(); }
76 const std::string &
type()
const {
return _input_options.type(); }
78 const std::string &
path()
const {
return _input_options.path(); }
80 const std::string &
doc()
const {
return _input_options.doc(); }
83 template <
typename T = NEML2Object>
84 const T *
host()
const;
87 template <
typename T = NEML2Object>
101 auto host_ptr =
dynamic_cast<const T *
>(_host ? _host :
this);
102 neml_assert(host_ptr,
"Internal error: Failed to retrieve host of object ",
name());
110 auto host_ptr =
dynamic_cast<T *
>(_host ? _host :
this);
112 throw NEMLException(
"Internal error: Failed to retrieve host of object " +
name());
The base class of all "manufacturable" objects in the NEML2 library.
Definition NEML2Object.h:42
NEML2Object(const NEML2Object &)=delete
const std::string & name() const
A readonly reference to the object's name.
Definition NEML2Object.h:74
const T * host() const
Get a readonly pointer to the host.
Definition NEML2Object.h:99
virtual void setup()
Setup this object.
Definition NEML2Object.h:71
const OptionSet & input_options() const
Definition NEML2Object.h:60
const std::string & type() const
A readonly reference to the object's type.
Definition NEML2Object.h:76
NEML2Object(NEML2Object &&)=delete
NEML2Object & operator=(const NEML2Object &)=delete
const std::string & doc() const
A readonly reference to the object's docstring.
Definition NEML2Object.h:80
NEML2Object & operator=(NEML2Object &&)=delete
const std::string & path() const
A readonly reference to the object's path.
Definition NEML2Object.h:78
static OptionSet expected_options()
Definition NEML2Object.cxx:30
virtual ~NEML2Object()=default
A custom map-like data structure. The keys are strings, and the values can be nonhomogeneously typed.
Definition OptionSet.h:52
Definition DiagnosticsInterface.cxx:30
void neml_assert(bool assertion, Args &&... args)
Definition assertions.h:47