OpenZWave Library
1.5.0
cpp
src
platform
Ref.h
Go to the documentation of this file.
1
//-----------------------------------------------------------------------------
2
//
3
// Ref.h
4
//
5
// Reference counting for objects.
6
//
7
// Copyright (c) 2010 Mal Lansell <mal@lansell.org>
8
// All rights reserved.
9
//
10
// SOFTWARE NOTICE AND LICENSE
11
//
12
// This file is part of OpenZWave.
13
//
14
// OpenZWave is free software: you can redistribute it and/or modify
15
// it under the terms of the GNU Lesser General Public License as published
16
// by the Free Software Foundation, either version 3 of the License,
17
// or (at your option) any later version.
18
//
19
// OpenZWave is distributed in the hope that it will be useful,
20
// but WITHOUT ANY WARRANTY; without even the implied warranty of
21
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
// GNU Lesser General Public License for more details.
23
//
24
// You should have received a copy of the GNU Lesser General Public License
25
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
26
//
27
//-----------------------------------------------------------------------------
28
#ifndef _Ref_H
29
#define _Ref_H
30
31
#pragma once
32
33
#include "
Defs.h
"
34
35
namespace
OpenZWave
36
{
46
class
Ref
47
{
48
public
:
54
Ref
(){ m_refs = 1; }
55
62
void
AddRef
(){ ++m_refs; }
63
70
int32
Release
()
71
{
72
if
( 0 >= ( --m_refs ) )
73
{
74
delete
this
;
75
return
0;
76
}
77
return
m_refs;
78
}
79
80
protected
:
81
virtual
~Ref
(){}
82
83
private
:
84
// Reference counting
85
int32
m_refs;
86
87
};
// class Ref
88
89
}
// namespace OpenZWave
90
91
#endif // _Ref_H
92
OpenZWave
Definition:
Bitfield.h:34
OpenZWave::Ref::AddRef
void AddRef()
Definition:
Ref.h:62
Defs.h
int32
signed int int32
Definition:
Defs.h:95
OpenZWave::Ref::~Ref
virtual ~Ref()
Definition:
Ref.h:81
OpenZWave::Ref::Release
int32 Release()
Definition:
Ref.h:70
OpenZWave::Ref
Definition:
Ref.h:46
OpenZWave::Ref::Ref
Ref()
Definition:
Ref.h:54
Generated on Thu Mar 15 2018 08:38:09 for OpenZWave Library by
1.8.12