My Project
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
22 {}
23 ;
24
161 {
162 public:
167
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
186 {
187 return reference_count_;
188 }
189
190 inline
191 void OSReferencedObject::AddRef(const OSReferencer* referencer) const
192 {
194 }
195
196 inline
197 void OSReferencedObject::ReleaseRef(const OSReferencer* referencer) const
198 {
200 }
201
202#endif
ReferencedObject class.
void ReleaseRef(const OSReferencer *referencer) const
int ReferenceCount() const
virtual ~OSReferencedObject()
void AddRef(const OSReferencer *referencer) const
Pseudo-class, from which everything has to inherit that wants to use be registered as a Referencer fo...