Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/thread/caller_context.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // (C) Copyright 2013,2015 Vicente J. Botet Escriba
0002 // Distributed under the Boost Software License, Version 1.0. (See
0003 // accompanying file LICENSE_1_0.txt or copy at
0004 // http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 
0007 #ifndef BOOST_THREAD_CALL_CONTEXT_HPP
0008 #define BOOST_THREAD_CALL_CONTEXT_HPP
0009 
0010 #include <boost/thread/detail/config.hpp>
0011 #if defined BOOST_THREAD_USES_LOG_THREAD_ID
0012 #include <boost/thread/thread.hpp>
0013 #endif
0014 #include <boost/current_function.hpp>
0015 #include <boost/io/ios_state.hpp>
0016 #include <iomanip>
0017 
0018 #include <boost/config/abi_prefix.hpp>
0019 
0020 namespace boost
0021 {
0022 
0023   struct caller_context_t
0024   {
0025     const char * filename;
0026     unsigned lineno;
0027     const char * func;
0028     caller_context_t(const char * filename, unsigned lineno, const char * func) :
0029       filename(filename), lineno(lineno), func(func)
0030     {
0031     }
0032   };
0033 
0034 #define BOOST_CONTEXTOF boost::caller_context_t(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION)
0035 
0036   template <typename OStream>
0037   OStream& operator<<(OStream& os, caller_context_t const& ctx)
0038   {
0039 #if defined BOOST_THREAD_USES_LOG_THREAD_ID
0040     {
0041       io::ios_flags_saver ifs( os );
0042       os << std::left << std::setw(14) << boost::this_thread::get_id() << " ";
0043     }
0044 #endif
0045     {
0046       io::ios_flags_saver ifs(os);
0047       os << std::setw(50) << ctx.filename << "["
0048          << std::setw(4) << std::right << std::dec<< ctx.lineno << "] ";
0049 #if defined BOOST_THREAD_USES_LOG_CURRENT_FUNCTION
0050       os << ctx.func << " " ;
0051 #endif
0052     }
0053     return os;
0054   }
0055 }
0056 
0057 #include <boost/config/abi_suffix.hpp>
0058 
0059 #endif // header