https://mooseframework.inl.gov
ReporterMode.h
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 #pragma once
10 
11 #include "MooseEnum.h"
12 
34 class ReporterMode;
36 extern const ReporterMode REPORTER_MODE_ROOT;
39 
46 {
47 public:
48  ReporterMode(const std::string & key);
49 
50 private:
51  // Automatically incremented in construction
52  static int ID_COUNTER;
53 };
54 
63 {
64 public:
66 
68  void clear();
69 
72  template <typename... Args>
73  void insert(const ReporterMode & mode, Args... modes);
74  void insert(const ReporterMode & mode);
76 };
77 
78 inline bool
79 operator==(const ReporterProducerEnum & producer_mode, const ReporterMode & mode)
80 {
81  return static_cast<int>(producer_mode) == static_cast<int>(mode);
82 }
83 
84 inline bool
85 operator==(const ReporterMode & mode, const ReporterProducerEnum & producer_mode)
86 {
87  return producer_mode == mode;
88 }
89 
90 inline bool
91 operator!=(const ReporterProducerEnum & producer_mode, const ReporterMode & mode)
92 {
93  return !(producer_mode == mode);
94 }
95 
96 inline bool
97 operator!=(const ReporterMode & mode, const ReporterProducerEnum & producer_mode)
98 {
99  return !(mode == producer_mode);
100 }
101 
102 template <typename... Args>
103 void
104 ReporterProducerEnum::insert(const ReporterMode & mode, Args... modes)
105 {
106  insert(mode);
107  insert(modes...);
108 }
bool operator==(const ReporterProducerEnum &producer_mode, const ReporterMode &mode)
Definition: ReporterMode.h:79
static int ID_COUNTER
Definition: ReporterMode.h:52
const ReporterMode REPORTER_MODE_UNSET
const ReporterMode REPORTER_MODE_ROOT
ReporterMode(const std::string &key)
Definition: ReporterMode.C:16
MooseEnum designed for the ReporterContext objects to define how a ReporterValue can and is being pro...
Definition: ReporterMode.h:62
void clear()
Clear all available items (i.e., create an empty MooseEnum)
Definition: ReporterMode.C:29
bool operator!=(const ReporterProducerEnum &producer_mode, const ReporterMode &mode)
Definition: ReporterMode.h:91
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:54
const ReporterMode REPORTER_MODE_DISTRIBUTED
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18
void insert(const ReporterMode &mode, Args... modes)
Definition: ReporterMode.h:104
const ReporterMode REPORTER_MODE_REPLICATED
MooseEnumItem that automatically creates the ID and doesn&#39;t allow the ID to be assigned.
Definition: ReporterMode.h:45