spot  2.16
cube.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 
20 #pragma once
21 
22 #include <spot/misc/common.hh>
23 #include <vector>
24 #include <string>
25 #include <climits>
26 #include <sstream>
27 
28 namespace spot
29 {
66  using cube = unsigned*;
67 
71  class SPOT_API cubeset final
72  {
73  // \brief The total number of variables stored
74  size_t size_;
75 
77  size_t uint_size_;
78 
80  size_t nb_bits_;
81 
82  public:
83  // Some default/deleted constructor/destructors
84  cubeset() = delete;
85  ~cubeset() = default;
86 
88  cubeset(int aps);
89 
91  cube alloc() const;
92 
94  void set_true_var(cube c, unsigned int x) const;
95 
97  void set_false_var(cube c, unsigned int x) const;
98 
100  bool is_true_var(cube c, unsigned int x) const;
101 
103  bool is_false_var(cube c, unsigned int x) const;
104 
106  bool intersect(const cube lhs, const cube rhs) const;
107 
109  cube intersection(const cube lhs, const cube rhs) const;
110 
113  bool is_valid(const cube lhs) const;
114 
116  size_t size() const;
117 
119  void release(cube lhs) const;
120 
122  void display(const cube c) const;
123 
125  std::string dump(cube c, const std::vector<std::string>& aps) const;
126  };
127 }
Manager for allocating and manipulating cubes (bit-encoded partial assignments over APs).
Definition: cube.hh:72
cubeset(int aps)
Build the cubeset manager for aps variables.
void release(cube lhs) const
Release a cube.
size_t size() const
Return the size of each cube.
bool is_valid(const cube lhs) const
Check whether lhs is valid, i.e., there is no variable that is both true and false at the same time.
bool is_true_var(cube c, unsigned int x) const
Check if the variable at position x is true.
void set_false_var(cube c, unsigned int x) const
Set the variable at position x to false.
void set_true_var(cube c, unsigned int x) const
Set the variable at position x to true.
std::string dump(cube c, const std::vector< std::string > &aps) const
Return the cube bound with atomic proposition names.
void display(const cube c) const
Raw display cube.
bool is_false_var(cube c, unsigned int x) const
Check if the variable at position x is false.
cube intersection(const cube lhs, const cube rhs) const
Return a cube resulting from the intersection of the two cubes.
bool intersect(const cube lhs, const cube rhs) const
Return true if two cubes intersect.
cube alloc() const
Allocate a new cube.
unsigned * cube
A cube is only a set of bits in memory.
Definition: cube.hh:66
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.1