ESyS-Particle
2.2
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
handle.hpp
Go to the documentation of this file.
1
2
// //
3
// Copyright (c) 2003-2013 by The University of Queensland //
4
// Earth Systems Science Computational Centre (ESSCC) //
5
// http://www.uq.edu.au/esscc //
6
// //
7
// Primary Business: Brisbane, Queensland, Australia //
8
// Licensed under the Open Software License version 3.0 //
9
// http://www.opensource.org/licenses/osl-3.0.php //
10
// //
12
13
template
<
typename
T>
14
T_Handle<T>::T_Handle
(T* t): m_rep(t), m_count(new int(1))
15
{}
16
17
template
<
typename
T>
18
T_Handle<T>::T_Handle
(
const
T_Handle
& h): m_rep(h.m_rep), m_count(h.m_count)
19
{
20
(*m_count)++;
21
}
22
23
template
<
typename
T>
24
T_Handle<T>::~T_Handle
()
25
{
26
if
(--(*m_count)==0){
27
delete
m_rep;
28
delete
m_count;
29
}
30
}
31
32
template
<
typename
T>
33
T_Handle<T>
&
T_Handle<T>::operator=
(
const
T_Handle
& h)
34
{
35
if
(m_rep!=h.
m_rep
){
36
if
(--(*m_count)==0){
37
delete
m_rep;
38
delete
m_count;
39
}
40
m_rep=h.
m_rep
;
41
m_count=h.
m_count
;
42
(*m_count)++;
43
}
44
return
*
this
;
45
}
46
47
/*template<typename T>
48
void T_Handle<T>::destroy()
49
{
50
if (m_count!=1) {
51
throw HandleException;
52
} else {
53
54
}
55
}*/
ntable
src
handle.hpp
Generated on Mon May 6 2013 23:26:30 for ESyS-Particle by
1.8.3.1