Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
MooseBase.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include <string>
13 
14 class InputParameters;
15 class MooseApp;
16 
17 #define usingMooseBaseMembers \
18  using MooseBase::getMooseApp; \
19  using MooseBase::type; \
20  using MooseBase::name; \
21  using MooseBase::typeAndName; \
22  using MooseBase::_type; \
23  using MooseBase::_app; \
24  using MooseBase::_name
25 
32 class MooseBase
33 {
34 public:
35  MooseBase(const std::string & type,
36  const std::string & name,
37  MooseApp & app,
38  const InputParameters & params);
39 
40  virtual ~MooseBase() = default;
41 
45  MooseApp & getMooseApp() const { return _app; }
46 
51  const std::string & type() const { return _type; }
52 
57  virtual const std::string & name() const { return _name; }
58 
63  std::string typeAndName() const;
64 
70  std::string errorPrefix(const std::string & error_type) const;
71 
80  [[noreturn]] void callMooseError(std::string msg, const bool with_prefix) const;
81 
82 protected:
85 
87  const std::string _type;
88 
90  const std::string _name;
91 
92 private:
95 };
Base class for everything in MOOSE with a name and a type.
Definition: MooseBase.h:32
Base class for MOOSE-based applications.
Definition: MooseApp.h:85
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
Definition: MooseBase.h:45
std::string errorPrefix(const std::string &error_type) const
Definition: MooseBase.C:43
const std::string _type
The type of this class.
Definition: MooseBase.h:87
const InputParameters & _params
The object&#39;s parameteres.
Definition: MooseBase.h:94
const std::string & type() const
Get the type of this class.
Definition: MooseBase.h:51
std::string typeAndName() const
Get the class&#39;s combined type and name; useful in error handling.
Definition: MooseBase.C:27
MooseApp & _app
The MOOSE application this is associated with.
Definition: MooseBase.h:84
const std::string _name
The name of this class.
Definition: MooseBase.h:90
MooseBase(const std::string &type, const std::string &name, MooseApp &app, const InputParameters &params)
Definition: MooseBase.C:18
void callMooseError(std::string msg, const bool with_prefix) const
Calls moose error with the message msg.
Definition: MooseBase.C:33
virtual ~MooseBase()=default