Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:39:18

0001 /*
0002  *          Copyright Andrey Semashev 2007 - 2015.
0003  * Distributed under the Boost Software License, Version 1.0.
0004  *    (See accompanying file LICENSE_1_0.txt or copy at
0005  *          http://www.boost.org/LICENSE_1_0.txt)
0006  */
0007 /*!
0008  * \file   current_process_id.hpp
0009  * \author Andrey Semashev
0010  * \date   12.09.2009
0011  *
0012  * The header contains implementation of a current process id attribute
0013  */
0014 
0015 #ifndef BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_ID_HPP_INCLUDED_
0016 #define BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_ID_HPP_INCLUDED_
0017 
0018 #include <boost/log/detail/config.hpp>
0019 #include <boost/log/detail/process_id.hpp>
0020 #include <boost/log/attributes/constant.hpp>
0021 #include <boost/log/attributes/attribute_cast.hpp>
0022 #include <boost/log/detail/header.hpp>
0023 
0024 #ifdef BOOST_HAS_PRAGMA_ONCE
0025 #pragma once
0026 #endif
0027 
0028 namespace boost {
0029 
0030 BOOST_LOG_OPEN_NAMESPACE
0031 
0032 //! Process identifier type used by the library
0033 typedef boost::log::aux::process::id process_id;
0034 
0035 namespace attributes {
0036 
0037 /*!
0038  * \brief A class of an attribute that holds the current process identifier
0039  */
0040 class current_process_id :
0041     public constant< process_id >
0042 {
0043     typedef constant< process_id > base_type;
0044 
0045 public:
0046     /*!
0047      * Constructor. Initializes the attribute with the current process identifier.
0048      */
0049     current_process_id() : base_type(boost::log::aux::this_process::get_id()) {}
0050     /*!
0051      * Constructor for casting support
0052      */
0053     explicit current_process_id(cast_source const& source) :
0054         base_type(source)
0055     {
0056     }
0057 };
0058 
0059 } // namespace attributes
0060 
0061 BOOST_LOG_CLOSE_NAMESPACE // namespace log
0062 
0063 } // namespace boost
0064 
0065 #include <boost/log/detail/footer.hpp>
0066 
0067 #endif // BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_ID_HPP_INCLUDED_