LCOV - code coverage report
Current view: top level - src/utils - ExecFlagEnum.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 37 40 92.5 %
Date: 2025-08-08 20:01:16 Functions: 10 11 90.9 %
Legend: Lines: hit not hit

          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    44188798 : ExecFlagEnum::ExecFlagEnum() : MultiMooseEnum() {}
      16           0 : ExecFlagEnum::ExecFlagEnum(const MultiMooseEnum & other) : MultiMooseEnum(other) {}
      17    20380709 : ExecFlagEnum::ExecFlagEnum(const ExecFlagEnum & other) : MultiMooseEnum(other) {}
      18             : 
      19             : const ExecFlagType &
      20    11293626 : ExecFlagEnum::addAvailableFlags(const ExecFlagType & flag)
      21             : {
      22    11293626 :   return addEnumerationItem(flag);
      23             : }
      24             : 
      25             : void
      26      117178 : ExecFlagEnum::removeAvailableFlags(const ExecFlagType & flag)
      27             : {
      28      117178 :   if (find(flag) == _items.end())
      29           1 :     mooseError("The supplied item '",
      30             :                flag,
      31             :                "' is not an available enum item for the "
      32             :                "MultiMooseEnum object, thus it cannot be removed.");
      33      117177 :   else if (isValueSet(flag))
      34           1 :     mooseError("The supplied item '", flag, "' is a selected item, thus it can not be removed.");
      35             : 
      36      117176 :   _items.erase(flag);
      37      117176 : }
      38             : 
      39             : std::string
      40    20487587 : ExecFlagEnum::getDocString() const
      41             : {
      42             :   std::string doc("The list of flag(s) indicating when this object should be executed. For a "
      43    20487587 :                   "description of each flag, see ");
      44    20487587 :   doc += MooseUtils::mooseDocsURL("source/interfaces/SetupInterface.html");
      45    20487587 :   doc += ".";
      46    20487587 :   return doc;
      47           0 : }
      48             : 
      49             : ExecFlagEnum &
      50     6051897 : ExecFlagEnum::operator=(const std::initializer_list<ExecFlagType> & flags)
      51             : {
      52     6051897 :   clearSetValues();
      53     6051897 :   *this += flags;
      54     6051897 :   return *this;
      55             : }
      56             : 
      57             : ExecFlagEnum &
      58    26436965 : ExecFlagEnum::operator=(const ExecFlagType & flag)
      59             : {
      60    26436965 :   clearSetValues();
      61    26436965 :   *this += flag;
      62    26436965 :   return *this;
      63             : }
      64             : 
      65             : ExecFlagEnum &
      66     6051898 : ExecFlagEnum::operator+=(const std::initializer_list<ExecFlagType> & flags)
      67             : {
      68    17761676 :   for (const ExecFlagType & flag : flags)
      69    11709778 :     appendCurrent(flag);
      70     6051898 :   checkDeprecated();
      71     6051898 :   return *this;
      72             : }
      73             : 
      74             : ExecFlagEnum &
      75    26436966 : ExecFlagEnum::operator+=(const ExecFlagType & flag)
      76             : {
      77    26436966 :   appendCurrent(flag);
      78    26436966 :   checkDeprecated();
      79    26436966 :   return *this;
      80             : }
      81             : 
      82             : void
      83    38146744 : ExecFlagEnum::appendCurrent(const ExecFlagType & item)
      84             : {
      85    38146744 :   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    38146744 :   _current_values.push_back(item);
      91    38146744 : }

Generated by: LCOV version 1.14