spot 2.16
Loading...
Searching...
No Matches
twaproduct.hh
1// -*- coding: utf-8 -*-
2// Copyright (C) by the Spot authors, see the AUTHORS file for details.
3//
4// This file is part of Spot, a model checking library.
5//
6// Spot is free software; you can redistribute it and/or modify it
7// under the terms of the GNU General Public License as published by
8// the Free Software Foundation; either version 3 of the License, or
9// (at your option) any later version.
10//
11// Spot is distributed in the hope that it will be useful, but WITHOUT
12// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14// License for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19#pragma once
20
21#include <spot/twa/twa.hh>
22#include <spot/misc/fixpool.hh>
23
24namespace spot
25{
26
32 class SPOT_API state_product final: public state
33 {
34 public:
41 state_product(const state* left,
42 const state* right,
44 : left_(left), right_(right), count_(1), pool_(pool)
45 {
46 }
47
48 virtual void destroy() const override;
49
51 const state*
52 left() const
53 {
54 return left_;
55 }
56
58 const state*
59 right() const
60 {
61 return right_;
62 }
63
64 virtual int compare(const state* other) const override;
65 virtual size_t hash() const override;
66 virtual state_product* clone() const override;
67
68 private:
69 const state* left_;
70 const state* right_;
71 mutable unsigned count_;
73
74 virtual ~state_product();
75 state_product(const state_product& o) = delete;
76 };
77
78
80 class SPOT_API twa_product: public twa
81 {
82 public:
87 twa_product(const const_twa_ptr& left, const const_twa_ptr& right);
88
89 virtual ~twa_product();
90
91 virtual const state* get_init_state() const override;
92
93 virtual twa_succ_iterator*
94 succ_iter(const state* state) const override;
95
96 virtual std::string format_state(const state* state) const override;
97
98 virtual state* project_state(const state* s, const const_twa_ptr& t)
99 const override;
100
102 const acc_cond& left_acc() const;
104 const acc_cond& right_acc() const;
105
106 protected:
111
112 private:
113 // Disallow copy.
114 twa_product(const twa_product&) = delete;
115 twa_product& operator=(const twa_product&) = delete;
116 };
117
119 class SPOT_API twa_product_init final: public twa_product
120 {
121 public:
129 const state* left_init, const state* right_init);
130 virtual const state* get_init_state() const override;
131 protected:
134 };
135
138 const const_twa_ptr& right)
139 {
140 return SPOT_make_shared_enabled__(twa_product, left, right);
141 }
142
145 const const_twa_ptr& right,
146 const state* left_init,
147 const state* right_init)
148 {
149 return SPOT_make_shared_enabled__(twa_product_init,
150 left, right, left_init, right_init);
151 }
152}
An acceptance condition.
Definition acc.hh:54
A fixed-size memory pool implementation.
Definition fixpool.hh:46
A state for twa_product.
Definition twaproduct.hh:33
const state * right() const
Return the right component of this product state.
Definition twaproduct.hh:59
virtual size_t hash() const override
Hash a state.
virtual void destroy() const override
Release a state.
const state * left() const
Return the left component of this product state.
Definition twaproduct.hh:52
state_product(const state *left, const state *right, fixed_size_pool< pool_type::Safe > *pool)
Constructor.
Definition twaproduct.hh:41
virtual int compare(const state *other) const override
Compares two states (that come from the same automaton).
virtual state_product * clone() const override
Duplicate a state.
Abstract class for states.
Definition twa.hh:49
A lazy product with different initial states.
Definition twaproduct.hh:120
twa_product_init(const const_twa_ptr &left, const const_twa_ptr &right, const state *left_init, const state *right_init)
Construct a product with explicit initial states.
const state * left_init_
Overridden left initial state.
Definition twaproduct.hh:132
virtual const state * get_init_state() const override
Get the initial state of the automaton.
const state * right_init_
Overridden right initial state.
Definition twaproduct.hh:133
A lazy product. (States are computed on the fly.)
Definition twaproduct.hh:81
const acc_cond & right_acc() const
Return the acceptance condition of the right automaton.
virtual std::string format_state(const state *state) const override
Format the state as a string for printing.
const acc_cond & left_acc() const
Return the acceptance condition of the left automaton.
const_twa_ptr left_
Left component automaton.
Definition twaproduct.hh:107
twa_product(const const_twa_ptr &left, const const_twa_ptr &right)
Constructor.
virtual twa_succ_iterator * succ_iter(const state *state) const override
Get an iterator over the successors of local_state.
const_twa_ptr right_
Right component automaton.
Definition twaproduct.hh:108
virtual state * project_state(const state *s, const const_twa_ptr &t) const override
Project a state on an automaton.
virtual const state * get_init_state() const override
Get the initial state of the automaton.
fixed_size_pool< pool_type::Safe > pool_
Pool for state_product.
Definition twaproduct.hh:110
bool left_kripke_
True iff left is a Kripke structure.
Definition twaproduct.hh:109
Iterate over the successors of a state.
Definition twa.hh:425
A Transition-based ω-Automaton.
Definition twa.hh:648
std::shared_ptr< const twa > const_twa_ptr
Shared pointer to a const twa.
Definition fwd.hh:36
std::shared_ptr< twa_product > twa_product_ptr
Shared pointer to a mutable twa_product.
Definition fwd.hh:52
Definition automata.hh:26
twa_product_ptr otf_product(const const_twa_ptr &left, const const_twa_ptr &right)
on-the-fly TGBA product
Definition twaproduct.hh:137
twa_product_ptr otf_product_at(const const_twa_ptr &left, const const_twa_ptr &right, const state *left_init, const state *right_init)
on-the-fly TGBA product with forced initial states
Definition twaproduct.hh:144

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Fri Feb 27 2015 10:00:07 for spot by doxygen 1.9.8