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)
8 * \file current_process_id.hpp
9 * \author Andrey Semashev
12 * The header contains implementation of a current process id attribute
15 #ifndef BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_ID_HPP_INCLUDED_
16 #define BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_ID_HPP_INCLUDED_
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>
24 #ifdef BOOST_HAS_PRAGMA_ONCE
30 BOOST_LOG_OPEN_NAMESPACE
32 //! Process identifier type used by the library
33 typedef boost::log::aux::process::id process_id;
35 namespace attributes {
38 * \brief A class of an attribute that holds the current process identifier
40 class current_process_id :
41 public constant< process_id >
43 typedef constant< process_id > base_type;
47 * Constructor. Initializes the attribute with the current process identifier.
49 current_process_id() : base_type(boost::log::aux::this_process::get_id()) {}
51 * Constructor for casting support
53 explicit current_process_id(cast_source const& source) :
59 } // namespace attributes
61 BOOST_LOG_CLOSE_NAMESPACE // namespace log
65 #include <boost/log/detail/footer.hpp>
67 #endif // BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_ID_HPP_INCLUDED_