blob: 73546852c399963194b69c95d4027d40afcfbbda (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
/* Temp_* classes implementation: inline functions.
Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com)
This file is part of the Parma Polyhedra Library (PPL).
The PPL is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
The PPL is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
For the most up-to-date information see the Parma Polyhedra Library
site: http://www.cs.unipr.it/ppl/ . */
#ifndef PPL_Temp_inlines_hh
#define PPL_Temp_inlines_hh 1
#include "meta_programming.hh"
namespace Parma_Polyhedra_Library {
template <typename T>
inline
Temp_Item<T>::Temp_Item()
: item_() {
}
template <typename T>
inline T&
Temp_Item<T>::item() {
return item_;
}
template <typename T>
inline Temp_Item<T>&
Temp_Item<T>::obtain() {
if (free_list_head != 0) {
Temp_Item* p = free_list_head;
free_list_head = free_list_head->next;
return *p;
}
else
return *new Temp_Item();
}
template <typename T>
inline void
Temp_Item<T>::release(Temp_Item& p) {
p.next = free_list_head;
free_list_head = &p;
}
template <typename T>
inline
Temp_Reference_Holder<T>::Temp_Reference_Holder()
: held(Temp_Item<T>::obtain()) {
}
template <typename T>
inline
Temp_Reference_Holder<T>::~Temp_Reference_Holder() {
Temp_Item<T>::release(held);
}
template <typename T>
inline T&
Temp_Reference_Holder<T>::item() {
return held.item();
}
template <typename T>
inline
Temp_Value_Holder<T>::Temp_Value_Holder() {
}
template <typename T>
inline T
Temp_Value_Holder<T>::item() {
return item_;
}
} // namespace Parma_Polyhedra_Library
#define PPL_DIRTY_TEMP(T, id) \
typename \
Parma_Polyhedra_Library::Dirty_Temp<T>::holder_type holder_ ## id; \
typename \
Parma_Polyhedra_Library::Dirty_Temp<T>::type id = holder_ ## id.item()
#define PPL_DIRTY_TEMP0(T, id) \
Parma_Polyhedra_Library::Dirty_Temp<T>::holder_type holder_ ## id; \
Parma_Polyhedra_Library::Dirty_Temp<T>::type id = holder_ ## id.item()
#endif // !defined(PPL_Temp_inlines_hh)
|