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_name.hpp
0009  * \author Andrey Semashev
0010  * \date   29.07.2012
0011  *
0012  * The header contains implementation of a current process name attribute
0013  */
0014 
0015 #ifndef BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_NAME_HPP_INCLUDED_
0016 #define BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_NAME_HPP_INCLUDED_
0017 
0018 #include <string>
0019 #include <boost/log/detail/config.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 namespace aux {
0033 
0034 //! The function returns the current process name
0035 BOOST_LOG_API std::string get_process_name();
0036 
0037 } // namespace aux
0038 
0039 namespace attributes {
0040 
0041 /*!
0042  * \brief A class of an attribute that holds the current process name
0043  */
0044 class current_process_name :
0045     public constant< std::string >
0046 {
0047     typedef constant< std::string > base_type;
0048 
0049 public:
0050     /*!
0051      * Constructor. Initializes the attribute with the current process name.
0052      */
0053     current_process_name() : base_type(boost::log::aux::get_process_name()) {}
0054     /*!
0055      * Constructor for casting support
0056      */
0057     explicit current_process_name(cast_source const& source) :
0058         base_type(source)
0059     {
0060     }
0061 };
0062 
0063 } // namespace attributes
0064 
0065 BOOST_LOG_CLOSE_NAMESPACE // namespace log
0066 
0067 } // namespace boost
0068 
0069 #include <boost/log/detail/footer.hpp>
0070 
0071 #endif // BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_NAME_HPP_INCLUDED_