/usr/include/ace/Intrusive_Auto_Ptr.inl is in libace-dev 6.0.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | // -*- C++ -*-
//
// $Id: Intrusive_Auto_Ptr.inl 81219 2008-04-02 20:23:32Z iliyan $
#include "ace/Guard_T.h"
#include "ace/Log_Msg.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
template <class X> ACE_INLINE
ACE_Intrusive_Auto_Ptr<X>::ACE_Intrusive_Auto_Ptr (X *p, bool addref)
: rep_ (p)
{
if (rep_ != 0 && addref)
X::intrusive_add_ref (rep_);
}
template <class X> ACE_INLINE
ACE_Intrusive_Auto_Ptr<X>::ACE_Intrusive_Auto_Ptr (const ACE_Intrusive_Auto_Ptr<X> &r)
: rep_ (r.rep_)
{
if (rep_ != 0)
X::intrusive_add_ref (rep_);
}
template <class X> ACE_INLINE X *
ACE_Intrusive_Auto_Ptr<X>::operator-> (void) const
{
return this->rep_;
}
template<class X> ACE_INLINE X &
ACE_Intrusive_Auto_Ptr<X>::operator *() const
{
return *this->rep_;
}
template <class X> ACE_INLINE X*
ACE_Intrusive_Auto_Ptr<X>::get (void) const
{
// We return the ACE_Future_rep.
return this->rep_;
}
template<class X> ACE_INLINE X *
ACE_Intrusive_Auto_Ptr<X>::release (void)
{
X *p = this->rep_;
if (this->rep_ != 0)
X::intrusive_remove_ref (this->rep_);
this->rep_ = 0;
return p;
}
template<class X> ACE_INLINE void
ACE_Intrusive_Auto_Ptr<X>::reset (X *p)
{
// Avoid deleting the underlying auto_ptr if assigning the same actual
// pointer value.
if (this->rep_ == p)
return;
X *old_rep = this->rep_;
this->rep_ = p;
if (this->rep_ != 0)
X::intrusive_add_ref (this->rep_);
if (old_rep != 0)
X::intrusive_remove_ref (old_rep);
return;
}
template <class X> ACE_INLINE void
ACE_Intrusive_Auto_Ptr<X>::operator = (const ACE_Intrusive_Auto_Ptr<X> &rhs)
{
// do nothing when aliasing
if (this->rep_ == rhs.rep_)
return;
// assign a zero
if (rhs.rep_ == 0)
{
X::intrusive_remove_ref (rhs.rep_);
this->rep_ = 0;
return;
}
// bind <this> to the same <ACE_Intrusive_Auto_Ptr_Rep> as <rhs>.
X *old_rep = this->rep_;
this->rep_ = rhs.rep_;
X::intrusive_add_ref (this->rep_);
X::intrusive_remove_ref (old_rep);
}
// Copy derived class constructor
template<class X> template <class U> ACE_INLINE
ACE_Intrusive_Auto_Ptr<X>::ACE_Intrusive_Auto_Ptr (const ACE_Intrusive_Auto_Ptr<U> & rhs)
{
// note implicit cast from U* to T* so illegal copy will generate a
// compiler warning here
this->rep_ = rhs.operator-> ();
X::intrusive_add_ref(this->rep_);
}
/// Equality operator that returns @c true if both
/// ACE_Intrusive_Auto_Ptr objects point to the same underlying
/// representation. It does not compare the actual pointers.
/**
* @note It also returns @c true if both objects have just been
* instantiated and not used yet.
*/
template<class T, class U> ACE_INLINE bool operator==(ACE_Intrusive_Auto_Ptr<T> const & a, ACE_Intrusive_Auto_Ptr<U> const & b)
{
return a.get() == b.get();
}
/// Inequality operator, which is the opposite of equality.
template<class T, class U> ACE_INLINE bool operator!=(ACE_Intrusive_Auto_Ptr<T> const & a, ACE_Intrusive_Auto_Ptr<U> const & b)
{
return a.get() != b.get();
}
template<class T, class U> ACE_INLINE bool operator==(ACE_Intrusive_Auto_Ptr<T> const & a, U * b)
{
return a.get() == b;
}
template<class T, class U> ACE_INLINE bool operator!=(ACE_Intrusive_Auto_Ptr<T> & a, U * b)
{
return a.get() != b;
}
template<class T, class U> ACE_INLINE bool operator==(T * a, ACE_Intrusive_Auto_Ptr<U> const & b)
{
return a == b.get();
}
template<class T, class U> ACE_INLINE bool operator!=(T * a, ACE_Intrusive_Auto_Ptr<U> const & b)
{
return a != b.get();
}
ACE_END_VERSIONED_NAMESPACE_DECL
|