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 
15 // Forward declarations
16 class ExecFlagEnum;
17 
25 {
26 public:
27  ExecFlagEnum();
28  ExecFlagEnum(const ExecFlagEnum & other);
29  ExecFlagEnum(const MultiMooseEnum & other);
30 
32 
40  template <typename... Args>
41  void addAvailableFlags(const ExecFlagType & flag, Args... flags);
42  void addAvailableFlags(const ExecFlagType & flag);
44 
46 
49  using MultiMooseEnum::operator=; // use parent methods
50  ExecFlagEnum & operator=(const std::initializer_list<ExecFlagType> & flags);
51  ExecFlagEnum & operator=(const ExecFlagType & flags);
52  ExecFlagEnum & operator+=(const std::initializer_list<ExecFlagType> & flags);
53  ExecFlagEnum & operator+=(const ExecFlagType & flags);
55 
57 
60  template <typename... Args>
61  void removeAvailableFlags(const ExecFlagType & flag, Args... flags);
62  void removeAvailableFlags(const ExecFlagType & flag);
64 
68  std::string getDocString() const;
69 
73  const std::set<ExecFlagType> & items() const { return _items; }
74 
75 protected:
79  void appendCurrent(const ExecFlagType & item);
80 };
81 
82 template <typename... Args>
83 void
84 ExecFlagEnum::addAvailableFlags(const ExecFlagType & flag, Args... flags)
85 {
86  addAvailableFlags(flag);
87  addAvailableFlags(flags...);
88 }
89 
90 template <typename... Args>
91 void
93 {
95  removeAvailableFlags(flags...);
96 }
97 
ExecFlagEnum & operator+=(const std::initializer_list< ExecFlagType > &flags)
Definition: ExecFlagEnum.C:65
A MultiMooseEnum object to hold "execute_on" flags.
Definition: ExecFlagEnum.h:24
void addAvailableFlags(const ExecFlagType &flag, Args... flags)
Add additional execute_on flags to the list of possible flags.
Definition: ExecFlagEnum.h:84
const std::set< ExecFlagType > & items() const
Reference the all the available items.
Definition: ExecFlagEnum.h:73
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:21
ExecFlagEnum & operator=(const std::initializer_list< ExecFlagType > &flags)
Definition: ExecFlagEnum.C:49
void removeAvailableFlags(const ExecFlagType &flag, Args... flags)
Remove flags from being available.
Definition: ExecFlagEnum.h:92
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...