ArKanjo
0.2
A tool for find code duplicated functions in codebases
Loading...
Searching...
No Matches
ast_method.hpp
Go to the documentation of this file.
1
5
#pragma once
6
7
#include <string>
8
#include <tuple>
9
#include <vector>
10
#include <filesystem>
11
#include <
arkanjo/methods/method.hpp
>
12
13
namespace
fs = std::filesystem;
14
15
struct
PostOrderTree
{
16
std::vector<std::string>
labels
;
17
std::vector<int>
lmd
;
18
19
fs::path
path
;
20
};
21
22
class
ASTMethod
:
public
IMethod
{
23
private
:
24
static
constexpr
const
char
* SAVING_MESSAGE =
"Saving results..."
;
25
26
fs::path base_path;
27
double
similarity;
28
29
std::vector<PostOrderTree> processed;
30
50
int
tree_distance(
const
PostOrderTree
& a,
const
PostOrderTree
& b);
51
68
double
similarity_score(
const
PostOrderTree
& a,
const
PostOrderTree
& b);
69
89
std::vector<DuplicationEntry> compare_range(
90
const
std::vector<PostOrderTree>& processed,
91
size_t
begin,
size_t
end
92
);
93
94
void
save_duplications(std::vector<DuplicationEntry>& file_duplication_pairs)
override
;
95
public
:
101
ASTMethod
(
const
fs::path& base_path_,
double
similarity_);
102
103
void
on_function
(
const
FunctionData
& fd)
override
;
104
108
void
execute
()
override
;
109
};
ASTMethod
Definition
ast_method.hpp:22
ASTMethod::ASTMethod
ASTMethod(const fs::path &base_path_, double similarity_)
Constructs preprocessor with configuration.
Definition
ast_method.cpp:92
ASTMethod::on_function
void on_function(const FunctionData &fd) override
Definition
ast_method.cpp:133
ASTMethod::execute
void execute() override
Executes the preprocessing pipeline.
Definition
ast_method.cpp:151
FunctionData
Definition
function_data.hpp:8
IMethod
Definition
method.hpp:13
method.hpp
PostOrderTree
Definition
ast_method.hpp:15
PostOrderTree::path
fs::path path
Definition
ast_method.hpp:19
PostOrderTree::lmd
std::vector< int > lmd
Definition
ast_method.hpp:17
PostOrderTree::labels
std::vector< std::string > labels
Definition
ast_method.hpp:16
include
arkanjo
methods
ast
ast_method.hpp
Generated by
1.12.0