mCRL2
Loading...
Searching...
No Matches
machine_number.h
Go to the documentation of this file.
1// Author(s): 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//
11
12#ifndef MCRL2_DATA_MACHINE_NUMBER_H
13#define MCRL2_DATA_MACHINE_NUMBER_H
14
17
18namespace mcrl2
19{
20
21namespace data
22{
23
24typedef std::pair<atermpp::aterm, atermpp::aterm> machine_number_key_type;
25
26
27//--- start generated class machine_number ---//
30{
31 public:
34 : data_expression(atermpp::aterm_int(std::size_t(0)))
35 {}
36
39 explicit machine_number(const atermpp::aterm& term)
40 : data_expression(term)
41 {
42 assert(this->type_is_int());
43 }
44
46 machine_number(std::size_t value)
47 : data_expression(atermpp::aterm_int(value))
48 {}
49
51 machine_number(const machine_number&) noexcept = default;
52 machine_number(machine_number&&) noexcept = default;
53 machine_number& operator=(const machine_number&) noexcept = default;
54 machine_number& operator=(machine_number&&) noexcept = default;
55
56 std::size_t value() const
57 {
58 return atermpp::down_cast<atermpp::aterm_int>(static_cast<const atermpp::aterm&>(*this)).value();
59 }
60};
61
64template <class... ARGUMENTS>
65inline void make_machine_number(atermpp::aterm& t, size_t n)
66{
67 atermpp::make_aterm_int(reinterpret_cast<atermpp::aterm_int&>(t), n);
68}
69
72
74typedef std::vector<machine_number> machine_number_vector;
75
76// prototype declaration
77std::string pp(const machine_number& x);
78
83inline
84std::ostream& operator<<(std::ostream& out, const machine_number& x)
85{
86 return out << data::pp(x);
87}
88
90inline void swap(machine_number& t1, machine_number& t2)
91{
92 t1.swap(t2);
93}
94//--- end generated class machine_number ---//
95
98inline std::string max_machine_number_string()
99{
100 std::size_t n=std::numeric_limits<std::size_t>::max();
101 assert(n % 100 != 99); // This is not possible, as n has the shape 2^n-1, but we check it anyhow.
102 return std::to_string(n/100) + std::to_string(1+n % 100);
103}
104
105
106
107// template function overloads
108std::string pp(const machine_number_list& x);
109std::string pp(const machine_number_vector& x);
110std::set<data::variable> find_all_variables(const data::machine_number& x);
111
112} // namespace data
113
114} // namespace mcrl2
115
116#endif // MCRL2_DATA_MACHINE_NUMBER_H
117
An integer term stores a single std::size_t value. It carries no arguments.
Definition aterm_int.h:26
A list of aterm objects.
Definition aterm_list.h:24
void swap(unprotected_aterm_core &t) noexcept
Swaps this term with its argument.
Definition aterm_core.h:152
bool type_is_int() const noexcept
Dynamic check whether the term is an aterm_int.
Definition aterm_core.h:63
\brief A machine number
machine_number()
\brief Default constructor X2.
std::size_t value() const
machine_number(const machine_number &) noexcept=default
Move semantics.
machine_number(std::size_t value)
\brief Constructor Z13.
machine_number(machine_number &&) noexcept=default
machine_number(const atermpp::aterm &term)
The class data_expression.
The main namespace for the aterm++ library.
Definition algorithm.h:21
void make_aterm_int(aterm_int &target, std::size_t value)
Constructs an integer term from a value.
Definition aterm_int.h:69
std::vector< machine_number > machine_number_vector
\brief vector of machine_numbers
void make_machine_number(atermpp::aterm &t, size_t n)
void swap(abstraction &t1, abstraction &t2)
\brief swap overload
std::set< data::variable > find_all_variables(const data::data_expression &x)
Definition data.cpp:94
atermpp::term_list< machine_number > machine_number_list
\brief list of machine_numbers
std::string pp(const abstraction &x)
Definition data.cpp:39
std::string max_machine_number_string()
A string representation indicating the maximal machine number + 1.
std::ostream & operator<<(std::ostream &out, const abstraction &x)
Definition abstraction.h:94
std::pair< atermpp::aterm, atermpp::aterm > machine_number_key_type
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.