spot  2.12
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 
24 namespace 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 
50  const state*
51  left() const
52  {
53  return left_;
54  }
55 
56  const state*
57  right() const
58  {
59  return right_;
60  }
61 
62  virtual int compare(const state* other) const override;
63  virtual size_t hash() const override;
64  virtual state_product* clone() const override;
65 
66  private:
67  const state* left_;
68  const state* right_;
69  mutable unsigned count_;
71 
72  virtual ~state_product();
73  state_product(const state_product& o) = delete;
74  };
75 
76 
78  class SPOT_API twa_product: public twa
79  {
80  public:
85  twa_product(const const_twa_ptr& left, const const_twa_ptr& right);
86 
87  virtual ~twa_product();
88 
89  virtual const state* get_init_state() const override;
90 
91  virtual twa_succ_iterator*
92  succ_iter(const state* state) const override;
93 
94  virtual std::string format_state(const state* state) const override;
95 
96  virtual state* project_state(const state* s, const const_twa_ptr& t)
97  const override;
98 
99  const acc_cond& left_acc() const;
100  const acc_cond& right_acc() const;
101 
102  protected:
103  const_twa_ptr left_;
104  const_twa_ptr right_;
105  bool left_kripke_;
107 
108  private:
109  // Disallow copy.
110  twa_product(const twa_product&) = delete;
111  twa_product& operator=(const twa_product&) = delete;
112  };
113 
115  class SPOT_API twa_product_init final: public twa_product
116  {
117  public:
118  twa_product_init(const const_twa_ptr& left, const const_twa_ptr& right,
119  const state* left_init, const state* right_init);
120  virtual const state* get_init_state() const override;
121  protected:
122  const state* left_init_;
123  const state* right_init_;
124  };
125 
127  inline twa_product_ptr otf_product(const const_twa_ptr& left,
128  const const_twa_ptr& right)
129  {
130  return SPOT_make_shared_enabled__(twa_product, left, right);
131  }
132 
134  inline twa_product_ptr otf_product_at(const const_twa_ptr& left,
135  const const_twa_ptr& right,
136  const state* left_init,
137  const state* right_init)
138  {
139  return SPOT_make_shared_enabled__(twa_product_init,
140  left, right, left_init, right_init);
141  }
142 }
An acceptance condition.
Definition: acc.hh:61
A state for spot::twa_product.
Definition: twaproduct.hh:33
virtual size_t hash() const override
Hash a state.
virtual void destroy() const override
Release a state.
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:47
A lazy product with different initial states.
Definition: twaproduct.hh:116
virtual const state * get_init_state() const override
Get the initial state of the automaton.
A lazy product. (States are computed on the fly.)
Definition: twaproduct.hh:79
virtual std::string format_state(const state *state) const override
Format the state as a string for printing.
twa_product(const const_twa_ptr &left, const const_twa_ptr &right)
Constructor.
virtual const state * get_init_state() const override
Get the initial state of the automaton.
virtual twa_succ_iterator * succ_iter(const state *state) const override
Get an iterator over the successors of local_state.
virtual state * project_state(const state *s, const const_twa_ptr &t) const override
Project a state on an automaton.
Iterate over the successors of a state.
Definition: twa.hh:394
A Transition-based ω-Automaton.
Definition: twa.hh:619
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:127
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:134

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.1