libassa
3.5.1
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
assa
Destroyer.h
Go to the documentation of this file.
1
// -*- c++ -*-
2
//------------------------------------------------------------------------------
3
// Destroyer.h
4
//------------------------------------------------------------------------------
5
// Copyright (C) 1997-2002 Vladislav Grinchenko
6
//
7
// This library is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU Library General Public
9
// License as published by the Free Software Foundation; either
10
// version 2 of the License, or (at your option) any later version.
11
//------------------------------------------------------------------------------
12
#ifndef _Destroyer_h
13
#define _Destroyer_h
14
15
namespace
ASSA
{
16
23
template
<
class
T>
24
class
Destroyer
25
{
26
public
:
30
Destroyer
(T* d_=0) :
m_otg
(d_) {
/* empty */
}
31
32
/* Destructor - deletes object T it owns.
33
*/
34
~Destroyer
() {
35
if
(
m_otg
) {
36
delete
m_otg
;
37
}
38
}
39
43
void
setGuard
(T* d_) {
44
m_otg
= d_;
45
}
46
47
private
:
48
Destroyer
(
const
Destroyer<T>
&);
49
Destroyer<T>
&
operator=
(
const
Destroyer<T>
&);
50
51
private
:
53
T*
m_otg
;
54
};
55
56
}
// end namespace ASSA
57
58
#endif
ASSA
Definition:
Acceptor.h:40
ASSA::Destroyer::m_otg
T * m_otg
Object T to guard.
Definition:
Destroyer.h:53
ASSA::Destroyer
Definition:
Destroyer.h:24
ASSA::Destroyer::Destroyer
Destroyer(T *d_=0)
Constructor.
Definition:
Destroyer.h:30
ASSA::Destroyer::setGuard
void setGuard(T *d_)
Transfer ownership of object T to Destroyer class.
Definition:
Destroyer.h:43
ASSA::Destroyer::operator=
Destroyer< T > & operator=(const Destroyer< T > &)
ASSA::Destroyer::~Destroyer
~Destroyer()
Definition:
Destroyer.h:34
Generated on Thu Aug 28 2014 22:57:26 for libassa by
1.8.8