https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ExecFlagEnum.C
Go to the documentation of this file.
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
18
19const ExecFlagType &
24
25void
27{
28 if (find(flag) == _items.end())
29 mooseError("The supplied item '",
30 flag,
31 "' is not an available enum item for the "
32 "MultiMooseEnum object, thus it cannot be removed.");
33 else if (isValueSet(flag))
34 mooseError("The supplied item '", flag, "' is a selected item, thus it can not be removed.");
35
36 _items.erase(flag);
37}
38
39std::string
41{
42 std::string doc("The list of flag(s) indicating when this object should be executed. For a "
43 "description of each flag, see ");
44 doc += MooseUtils::mooseDocsURL("source/interfaces/SetupInterface.html");
45 doc += ".";
46 return doc;
47}
48
50ExecFlagEnum::operator=(const std::initializer_list<ExecFlagType> & flags)
51{
53 *this += flags;
54 return *this;
55}
56
59{
61 *this += flag;
62 return *this;
63}
64
66ExecFlagEnum::operator+=(const std::initializer_list<ExecFlagType> & flags)
67{
68 for (const ExecFlagType & flag : flags)
69 appendCurrent(flag);
71 return *this;
72}
73
76{
77 appendCurrent(flag);
79 return *this;
80}
81
82void
84{
85 if (find(item) == _items.end())
86 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 _current_values.push_back(item);
91}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
A MultiMooseEnum object to hold "execute_on" flags.
void appendCurrent(const ExecFlagType &item)
Append the list of current flags.
std::string getDocString() const
Generate a documentation string for the "execute_on" parameter.
ExecFlagEnum & operator=(const ExecFlagEnum &other)=default
ExecFlagEnum & operator+=(const std::initializer_list< ExecFlagType > &flags)
void addAvailableFlags(const ExecFlagType &flag, Args... flags)
Add additional execute_on flags to the list of possible flags.
void removeAvailableFlags(const ExecFlagType &flag, Args... flags)
Remove flags from being available.
std::set< MooseEnumItem > _items
Storage for the assigned items.
std::set< MooseEnumItem >::const_iterator find(const MooseEnumItem &other) const
Locate an item.
const MooseEnumItem & addEnumerationItem(const MooseEnumItem &item)
Class for containing MooseEnum item information.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
std::vector< MooseEnumItem > _current_values
The current value(s) of the MultiMooseEnum.
virtual void checkDeprecated() const override
Check whether any of the current values are deprecated when called.
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.
void clearSetValues()
Clear the MultiMooseEnum.
std::string mooseDocsURL(const std::string &path)
Definition MooseUtils.C:150