mCRL2
Loading...
Searching...
No Matches
set_identifier_generator.h
Go to the documentation of this file.
1// Author(s): Wieger Wesselink
2// Copyright: see the accompanying file COPYING or copy at
3// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
11
12#ifndef MCRL2_DATA_SET_IDENTIFIER_GENERATOR_H
13#define MCRL2_DATA_SET_IDENTIFIER_GENERATOR_H
14
17
18namespace mcrl2
19{
20
21namespace data
22{
23
30{
31 protected:
33 std::set<core::identifier_string> m_identifiers;
34
35 public:
38
40 void clear_context() override
41 {
42 m_identifiers.clear();
43 m_generator.clear();
44 }
45
49 {
50 m_identifiers.insert(s);
51 }
52
56 {
57 m_identifiers.erase(s);
58 }
59
63 bool has_identifier(const core::identifier_string& s) const override
64 {
66 return contains(m_identifiers, s);
67 }
68
71 const std::set<core::identifier_string>& context() const
72 {
73 return m_identifiers;
74 }
75};
76
86{
87 protected:
89 std::multiset<core::identifier_string> m_identifiers;
90
91 public:
94
96 void clear_context() override
97 {
98 m_identifiers.clear();
99 m_generator.clear();
100 }
101
105 {
106 m_identifiers.insert(s);
107 }
108
112 {
113 auto i = m_identifiers.find(s);
114 if (i != m_identifiers.end())
115 {
116 m_identifiers.erase(i);
117 }
118 }
119
123 bool has_identifier(const core::identifier_string& s) const override
124 {
126 return contains(m_identifiers, s);
127 }
128
131 const std::multiset<core::identifier_string>& context() const
132 {
133 return m_identifiers;
134 }
135};
136
137} // namespace data
138
139} // namespace mcrl2
140
141#endif // MCRL2_DATA_SET_IDENTIFIER_GENERATOR_H
Term containing a string.
Abstract base class for identifier generators. Identifier generators generate fresh names that do not...
Identifier generator that stores the identifiers of the context in a multiset. If an identifier occur...
bool has_identifier(const core::identifier_string &s) const override
Returns true if the identifier s appears in the context.
void remove_identifier(const core::identifier_string &s) override
Removes one occurrence of the identifier s from the context.
void add_identifier(const core::identifier_string &s) override
Adds the identifier s to the context.
void clear_context() override
Clears the context.
const std::multiset< core::identifier_string > & context() const
Returns the context.
std::multiset< core::identifier_string > m_identifiers
The context of the identifier generator.
multiset_identifier_generator()=default
Constructor.
Identifier generator that stores the identifiers of the context in a set. Using the operator()() and ...
const std::set< core::identifier_string > & context() const
Returns the context.
void remove_identifier(const core::identifier_string &s) override
Removes one occurrence of the identifier s from the context.
set_identifier_generator()=default
Constructor.
void clear_context() override
Clears the context.
void add_identifier(const core::identifier_string &s) override
Adds the identifier s to the context.
std::set< core::identifier_string > m_identifiers
The context of the identifier generator.
bool has_identifier(const core::identifier_string &s) const override
Returns true if the identifier s appears in the context.
The class identifier_generator.
bool contains(const atermpp::indexed_set< Key, ThreadSafe, Hash, Equals, Allocator, KeyTable > &c, const typename atermpp::indexed_set< Key, ThreadSafe, Hash, Equals, Allocator, KeyTable >::key_type &v, const std::size_t thread_index=0)
Definition indexed_set.h:86
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72