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