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 "ExecFlagEnum.h" 11 : #include "MooseError.h" 12 : #include "Conversion.h" 13 : #include "MooseUtils.h" 14 : 15 46343021 : ExecFlagEnum::ExecFlagEnum() : MultiMooseEnum() {} 16 0 : ExecFlagEnum::ExecFlagEnum(const MultiMooseEnum & other) : MultiMooseEnum(other) {} 17 21240594 : ExecFlagEnum::ExecFlagEnum(const ExecFlagEnum & other) : MultiMooseEnum(other) {} 18 : 19 : const ExecFlagType & 20 19154751 : ExecFlagEnum::addAvailableFlags(const ExecFlagType & flag) 21 : { 22 19154751 : return addEnumerationItem(flag); 23 : } 24 : 25 : void 26 121036 : ExecFlagEnum::removeAvailableFlags(const ExecFlagType & flag) 27 : { 28 121036 : if (find(flag) == _items.end()) 29 2 : mooseError("The supplied item '", 30 : flag, 31 : "' is not an available enum item for the " 32 : "MultiMooseEnum object, thus it cannot be removed."); 33 121034 : else if (isValueSet(flag)) 34 2 : mooseError("The supplied item '", flag, "' is a selected item, thus it can not be removed."); 35 : 36 121032 : _items.erase(flag); 37 121032 : } 38 : 39 : std::string 40 21428323 : ExecFlagEnum::getDocString() const 41 : { 42 : std::string doc("The list of flag(s) indicating when this object should be executed. For a " 43 42856646 : "description of each flag, see "); 44 21428323 : doc += MooseUtils::mooseDocsURL("source/interfaces/SetupInterface.html"); 45 21428323 : doc += "."; 46 21428323 : return doc; 47 0 : } 48 : 49 : ExecFlagEnum & 50 6331740 : ExecFlagEnum::operator=(const std::initializer_list<ExecFlagType> & flags) 51 : { 52 6331740 : clearSetValues(); 53 6331740 : *this += flags; 54 6331740 : return *this; 55 : } 56 : 57 : ExecFlagEnum & 58 27773027 : ExecFlagEnum::operator=(const ExecFlagType & flag) 59 : { 60 27773027 : clearSetValues(); 61 27773027 : *this += flag; 62 27773027 : return *this; 63 : } 64 : 65 : ExecFlagEnum & 66 6331742 : ExecFlagEnum::operator+=(const std::initializer_list<ExecFlagType> & flags) 67 : { 68 18518229 : for (const ExecFlagType & flag : flags) 69 12186487 : appendCurrent(flag); 70 6331742 : checkDeprecated(); 71 6331742 : return *this; 72 : } 73 : 74 : ExecFlagEnum & 75 27773029 : ExecFlagEnum::operator+=(const ExecFlagType & flag) 76 : { 77 27773029 : appendCurrent(flag); 78 27773029 : checkDeprecated(); 79 27773029 : return *this; 80 : } 81 : 82 : void 83 39959516 : ExecFlagEnum::appendCurrent(const ExecFlagType & item) 84 : { 85 39959516 : if (find(item) == _items.end()) 86 0 : mooseError("The supplied item '", 87 : item, 88 : "' is not an available item for the " 89 : "ExecFlagEnum object, thus it cannot be set as current."); 90 39959516 : _current_values.push_back(item); 91 39959516 : }