SpECTRE Documentation Coverage Report
Current view: top level - DataStructures/DataBox - TagName.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 50.0 % 2 1
Test Date: 2026-10-22 17:29:42
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 <string>
       7              : #include <type_traits>
       8              : 
       9              : #include "DataStructures/DataBox/TagTraits.hpp"
      10              : #include "Utilities/PrettyType.hpp"
      11              : #include "Utilities/TypeTraits/CreateHasTypeAlias.hpp"
      12              : #include "Utilities/TypeTraits/CreateIsCallable.hpp"
      13              : 
      14              : /// \cond
      15              : namespace db {
      16              : struct PrefixTag;
      17              : }  // namespace db
      18              : /// \endcond
      19              : 
      20              : namespace db {
      21              : 
      22              : namespace detail {
      23              : CREATE_HAS_TYPE_ALIAS(base)
      24              : CREATE_HAS_TYPE_ALIAS_V(base)
      25              : CREATE_IS_CALLABLE(name)
      26              : CREATE_IS_CALLABLE_V(name)
      27              : }  // namespace detail
      28              : 
      29              : /*!
      30              :  * \ingroup DataBoxGroup
      31              :  * \brief Get the name of a DataBox tag, including prefixes
      32              :  *
      33              :  * \details
      34              :  * Given a DataBox tag returns the name of the DataBox tag as a std::string. If
      35              :  * the DataBox tag is also a PrefixTag then the prefix is added.
      36              :  *
      37              :  * \tparam Tag the DataBox tag whose name to get
      38              :  * \return string holding the DataBox tag's name
      39              :  */
      40              : template <typename Tag>
      41            1 : std::string tag_name() {
      42              :   if constexpr (detail::is_name_callable_v<Tag>) {
      43              :     return Tag::name();
      44              :   } else if constexpr (detail::has_base_v<Tag>) {
      45              :     return tag_name<typename Tag::base>();
      46              :   } else if constexpr (std::is_base_of_v<db::PrefixTag, Tag>) {
      47              :     return pretty_type::short_name<Tag>() + "(" +
      48              :            tag_name<typename Tag::tag>() + ")";
      49              :   } else {
      50              :     return pretty_type::short_name<Tag>();
      51              :   }
      52              : }
      53              : }  // namespace db
        

Generated by: LCOV version 2.0-1