Ptr.pkg 691 B

1234567891011121314151617181920
  1. $#include "RenderPath.h"
  2. $#include "Ptr.h"
  3. /// Shared pointer template class with intrusive reference counting.
  4. class SharedPtr
  5. {
  6. TOLUA_TEMPLATE_BIND(T, RenderPath)
  7. public:
  8. /// Point to the object.
  9. bool operator < (const SharedPtr<T>& rhs) const { return ptr_ < rhs.ptr_; }
  10. /// Test for equality with another shared pointer.
  11. bool operator == (const SharedPtr<T>& rhs) const { return ptr_ == rhs.ptr_; }
  12. /// Check if the pointer is null.
  13. bool Null() const { return ptr_ == 0; }
  14. /// Check if the pointer is not null.
  15. bool NotNull() const { return ptr_ != 0; }
  16. /// Return the raw pointer.
  17. T* Get() const { return ptr_; }
  18. };