globjects  1.0.0.000000000000
Strict OpenGL objects wrapper.
ref_ptr.h
Go to the documentation of this file.
1
2#pragma once
3
4
5namespace globjects
6{
7
8
9class Referenced;
10
31template<typename T>
33{
34// static_assert(std::is_base_of<Referenced, T>::value, "T is not a subclass of Referenced");
35
36public:
38 ref_ptr(T * referenced);
39 ref_ptr(const ref_ptr & reference);
40 ref_ptr(ref_ptr && reference);
42
43 ref_ptr & operator=(T * referenced);
44 ref_ptr & operator=(const ref_ptr & reference);
45
46 T * get() const;
47 T & operator*() const;
48 T * operator->() const;
49
50 operator T *() const;
51
52 bool operator<(const ref_ptr & reference) const;
53 bool operator>(const ref_ptr & reference) const;
54 bool operator==(const ref_ptr & reference) const;
55 bool operator!=(const ref_ptr & reference) const;
56
57 bool operator<(T * pointer) const;
58 bool operator>(T * pointer) const;
59 bool operator==(T * pointer) const;
60 bool operator!=(T * pointer) const;
61
62protected:
65
66protected:
67 mutable const Referenced * m_referenced;
68};
69
70template<typename T, typename... Args>
71ref_ptr<T> make_ref(Args&&... args);
72
73
74} // namespace globjects
75
76
77#include <globjects/base/ref_ptr.inl>
Superclass for all classes that use reference counting in globjects.
Definition: Referenced.h:23
The ref_ptr class provides the interface for a reference pointer.
Definition: ref_ptr.h:33
ref_ptr & operator=(T *referenced)
bool operator>(T *pointer) const
T * operator->() const
bool operator!=(T *pointer) const
bool operator==(const ref_ptr &reference) const
ref_ptr & operator=(const ref_ptr &reference)
ref_ptr(ref_ptr &&reference)
ref_ptr(T *referenced)
bool operator<(const ref_ptr &reference) const
const Referenced * m_referenced
Definition: ref_ptr.h:67
bool operator==(T *pointer) const
ref_ptr(const ref_ptr &reference)
bool operator>(const ref_ptr &reference) const
T & operator*() const
bool operator!=(const ref_ptr &reference) const
bool operator<(T *pointer) const
Contains all the classes that wrap OpenGL functionality.
ref_ptr< T > make_ref(Args &&... args)