OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::BBLTask Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/ProjectTask.hpp>

Collaboration diagram for Slic3r::BBLTask:

Public Types

enum  TaskStatus { TASK_ACTIVE = 0 , TASK_INACTIVE = 1 }

Public Member Functions

 BBLTask (BBLProfile *profile=nullptr)
std::string task_status_str ()
int parse_content_json (std::string json)

Public Attributes

std::string task_id
std::string task_name
std::string task_create_time
TaskStatus task_status
std::wstring task_file
std::string task_url
std::string task_url_md5
std::wstring task_dst_url
BBLProfile * profile_
std::string task_project_id
std::string task_model_id
std::string task_profile_id
std::vector< BBLSubTask * > subtasks
std::map< std::string, BBLSliceInfo * > slice_info

Detailed Description

Member Enumeration Documentation

◆ TaskStatus

Enumerator
TASK_ACTIVE 
TASK_INACTIVE 
249 {
250 TASK_ACTIVE = 0,
251 TASK_INACTIVE = 1,
252 };
@ TASK_INACTIVE
Definition ProjectTask.hpp:251
@ TASK_ACTIVE
Definition ProjectTask.hpp:250

Constructor & Destructor Documentation

◆ BBLTask()

Slic3r::BBLTask::BBLTask ( BBLProfile * profile = nullptr)
49 {
50 profile_ = nullptr;
51 if (profile) {
52 profile_ = profile;
53 task_profile_id = profile->profile_id;
54 task_project_id = profile->project_id;
55 }
56 }
std::string task_profile_id
Definition ProjectTask.hpp:268
BBLProfile * profile_
Definition ProjectTask.hpp:265
std::string task_project_id
Definition ProjectTask.hpp:266

References profile_, Slic3r::BBLProfile::profile_id, Slic3r::BBLProfile::project_id, task_profile_id, and task_project_id.

Member Function Documentation

◆ parse_content_json()

int Slic3r::BBLTask::parse_content_json ( std::string json)
135 {
136 try {
137 std::stringstream ss(json);
138 pt::ptree root;
139 pt::read_json(ss, root);
140
141 for (int i = 0; i < subtasks.size(); i++) {
142 delete subtasks[i];
143 }
144 subtasks.clear();
145 if (root.get_child_optional("subtasks")!= boost::none) {
146 pt::ptree subtask_list = root.get_child("subtasks");
147 for (auto subtask = subtask_list.begin(); subtask != subtask_list.end(); ++subtask) {
148 BBLSubTask* new_subtask = new BBLSubTask(this);
149 /* create subtasks */
150 boost::optional<std::string> subtask_id = subtask->second.get_optional<std::string>("id");
151 if (subtask_id.has_value()) new_subtask->task_id = subtask_id.value();
152
153 boost::optional<std::string> subtask_name = subtask->second.get_optional<std::string>("name");
154 if (subtask_name.has_value()) new_subtask->task_name = subtask_name.value();
155
156 boost::optional<std::string> subtask_create_time = subtask->second.get_optional<std::string>("create_time");
157 if (subtask_create_time.has_value()) new_subtask->task_create_time = subtask_create_time.value();
158
159 boost::optional<std::string> subtask_plate_idx = subtask->second.get_optional<std::string>("plate_idx");
160 if (subtask_plate_idx.has_value()) new_subtask->task_partplate_idx = subtask_plate_idx.value();
161
162 boost::optional<std::string> subtask_printer = subtask->second.get_optional<std::string>("printer");
163 if (subtask_printer.has_value()) new_subtask->task_printer_dev_id = subtask_printer.value();
164
165 boost::optional<std::string> subtask_weight = subtask->second.get_optional<std::string>("weight");
166 if (subtask_weight.has_value()) new_subtask->task_weight = subtask_weight.value();
167 subtasks.push_back(new_subtask);
168 }
169 }
170 }
171 catch (...) {
172 BOOST_LOG_TRIVIAL(trace) << "parse_content_json failed! json=" << json;
173 }
174 return 0;
175 }
std::vector< BBLSubTask * > subtasks
Definition ProjectTask.hpp:269
void trace(unsigned int level, const char *message)
Definition utils.cpp:247
nlohmann::json json
Definition AssembleList.cpp:42

References subtasks, Slic3r::BBLSubTask::task_create_time, Slic3r::BBLSubTask::task_id, Slic3r::BBLSubTask::task_name, Slic3r::BBLSubTask::task_partplate_idx, Slic3r::BBLSubTask::task_printer_dev_id, Slic3r::BBLSubTask::task_weight, and Slic3r::trace().

Here is the call graph for this function:

◆ task_status_str()

std::string Slic3r::BBLTask::task_status_str ( )
inline
272 {
274 return "active";
275 }
277 return "inactive";
278 }
279 else {
280 return "inactive";
281 }
282 }
TaskStatus task_status
Definition ProjectTask.hpp:260

References TASK_ACTIVE, TASK_INACTIVE, and task_status.

Member Data Documentation

◆ profile_

BBLProfile* Slic3r::BBLTask::profile_

Referenced by BBLTask().

◆ slice_info

std::map<std::string, BBLSliceInfo*> Slic3r::BBLTask::slice_info

◆ subtasks

std::vector<BBLSubTask*> Slic3r::BBLTask::subtasks

Referenced by parse_content_json().

◆ task_create_time

std::string Slic3r::BBLTask::task_create_time

◆ task_dst_url

std::wstring Slic3r::BBLTask::task_dst_url

◆ task_file

std::wstring Slic3r::BBLTask::task_file

◆ task_id

std::string Slic3r::BBLTask::task_id

◆ task_model_id

std::string Slic3r::BBLTask::task_model_id

◆ task_name

std::string Slic3r::BBLTask::task_name

◆ task_profile_id

std::string Slic3r::BBLTask::task_profile_id

◆ task_project_id

std::string Slic3r::BBLTask::task_project_id

◆ task_status

TaskStatus Slic3r::BBLTask::task_status

Referenced by task_status_str().

◆ task_url

std::string Slic3r::BBLTask::task_url

◆ task_url_md5

std::string Slic3r::BBLTask::task_url_md5

The documentation for this class was generated from the following files: