Horizon Official Technical Documentation
RefManager.hpp
Go to the documentation of this file.
1
2
3#ifndef HORIZON_CORE_STRUCTURES_REFMANAGER_HPP
4#define HORIZON_CORE_STRUCTURES_REFMANAGER_HPP
5
8
9namespace Horizon
10{
11namespace Structures
12{
13namespace LinkedList
14{
31template <class TO, class FROM>
32class RefManager : public Head
33{
34public:
37
40 Reference<TO, FROM> const *first() const { return static_cast<Reference<TO, FROM> const *>(Head::first()); }
41
43 iterator begin() { return iterator(first()); }
45 iterator end() { return iterator(nullptr); }
46
47 virtual ~RefManager()
48 {
49 clear_all();
50 }
51
52 void clear_all()
53 {
54 while (Reference<TO, FROM> *ref = first())
55 ref->invalidate();
56 }
57};
58}
59}
60}
61
62#endif
LinkedList Head class. This class is used to manage a linked list of Elements. It is used as a base c...
Definition: Head.hpp:26
Element * first()
Returns the first Element in the list.
Definition: Head.hpp:46
This class is used to manage a linked list of References. It is not intended to be used directly....
Definition: RefManager.hpp:33
iterator begin()
Returns the iterator at the beginning of the list.
Definition: RefManager.hpp:43
Reference< TO, FROM > * first()
Returns the first Reference in the list.
Definition: RefManager.hpp:39
RefManager()
Definition: RefManager.hpp:36
virtual ~RefManager()
Definition: RefManager.hpp:47
void clear_all()
Definition: RefManager.hpp:52
Head::Iterator< Reference< TO, FROM > > iterator
Definition: RefManager.hpp:35
Reference< TO, FROM > const * first() const
Definition: RefManager.hpp:40
iterator end()
Returns the iterator at the end of the list.
Definition: RefManager.hpp:45
Definition: Reference.hpp:28
Definition: Element.hpp:7