www.mooseframework.org
ExecFlagEnum.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 #pragma once
11 
12 // MOOSE includes
13 #include "MultiMooseEnum.h"
14 
22 {
23 public:
24  ExecFlagEnum();
25  ExecFlagEnum(const ExecFlagEnum & other);
26  ExecFlagEnum(const MultiMooseEnum & other);
27  ExecFlagEnum & operator=(const ExecFlagEnum & other) = default;
28 
30 
38  template <typename... Args>
39  void addAvailableFlags(const ExecFlagType & flag, Args... flags);
40  const ExecFlagType & addAvailableFlags(const ExecFlagType & flag);
42 
44 
47  using MultiMooseEnum::operator=; // use parent methods
48  ExecFlagEnum & operator=(const std::initializer_list<ExecFlagType> & flags);
49  ExecFlagEnum & operator=(const ExecFlagType & flags);
50  ExecFlagEnum & operator+=(const std::initializer_list<ExecFlagType> & flags);
51  ExecFlagEnum & operator+=(const ExecFlagType & flags);
53 
55 
58  template <typename... Args>
59  void removeAvailableFlags(const ExecFlagType & flag, Args... flags);
60  void removeAvailableFlags(const ExecFlagType & flag);
62 
66  std::string getDocString() const;
67 
71  const std::set<ExecFlagType> & items() const { return _items; }
72 
73 protected:
77  void appendCurrent(const ExecFlagType & item);
78 };
79 
80 template <typename... Args>
81 void
82 ExecFlagEnum::addAvailableFlags(const ExecFlagType & flag, Args... flags)
83 {
84  addAvailableFlags(flag);
85  addAvailableFlags(flags...);
86 }
87 
88 template <typename... Args>
89 void
91 {
93  removeAvailableFlags(flags...);
94 }
ExecFlagEnum & operator+=(const std::initializer_list< ExecFlagType > &flags)
Definition: ExecFlagEnum.C:65
A MultiMooseEnum object to hold "execute_on" flags.
Definition: ExecFlagEnum.h:21
void addAvailableFlags(const ExecFlagType &flag, Args... flags)
Add additional execute_on flags to the list of possible flags.
Definition: ExecFlagEnum.h:82
const std::set< ExecFlagType > & items() const
Reference the all the available items.
Definition: ExecFlagEnum.h:71
ExecFlagEnum & operator=(const ExecFlagEnum &other)=default
std::string getDocString() const
Generate a documentation string for the "execute_on" parameter.
Definition: ExecFlagEnum.C:39
std::set< MooseEnumItem > _items
Storage for the assigned items.
void appendCurrent(const ExecFlagType &item)
Append the list of current flags.
Definition: ExecFlagEnum.C:82
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18
void removeAvailableFlags(const ExecFlagType &flag, Args... flags)
Remove flags from being available.
Definition: ExecFlagEnum.h:90
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...