LCOV - code coverage report
Current view: top level - src/utils - ExecFlagEnum.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 37 40 92.5 %
Date: 2026-05-29 20:35:17 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    16906172 : ExecFlagEnum::ExecFlagEnum() : MultiMooseEnum() {}
      16           0 : ExecFlagEnum::ExecFlagEnum(const MultiMooseEnum & other) : MultiMooseEnum(other) {}
      17     8206585 : ExecFlagEnum::ExecFlagEnum(const ExecFlagEnum & other) : MultiMooseEnum(other) {}
      18             : 
      19             : const ExecFlagType &
      20     6467322 : ExecFlagEnum::addAvailableFlags(const ExecFlagType & flag)
      21             : {
      22     6467322 :   return addEnumerationItem(flag);
      23             : }
      24             : 
      25             : void
      26       27156 : ExecFlagEnum::removeAvailableFlags(const ExecFlagType & flag)
      27             : {
      28       27156 :   if (find(flag) == _items.end())
      29           2 :     mooseError("The supplied item '",
      30             :                flag,
      31             :                "' is not an available enum item for the "
      32             :                "MultiMooseEnum object, thus it cannot be removed.");
      33       27154 :   else if (isValueSet(flag))
      34           2 :     mooseError("The supplied item '", flag, "' is a selected item, thus it can not be removed.");
      35             : 
      36       27152 :   _items.erase(flag);
      37       27152 : }
      38             : 
      39             : std::string
      40     6374311 : ExecFlagEnum::getDocString() const
      41             : {
      42             :   std::string doc("The list of flag(s) indicating when this object should be executed. For a "
      43    12748622 :                   "description of each flag, see ");
      44     6374311 :   doc += MooseUtils::mooseDocsURL("source/interfaces/SetupInterface.html");
      45     6374311 :   doc += ".";
      46     6374311 :   return doc;
      47           0 : }
      48             : 
      49             : ExecFlagEnum &
      50     2770459 : ExecFlagEnum::operator=(const std::initializer_list<ExecFlagType> & flags)
      51             : {
      52     2770459 :   clearSetValues();
      53     2770459 :   *this += flags;
      54     2770459 :   return *this;
      55             : }
      56             : 
      57             : ExecFlagEnum &
      58     5934641 : ExecFlagEnum::operator=(const ExecFlagType & flag)
      59             : {
      60     5934641 :   clearSetValues();
      61     5934641 :   *this += flag;
      62     5934641 :   return *this;
      63             : }
      64             : 
      65             : ExecFlagEnum &
      66     2770461 : ExecFlagEnum::operator+=(const std::initializer_list<ExecFlagType> & flags)
      67             : {
      68     8327682 :   for (const ExecFlagType & flag : flags)
      69     5557221 :     appendCurrent(flag);
      70     2770461 :   checkDeprecated();
      71     2770461 :   return *this;
      72             : }
      73             : 
      74             : ExecFlagEnum &
      75     5934643 : ExecFlagEnum::operator+=(const ExecFlagType & flag)
      76             : {
      77     5934643 :   appendCurrent(flag);
      78     5934643 :   checkDeprecated();
      79     5934643 :   return *this;
      80             : }
      81             : 
      82             : void
      83    11491864 : ExecFlagEnum::appendCurrent(const ExecFlagType & item)
      84             : {
      85    11491864 :   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    11491864 :   _current_values.push_back(item);
      91    11491864 : }

Generated by: LCOV version 1.14