spot 2.16
Loading...
Searching...
No Matches
stats.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/twaalgos/sccinfo.hh>
23#include <iosfwd>
24#include <spot/misc/formater.hh>
25
26namespace spot
27{
28
31
33 struct SPOT_API twa_statistics
34 {
35 unsigned edges;
36 unsigned states;
37
38 twa_statistics() { edges = 0; states = 0; }
40 std::ostream& dump(std::ostream& out) const;
41 };
42
44 struct SPOT_API twa_sub_statistics: public twa_statistics
45 {
46 unsigned long long transitions;
47
48 twa_sub_statistics() { transitions = 0; }
50 std::ostream& dump(std::ostream& out) const;
51 };
52
57
59 SPOT_API unsigned long long
61
63 class SPOT_API printable_formula: public printable_value<formula>
64 {
65 public:
69 {
70 val_ = new_val;
71 return *this;
72 }
73
75 virtual void
76 print(std::ostream& os, const char*) const override;
77 };
78
81 class SPOT_API printable_acc_cond final: public spot::printable
82 {
83 acc_cond val_;
84 public:
87 operator=(const acc_cond& new_val)
88 {
89 val_ = new_val;
90 return *this;
91 }
92
94 void print(std::ostream& os, const char* pos) const override;
95 };
96
99 class SPOT_API printable_scc_info final:
100 public spot::printable
101 {
102 std::unique_ptr<scc_info> val_;
103 public:
106 {
107 val_ = std::make_unique<scc_info>(aut);
108 }
109
111 void reset()
112 {
113 val_ = nullptr;
114 }
115
117 void print(std::ostream& os, const char* pos) const override;
118 };
119
122 class SPOT_API printable_size final:
123 public spot::printable
124 {
125 unsigned reachable_ = 0;
126 unsigned all_ = 0;
127 public:
129 void set(unsigned reachable, unsigned all)
130 {
131 reachable_ = reachable;
132 all_ = all;
133 }
134
136 void print(std::ostream& os, const char* pos) const override;
137 };
138
141 class SPOT_API printable_long_size final:
142 public spot::printable
143 {
144 unsigned long long reachable_ = 0;
145 unsigned long long all_ = 0;
146 public:
148 void set(unsigned long long reachable, unsigned long long all)
149 {
150 reachable_ = reachable;
151 all_ = all;
152 }
153
155 void print(std::ostream& os, const char* pos) const override;
156 };
157
163 class SPOT_API stat_printer: protected formater
164 {
165 public:
167 stat_printer(std::ostream& os, const char* format);
168
173 std::ostream&
174 print(const const_twa_graph_ptr& aut, formula f = nullptr);
175
176 private:
177 const char* format_;
178
179 printable_formula form_;
180 printable_size states_;
181 printable_size edges_;
182 printable_long_size trans_;
185 printable_value<unsigned> nondetstates_;
186 printable_value<unsigned> deterministic_;
188 printable_acc_cond gen_acc_;
189 };
190
192}
An acceptance condition.
Definition acc.hh:54
A string formatter that dispatches %-escape sequences to printable objects.
Definition formater.hh:130
Main class for temporal logic formula.
Definition formula.hh:847
A printable wrapper for an acceptance condition, for use in format strings.
Definition stats.hh:82
printable_acc_cond & operator=(const acc_cond &new_val)
Assign a new acceptance condition value.
Definition stats.hh:87
void print(std::ostream &os, const char *pos) const override
Print the acceptance condition to an output stream.
A printable wrapper for a formula, for use in format strings.
Definition stats.hh:64
printable_formula & operator=(formula new_val)
Assign a new formula value.
Definition stats.hh:68
virtual void print(std::ostream &os, const char *) const override
Print the formula to an output stream.
A printable wrapper reporting reachable and total transition counts as long long.
Definition stats.hh:143
void print(std::ostream &os, const char *pos) const override
Print the long size to an output stream.
void set(unsigned long long reachable, unsigned long long all)
Set the reachable and total counts.
Definition stats.hh:148
A printable wrapper for SCC information of an automaton, for use in format strings.
Definition stats.hh:101
void print(std::ostream &os, const char *pos) const override
Print SCC statistics to an output stream.
void reset()
Clear the stored SCC information.
Definition stats.hh:111
void automaton(const const_twa_graph_ptr &aut)
Compute SCC information for the given automaton.
Definition stats.hh:105
A printable wrapper reporting reachable and total state/edge counts.
Definition stats.hh:124
void set(unsigned reachable, unsigned all)
Set the reachable and total counts.
Definition stats.hh:129
void print(std::ostream &os, const char *pos) const override
Print the size to an output stream.
A printable wrapper around a value of type T.
Definition formater.hh:50
Abstract base class for objects that can be printed to a stream via a format string.
Definition formater.hh:35
prints various statistics about a TGBA
Definition stats.hh:164
stat_printer(std::ostream &os, const char *format)
Construct with an output stream and a format string.
std::ostream & print(const const_twa_graph_ptr &aut, formula f=nullptr)
print the configured statistics.
std::shared_ptr< const twa > const_twa_ptr
Shared pointer to a const twa.
Definition fwd.hh:36
twa_statistics stats_reachable(const const_twa_ptr &g)
Compute statistics for an automaton.
unsigned long long count_all_transitions(const const_twa_graph_ptr &g)
Count all transitions, even unreachable ones.
twa_sub_statistics sub_stats_reachable(const const_twa_ptr &g)
Compute sub statistics for an automaton.
std::shared_ptr< const twa_graph > const_twa_graph_ptr
Shared pointer to a const twa_graph.
Definition fwd.hh:41
Definition automata.hh:26
Basic statistics (states and edges counts) for a TωA.
Definition stats.hh:34
unsigned states
Number of states in the automaton.
Definition stats.hh:36
unsigned edges
Number of edges in the automaton.
Definition stats.hh:35
std::ostream & dump(std::ostream &out) const
Dump statistics to an output stream.
Extended statistics including transition counts for a TωA.
Definition stats.hh:45
unsigned long long transitions
Number of transitions in the automaton.
Definition stats.hh:46
std::ostream & dump(std::ostream &out) const
Dump statistics to an output stream.

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