Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:52:31

0001 // Copyright Antony Polukhin, 2016-2023.
0002 //
0003 // Distributed under the Boost Software License, Version 1.0. (See
0004 // accompanying file LICENSE_1_0.txt or copy at
0005 // http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 #ifndef BOOST_STACKTRACE_FRAME_HPP
0008 #define BOOST_STACKTRACE_FRAME_HPP
0009 
0010 #include <boost/config.hpp>
0011 #ifdef BOOST_HAS_PRAGMA_ONCE
0012 #   pragma once
0013 #endif
0014 
0015 #include <iosfwd>
0016 #include <string>
0017 
0018 #include <boost/stacktrace/safe_dump_to.hpp> // boost::stacktrace::detail::native_frame_ptr_t
0019 
0020 #include <boost/stacktrace/detail/frame_decl.hpp>
0021 #include <boost/stacktrace/detail/push_options.h>
0022 
0023 namespace boost { namespace stacktrace {
0024 
0025 /// Comparison operators that provide platform dependant ordering and have O(1) complexity; are Async-Handler-Safe.
0026 constexpr inline bool operator< (const frame& lhs, const frame& rhs) noexcept { return lhs.address() < rhs.address(); }
0027 constexpr inline bool operator> (const frame& lhs, const frame& rhs) noexcept { return rhs < lhs; }
0028 constexpr inline bool operator<=(const frame& lhs, const frame& rhs) noexcept { return !(lhs > rhs); }
0029 constexpr inline bool operator>=(const frame& lhs, const frame& rhs) noexcept { return !(lhs < rhs); }
0030 constexpr inline bool operator==(const frame& lhs, const frame& rhs) noexcept { return lhs.address() == rhs.address(); }
0031 constexpr inline bool operator!=(const frame& lhs, const frame& rhs) noexcept { return !(lhs == rhs); }
0032 
0033 /// Fast hashing support, O(1) complexity; Async-Handler-Safe.
0034 inline std::size_t hash_value(const frame& f) noexcept {
0035     return reinterpret_cast<std::size_t>(f.address());
0036 }
0037 
0038 /// Outputs stacktrace::frame in a human readable format to string; unsafe to use in async handlers.
0039 BOOST_STACKTRACE_FUNCTION std::string to_string(const frame& f);
0040 
0041 /// Outputs stacktrace::frame in a human readable format to output stream; unsafe to use in async handlers.
0042 template <class CharT, class TraitsT>
0043 std::basic_ostream<CharT, TraitsT>& operator<<(std::basic_ostream<CharT, TraitsT>& os, const frame& f) {
0044     return os << boost::stacktrace::to_string(f);
0045 }
0046 
0047 }} // namespace boost::stacktrace
0048 
0049 /// @cond
0050 
0051 #include <boost/stacktrace/detail/pop_options.h>
0052 
0053 #ifndef BOOST_STACKTRACE_LINK
0054 #   if defined(BOOST_STACKTRACE_USE_NOOP)
0055 #       include <boost/stacktrace/detail/frame_noop.ipp>
0056 #   elif defined(BOOST_MSVC) || defined(BOOST_STACKTRACE_USE_WINDBG) || defined(BOOST_STACKTRACE_USE_WINDBG_CACHED)
0057 #       include <boost/stacktrace/detail/frame_msvc.ipp>
0058 #   else
0059 #       include <boost/stacktrace/detail/frame_unwind.ipp>
0060 #   endif
0061 #endif
0062 /// @endcond
0063 
0064 
0065 #endif // BOOST_STACKTRACE_FRAME_HPP