ACAV f0ba4b7c9529
Abstract Syntax Tree (AST) visualization tool for C, C++, and Objective-C
Loading...
Searching...
No Matches
QueryDependenciesParallelRunner.h
Go to the documentation of this file.
1/*$!{
2* Aurora Clang AST Viewer (ACAV)
3*
4* Copyright (c) 2026 Min Liu
5* Copyright (c) 2026 Michael David Adams
6*
7* SPDX-License-Identifier: GPL-2.0-or-later
8*
9* This program is free software; you can redistribute it and/or modify
10* it under the terms of the GNU General Public License as published by
11* the Free Software Foundation; either version 2 of the License, or
12* (at your option) any later version.
13*
14* This program is distributed in the hope that it will be useful,
15* but WITHOUT ANY WARRANTY; without even the implied warranty of
16* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17* GNU General Public License for more details.
18*
19* You should have received a copy of the GNU General Public License along
20* with this program; if not, see <https://www.gnu.org/licenses/>.
21}$!*/
22
25#pragma once
26
28#include <QElapsedTimer>
29#include <QJsonObject>
30
31namespace acav {
32
46class QueryDependenciesParallelRunner : public ParallelProcessRunner {
47 Q_OBJECT
48
49public:
50 explicit QueryDependenciesParallelRunner(QObject *parent = nullptr);
51 ~QueryDependenciesParallelRunner() override = default;
52
57 void run(const QString &compilationDatabasePath,
58 const QString &outputFilePath,
59 const QString &queryDependenciesBinary = QString());
60
63 void setClangResourceDir(const QString &dir) { clangResourceDir_ = dir; }
64
65signals:
67 void dependenciesReady(const QJsonObject &dependencies);
68
70 void dependenciesReadyWithErrors(const QJsonObject &dependencies,
71 const QStringList &errorMessages);
72
73protected:
75 QStringList prepareProcessArguments(
76 int chunkIndex,
77 const QStringList &chunkData,
78 const QString &tempOutputPath) override;
79
81 bool mergeResults(
82 const QStringList &tempOutputPaths,
83 const QString &finalOutputPath,
84 QString &errorMessage) override;
85
87 void onAllCompleted(int successCount, int failureCount, int totalCount) override;
88
89private:
90 QString compilationDatabasePath_;
91 QString queryDependenciesBinary_;
92 QString clangResourceDir_;
93 QElapsedTimer elapsed_;
94};
95
96} // namespace acav
Generic parallel process runner for executing multiple instances of a program.
bool mergeResults(const QStringList &tempOutputPaths, const QString &finalOutputPath, QString &errorMessage) override
Merge JSON dependency files.
void dependenciesReadyWithErrors(const QJsonObject &dependencies, const QStringList &errorMessages)
Emitted when processes complete with some errors.
void run(const QString &compilationDatabasePath, const QString &outputFilePath, const QString &queryDependenciesBinary=QString())
Run query-dependencies in parallel.
void dependenciesReady(const QJsonObject &dependencies)
Emitted when all processes complete successfully.
QStringList prepareProcessArguments(int chunkIndex, const QStringList &chunkData, const QString &tempOutputPath) override
Build command-line arguments for query-dependencies.
void onAllCompleted(int successCount, int failureCount, int totalCount) override
Handle completion and emit domain-specific signals.
void setClangResourceDir(const QString &dir)
Set the Clang resource directory.