Awali
Another Weighted Automata library
history.hh
Go to the documentation of this file.
1 // This file is part of Awali.
2 // Copyright 2016-2022 Sylvain Lombardy, Victor Marsault, Jacques Sakarovitch
3 //
4 // Awali is a free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef AWALI_HISTORY_HH
18 # define AWALI_HISTORY_HH
19 
20 # include <iostream>
21 #include<vector>
22 #include <awali/common/types.hh>
23 #include <awali/common/enums.hh>
24 #include <awali/sttc/ctx/traits.hh>
25 
26 namespace awali {
27  namespace sttc {
28 
29 
30  // enum class history_kind_t {
31  // SINGLE, TUPLE, RATEXP, STRING, NO_HISTORY, PARTITION
32  // };
40  class history_base {
41  public:
42 
43  virtual std::ostream&
44  print_state_name(state_t s, std::ostream& o,
45  const std::string& fmt = "text") const = 0;
46 
47 
48  virtual history_kind_t get_nature() const =0;
49 
50  virtual bool has_history() const {
51  return true;
52  }
53 
54  virtual bool has_history(state_t) const =0;
55 
56  virtual bool remove_history(state_t) =0;
57 
58  template<typename H>
59  H& as()
60  {
61  return dynamic_cast<H&>(*this);
62  }
63 
64  template<typename H>
65  H& as() const
66  {
67  return dynamic_cast<const H&>(*this);
68  }
69 
70  virtual state_t get_state(state_t s) = 0;
71  virtual std::vector<state_t> get_state_set(state_t s) = 0;
72 
73  virtual ~history_base() {}
74  };
75  }
76 }//end of ns awali::stc
77 
78 #endif // !AWALI_HISTORY_HH
base type for history of automata
Definition: history.hh:40
virtual ~history_base()
Definition: history.hh:73
virtual bool remove_history(state_t)=0
H & as()
Definition: history.hh:59
virtual bool has_history() const
Definition: history.hh:50
virtual history_kind_t get_nature() const =0
virtual bool has_history(state_t) const =0
H & as() const
Definition: history.hh:65
virtual std::vector< state_t > get_state_set(state_t s)=0
virtual std::ostream & print_state_name(state_t s, std::ostream &o, const std::string &fmt="text") const =0
virtual state_t get_state(state_t s)=0
history_kind_t
The different kinds of history.
Definition: enums.hh:178
Main namespace of Awali.
Definition: ato.hh:22
unsigned state_t
Definition: types.hh:21