-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdomain_fsm.cpp
More file actions
26 lines (20 loc) · 838 Bytes
/
domain_fsm.cpp
File metadata and controls
26 lines (20 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "domain_fsm.h"
Domain_FSM::Domain_FSM()
{
}
pair<string, int> Domain_FSM::find_rule(set<string> flow_tags)
{
// map< set<string> , pair<string, int> >::iterator transition_table_iter;
set<string> diff_set;
for(auto transition_table_iter = this->transition_table.begin(); transition_table_iter != this->transition_table.end(); ++transition_table_iter)
{
diff_set.erase(diff_set.begin(),diff_set.end());
set_difference((*transition_table_iter).first.begin(),(*transition_table_iter).first.end(),
flow_tags.begin(), flow_tags.end(), inserter(diff_set,diff_set.begin()));
if (diff_set.size() == 0) // this is needed rule
{
return (*transition_table_iter).second;
}
}
return pair<string,int>("NONE",0); // there is NO such rule
}