]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/thread/include/boost/thread/caller_context.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / thread / include / boost / thread / caller_context.hpp
1 // (C) Copyright 2013,2015 Vicente J. Botet Escriba
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5
6
7 #ifndef BOOST_THREAD_CALL_CONTEXT_HPP
8 #define BOOST_THREAD_CALL_CONTEXT_HPP
9
10 #include <boost/thread/detail/config.hpp>
11 #if defined BOOST_THREAD_USES_LOG_THREAD_ID
12 #include <boost/thread/thread.hpp>
13 #endif
14 #include <boost/current_function.hpp>
15 #include <boost/io/ios_state.hpp>
16 #include <iomanip>
17
18 #include <boost/config/abi_prefix.hpp>
19
20 namespace boost
21 {
22
23 struct caller_context_t
24 {
25 const char * filename;
26 unsigned lineno;
27 const char * func;
28 caller_context_t(const char * filename, unsigned lineno, const char * func) :
29 filename(filename), lineno(lineno), func(func)
30 {
31 }
32 };
33
34 #define BOOST_CONTEXTOF boost::caller_context_t(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION)
35
36 template <typename OStream>
37 OStream& operator<<(OStream& os, caller_context_t const& ctx)
38 {
39 #if defined BOOST_THREAD_USES_LOG_THREAD_ID
40 {
41 io::ios_flags_saver ifs( os );
42 os << std::left << std::setw(14) << boost::this_thread::get_id() << " ";
43 }
44 #endif
45 {
46 io::ios_flags_saver ifs(os);
47 os << std::setw(50) << ctx.filename << "["
48 << std::setw(4) << std::right << std::dec<< ctx.lineno << "] ";
49 #if defined BOOST_THREAD_USES_LOG_CURRENT_FUNCTION
50 os << ctx.func << " " ;
51 #endif
52 }
53 return os;
54 }
55 }
56
57 #include <boost/config/abi_suffix.hpp>
58
59 #endif // header