Ipopt
3.11.8
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Common
IpTaggedObject.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: IpTaggedObject.hpp 2476 2014-04-08 09:41:07Z stefan $
6
//
7
// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8
9
#ifndef __IPTAGGEDOBJECT_HPP__
10
#define __IPTAGGEDOBJECT_HPP__
11
12
#include "
IpUtils.hpp
"
13
#include "
IpDebug.hpp
"
14
#include "
IpReferenced.hpp
"
15
#include "
IpObserver.hpp
"
16
#include <limits>
17
18
/* keyword to declare a thread-local variable according to http://en.wikipedia.org/wiki/Thread-local_storage */
19
#ifdef _MSC_VER
20
#define IPOPT_THREAD_LOCAL __declspec(thread)
21
#else
22
#define IPOPT_THREAD_LOCAL __thread
23
#endif
24
25
namespace
Ipopt
26
{
27
67
class
TaggedObject
:
public
ReferencedObject
,
public
Subject
68
{
69
public
:
71
typedef
unsigned
int
Tag
;
72
74
TaggedObject
()
75
:
76
Subject
()
77
{
78
ObjectChanged
();
79
}
80
82
virtual
~TaggedObject
()
83
{}
84
89
Tag
GetTag
()
const
90
{
91
return
tag_
;
92
}
93
99
bool
HasChanged
(
const
Tag
comparison_tag)
const
100
{
101
return
(comparison_tag ==
tag_
) ?
false
:
true
;
102
}
103
protected
:
108
void
ObjectChanged
()
109
{
110
DBG_START_METH
(
"TaggedObject::ObjectChanged()"
, 0);
111
tag_
=
unique_tag_
;
112
unique_tag_
++;
113
DBG_ASSERT
(
unique_tag_
< std::numeric_limits<Tag>::max());
114
// The Notify method from the Subject base class notifies all
115
// registered Observers that this subject has changed.
116
Notify
(
Observer::NT_Changed
);
117
}
118
private
:
126
TaggedObject
(
const
TaggedObject
&);
127
129
void
operator=
(
const
TaggedObject
&);
131
136
static
IPOPT_THREAD_LOCAL
Tag
unique_tag_
;
137
143
Tag
tag_
;
144
150
Index
cache_priority_
;
151
};
152
}
// namespace Ipopt
153
#endif
Generated by
1.8.3.1