spot  1.2.1a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
cube.hh
1 // Copyright (C) 2012 Laboratoire de Recherche et Developpement de
2 // l'Epita (LRDE).
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 
20 #ifndef SPOT_FASTTGBA_CUBE_HH
21 # define SPOT_FASTTGBA_CUBE_HH
22 
23 #include <vector>
24 #include <string>
25 #include <boost/dynamic_bitset.hpp>
26 #include "ap_dict.hh"
27 
28 namespace spot
29 {
34  class cube
35  {
36  public:
40  cube (ap_dict& aps);
41 
43  cube (const spot::cube& c);
44 
48  bool operator==(const spot::cube& rhs);
49 
57  cube operator&(const cube& rhs) const;
58 
62  void set_true_var(size_t index);
63 
67  void set_false_var(size_t index);
68 
72  void set_free_var(size_t index);
73 
75  size_t size() const;
76 
79  bool is_valid() const;
80 
84  std::string dump();
85 
86  protected:
87 
88  // -----------------------------------------------------------
89  // This class is a wrapper for two bitsets :
90  // - true_var : a bitset representing variables that
91  // are set to true
92  // - false_var : a bitset representing variables that
93  // are set to false
94  //
95  // In the two vectors a bit set to 1 represent a variable set to
96  // true (resp. false) for the true_var (resp. false_var)
97  //
98  // The cube for (a & !b) will be repensented by :
99  // - true_var = 1 0
100  // - false_var = 0 1
101  //
102  // To represent free variables such as in (a & !b) | (a & b)
103  // (wich is equivalent to (a) with b free)
104  // - true_var : 1 0
105  // - false_var : 0 0
106  // This exemple shows that the representation of free variables
107  // is done by unsetting variable in both vector
108  //
109  // Warning : a variable cannot be set in both bitset at the
110  // same time (consistency! cannot be true and false)
111  // -----------------------------------------------------------
112 
113  boost::dynamic_bitset<> true_var;
114  boost::dynamic_bitset<> false_var;
116  mutable bool valid;
117  };
118 }
119 
120 #endif // SPOT_FASTTGBA_CUBE_HH
ap_dict & aps_
the reference over the atomic props
Definition: cube.hh:115
cube operator&(const cube &rhs) const
The logical AND of two cubes.
bool is_valid() const
return true if the cube is valid considering true and false variables
boost::dynamic_bitset true_var
the set of variables set to true
Definition: cube.hh:113
This class represents conjunction of variables.
Definition: cube.hh:34
This class is used to create a dictionary that will contain all atomic propositions that are needed b...
Definition: ap_dict.hh:41
void set_true_var(size_t index)
Set the variable at the index position to true.
size_t size() const
return the size of the cube
bool operator==(const spot::cube &rhs)
Compare two cubes.
void set_free_var(size_t index)
Set the variable at the index position to free.
cube(ap_dict &aps)
Initialize a cube of size size.
void set_false_var(size_t index)
Set the variable at the index position to false.
std::string dump()
output the description of the cube
boost::dynamic_bitset false_var
the set of variables set to false
Definition: cube.hh:114

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Tue Jan 21 2014 16:52:01 for spot by doxygen 1.8.5