MPQC
2.3.1
Main Page
Related Pages
Classes
Files
File List
src
lib
util
ref
identity.h
1
//
2
// identity.h --- definition of the Identity class
3
//
4
// Copyright (C) 1996 Limit Point Systems, Inc.
5
//
6
// Author: Curtis Janssen <cljanss@limitpt.com>
7
// Maintainer: LPS
8
//
9
// This file is part of the SC Toolkit.
10
//
11
// The SC Toolkit is free software; you can redistribute it and/or modify
12
// it under the terms of the GNU Library General Public License as published by
13
// the Free Software Foundation; either version 2, or (at your option)
14
// any later version.
15
//
16
// The SC Toolkit is distributed in the hope that it will be useful,
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
// GNU Library General Public License for more details.
20
//
21
// You should have received a copy of the GNU Library General Public License
22
// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23
// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24
//
25
// The U.S. Government is granted a limited license as per AL 91-7.
26
//
27
28
#ifndef _util_ref_identity_h
29
#define _util_ref_identity_h
30
31
#ifdef __GNUG__
32
#pragma interface
33
#endif
34
35
#include <iostream>
36
37
#include <scconfig.h>
38
39
namespace
sc {
40
41
class
Identity;
42
50
class
Identifier
{
51
private
:
52
const
void
* id;
53
public
:
55
Identifier
(): id(0) {}
57
Identifier
(
const
Identity
* i): id((void*)i) {}
59
Identifier
(
const
Identifier
& i): id(i.id) {}
61
~Identifier
() {}
62
64
void
operator =
(
const
Identifier
& i) {
id
= i.id; }
65
67
int
operator <
(
const
Identifier
&i)
const
{
return
id
< i.id; }
69
int
operator >
(
const
Identifier
&i)
const
{
return
id
> i.id; }
71
int
operator ==
(
const
Identifier
&i)
const
{
return
id
== i.id; }
73
int
operator <=
(
const
Identifier
&i)
const
{
return
id
<= i.id; }
75
int
operator >=
(
const
Identifier
&i)
const
{
return
id
>= i.id; }
77
int
operator !=
(
const
Identifier
&i)
const
{
return
id
!= i.id; }
78
79
void
print(std::ostream&)
const
;
80
};
81
82
std::ostream & operator << (std::ostream &o,
const
Identifier &i);
83
89
class
Identity
{
90
public
:
91
virtual
~
Identity
();
94
Identifier
identifier
() {
return
this
; }
95
};
97
inline
int
lt(
const
Identity*i,
const
Identity*j) {
return
i < j; }
99
inline
int
gt(
const
Identity*i,
const
Identity*j) {
return
i > j; }
101
inline
int
le(
const
Identity*i,
const
Identity*j) {
return
i <= j; }
103
inline
int
ge(
const
Identity*i,
const
Identity*j) {
return
i >= j; }
105
inline
int
eq(
const
Identity*i,
const
Identity*j) {
return
i == j; }
107
inline
int
ne(
const
Identity*i,
const
Identity*j) {
return
i != j; }
110
inline
int
cmp(
const
Identity*i,
const
Identity*j)
111
{
112
return
(i==j)?0:((i<j)?-1:1);
113
}
114
115
}
116
117
#endif
118
119
// Local Variables:
120
// mode: c++
121
// c-file-style: "CLJ"
122
// End:
Generated at Sun Oct 6 2013 16:42:50 for
MPQC
2.3.1 using the documentation package
Doxygen
1.8.3.1.