Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-07 09:42:30

0001 //  cv_status.hpp
0002 //
0003 // Copyright (C) 2011 Vicente J. Botet Escriba
0004 // Copyright (C) 2021 Ion Gaztanaga
0005 //
0006 //  Distributed under the Boost Software License, Version 1.0. (See
0007 //  accompanying file LICENSE_1_0.txt or copy at
0008 //  http://www.boost.org/LICENSE_1_0.txt)
0009 
0010 #ifndef BOOST_INTERPROCESS_CV_STATUS_HPP
0011 #define BOOST_INTERPROCESS_CV_STATUS_HPP
0012 
0013 #include <boost/config.hpp>
0014 
0015 namespace boost {
0016 namespace interprocess {
0017 
0018 #if !defined(BOOST_NO_CXX11_SCOPED_ENUMS)
0019 
0020 enum class cv_status
0021 {
0022    no_timeout,
0023    timeout
0024 };
0025 
0026 #else //BOOST_NO_CXX11_SCOPED_ENUMS
0027 
0028 // enum class cv_status emulation
0029 struct cv_status
0030 {
0031    typedef void is_boost_scoped_enum_tag;
0032    typedef int underlying_type;
0033 
0034    cv_status()  {}
0035 
0036    explicit  cv_status(underlying_type v)
0037       : v_(v)
0038    {}
0039 
0040    underlying_type get_underlying_value_() const  { return v_; }
0041 
0042    private:
0043    underlying_type v_;
0044    typedef cv_status self_type;
0045    public:
0046    enum enum_type
0047    {
0048       no_timeout,
0049       timeout
0050    };
0051 
0052    cv_status(enum_type v)
0053       : v_(v)
0054    {}
0055 
0056    enum_type get_native_value_() const
0057    { return enum_type(v_); }
0058 
0059    friend bool operator ==(self_type lhs, self_type rhs)
0060    { return enum_type(lhs.v_)==enum_type(rhs.v_); }
0061 
0062    friend bool operator ==(self_type lhs, enum_type rhs)
0063    { return enum_type(lhs.v_)==rhs; }
0064 
0065    friend bool operator ==(enum_type lhs, self_type rhs)
0066    { return lhs==enum_type(rhs.v_); }
0067 
0068    friend bool operator !=(self_type lhs, self_type rhs)
0069    { return enum_type(lhs.v_)!=enum_type(rhs.v_); }
0070 
0071    friend  bool operator !=(self_type lhs, enum_type rhs)
0072    { return enum_type(lhs.v_)!=rhs; }
0073 
0074    friend bool operator !=(enum_type lhs, self_type rhs)
0075    { return lhs!=enum_type(rhs.v_); }
0076 
0077    friend bool operator <(self_type lhs, self_type rhs)
0078    { return enum_type(lhs.v_)<enum_type(rhs.v_); }
0079 
0080    friend bool operator <(self_type lhs, enum_type rhs)
0081    { return enum_type(lhs.v_)<rhs; }
0082 
0083    friend bool operator <(enum_type lhs, self_type rhs)
0084    { return lhs<enum_type(rhs.v_); }
0085 
0086    friend bool operator <=(self_type lhs, self_type rhs)
0087    { return enum_type(lhs.v_)<=enum_type(rhs.v_); }
0088 
0089    friend bool operator <=(self_type lhs, enum_type rhs)
0090    { return enum_type(lhs.v_)<=rhs; }
0091 
0092    friend bool operator <=(enum_type lhs, self_type rhs)
0093    { return lhs<=enum_type(rhs.v_); }
0094 
0095    friend bool operator >(self_type lhs, self_type rhs)
0096    { return enum_type(lhs.v_)>enum_type(rhs.v_); }
0097 
0098    friend bool operator >(self_type lhs, enum_type rhs)
0099    { return enum_type(lhs.v_)>rhs; }
0100 
0101    friend bool operator >(enum_type lhs, self_type rhs)
0102    { return lhs>enum_type(rhs.v_); }
0103 
0104    friend bool operator >=(self_type lhs, self_type rhs)
0105    { return enum_type(lhs.v_)>=enum_type(rhs.v_); }
0106 
0107    friend bool operator >=(self_type lhs, enum_type rhs)
0108    { return enum_type(lhs.v_)>=rhs; }
0109 
0110    friend bool operator >=(enum_type lhs, self_type rhs)
0111    { return lhs>=enum_type(rhs.v_); }
0112 };
0113 
0114 #endif
0115 
0116 } //namespace interprocess
0117 } //namespace boost
0118 
0119 #endif // header