LydiaSyft
ExplicitStateDfaAdd.h
1 #ifndef EXPLICIT_STATE_DFA_ADD_H
2 #define EXPLICIT_STATE_DFA_ADD_H
3 
4 #include <exception>
5 #include <istream>
6 #include <memory>
7 #include <unordered_map>
8 #include <vector>
9 
10 #include "VarMgr.h"
11 #include "ExplicitStateDfa.h"
12 
13 namespace Syft {
14 
19  private:
20  std::shared_ptr<VarMgr> var_mgr_;
21 
22  size_t initial_state_;
23  size_t state_count_;
24  std::vector<size_t> final_states_;
25  std::vector<CUDD::ADD> transition_function_;
26 
27  ExplicitStateDfaAdd(std::shared_ptr<VarMgr> var_mgr);
28 
29  static CUDD::ADD build_add(
30  std::size_t node_index,
31  const std::shared_ptr<VarMgr> &var_mgr,
32  const std::vector<std::string> &variable_names,
33  const std::vector<std::vector<int>> &node_table,
34  std::unordered_map<std::size_t, CUDD::ADD> &add_table);
35 
36  static CUDD::ADD build_add_from_dfa(
37  unsigned node_index,
38  const std::shared_ptr<VarMgr> &var_mgr,
39  const std::vector<std::string> &variable_names,
40  const ExplicitStateDfa &explicit_dfa,
41  std::unordered_map<std::size_t, CUDD::ADD> &add_table);
42 
43  public:
44 
52  static ExplicitStateDfaAdd from_dfa_mona(std::shared_ptr<VarMgr> var_mgr,
53  const ExplicitStateDfa &explicit_dfa);
54 
58  std::shared_ptr<VarMgr> var_mgr() const;
59 
63  std::size_t initial_state() const;
64 
68  std::size_t state_count() const;
69 
73  std::vector<std::size_t> final_states() const;
74 
80  std::vector<CUDD::ADD> transition_function() const;
81 
87  void dump_dot(const std::string &filename) const;
88  };
89 
90 }
91 
92 #endif // EXPLICIT_STATE_DFA_ADD_H
A DFA with explicit states and symbolic transitions represented in ADDs.
Definition: ExplicitStateDfaAdd.h:18
std::vector< CUDD::ADD > transition_function() const
Returns the transition function of the DFA as a vector of ADDs.
Definition: ExplicitStateDfaAdd.cpp:125
std::size_t state_count() const
Returns the number of states in the DFA.
Definition: ExplicitStateDfaAdd.cpp:117
std::size_t initial_state() const
Returns the initial state of the DFA.
Definition: ExplicitStateDfaAdd.cpp:113
std::vector< std::size_t > final_states() const
Returns the list of indices of final states of the DFA.
Definition: ExplicitStateDfaAdd.cpp:121
std::shared_ptr< VarMgr > var_mgr() const
Returns the variable manager.
Definition: ExplicitStateDfaAdd.cpp:109
static ExplicitStateDfaAdd from_dfa_mona(std::shared_ptr< VarMgr > var_mgr, const ExplicitStateDfa &explicit_dfa)
Constructs an explicit-state DFA in ADD representation from an explicit-state DFA.
Definition: ExplicitStateDfaAdd.cpp:44
void dump_dot(const std::string &filename) const
Saves the transition function of the DFA in a .dot file.
Definition: ExplicitStateDfaAdd.cpp:129
A DFA with explicit states and symbolic transitions.
Definition: ExplicitStateDfa.h:22