LCOV - code coverage report
Current view: top level - src/restart - InputStream.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 16 17 94.1 %
Date: 2025-07-17 01:28:37 Functions: 4 5 80.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 "InputStream.h"
      11             : 
      12             : #include "MooseError.h"
      13             : 
      14       32812 : InputStream::~InputStream()
      15             : {
      16       32812 :   if (inUse())
      17           0 :     mooseError("Stream still in use");
      18       32812 : }
      19             : 
      20             : void
      21      543092 : InputStream::addSharedStream(std::weak_ptr<std::istream> stream) const
      22             : {
      23             :   mooseAssert(!stream.expired(), "Stream is expired");
      24             : 
      25      543092 :   for (auto & entry : _shared_streams)
      26      512685 :     if (entry.expired())
      27             :     {
      28      512685 :       entry = stream;
      29      512685 :       return;
      30             :     }
      31       30407 :   _shared_streams.push_back(stream);
      32             : }
      33             : 
      34             : bool
      35       52626 : InputStream::inUse() const
      36             : {
      37      102776 :   for (auto & stream : _shared_streams)
      38       50152 :     if (!stream.expired())
      39           2 :       return true;
      40       52624 :   return false;
      41             : }
      42             : 
      43             : std::optional<std::filesystem::path>
      44           1 : InputStream::getFilename() const
      45             : {
      46           1 :   return {};
      47             : }

Generated by: LCOV version 1.14