73 friend class Ptr<const T>;
140 template <
typename U>
218 explicit operator bool()
const;
237template <
typename T,
typename... Ts>
274template <
typename T1,
typename T2>
277template <
typename T1,
typename T2>
280template <
typename T1,
typename T2>
289template <
typename T1,
typename T2>
290std::enable_if_t<std::is_same_v<T2, std::nullptr_t>,
bool>
operator==(
const Ptr<T1>& lhs, T2 rhs);
313template <
typename T1,
typename T2>
316template <
typename T1,
typename T2>
319template <
typename T1,
typename T2>
328template <
typename T1,
typename T2>
329std::enable_if_t<std::is_same_v<T2, std::nullptr_t>,
bool>
operator!=(
const Ptr<T1>& lhs, T2 rhs);
364template <
typename T1,
typename T2>
437template <
typename T,
typename... Ts>
441 static_assert(!std::is_base_of_v<Object, T>,
442 "Use CreateObject() instead of Create() for Object subclasses");
443 return Ptr<T>(
new T(std::forward<Ts>(args)...),
false);
469template <
typename T1,
typename T2>
476template <
typename T1,
typename T2>
483template <
typename T1,
typename T2>
490template <
typename T1,
typename T2>
497template <
typename T1,
typename T2>
504template <
typename T1,
typename T2>
511template <
typename T1,
typename T2>
512std::enable_if_t<std::is_same_v<T2, std::nullptr_t>,
bool>
518template <
typename T1,
typename T2>
519std::enable_if_t<std::is_same_v<T2, std::nullptr_t>,
bool>
576template <
typename T1,
typename T2>
583template <
typename T1,
typename T2>
590template <
typename T1,
typename T2>
617Copy(Ptr<const T>
object)
619 Ptr<T> p = Ptr<T>(
new T(*
PeekPointer(
object)),
false);
633 if (m_ptr !=
nullptr)
685 if (m_ptr !=
nullptr)
699 if (m_ptr !=
nullptr)
712 NS_ASSERT_MSG(m_ptr,
"Attempted to dereference zero pointer");
720 NS_ASSERT_MSG(m_ptr,
"Attempted to dereference zero pointer");
728 NS_ASSERT_MSG(m_ptr,
"Attempted to dereference zero pointer");
736 NS_ASSERT_MSG(m_ptr,
"Attempted to dereference zero pointer");
743 return m_ptr !=
nullptr;
766struct std::hash<
ns3::Ptr<T>>
NS_ASSERT() and NS_ASSERT_MSG() macro definitions.
Smart pointer class similar to boost::intrusive_ptr.
Ptr(T *ptr)
Create a smart pointer which points to the object pointed to by the input raw pointer ptr.
Ptr(const Ptr &o)
Copy by referencing the same underlying object.
T & operator*()
A dereference.
Ptr()
Create an empty smart pointer.
void Acquire() const
Mark this as a a reference by incrementing the reference count.
friend U * PeekPointer(const Ptr< U > &p)
Get a temporary pointer to the underlying object.
Ptr(const Ptr< U > &o)
Copy, removing const qualifier.
T * operator->()
An lvalue member access.
T & operator*() const
A const dereference.
friend U * GetPointer(const Ptr< U > &p)
Get a permanent pointer to the underlying object.
Ptr< T > & operator=(const Ptr &o)
Assignment operator by referencing the same underlying object.
Ptr(T *ptr, bool ref)
Create a smart pointer which points to the object pointed to by the input raw pointer ptr.
T * operator->() const
An rvalue member access.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
bool operator>=(const int64x64_t &lhs, const int64x64_t &rhs)
Greater or equal operator.
bool operator<=(const int64x64_t &lhs, const int64x64_t &rhs)
Less or equal operator.
bool operator>(const Length &left, const Length &right)
Check if left has a value greater than right.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
U * PeekPointer(const Ptr< U > &p)
bool operator!=(Callback< R, Args... > a, Callback< R, Args... > b)
Inequality test.
bool operator==(const EventId &a, const EventId &b)
std::ostream & operator<<(std::ostream &os, const Angles &a)
Ptr< T1 > const_pointer_cast(const Ptr< T2 > &p)
Return a copy of p with its stored pointer const casted from T2 to T1.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
bool operator<(const EventId &a, const EventId &b)
Ptr< T > Copy(Ptr< T > object)
Return a deep copy of a Ptr.
Ptr< T1 > StaticCast(const Ptr< T2 > &p)
Cast a Ptr.
U * GetPointer(const Ptr< U > &p)
Ptr< T1 > ConstCast(const Ptr< T2 > &p)
Cast a Ptr.
static T & GetReference(const Ptr< T > p)
static T & GetReference(Ptr< T > p)
Helper for the MakeEvent functions which take a class method.
std::size_t operator()(ns3::Ptr< T > p) const
The functor.