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: id()44 BOOST_CONSTEXPR id() BOOST_NOEXCEPT : m_NativeID(0) {} 45 id(native_type native)46 explicit id(native_type native) BOOST_NOEXCEPT : m_NativeID(native) {} 47 native_id() const48 native_type native_id() const BOOST_NOEXCEPT { return m_NativeID; } 49 operator ==(id const & that) const50 bool operator== (id const& that) const BOOST_NOEXCEPT 51 { 52 return (m_NativeID == that.m_NativeID); 53 } operator !=(id const & that) const54 bool operator!= (id const& that) const BOOST_NOEXCEPT 55 { 56 return (m_NativeID != that.m_NativeID); 57 } operator <(id const & that) const58 bool operator< (id const& that) const BOOST_NOEXCEPT 59 { 60 return (m_NativeID < that.m_NativeID); 61 } operator >(id const & that) const62 bool operator> (id const& that) const BOOST_NOEXCEPT 63 { 64 return (m_NativeID > that.m_NativeID); 65 } operator <=(id const & that) const66 bool operator<= (id const& that) const BOOST_NOEXCEPT 67 { 68 return (m_NativeID <= that.m_NativeID); 69 } operator >=(id const & that) const70 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