Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
tmp
OS-2.10.2
OS
src
OSUtils
OSReferenced.hpp
Go to the documentation of this file.
1
// Copyright (C) 2004, 2006 International Business Machines and others.
2
// All Rights Reserved.
3
// This code is published under the Eclipse Public License.
4
//
5
// $Id: OSIpReferenced.hpp 1861 2010-12-21 21:34:47Z andreasw $
6
//
7
// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8
9
// copied from IpReferenced.hpp so as to allow OS to be compiled
10
// stand-alone (without the Fortran implications inherent in Ipopt)
11
12
#ifndef OSREFERENCED_HPP
13
#define OSREFERENCED_HPP
14
15
#include <list>
16
#include <assert.h>
17
21
class
OSReferencer
22
{}
23
;
24
160
class
OSReferencedObject
161
{
162
public
:
163
OSReferencedObject
()
164
:
165
reference_count_
(0)
166
{}
167
168
virtual
~OSReferencedObject
()
169
{
170
assert(
reference_count_
== 0);
171
}
172
173
int
ReferenceCount
()
const
;
174
175
void
AddRef
(
const
OSReferencer
* referencer)
const
;
176
177
void
ReleaseRef
(
const
OSReferencer
* referencer)
const
;
178
179
private
:
180
mutable
int
reference_count_
;
181
};
182
183
/* inline methods */
184
inline
185
int
OSReferencedObject::ReferenceCount
()
const
186
{
187
return
reference_count_
;
188
}
189
190
inline
191
void
OSReferencedObject::AddRef
(
const
OSReferencer
* referencer)
const
192
{
193
reference_count_
++;
194
}
195
196
inline
197
void
OSReferencedObject::ReleaseRef
(
const
OSReferencer
* referencer)
const
198
{
199
reference_count_
--;
200
}
201
202
#endif
OSReferencedObject::ReferenceCount
int ReferenceCount() const
Definition:
OSReferenced.hpp:185
OSReferencedObject::AddRef
void AddRef(const OSReferencer *referencer) const
Definition:
OSReferenced.hpp:191
OSReferencedObject::reference_count_
int reference_count_
Definition:
OSReferenced.hpp:180
OSReferencedObject
ReferencedObject class.
Definition:
OSReferenced.hpp:160
OSReferencedObject::~OSReferencedObject
virtual ~OSReferencedObject()
Definition:
OSReferenced.hpp:168
OSReferencedObject::OSReferencedObject
OSReferencedObject()
Definition:
OSReferenced.hpp:163
OSReferencedObject::ReleaseRef
void ReleaseRef(const OSReferencer *referencer) const
Definition:
OSReferenced.hpp:197
OSReferencer
Pseudo-class, from which everything has to inherit that wants to use be registered as a Referencer fo...
Definition:
OSReferenced.hpp:21
Generated by
1.8.5