SpECTRE Documentation Coverage Report
Current view: top level - Parallel - OutputInbox.hpp Hit Total Coverage
Commit: 2c4f624839e832d3d5b2abc37601f7e1f9a600c9 Lines: 1 2 50.0 %
Date: 2024-05-04 01:01:37
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #pragma once
       5             : 
       6             : #include <cstddef>
       7             : 
       8             : #include "Utilities/TMPL.hpp"
       9             : #include "Utilities/TaggedTuple.hpp"
      10             : #include "Utilities/TypeTraits/CreateIsCallable.hpp"
      11             : 
      12             : namespace Parallel {
      13             : namespace detail {
      14             : CREATE_IS_CALLABLE(output_inbox)
      15             : CREATE_IS_CALLABLE_V(output_inbox)
      16             : }  // namespace detail
      17             : 
      18             : /*!
      19             :  * \brief Returns a string of the contents of the inbox.
      20             :  *
      21             :  * Calls a static `output_inbox` member function of the `InboxTag`. If the inbox
      22             :  * tag doesn't have the `output_inbox` function, then this function can't be
      23             :  * called with that inbox (a `static_assert` will fail).
      24             :  *
      25             :  * \note It's up to the individual inbox what to include in the string. Data may
      26             :  * or may not be included
      27             :  *
      28             :  * \tparam InboxTag Inbox tag with an `output_inbox` member function
      29             :  * \tparam InboxTypes Types of all inboxes (deduced)
      30             :  * \param inboxes All inboxes
      31             :  * \param indent_pad Number of empty spaces to pad the message with incase
      32             :  * indenting is needed.
      33             :  * \return std::string The contents of the inbox
      34             :  */
      35             : template <typename InboxTag, typename... InboxTypes>
      36           1 : std::string output_inbox(const tuples::TaggedTuple<InboxTypes...>& inboxes,
      37             :                          const size_t indent_pad) {
      38             :   static_assert(tmpl::list_contains_v<tmpl::list<InboxTypes...>, InboxTag>);
      39             : 
      40             :   return InboxTag::output_inbox(tuples::get<InboxTag>(inboxes), indent_pad);
      41             : }
      42             : }  // namespace Parallel

Generated by: LCOV version 1.14