Line data Source code
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 : // MOOSE includes 13 : #include "MooseUtils.h" 14 : #include "ParallelParamObject.h" 15 : #include "InputParameters.h" 16 : #include "ConsoleStreamInterface.h" 17 : #include "Registry.h" 18 : #include "MooseObjectParameterName.h" 19 : 20 : #define usingMooseObjectMembers \ 21 : usingMooseBaseMembers; \ 22 : usingMooseBaseParameterInterfaceMembers; \ 23 : using MooseObject::enabled 24 : 25 : /** 26 : * Every object that can be built by the factory should be derived from this class. 27 : */ 28 : class MooseObject : public ParallelParamObject, public std::enable_shared_from_this<MooseObject> 29 : { 30 : public: 31 : static InputParameters validParams(); 32 : 33 : MooseObject(const InputParameters & parameters); 34 : 35 2099854 : virtual ~MooseObject() = default; 36 : 37 : /** 38 : * Return the enabled status of the object. 39 : */ 40 153717301 : virtual bool enabled() const { return _enabled; } 41 : 42 : /** 43 : * Get another shared pointer to this object that has the same ownership group. Wrapper around 44 : * shared_from_this(). 45 : */ 46 : std::shared_ptr<MooseObject> getSharedPtr(); 47 : std::shared_ptr<const MooseObject> getSharedPtr() const; 48 : 49 : protected: 50 : /// Reference to the "enable" InputParameters, used by Controls for toggling on/off MooseObjects 51 : const bool & _enabled; 52 : 53 : // Base classes have the same name for that attribute, pick one 54 : using MooseBase::_app; 55 : };