Learn Environment
task_parser.hpp
Go to the documentation of this file.
1 #ifndef TASK_PARSER_HPP
2 #define TASK_PARSER_HPP
3 
4 #include "common/task.hpp"
5 
6 #include <QVector>
7 #include <QString>
8 #include <QSharedPointer>
9 #include <nlohmann/json.hpp>
10 
18 class TaskParser {
19 public:
33  QVector<QSharedPointer<Task>> loadTasks(const QString& taskPath, const QString& difficultyPath, const QString& topicPath);
34 
35 
36 private:
37  using json = nlohmann::json;
38 
47  QVector<QSharedPointer<Task>> parseTasks(const json& taskJsonData, const json& difficultyJsonData, const json& topicJsonData);
48 
56  QVector<Subtask> parseSubtasks(const json& subtasksJson, QSharedPointer<Task> parentTask);
57 };
58 
59 #endif // TASK_PARSER_HPP
FolderStructureConstants::USER_WORKSPACE
const QString USER_WORKSPACE
Path to the user workspace directory. Adjust it in devconatiner.json if changed.
Definition: folder_structure_constants.hpp:63
Subtask::evaluationFilePath
QString evaluationFilePath
The file path to the evaluation script of the subtask.
Definition: task.hpp:37
json
nlohmann::json json
Definition: notebook_converter.cpp:12
task.hpp
Subtask::file
QString file
The file name of the subtask.
Definition: task.hpp:34
folder_structure_constants.hpp
TaskParser::loadTasks
QVector< QSharedPointer< Task > > loadTasks(const QString &taskPath, const QString &difficultyPath, const QString &topicPath)
Loads tasks with all configuration JSON files.
Definition: task_parser.cpp:33
Subtask::timeoutSeconds
int timeoutSeconds
The timeout for the subtask execution in seconds.
Definition: task.hpp:40
Subtask::solutionFilePath
QString solutionFilePath
The file path to the solution of the subtask.
Definition: task.hpp:36
Subtask::description
QString description
The description of the subtask.
Definition: task.hpp:33
Subtask::title
QString title
The title of the subtask.
Definition: task.hpp:32
FolderStructureConstants::getPackagePath
QString getPackagePath()
Retrieves the path of the package.
Definition: folder_structure_constants.hpp:80
Subtask::parentTask
QWeakPointer< Task > parentTask
Weak pointer to the parent task.
Definition: task.hpp:45
FolderStructureConstants::SOLUTION_SCRIPTS_SOURCE_PATH
const QString SOLUTION_SCRIPTS_SOURCE_PATH
Path to the solution scripts source directory.
Definition: folder_structure_constants.hpp:51
FolderStructureConstants::EVALUATION_SCRIPTS_SOURCE_PATH
const QString EVALUATION_SCRIPTS_SOURCE_PATH
Path to the evaluation scripts source directory.
Definition: folder_structure_constants.hpp:57
Subtask::filePath
QString filePath
The file path of the subtask.
Definition: task.hpp:35
TaskParser
Parses tasks and subtasks from a JSON file.
Definition: task_parser.hpp:18
task_parser.hpp
json
nlohmann::json json
Definition: task_parser.cpp:9
Subtask::reset_robot_before_executing
bool reset_robot_before_executing
Whether to reset the robot before executing the subtask.
Definition: task.hpp:42
Subtask::parallelizedEvaluationRequired
bool parallelizedEvaluationRequired
Whether parallelized evaluation is required.
Definition: task.hpp:41
Task
Represents a task containing multiple subtasks.
Definition: task.hpp:61
Subtask
Represents a subtask within a task.
Definition: task.hpp:31