Blame view

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