mCRL2
Loading...
Searching...
No Matches
transition.h
Go to the documentation of this file.
1// Author(s): Muck van Weerdenburg, Jan Friso Groote
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//
9
17#ifndef MCRL2_LTS_TRANSITION_H
18#define MCRL2_LTS_TRANSITION_H
19
20#include <functional>
22
23namespace mcrl2
24{
25namespace lts
26{
27
28static const std::size_t const_tau_label_index=0;
29
35{
41 target
42};
43
48{
49 public:
51 typedef std::size_t size_type;
52
53 private:
57
58 public:
59 // The default transition is intentionally a non realistic transition.
61 : m_from(-1),
62 m_label(-1),
63 m_to(-1)
64 {}
65
67 transition(const std::size_t f,
68 const std::size_t l,
69 const std::size_t t)
70 : m_from(f),
71 m_label(l),
72 m_to(t)
73 {}
74
76 transition(const transition& t) = default;
77
79 transition(transition&& t) = default;
80
82 transition& operator=(const transition& t) = default;
83
86
89 from() const
90 {
91 return m_from;
92 }
93
96 {
97 return m_label;
98 }
99
102 to() const
103 {
104 return m_to;
105 }
106
108 void
110 {
111 m_from = from;
112 }
113
115 void
117 {
118 m_label = label;
119 }
120
122 void
124 {
125 m_to = to;
126 }
127
129 bool
130 operator ==(const transition& t) const
131 {
132 return m_from == t.m_from && m_label == t.m_label && m_to == t.m_to;
133 }
134
136 bool
137 operator !=(const transition& t) const
138 {
139 return !(*this==t);
140 }
141
146 bool
147 operator <(const transition& t) const
148 {
149 return m_from < t.m_from || (m_from == t.m_from && (m_label
150 < t.m_label || (m_label == t.m_label && m_to < t.m_to)));
151 }
152};
153
154} // namespace lts
155} // namespace mcrl2
156
157namespace std
158{
159
161template<>
162struct hash<mcrl2::lts::transition>
163{
164 std::size_t operator()(const mcrl2::lts::transition& t) const
165 {
166 // return t.from() << 2 ^ t.label() << 1 ^ t.to();
168 }
169};
170
171} // namespace std
172
173
175
176#endif // MCRL2_LTS_TRANSITION_H
A class containing triples, source label and target representing transitions.
Definition transition.h:48
void set_label(const size_type label)
Set the label of the transition.
Definition transition.h:116
transition & operator=(const transition &t)=default
Assignment.
void set_to(const size_type to)
Set the target of the transition.
Definition transition.h:123
bool operator<(const transition &t) const
Standard lexicographic ordering on transitions.
Definition transition.h:147
transition(const std::size_t f, const std::size_t l, const std::size_t t)
Constructor (there is no default constructor).
Definition transition.h:67
size_type from() const
The source of the transition.
Definition transition.h:89
transition & operator=(transition &&t)=default
Move assignment.
bool operator!=(const transition &t) const
Standard inequality on transitions.
Definition transition.h:137
size_type label() const
The label of the transition.
Definition transition.h:95
size_type to() const
The target of the transition.
Definition transition.h:102
void set_from(const size_type from)
Set the source of the transition.
Definition transition.h:109
transition(transition &&t)=default
Move constructor.
transition(const transition &t)=default
Copy constructor.
std::size_t size_type
The type of the elements in a transition.
Definition transition.h:51
bool operator==(const transition &t) const
Standard equality on transitions.
Definition transition.h:130
This file contains a specialisation for hashes on pairs. This is not a part of the standard,...
transition_sort_style
Transition sort styles.
Definition transition.h:35
static const std::size_t const_tau_label_index
Definition transition.h:28
std::size_t hash_combine(const std::size_t h1, const std::size_t h2)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72
STL namespace.
std::size_t operator()(const mcrl2::lts::transition &t) const
Definition transition.h:164
#define hash(l, r, m)
Definition tree_set.cpp:23