spot 2.15.1
Loading...
Searching...
No Matches
intersect.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/kripke/kripke.hh>
22#include <spot/twacube/twacube.hh>
23#include <queue>
24
25namespace spot
26{
33 template<typename SuccIterator, typename State>
34 static void forward_iterators(kripkecube<State, SuccIterator>& sys,
35 twacube_ptr twa,
36 SuccIterator* it_kripke,
37 std::shared_ptr<trans_index> it_prop,
38 bool just_visited,
39 unsigned tid)
40 {
41 (void) sys; // System is useless, but the API is clearer
42 SPOT_ASSERT(!(it_prop->done() && it_kripke->done()));
43
44 // Sometimes kripke state may have no successors.
45 if (it_kripke->done())
46 return;
47
48 // The state has just been visited and the 2 iterators intersect.
49 // There is no need to move iterators forward.
50 SPOT_ASSERT(!(it_prop->done()));
51 if (just_visited && twa->get_cubeset()
52 .intersect(twa->trans_data(it_prop, tid).cube_,
53 it_kripke->condition()))
54 return;
55
56 // Otherwise we have to compute the next valid successor (if it exits).
57 // This requires two loops. The most inner one is for the twacube since
58 // its costless
59 if (it_prop->done())
60 it_prop->reset();
61 else
62 it_prop->next();
63
64 while (!it_kripke->done())
65 {
66 while (!it_prop->done())
67 {
68 if (SPOT_UNLIKELY(twa->get_cubeset()
69 .intersect(twa->trans_data(it_prop, tid).cube_,
70 it_kripke->condition())))
71 return;
72 it_prop->next();
73 }
74 it_prop->reset();
75 it_kripke->next();
76 }
77 }
78}
Definition automata.hh:26

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