spot
1.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
evtgba
symbol.hh
Go to the documentation of this file.
1
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
2
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
3
// et Marie Curie.
4
//
5
// This file is part of Spot, a model checking library.
6
//
7
// Spot is free software; you can redistribute it and/or modify it
8
// under the terms of the GNU General Public License as published by
9
// the Free Software Foundation; either version 3 of the License, or
10
// (at your option) any later version.
11
//
12
// Spot is distributed in the hope that it will be useful, but WITHOUT
13
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15
// License for more details.
16
//
17
// You should have received a copy of the GNU General Public License
18
// along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20
#ifndef SPOT_EVTGBA_SYMBOL_HH
21
# define SPOT_EVTGBA_SYMBOL_HH
22
23
#include <string>
24
#include <iosfwd>
25
#include <map>
26
#include <set>
27
28
namespace
spot
29
{
30
class
symbol
31
{
32
public
:
33
static
const
symbol
*
instance
(
const
std::string&
name
);
34
const
std::string&
name
()
const
;
35
37
static
unsigned
instance_count
();
39
static
std::ostream&
dump_instances
(std::ostream& os);
40
41
void
ref
()
const
;
42
void
unref
()
const
;
43
44
protected
:
45
int
ref_count_
()
const
;
46
symbol
(
const
std::string* name);
47
~symbol
();
48
typedef
std::map<const std::string, const symbol*>
map
;
49
static
map
instances_
;
50
private
:
51
symbol
(
const
symbol
&);
52
const
std::string*
name_
;
53
mutable
int
refs_
;
54
};
55
56
class
rsymbol
57
{
58
public
:
59
rsymbol
(
const
symbol
* s):
s_
(s)
60
{
61
}
62
63
rsymbol
(
const
std::string& s):
s_
(
symbol
::instance(s))
64
{
65
}
66
67
rsymbol
(
const
char
* s):
s_
(
symbol
::instance(s))
68
{
69
}
70
71
rsymbol
(
const
rsymbol
& rs):
s_
(rs.
s_
)
72
{
73
s_
->
ref
();
74
}
75
76
~rsymbol
()
77
{
78
s_
->
unref
();
79
}
80
81
operator
const
symbol
*()
const
82
{
83
return
s_
;
84
}
85
86
const
rsymbol
&
87
operator=
(
const
rsymbol
& rs)
88
{
89
if
(
this
!= &rs)
90
{
91
this->
~rsymbol
();
92
new
(
this
)
rsymbol
(rs);
93
}
94
return
*
this
;
95
}
96
97
bool
98
operator==
(
const
rsymbol
& rs)
const
99
{
100
return
s_
== rs.
s_
;
101
}
102
103
bool
104
operator!=
(
const
rsymbol
& rs)
const
105
{
106
return
s_
!= rs.
s_
;
107
}
108
109
bool
110
operator<
(
const
rsymbol
& rs)
const
111
{
112
return
s_
< rs.
s_
;
113
}
114
115
private
:
116
const
symbol
*
s_
;
117
};
118
119
typedef
std::set<const symbol*>
symbol_set
;
120
typedef
std::set<rsymbol>
rsymbol_set
;
121
122
}
123
124
#endif // SPOT_EVTGBA_SYMBOL_HH
Please
comment
this page and
report errors
about it on
the RefDocComments page
.
Generated on Sat Oct 27 2012 09:34:32 for spot by
1.8.1.2