forked from Project-LemonLime/Project_LemonLime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjudgingthread.h
More file actions
96 lines (88 loc) · 2.41 KB
/
judgingthread.h
File metadata and controls
96 lines (88 loc) · 2.41 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
* SPDX-FileCopyrightText: 2011-2018 Project Lemon, Zhipeng Jia
* 2018-2019 Project LemonPlus, Dust1404
* 2019-2022 Project LemonLime
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#pragma once
//
#include "base/LemonType.hpp"
#include "processrunner.h"
#include <QProcessEnvironment>
#include <QThread>
#include <atomic>
class Task;
class JudgingThread : public QThread {
Q_OBJECT
public:
explicit JudgingThread(QObject *parent = nullptr);
// void setCheckRejudgeMode(bool);
void setExtraTimeRatio(double);
void setEnvironment(const QProcessEnvironment &);
void setWorkingDirectory(const QString &);
void setSpecialJudgeTimeLimit(int);
void setExecutableFile(const QString &);
void setArguments(const QString &);
void setAnswerFile(const QString &);
void setInputFile(const QString &);
void setOutputFile(const QString &);
void setDiffPath(const QString &);
void setTask(Task *);
void setFullScore(int);
void setTimeLimit(int);
void setRawTimeLimit(int);
void setMemoryLimit(int);
void setRawMemoryLimit(int);
void setInterpreterAsWatcher(bool);
int getTimeUsed() const;
qint64 getMemoryUsed() const;
int getScore() const;
int getFullScore() const;
int getJudgeTimes() const;
ResultState getResult() const;
const QString &getMessage() const;
bool getNeedRejudge() const;
void run();
private:
// bool checkRejudgeMode;
bool needRejudge;
// Control some extra time program used, like kernel time, judge system fluctuation
double extraTimeRatio{};
QProcessEnvironment environment;
QString workingDirectory;
QString executableFile;
QString arguments;
QString answerFile;
QString inputFile;
QString outputFile;
QString diffPath;
Task *task{};
int specialJudgeTimeLimit{};
int fullScore{};
int timeLimit{};
int rawTimeLimit{};
int memoryLimit{};
int rawMemoryLimit{};
int timeUsed;
qint64 memoryUsed;
int score{};
int judgedTimes;
ResultState result;
QString message;
std::atomic<bool> stopJudging{false};
bool interpreterAsWatcher{};
void compareLineByLine(const QString &);
void compareIgnoreSpaces(const QString &);
void compareWithDiff(const QString &);
void compareRealNumbers(const QString &);
void lemonSpecialJudge(const QString &);
void testlibSpecialJudge(const QString &);
void judgeOutput();
void judgeTraditionalTask();
void judgeAnswersOnlyTask();
// void judgeInteractionTask();
public slots:
void stopJudgingSlot();
};