17#ifndef AGX_OBSERVER_PTR
18#define AGX_OBSERVER_PTR
32 virtual ~Observer() {}
33 virtual void objectDeleted(
void*) {}
102 template <
typename U>
106 template <
typename U>
110 template <
typename U>
144 if (m_ptr) m_ptr->addObserver(
this);
150 if (m_ptr) m_ptr->addObserver(
this);
156 if (m_ptr) m_ptr->removeObserver(
this);
164 if (m_ptr == rp.m_ptr)
return *
this;
165 if (m_ptr) m_ptr->removeObserver(
this);
168 if (m_ptr) m_ptr->addObserver(
this);
175 if (m_ptr == ptr)
return *
this;
176 if (m_ptr) m_ptr->removeObserver(
this);
179 if (m_ptr) m_ptr->addObserver(
this);
200 typedef const T *PtrT;
216 template <
typename U>
219 return m_ptr == rp.m_ptr;
223 template <
typename U>
226 return m_ptr != rp.m_ptr;
230 template <
typename U>
237 template <
typename U>
244 template <
typename U>
251 template <
typename U>
260 return (m_ptr < rp.m_ptr);
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
observer_ptr & operator=(const observer_ptr &rp)
Assignment operator.
T * operator->() const
automatic cast to native pointer and use the dereferencing operator
bool operator==(observer_ptr< U > const &rp) const
bool operator<(const observer_ptr &rp) const
virtual void objectDeleted(void *)
virtual ~observer_ptr()
Destructor.
observer_ptr()
Constructor.
observer_ptr(const observer_ptr &rp)
Copy constructor.
observer_ptr(T *t)
Constructor, create an observer_ptr and listen to the object t for when it is deleted.
T element_type
The type of the referenced class.
bool operator!=(observer_ptr< U > const &rp) const
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
UInt32 hash(const T &key)
bool operator!=(T val, InvalidIndexStruct)
bool operator==(T val, InvalidIndexStruct)
UInt32 operator()(const T &key) const