LCOV - code coverage report
Current view: top level - opt/homebrew/include/boost/test/utils - rtti.hpp (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 4 4 100.0 %
Date: 2026-06-25 07:23:43 Functions: 24 24 100.0 %

          Line data    Source code
       1             : //  (C) Copyright Gennadiy Rozental 2001.
       2             : //  Distributed under the Boost Software License, Version 1.0.
       3             : //  (See accompanying file LICENSE_1_0.txt or copy at
       4             : //  http://www.boost.org/LICENSE_1_0.txt)
       5             : 
       6             : //  See http://www.boost.org/libs/test for the library home page.
       7             : //
       8             : //  File        : $RCSfile$
       9             : //
      10             : //  Version     : $Revision$
      11             : //
      12             : //  Description : simple facilities for accessing type information at runtime
      13             : // ***************************************************************************
      14             : 
      15             : #ifndef BOOST_TEST_UTILS_RTTI_HPP
      16             : #define BOOST_TEST_UTILS_RTTI_HPP
      17             : 
      18             : // C Runtime
      19             : #include <cstddef>
      20             : #include <boost/test/detail/config.hpp>
      21             : 
      22             : namespace boost {
      23             : namespace rtti {
      24             : 
      25             : // ************************************************************************** //
      26             : // **************                   rtti::type_id              ************** //
      27             : // ************************************************************************** //
      28             : 
      29             : typedef std::ptrdiff_t id_t;
      30             : 
      31             : namespace rtti_detail {
      32             : 
      33             : template<typename T>
      34             : struct BOOST_TEST_DECL rttid_holder {
      35       11390 :     static id_t id() { return reinterpret_cast<id_t>( &inst() ); }
      36             : 
      37             : private:
      38             :     struct rttid {};
      39             : 
      40       11390 :     static rttid const& inst() { static rttid s_inst; return s_inst; }
      41             : };
      42             : 
      43             : } // namespace rtti_detail
      44             : 
      45             : //____________________________________________________________________________//
      46             : 
      47             : template<typename T>
      48             : BOOST_TEST_DECL inline id_t
      49       11390 : type_id()
      50             : {
      51       11390 :     return rtti_detail::rttid_holder<T>::id();
      52             : }
      53             : 
      54             : //____________________________________________________________________________//
      55             : 
      56             : #define BOOST_RTTI_SWITCH( type_id_ ) if( ::boost::rtti::id_t switch_by_id = type_id_ )
      57             : #define BOOST_RTTI_CASE( type )       if( switch_by_id == ::boost::rtti::type_id<type>() )
      58             : 
      59             : //____________________________________________________________________________//
      60             : 
      61             : } // namespace rtti
      62             : } // namespace boost
      63             : 
      64             : #endif // BOOST_TEST_UTILS_RTTI_HPP

Generated by: LCOV version 1.16