1 #pragma once 2 #include <nlohmann/json.hpp> 3 4 namespace task 5 { 6 // clang-format off 7 8 enum class TaskState{ 9 Invalid, 10 New, 11 Starting, 12 Running, 13 Suspended, 14 Interrupted, 15 Pending, 16 Stopping, 17 Completed, 18 Killed, 19 Exception, 20 Service, 21 Cancelling, 22 Cancelled, 23 }; 24 25 NLOHMANN_JSON_SERIALIZE_ENUM(TaskState, { 26 {TaskState::Invalid, "Invalid"}, 27 {TaskState::New, "New"}, 28 {TaskState::Starting, "Starting"}, 29 {TaskState::Running, "Running"}, 30 {TaskState::Suspended, "Suspended"}, 31 {TaskState::Interrupted, "Interrupted"}, 32 {TaskState::Pending, "Pending"}, 33 {TaskState::Stopping, "Stopping"}, 34 {TaskState::Completed, "Completed"}, 35 {TaskState::Killed, "Killed"}, 36 {TaskState::Exception, "Exception"}, 37 {TaskState::Service, "Service"}, 38 {TaskState::Cancelling, "Cancelling"}, 39 {TaskState::Cancelled, "Cancelled"}, 40 }); 41 42 } 43 // clang-format on 44