LCOV - code coverage report
Current view: top level - src/controls - WebServerControlTypeRegistry.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: d8769b Lines: 19 20 95.0 %
Date: 2025-11-07 20:01:30 Functions: 5 5 100.0 %
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 "WebServerControlTypeRegistry.h"
      11             : 
      12             : namespace Moose
      13             : {
      14             : WebServerControlTypeRegistry &
      15      917754 : WebServerControlTypeRegistry::getRegistry()
      16             : {
      17             :   static WebServerControlTypeRegistry * registry_singleton = nullptr;
      18      917754 :   if (!registry_singleton)
      19       57346 :     registry_singleton = new WebServerControlTypeRegistry;
      20      917754 :   return *registry_singleton;
      21             : }
      22             : 
      23             : const WebServerControlTypeRegistry::RegisteredTypeBase *
      24         218 : WebServerControlTypeRegistry::query(const std::string & type)
      25             : {
      26         218 :   const auto & name_map = getRegistry()._name_map;
      27         218 :   if (const auto it = name_map.find(type); it != name_map.end())
      28             :   {
      29             :     mooseAssert(it->second, "Item is nullptr");
      30         214 :     return it->second.get();
      31             :   }
      32           4 :   return nullptr;
      33             : }
      34             : 
      35             : const WebServerControlTypeRegistry::RegisteredTypeBase &
      36          62 : WebServerControlTypeRegistry::get(const std::string & type)
      37             : {
      38          62 :   if (const auto obj = query(type))
      39          62 :     return *obj;
      40           0 :   mooseError("WebServerControlTypeRegistry: The type '", type, "' is not registered");
      41             : }
      42             : 
      43      458768 : WebServerControlTypeRegistry::RegisteredTypeBase::RegisteredTypeBase(const std::string & type)
      44      458768 :   : _type(type)
      45             : {
      46      458768 : }
      47             : 
      48         190 : WebServerControlTypeRegistry::ControlledValueBase::ControlledValueBase(const std::string & name,
      49         190 :                                                                        const std::string & type)
      50         190 :   : _name(name), _type(type)
      51             : {
      52         190 : }
      53             : }

Generated by: LCOV version 1.14