File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -157,8 +157,8 @@ class MooseBase : public ConsoleStreamInterface
157157 /* *
158158 * Query a parameter for the object
159159 *
160- * If the parameter is not valid, nullptr will be returned
161- *
160+ * If a parameter of the given name and type does not exist or if the
161+ * parameter is not valid, nullptr will be returned
162162 * @param name The name of the parameter
163163 * @return A pointer to the parameter value, if it exists
164164 */
@@ -192,6 +192,16 @@ class MooseBase : public ConsoleStreamInterface
192192 template <typename T>
193193 T getCheckedPointerParam (const std::string & name, const std::string & error_string = " " ) const ;
194194
195+ /* *
196+ * Test if a parameter of the given name and type exists
197+ * @param name The name of the parameter to test
198+ */
199+ template <typename T>
200+ inline bool haveParameter (const std::string & name) const
201+ {
202+ return _pars.have_parameter <T>(name);
203+ }
204+
195205 /* *
196206 * Test if the supplied parameter is valid
197207 * @param name The name of the parameter to test
@@ -412,7 +422,7 @@ template <typename T>
412422const T *
413423MooseBase::queryParam (const std::string & name) const
414424{
415- return isParamValid (name) ? &getParam<T>(name) : nullptr ;
425+ return haveParameter<T>(name) && isParamValid (name) ? &getParam<T>(name) : nullptr ;
416426}
417427
418428template <typename T>
You can’t perform that action at this time.
0 commit comments