LCOV - code coverage report
Current view: top level - include/utils - StreamArguments.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 6 6 100.0 %
Date: 2025-07-17 01:28:37 Functions: 30 64 46.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             : #pragma once
      11             : 
      12             : #include <tuple>
      13             : 
      14             : /***
      15             :  * Streams all of the given arguments into the given stream
      16             :  */
      17             : template <class StreamType>
      18             : void
      19         423 : streamArguments(StreamType &)
      20             : {
      21         423 : }
      22             : 
      23             : // Recursive parameter pack expansion
      24             : template <class StreamType, typename T, typename... Args>
      25             : void
      26        1221 : streamArguments(StreamType & ss, T && val, Args &&... args)
      27             : {
      28        1221 :   ss << val;
      29        1221 :   streamArguments(ss, std::forward<Args>(args)...);
      30        1221 : }
      31             : 
      32             : // Base case for Tuple expansion recursive method
      33             : template <std::size_t I = 0, class StreamType, typename... Args>
      34             : inline typename std::enable_if<I == sizeof...(Args), void>::type
      35             : streamArguments(StreamType & /*ss*/, std::tuple<Args...> /*args*/)
      36             : {
      37             : }
      38             : 
      39             : // Recursive method for tuple expansion
      40             : // clang-format off
      41             : template <std::size_t I = 0, class StreamType, typename... Args>
      42             : inline typename std::enable_if<I < sizeof...(Args), void>::type
      43             : streamArguments(StreamType & ss, std::tuple<Args...> args)
      44             : {
      45             :   ss << std::get<I>(args);
      46             :   streamArguments<I + 1, StreamType, Args...>(ss, args);
      47             : }
      48             : // clang-format on

Generated by: LCOV version 1.14