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 : using MooseObject::enabled 23 : 24 : /** 25 : * Every object that can be built by the factory should be derived from this class. 26 : */ 27 : class MooseObject : public ParallelParamObject, public std::enable_shared_from_this<MooseObject> 28 : { 29 : public: 30 : static InputParameters validParams(); 31 : 32 : MooseObject(const InputParameters & parameters); 33 : 34 2328187 : virtual ~MooseObject() = default; 35 : 36 : /** 37 : * Return the enabled status of the object. 38 : */ 39 163204356 : virtual bool enabled() const { return _enabled; } 40 : 41 : /** 42 : * Get another shared pointer to this object that has the same ownership group. Wrapper around 43 : * shared_from_this(). 44 : */ 45 : std::shared_ptr<MooseObject> getSharedPtr(); 46 : std::shared_ptr<const MooseObject> getSharedPtr() const; 47 : 48 : protected: 49 : /// Reference to the "enable" InputParameters, used by Controls for toggling on/off MooseObjects 50 : const bool & _enabled; 51 : 52 : // Base classes have the same name for that attribute, pick one 53 : using MooseBase::_app; 54 : };