LCOV - code coverage report
Current view: top level - src/utils - ExecFlagEnum.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 37 40 92.5 %
Date: 2025-07-17 01:28:37 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    42988360 : ExecFlagEnum::ExecFlagEnum() : MultiMooseEnum() {}
      16           0 : ExecFlagEnum::ExecFlagEnum(const MultiMooseEnum & other) : MultiMooseEnum(other) {}
      17    19819041 : ExecFlagEnum::ExecFlagEnum(const ExecFlagEnum & other) : MultiMooseEnum(other) {}
      18             : 
      19             : const ExecFlagType &
      20    10362460 : ExecFlagEnum::addAvailableFlags(const ExecFlagType & flag)
      21             : {
      22    10362460 :   return addEnumerationItem(flag);
      23             : }
      24             : 
      25             : void
      26      116970 : ExecFlagEnum::removeAvailableFlags(const ExecFlagType & flag)
      27             : {
      28      116970 :   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      116969 :   else if (isValueSet(flag))
      34           1 :     mooseError("The supplied item '", flag, "' is a selected item, thus it can not be removed.");
      35             : 
      36      116968 :   _items.erase(flag);
      37      116968 : }
      38             : 
      39             : std::string
      40    19544988 : ExecFlagEnum::getDocString() const
      41             : {
      42             :   std::string doc("The list of flag(s) indicating when this object should be executed. For a "
      43    19544988 :                   "description of each flag, see ");
      44    19544988 :   doc += MooseUtils::mooseDocsURL("source/interfaces/SetupInterface.html");
      45    19544988 :   doc += ".";
      46    19544988 :   return doc;
      47           0 : }
      48             : 
      49             : ExecFlagEnum &
      50     5915669 : ExecFlagEnum::operator=(const std::initializer_list<ExecFlagType> & flags)
      51             : {
      52     5915669 :   clearSetValues();
      53     5915669 :   *this += flags;
      54     5915669 :   return *this;
      55             : }
      56             : 
      57             : ExecFlagEnum &
      58    26106612 : ExecFlagEnum::operator=(const ExecFlagType & flag)
      59             : {
      60    26106612 :   clearSetValues();
      61    26106612 :   *this += flag;
      62    26106612 :   return *this;
      63             : }
      64             : 
      65             : ExecFlagEnum &
      66     5915670 : ExecFlagEnum::operator+=(const std::initializer_list<ExecFlagType> & flags)
      67             : {
      68    17343142 :   for (const ExecFlagType & flag : flags)
      69    11427472 :     appendCurrent(flag);
      70     5915670 :   checkDeprecated();
      71     5915670 :   return *this;
      72             : }
      73             : 
      74             : ExecFlagEnum &
      75    26106613 : ExecFlagEnum::operator+=(const ExecFlagType & flag)
      76             : {
      77    26106613 :   appendCurrent(flag);
      78    26106613 :   checkDeprecated();
      79    26106613 :   return *this;
      80             : }
      81             : 
      82             : void
      83    37534085 : ExecFlagEnum::appendCurrent(const ExecFlagType & item)
      84             : {
      85    37534085 :   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    37534085 :   _current_values.push_back(item);
      91    37534085 : }

Generated by: LCOV version 1.14