]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/log/include/boost/log/attributes/current_process_name.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / log / include / boost / log / attributes / current_process_name.hpp
1 /*
2 * Copyright Andrey Semashev 2007 - 2015.
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
6 */
7 /*!
8 * \file current_process_name.hpp
9 * \author Andrey Semashev
10 * \date 29.07.2012
11 *
12 * The header contains implementation of a current process name attribute
13 */
14
15 #ifndef BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_NAME_HPP_INCLUDED_
16 #define BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_NAME_HPP_INCLUDED_
17
18 #include <string>
19 #include <boost/log/detail/config.hpp>
20 #include <boost/log/attributes/constant.hpp>
21 #include <boost/log/attributes/attribute_cast.hpp>
22 #include <boost/log/detail/header.hpp>
23
24 #ifdef BOOST_HAS_PRAGMA_ONCE
25 #pragma once
26 #endif
27
28 namespace boost {
29
30 BOOST_LOG_OPEN_NAMESPACE
31
32 namespace aux {
33
34 //! The function returns the current process name
35 BOOST_LOG_API std::string get_process_name();
36
37 } // namespace aux
38
39 namespace attributes {
40
41 /*!
42 * \brief A class of an attribute that holds the current process name
43 */
44 class current_process_name :
45 public constant< std::string >
46 {
47 typedef constant< std::string > base_type;
48
49 public:
50 /*!
51 * Constructor. Initializes the attribute with the current process name.
52 */
53 current_process_name() : base_type(boost::log::aux::get_process_name()) {}
54 /*!
55 * Constructor for casting support
56 */
57 explicit current_process_name(cast_source const& source) :
58 base_type(source)
59 {
60 }
61 };
62
63 } // namespace attributes
64
65 BOOST_LOG_CLOSE_NAMESPACE // namespace log
66
67 } // namespace boost
68
69 #include <boost/log/detail/footer.hpp>
70
71 #endif // BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_NAME_HPP_INCLUDED_