GEGELATI
policyStats.h
1
36#ifndef POLICY_STATS_H
37#define POLICY_STATS_H
38
39#include <iostream>
40#include <map>
41#include <vector>
42
43#include "instructions/instruction.h"
44
45#include "program/program.h"
46
47#include "tpg/tpgAction.h"
48#include "tpg/tpgGraph.h"
49#include "tpg/tpgTeam.h"
50
51namespace TPG {
52
67 {
68 private:
70 const Environment* environment = nullptr;
71
73 std::vector<std::reference_wrapper<const Data::DataHandler>>
74 dataSourcesAndRegisters;
75
76 public:
83 std::map<const Program::Program*, size_t> nbUsePerProgram;
84
91 std::map<const TPGTeam*, size_t> nbUsePerTPGTeam;
92
99 std::map<const TPGAction*, size_t> nbUsePerTPGAction;
100
102 std::vector<size_t> nbLinesPerProgram;
103
105 std::vector<size_t> nbIntronPerProgram;
106
112 std::map<size_t, size_t> nbUsagePerInstruction;
113
121 std::map<std::pair<size_t, size_t>, size_t> nbUsagePerDataLocation;
122
124 std::vector<size_t> nbOutgoingEdgesPerTeam;
125
130 std::map<size_t, size_t> nbUsagePerActionID;
131
133 size_t maxPolicyDepth = 0;
134
142 std::map<size_t, size_t> nbTPGVertexPerDepthLevel;
143
145 size_t nbDistinctTeams = 0;
146
148 PolicyStats() = default;
149
153 void clear();
154
163 void setEnvironment(const Environment& env);
164
172 void analyzeLine(const Program::Line* line);
173
191 void analyzeProgram(const Program::Program* prog);
192
204 void analyzeTPGTeam(const TPG::TPGTeam* team);
205
216 void analyzeTPGAction(const TPG::TPGAction* action);
217
229 void analyzePolicy(const TPG::TPGVertex* vertex);
230
231 friend std::ostream& operator<<(std::ostream& os,
232 const PolicyStats& policyStats);
233 };
234
236 std::ostream& operator<<(std::ostream& os, const PolicyStats& policyStats);
237} // namespace TPG
238
239#endif
The Environment class contains all information needed to execute a Program.
Definition: environment.h:84
Definition: line.h:48
The Program class contains a list of program lines that can be executed within a well defined Environ...
Definition: program.h:53
Definition: policyStats.h:67
std::vector< size_t > nbLinesPerProgram
Number of lines of analyzed Program.
Definition: policyStats.h:102
std::map< size_t, size_t > nbUsagePerInstruction
Definition: policyStats.h:112
std::vector< size_t > nbIntronPerProgram
Number of intron lines of analyzed Program.
Definition: policyStats.h:105
void analyzeLine(const Program::Line *line)
Analyze the given Line.
Definition: policyStats.cpp:68
size_t nbDistinctTeams
Number of distinct TPGTeams per policy.
Definition: policyStats.h:145
size_t maxPolicyDepth
Depth of the analyzed policy.
Definition: policyStats.h:133
void setEnvironment(const Environment &env)
Set Environement used during analyses.
Definition: policyStats.cpp:58
std::map< std::pair< size_t, size_t >, size_t > nbUsagePerDataLocation
Definition: policyStats.h:121
std::vector< size_t > nbOutgoingEdgesPerTeam
Number of outgoing TPGEdge of per TPGTeam of the TPGGraph.
Definition: policyStats.h:124
PolicyStats()=default
Default constructor.
void analyzeTPGAction(const TPG::TPGAction *action)
Definition: policyStats.cpp:144
void analyzeProgram(const Program::Program *prog)
Analyze the given Program.
Definition: policyStats.cpp:102
std::map< const TPGTeam *, size_t > nbUsePerTPGTeam
Number of time a TPGTeam was analyzed.
Definition: policyStats.h:91
friend std::ostream & operator<<(std::ostream &os, const PolicyStats &policyStats)
Overload of the stream output operator for the PolicyStats class.
std::map< size_t, size_t > nbTPGVertexPerDepthLevel
Definition: policyStats.h:142
std::map< size_t, size_t > nbUsagePerActionID
Definition: policyStats.h:130
void clear()
Definition: policyStats.cpp:42
std::map< const TPGAction *, size_t > nbUsePerTPGAction
Number of time a TPGAction was analyzed.
Definition: policyStats.h:99
std::map< const Program::Program *, size_t > nbUsePerProgram
Number of time a Program was analyzed.
Definition: policyStats.h:83
void analyzeTPGTeam(const TPG::TPGTeam *team)
Definition: policyStats.cpp:132
void analyzePolicy(const TPG::TPGVertex *vertex)
Definition: policyStats.cpp:153
Class representing an Action of a TPGGraph.
Definition: tpgAction.h:52
Definition: tpgTeam.h:48
Abstract class representing the vertices of a TPGGraph.
Definition: tpgVertex.h:49
Definition: tpgActionInstrumented.h:8
std::ostream & operator<<(std::ostream &os, const PolicyStats &policyStats)
Overload of the stream output operator for the PolicyStats class.
Definition: policyStats.cpp:197