TDME2
1.9.121
src
tdme
utilities
ObjectDeleter.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <algorithm>
4
#include <vector>
5
6
#include <
tdme/tdme.h
>
7
#include <
tdme/utilities/fwd-tdme.h
>
8
9
using
std::find;
10
using
std::vector;
11
12
namespace
tdme
{
13
namespace
utilities {
14
15
/**
16
* Object deleter
17
* @author Andreas Drewke
18
* @version $Id$
19
*/
20
template
<
typename
T>
21
class
ObjectDeleter
final
22
{
23
private
:
24
vector<T*>
objects
;
25
26
public
:
27
/**
28
* Public constructor
29
*/
30
ObjectDeleter
() {
31
}
32
33
/**
34
* Public destructor
35
*/
36
~ObjectDeleter
() {
37
for
(
auto
object
:
objects
)
delete
object;
38
objects
.clear();
39
}
40
41
/**
42
* Adds vector to iterator
43
* @param vector vector
44
*/
45
T*
add
(T*
object
) {
46
if
(find(
objects
.begin(),
objects
.end(),
object
) !=
objects
.end())
return
object;
47
objects
.push_back(
object
);
48
return
object;
49
}
50
51
};
52
53
};
54
};
tdme::utilities::ObjectDeleter
Object deleter.
Definition:
ObjectDeleter.h:22
tdme::utilities::ObjectDeleter::~ObjectDeleter
~ObjectDeleter()
Public destructor.
Definition:
ObjectDeleter.h:36
tdme::utilities::ObjectDeleter::add
T * add(T *object)
Adds vector to iterator.
Definition:
ObjectDeleter.h:45
tdme::utilities::ObjectDeleter::objects
vector< T * > objects
Definition:
ObjectDeleter.h:24
tdme::utilities::ObjectDeleter::ObjectDeleter
ObjectDeleter()
Public constructor.
Definition:
ObjectDeleter.h:30
tdme
Definition:
fwd-tdme.h:4
tdme.h
fwd-tdme.h
Generated by
1.9.3