Loading...
Searching...
No Matches
ref_ptr.h
Go to the documentation of this file.
#pragma once
namespace globjects
{
class Referenced;
template<typename T>
class ref_ptr
{
// static_assert(std::is_base_of<Referenced, T>::value, "T is not a subclass of Referenced");
public:
ref_ptr();
ref_ptr(T * referenced);
ref_ptr(const ref_ptr & reference);
ref_ptr(ref_ptr && reference);
~ref_ptr();
ref_ptr & operator=(T * referenced);
ref_ptr & operator=(const ref_ptr & reference);
T * get() const;
T & operator*() const;
T * operator->() const;
operator T *() const;
bool operator<(const ref_ptr & reference) const;
bool operator>(const ref_ptr & reference) const;
bool operator==(const ref_ptr & reference) const;
bool operator!=(const ref_ptr & reference) const;
bool operator<(T * pointer) const;
bool operator>(T * pointer) const;
bool operator==(T * pointer) const;
bool operator!=(T * pointer) const;
protected:
void increaseRef();
void decreaseRef();
protected:
mutable const Referenced * m_referenced;
};
template<typename T, typename... Args>
ref_ptr<T> make_ref(Args&&... args);
} // namespace globjects
#include <globjects/base/ref_ptr.inl>
globjects::Referenced
Superclass for all classes that use reference counting in globjects.
Definition Referenced.h:23
globjects::ref_ptr
The ref_ptr class provides the interface for a reference pointer.
Definition ref_ptr.h:33
globjects::ref_ptr::operator=
ref_ptr & operator=(T *referenced)
globjects::ref_ptr::increaseRef
void increaseRef()
globjects::ref_ptr::operator>
bool operator>(T *pointer) const
globjects::ref_ptr::get
T * get() const
globjects::ref_ptr::operator->
T * operator->() const
globjects::ref_ptr::ref_ptr
ref_ptr()
globjects::ref_ptr::operator!=
bool operator!=(T *pointer) const
globjects::ref_ptr::operator==
bool operator==(const ref_ptr &reference) const
globjects::ref_ptr::operator=
ref_ptr & operator=(const ref_ptr &reference)
globjects::ref_ptr::ref_ptr
ref_ptr(ref_ptr &&reference)
globjects::ref_ptr::ref_ptr
ref_ptr(T *referenced)
globjects::ref_ptr::operator<
bool operator<(const ref_ptr &reference) const
globjects::ref_ptr::m_referenced
const Referenced * m_referenced
Definition ref_ptr.h:67
globjects::ref_ptr::~ref_ptr
~ref_ptr()
globjects::ref_ptr::operator==
bool operator==(T *pointer) const
globjects::ref_ptr::ref_ptr
ref_ptr(const ref_ptr &reference)
globjects::ref_ptr::operator>
bool operator>(const ref_ptr &reference) const
globjects::ref_ptr::operator*
T & operator*() const
globjects::ref_ptr::operator!=
bool operator!=(const ref_ptr &reference) const
globjects::ref_ptr::operator<
bool operator<(T *pointer) const
globjects::ref_ptr::decreaseRef
void decreaseRef()
globjects
Contains all the classes that wrap OpenGL functionality.
globjects::make_ref
ref_ptr< T > make_ref(Args &&... args)