| 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 id.hpp |
| 9 | * \author Andrey Semashev |
| 10 | * \date 08.01.2012 |
| 11 | * |
| 12 | * \brief This header is the Boost.Log library implementation, see the library documentation |
| 13 | * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html. |
| 14 | */ |
| 15 | |
| 16 | #ifndef BOOST_LOG_DETAIL_ID_HPP_INCLUDED_ |
| 17 | #define BOOST_LOG_DETAIL_ID_HPP_INCLUDED_ |
| 18 | |
| 19 | #include <boost/log/detail/config.hpp> |
| 20 | #include <boost/log/detail/header.hpp> |
| 21 | |
| 22 | #ifdef BOOST_HAS_PRAGMA_ONCE |
| 23 | #pragma once |
| 24 | #endif |
| 25 | |
| 26 | namespace boost { |
| 27 | |
| 28 | BOOST_LOG_OPEN_NAMESPACE |
| 29 | |
| 30 | namespace aux { |
| 31 | |
| 32 | //! Generic identifier class |
| 33 | template< typename DescriptorT > |
| 34 | class id |
| 35 | { |
| 36 | public: |
| 37 | //! Native type of the process id |
| 38 | typedef typename DescriptorT::native_type native_type; |
| 39 | |
| 40 | private: |
| 41 | native_type m_NativeID; |
| 42 | |
| 43 | public: |
| 44 | BOOST_CONSTEXPR id() BOOST_NOEXCEPT : m_NativeID(0) {} |
| 45 | |
| 46 | explicit id(native_type native) BOOST_NOEXCEPT : m_NativeID(native) {} |
| 47 | |
| 48 | native_type native_id() const BOOST_NOEXCEPT { return m_NativeID; } |
| 49 | |
| 50 | bool operator== (id const& that) const BOOST_NOEXCEPT |
| 51 | { |
| 52 | return (m_NativeID == that.m_NativeID); |
| 53 | } |
| 54 | bool operator!= (id const& that) const BOOST_NOEXCEPT |
| 55 | { |
| 56 | return (m_NativeID != that.m_NativeID); |
| 57 | } |
| 58 | bool operator< (id const& that) const BOOST_NOEXCEPT |
| 59 | { |
| 60 | return (m_NativeID < that.m_NativeID); |
| 61 | } |
| 62 | bool operator> (id const& that) const BOOST_NOEXCEPT |
| 63 | { |
| 64 | return (m_NativeID > that.m_NativeID); |
| 65 | } |
| 66 | bool operator<= (id const& that) const BOOST_NOEXCEPT |
| 67 | { |
| 68 | return (m_NativeID <= that.m_NativeID); |
| 69 | } |
| 70 | bool operator>= (id const& that) const BOOST_NOEXCEPT |
| 71 | { |
| 72 | return (m_NativeID >= that.m_NativeID); |
| 73 | } |
| 74 | }; |
| 75 | |
| 76 | } // namespace aux |
| 77 | |
| 78 | BOOST_LOG_CLOSE_NAMESPACE // namespace log |
| 79 | |
| 80 | } // namespace boost |
| 81 | |
| 82 | #include <boost/log/detail/footer.hpp> |
| 83 | |
| 84 | #endif // BOOST_LOG_DETAIL_ID_HPP_INCLUDED_ |
| 85 |
