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>
12
13namespace fs = std::filesystem;
14
16 std::vector<std::string> labels;
17 std::vector<int> lmd;
18
19 fs::path path;
20};
21
22class 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(const fs::path &base_path_, double similarity_)
Constructs preprocessor with configuration.
void on_function(const FunctionData &fd) override
void execute() override
Executes the preprocessing pipeline.
fs::path path
std::vector< int > lmd
std::vector< std::string > labels