Loading include/utils/RefBase.h +48 −14 Original line number Diff line number Diff line Loading @@ -31,13 +31,10 @@ template<typename T> class wp; // --------------------------------------------------------------------------- #define COMPARE(_op_) \ #define COMPARE_WEAK(_op_) \ inline bool operator _op_ (const sp<T>& o) const { \ return m_ptr _op_ o.m_ptr; \ } \ inline bool operator _op_ (const wp<T>& o) const { \ return m_ptr _op_ o.m_ptr; \ } \ inline bool operator _op_ (const T* o) const { \ return m_ptr _op_ o; \ } \ Loading @@ -46,12 +43,18 @@ inline bool operator _op_ (const sp<U>& o) const { \ return m_ptr _op_ o.m_ptr; \ } \ template<typename U> \ inline bool operator _op_ (const wp<U>& o) const { \ inline bool operator _op_ (const U* o) const { \ return m_ptr _op_ o; \ } #define COMPARE(_op_) \ COMPARE_WEAK(_op_) \ inline bool operator _op_ (const wp<T>& o) const { \ return m_ptr _op_ o.m_ptr; \ } \ template<typename U> \ inline bool operator _op_ (const U* o) const { \ return m_ptr _op_ o; \ inline bool operator _op_ (const wp<U>& o) const { \ return m_ptr _op_ o.m_ptr; \ } // --------------------------------------------------------------------------- Loading Loading @@ -275,12 +278,42 @@ public: // Operators COMPARE(==) COMPARE(!=) COMPARE(>) COMPARE(<) COMPARE(<=) COMPARE(>=) COMPARE_WEAK(==) COMPARE_WEAK(!=) COMPARE_WEAK(>) COMPARE_WEAK(<) COMPARE_WEAK(<=) COMPARE_WEAK(>=) inline bool operator == (const wp<T>& o) const { return (m_ptr == o.m_ptr) && (m_refs == o.m_refs); } template<typename U> inline bool operator == (const wp<U>& o) const { return m_ptr == o.m_ptr; } inline bool operator > (const wp<T>& o) const { return (m_ptr == o.m_ptr) ? (m_refs > o.m_refs) : (m_ptr > o.m_ptr); } template<typename U> inline bool operator > (const wp<U>& o) const { return (m_ptr == o.m_ptr) ? (m_refs > o.m_refs) : (m_ptr > o.m_ptr); } inline bool operator < (const wp<T>& o) const { return (m_ptr == o.m_ptr) ? (m_refs < o.m_refs) : (m_ptr < o.m_ptr); } template<typename U> inline bool operator < (const wp<U>& o) const { return (m_ptr == o.m_ptr) ? (m_refs < o.m_refs) : (m_ptr < o.m_ptr); } inline bool operator != (const wp<T>& o) const { return m_refs != o.m_refs; } template<typename U> inline bool operator != (const wp<U>& o) const { return !operator == (o); } inline bool operator <= (const wp<T>& o) const { return !operator > (o); } template<typename U> inline bool operator <= (const wp<U>& o) const { return !operator > (o); } inline bool operator >= (const wp<T>& o) const { return !operator < (o); } template<typename U> inline bool operator >= (const wp<U>& o) const { return !operator < (o); } private: template<typename Y> friend class sp; Loading @@ -294,6 +327,7 @@ template <typename T> TextOutput& operator<<(TextOutput& to, const wp<T>& val); #undef COMPARE #undef COMPARE_WEAK // --------------------------------------------------------------------------- // No user serviceable parts below here. Loading Loading
include/utils/RefBase.h +48 −14 Original line number Diff line number Diff line Loading @@ -31,13 +31,10 @@ template<typename T> class wp; // --------------------------------------------------------------------------- #define COMPARE(_op_) \ #define COMPARE_WEAK(_op_) \ inline bool operator _op_ (const sp<T>& o) const { \ return m_ptr _op_ o.m_ptr; \ } \ inline bool operator _op_ (const wp<T>& o) const { \ return m_ptr _op_ o.m_ptr; \ } \ inline bool operator _op_ (const T* o) const { \ return m_ptr _op_ o; \ } \ Loading @@ -46,12 +43,18 @@ inline bool operator _op_ (const sp<U>& o) const { \ return m_ptr _op_ o.m_ptr; \ } \ template<typename U> \ inline bool operator _op_ (const wp<U>& o) const { \ inline bool operator _op_ (const U* o) const { \ return m_ptr _op_ o; \ } #define COMPARE(_op_) \ COMPARE_WEAK(_op_) \ inline bool operator _op_ (const wp<T>& o) const { \ return m_ptr _op_ o.m_ptr; \ } \ template<typename U> \ inline bool operator _op_ (const U* o) const { \ return m_ptr _op_ o; \ inline bool operator _op_ (const wp<U>& o) const { \ return m_ptr _op_ o.m_ptr; \ } // --------------------------------------------------------------------------- Loading Loading @@ -275,12 +278,42 @@ public: // Operators COMPARE(==) COMPARE(!=) COMPARE(>) COMPARE(<) COMPARE(<=) COMPARE(>=) COMPARE_WEAK(==) COMPARE_WEAK(!=) COMPARE_WEAK(>) COMPARE_WEAK(<) COMPARE_WEAK(<=) COMPARE_WEAK(>=) inline bool operator == (const wp<T>& o) const { return (m_ptr == o.m_ptr) && (m_refs == o.m_refs); } template<typename U> inline bool operator == (const wp<U>& o) const { return m_ptr == o.m_ptr; } inline bool operator > (const wp<T>& o) const { return (m_ptr == o.m_ptr) ? (m_refs > o.m_refs) : (m_ptr > o.m_ptr); } template<typename U> inline bool operator > (const wp<U>& o) const { return (m_ptr == o.m_ptr) ? (m_refs > o.m_refs) : (m_ptr > o.m_ptr); } inline bool operator < (const wp<T>& o) const { return (m_ptr == o.m_ptr) ? (m_refs < o.m_refs) : (m_ptr < o.m_ptr); } template<typename U> inline bool operator < (const wp<U>& o) const { return (m_ptr == o.m_ptr) ? (m_refs < o.m_refs) : (m_ptr < o.m_ptr); } inline bool operator != (const wp<T>& o) const { return m_refs != o.m_refs; } template<typename U> inline bool operator != (const wp<U>& o) const { return !operator == (o); } inline bool operator <= (const wp<T>& o) const { return !operator > (o); } template<typename U> inline bool operator <= (const wp<U>& o) const { return !operator > (o); } inline bool operator >= (const wp<T>& o) const { return !operator < (o); } template<typename U> inline bool operator >= (const wp<U>& o) const { return !operator < (o); } private: template<typename Y> friend class sp; Loading @@ -294,6 +327,7 @@ template <typename T> TextOutput& operator<<(TextOutput& to, const wp<T>& val); #undef COMPARE #undef COMPARE_WEAK // --------------------------------------------------------------------------- // No user serviceable parts below here. Loading