id.hpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. #ifndef BOOST_LOG_DETAIL_ID_HPP_INCLUDED_
  16. #define BOOST_LOG_DETAIL_ID_HPP_INCLUDED_
  17. #include <boost/log/detail/config.hpp>
  18. #include <boost/log/detail/header.hpp>
  19. #ifdef BOOST_HAS_PRAGMA_ONCE
  20. #pragma once
  21. #endif
  22. namespace boost {
  23. BOOST_LOG_OPEN_NAMESPACE
  24. namespace aux {
  25. //! Generic identifier class
  26. template< typename DescriptorT >
  27. class id
  28. {
  29. public:
  30. //! Native type of the process id
  31. typedef typename DescriptorT::native_type native_type;
  32. private:
  33. native_type m_NativeID;
  34. public:
  35. BOOST_CONSTEXPR id() BOOST_NOEXCEPT : m_NativeID(0) {}
  36. explicit id(native_type native) BOOST_NOEXCEPT : m_NativeID(native) {}
  37. native_type native_id() const BOOST_NOEXCEPT { return m_NativeID; }
  38. bool operator== (id const& that) const BOOST_NOEXCEPT
  39. {
  40. return (m_NativeID == that.m_NativeID);
  41. }
  42. bool operator!= (id const& that) const BOOST_NOEXCEPT
  43. {
  44. return (m_NativeID != that.m_NativeID);
  45. }
  46. bool operator< (id const& that) const BOOST_NOEXCEPT
  47. {
  48. return (m_NativeID < that.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. };
  63. } // namespace aux
  64. BOOST_LOG_CLOSE_NAMESPACE // namespace log
  65. } // namespace boost
  66. #include <boost/log/detail/footer.hpp>
  67. #endif // BOOST_LOG_DETAIL_ID_HPP_INCLUDED_