OpenZWave Library
1.2
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
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
{
45
class
Ref
46
{
47
public
:
53
Ref
(){ m_refs = 1; }
54
61
void
AddRef
(){ ++m_refs; }
62
69
int32
Release
()
70
{
71
if
( 0 >= ( --m_refs ) )
72
{
73
delete
this
;
74
return
0;
75
}
76
return
m_refs;
77
}
78
79
protected
:
80
virtual
~Ref
(){}
81
82
private
:
83
// Reference counting
84
int32
m_refs;
85
86
};
// class Ref
87
88
}
// namespace OpenZWave
89
90
#endif // _Ref_H
91
OpenZWave
Definition:
Bitfield.h:34
OpenZWave::Ref::AddRef
void AddRef()
Definition:
Ref.h:61
Defs.h
int32
signed int int32
Definition:
Defs.h:68
OpenZWave::Ref::~Ref
virtual ~Ref()
Definition:
Ref.h:80
OpenZWave::Ref::Release
int32 Release()
Definition:
Ref.h:69
OpenZWave::Ref
Definition:
Ref.h:45
OpenZWave::Ref::Ref
Ref()
Definition:
Ref.h:53
Generated on Sun Nov 15 2015 17:30:59 for OpenZWave Library by
1.8.8