]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/log/include/boost/log/attributes/current_process_id.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / log / include / boost / log / attributes / current_process_id.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_id.hpp
9 * \author Andrey Semashev
10 * \date 12.09.2009
11 *
12 * The header contains implementation of a current process id attribute
13 */
14
15 #ifndef BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_ID_HPP_INCLUDED_
16 #define BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_ID_HPP_INCLUDED_
17
18 #include <boost/log/detail/config.hpp>
19 #include <boost/log/detail/process_id.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 //! Process identifier type used by the library
33 typedef boost::log::aux::process::id process_id;
34
35 namespace attributes {
36
37 /*!
38 * \brief A class of an attribute that holds the current process identifier
39 */
40 class current_process_id :
41 public constant< process_id >
42 {
43 typedef constant< process_id > base_type;
44
45 public:
46 /*!
47 * Constructor. Initializes the attribute with the current process identifier.
48 */
49 current_process_id() : base_type(boost::log::aux::this_process::get_id()) {}
50 /*!
51 * Constructor for casting support
52 */
53 explicit current_process_id(cast_source const& source) :
54 base_type(source)
55 {
56 }
57 };
58
59 } // namespace attributes
60
61 BOOST_LOG_CLOSE_NAMESPACE // namespace log
62
63 } // namespace boost
64
65 #include <boost/log/detail/footer.hpp>
66
67 #endif // BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_ID_HPP_INCLUDED_