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 : #include "ExecFlagRegistry.h" 11 : #include "MooseUtils.h" 12 : 13 : namespace moose 14 : { 15 : namespace internal 16 : { 17 : 18 : ExecFlagRegistry & 19 18350191 : ExecFlagRegistry::getExecFlagRegistry() 20 : { 21 18350191 : static ExecFlagRegistry exec_flag_registry; 22 18350191 : return exec_flag_registry; 23 : } 24 : 25 : const ExecFlagType & 26 1331560 : ExecFlagRegistry::registerFlag(const std::string & name, const bool is_default) 27 : { 28 1331560 : const auto name_upper = MooseUtils::toUpper(name); 29 1331560 : const auto flag_iter = _flags.find(name_upper); 30 1331560 : if (flag_iter != _flags.items().end()) 31 : { 32 : // Assume that this is not a duplicate name, but a "double registration" due 33 : // to the dynamic load functionality. 34 0 : return *flag_iter; 35 : } 36 : 37 1331560 : const auto & flag = _flags.addAvailableFlags(ExecFlagType(name_upper, _flags.getNextValidID())); 38 : 39 1331560 : if (is_default) 40 716912 : _default_flags.addAvailableFlags(flag); 41 : 42 1331560 : return flag; 43 1331560 : } 44 : 45 : } // internal 46 : } // moose