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 46778941 : ExecFlagEnum::ExecFlagEnum() : MultiMooseEnum() {} 16 0 : ExecFlagEnum::ExecFlagEnum(const MultiMooseEnum & other) : MultiMooseEnum(other) {} 17 21431364 : ExecFlagEnum::ExecFlagEnum(const ExecFlagEnum & other) : MultiMooseEnum(other) {} 18 : 19 : const ExecFlagType & 20 19342221 : ExecFlagEnum::addAvailableFlags(const ExecFlagType & flag) 21 : { 22 19342221 : return addEnumerationItem(flag); 23 : } 24 : 25 : void 26 121996 : ExecFlagEnum::removeAvailableFlags(const ExecFlagType & flag) 27 : { 28 121996 : 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 121994 : else if (isValueSet(flag)) 34 2 : mooseError("The supplied item '", flag, "' is a selected item, thus it can not be removed."); 35 : 36 121992 : _items.erase(flag); 37 121992 : } 38 : 39 : std::string 40 21694047 : ExecFlagEnum::getDocString() const 41 : { 42 : std::string doc("The list of flag(s) indicating when this object should be executed. For a " 43 43388094 : "description of each flag, see "); 44 21694047 : doc += MooseUtils::mooseDocsURL("source/interfaces/SetupInterface.html"); 45 21694047 : doc += "."; 46 21694047 : return doc; 47 0 : } 48 : 49 : ExecFlagEnum & 50 6435827 : ExecFlagEnum::operator=(const std::initializer_list<ExecFlagType> & flags) 51 : { 52 6435827 : clearSetValues(); 53 6435827 : *this += flags; 54 6435827 : return *this; 55 : } 56 : 57 : ExecFlagEnum & 58 28045566 : ExecFlagEnum::operator=(const ExecFlagType & flag) 59 : { 60 28045566 : clearSetValues(); 61 28045566 : *this += flag; 62 28045566 : return *this; 63 : } 64 : 65 : ExecFlagEnum & 66 6435829 : ExecFlagEnum::operator+=(const std::initializer_list<ExecFlagType> & flags) 67 : { 68 18816338 : for (const ExecFlagType & flag : flags) 69 12380509 : appendCurrent(flag); 70 6435829 : checkDeprecated(); 71 6435829 : return *this; 72 : } 73 : 74 : ExecFlagEnum & 75 28045568 : ExecFlagEnum::operator+=(const ExecFlagType & flag) 76 : { 77 28045568 : appendCurrent(flag); 78 28045568 : checkDeprecated(); 79 28045568 : return *this; 80 : } 81 : 82 : void 83 40426077 : ExecFlagEnum::appendCurrent(const ExecFlagType & item) 84 : { 85 40426077 : 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 40426077 : _current_values.push_back(item); 91 40426077 : }