diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fbf60cf..6658e336 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,6 +146,7 @@ set(task_module ${lithium_src_dir}/task/task_manager.cpp ${lithium_src_dir}/task/task_stack.cpp ${lithium_src_dir}/task/task_generator.cpp + ${lithium_src_dir}/task/task_container.cpp ) set(Lithium_module @@ -228,7 +229,7 @@ target_link_libraries(lithium_server loguru) target_link_libraries(lithium_server libzippp) target_link_libraries(lithium_server atomstatic) -target_link_libraries(lithium_server lithiumcorestatic) +target_link_libraries(lithium_server atom.propertystatic) target_link_libraries(lithium_server lithiumpluginstatic) if(NOT WIN32) target_link_libraries(lithium_server hydrogenclientstatic) diff --git a/client/lib/api/subsystem_api.dart b/client/lib/api/subsystem_api.dart index 37204438..0f05d649 100644 --- a/client/lib/api/subsystem_api.dart +++ b/client/lib/api/subsystem_api.dart @@ -23,4 +23,31 @@ class SubsystemApi { static removeByIds(data) { return HttpUtil.post('/subsystem/removeByIds', data: data); } + + static loadById(String lib_path, String lib_name, int lib_type) { + return HttpUtil.post('/api/module/load', data: { + {'lib_path': lib_path}, + {"lib_name", lib_name}, + {"lib_type", lib_type} + }); + } + + static unloadById(String lib_path, String lib_name, int lib_type) { + return HttpUtil.post('/api/module/unload', data: { + {"lib_name", lib_name} + }); + } + + static enableById(String lib_path, String lib_name, int lib_type) { + return HttpUtil.post('/api/module/enable', data: { + {'lib_path': lib_path}, + {"lib_name", lib_name} + }); + } + + static disableById(String lib_path, String lib_name, int lib_type) { + return HttpUtil.post('/api/module/disable', data: { + {"lib_name", lib_name} + }); + } } diff --git a/client/lib/common/routes.dart b/client/lib/common/routes.dart index 62c329ab..7d7f1d2d 100644 --- a/client/lib/common/routes.dart +++ b/client/lib/common/routes.dart @@ -53,8 +53,8 @@ class Routes { '/message': MessageMain(), '/subsystemList': SubsystemMain(), '/settingBase': SettingBase(), - '/secondLevel': OnlyText('二级菜单页面'), - '/threeLevel': OnlyText('三级菜单页面'), + //'/secondLevel': OnlyText('二级菜单页面'), + //'/threeLevel': OnlyText('三级菜单页面'), }; static List whiteRoutes = ['/register']; diff --git a/locale/lithium.pot b/locale/lithium.pot index 10264361..dc18e2af 100644 --- a/locale/lithium.pot +++ b/locale/lithium.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: astro_air@126.com\n" -"POT-Creation-Date: 2023-12-30 21:14+0800\n" +"POT-Creation-Date: 2024-01-01 12:32+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/src/atom/CMakeLists.txt b/src/atom/CMakeLists.txt index 7ed15ebc..18aaca26 100644 --- a/src/atom/CMakeLists.txt +++ b/src/atom/CMakeLists.txt @@ -9,6 +9,7 @@ add_subdirectory(type) add_subdirectory(web) add_subdirectory(connection) add_subdirectory(components) +add_subdirectory(property) if(NOT HAS_STD_FORMAT) find_package(fmt REQUIRED) diff --git a/src/atom/property/CMakeLists.txt b/src/atom/property/CMakeLists.txt new file mode 100644 index 00000000..ace1df59 --- /dev/null +++ b/src/atom/property/CMakeLists.txt @@ -0,0 +1,70 @@ +cmake_minimum_required(VERSION 3.20) +project(atom.property C CXX) + +# Sources +list(APPEND ${PROJECT_NAME}_SOURCES + task/daemon_task.cpp + task/device_task.cpp + task/loop_task.cpp + task/plugin_task.cpp + task/conditional_task.cpp + task/task.cpp + + base64.cpp + iphoto.cpp + iproperty.cpp + uuid.cpp +) + +# Headers +list(APPEND ${PROJECT_NAME}_HEADERS + task/daemon_task.hpp + task/device_task.hpp + task/loop_task.hpp + task/plugin_task.hpp + task/conditional_task.hpp + task/task.hpp + + base64.hpp + iphoto.hpp + iproperty.hpp + uuid.hpp + sha256.hpp +) + +# Private Headers +list(APPEND ${PROJECT_NAME}_PRIVATE_HEADERS + +) + +# Build Object Library +add_library(${PROJECT_NAME}_OBJECT OBJECT) +set_property(TARGET ${PROJECT_NAME}_OBJECT PROPERTY POSITION_INDEPENDENT_CODE 1) + +target_link_libraries(${PROJECT_NAME}_OBJECT loguru) + +target_sources(${PROJECT_NAME}_OBJECT + PUBLIC + ${${PROJECT_NAME}_HEADERS} + PRIVATE + ${${PROJECT_NAME}_SOURCES} + ${${PROJECT_NAME}_PRIVATE_HEADERS} +) + +target_link_libraries(${PROJECT_NAME}_OBJECT ${${PROJECT_NAME}_LIBS}) + +add_library(${PROJECT_NAME}static STATIC) + +target_link_libraries(${PROJECT_NAME}static ${PROJECT_NAME}_OBJECT ${${PROJECT_NAME}_LIBS}) +target_link_libraries(${PROJECT_NAME}static ${CMAKE_THREAD_LIBS_INIT}) +target_include_directories(${PROJECT_NAME}static PUBLIC .) + +set_target_properties(${PROJECT_NAME}static PROPERTIES + VERSION ${CMAKE_HYDROGEN_VERSION_STRING} + SOVERSION ${HYDROGEN_SOVERSION} + OUTPUT_NAME ${PROJECT_NAME} # this same name like shared library - backwards compatibility +) + +install(TARGETS ${PROJECT_NAME}static + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) \ No newline at end of file diff --git a/src/atom/property/task/conditional_task.cpp b/src/atom/property/task/conditional_task.cpp index 3b3246dd..376e962e 100644 --- a/src/atom/property/task/conditional_task.cpp +++ b/src/atom/property/task/conditional_task.cpp @@ -31,31 +31,28 @@ Description: Conditional Task Definition #include "conditional_task.hpp" -namespace Lithium +ConditionalTask::ConditionalTask(const std::function &condition_fn, + const json ¶ms, + const std::function &task_fn, + std::function &stop_fn) + : BasicTask(stop_fn, stop_fn != nullptr), condition_fn_(condition_fn), params_(params), task_fn_(task_fn) {} + +// Executes the task +const json ConditionalTask::execute() { - ConditionalTask::ConditionalTask(const std::function &condition_fn, - const json ¶ms, - const std::function &task_fn, - std::function &stop_fn) - : BasicTask(stop_fn, stop_fn != nullptr), condition_fn_(condition_fn), params_(params), task_fn_(task_fn) {} - - // Executes the task - const json ConditionalTask::execute() + if (condition_fn_(params_)) { - if (condition_fn_(params_)) - { - task_fn_(params_); - } - done_ = true; - return {{"status", "done"}}; + task_fn_(params_); } + done_ = true; + return {{"status", "done"}}; +} - // Serializes the task to a JSON object - const json ConditionalTask::toJson() const - { - auto json = BasicTask::toJson(); - json["type"] = "conditional"; - json["params"] = params_; - return json; - } -} // namespace Lithium +// Serializes the task to a JSON object +const json ConditionalTask::toJson() const +{ + auto json = BasicTask::toJson(); + json["type"] = "conditional"; + json["params"] = params_; + return json; +} \ No newline at end of file diff --git a/src/atom/property/task/conditional_task.hpp b/src/atom/property/task/conditional_task.hpp index bbb6cec3..01952941 100644 --- a/src/atom/property/task/conditional_task.hpp +++ b/src/atom/property/task/conditional_task.hpp @@ -33,43 +33,40 @@ Description: Conditional Task Definition #include "task.hpp" -namespace Lithium +class ConditionalTask : public Atom::Task::BasicTask { - class ConditionalTask : public BasicTask - { - public: - /** - * @brief ConditionalTask类构造函数 - * @param condition_fn 条件函数,用于判断是否执行任务 - * @param params 任务参数 - * @param task_fn 任务函数,用于执行任务逻辑 - * @param stop_fn 一个可选的停止函数,默认为nullptr - */ - ConditionalTask(const std::function &condition_fn, - const json ¶ms, - const std::function &task_fn, - std::function &stop_fn); +public: + /** + * @brief ConditionalTask类构造函数 + * @param condition_fn 条件函数,用于判断是否执行任务 + * @param params 任务参数 + * @param task_fn 任务函数,用于执行任务逻辑 + * @param stop_fn 一个可选的停止函数,默认为nullptr + */ + ConditionalTask(const std::function &condition_fn, + const json ¶ms, + const std::function &task_fn, + std::function &stop_fn); - /** - * @brief 执行任务的虚函数,由子类实现具体逻辑 - * @return 以json格式返回任务执行结果 - */ - virtual const json execute() override; + /** + * @brief 执行任务的虚函数,由子类实现具体逻辑 + * @return 以json格式返回任务执行结果 + */ + virtual const json execute() override; - /** - * @brief 将任务序列化为JSON对象 - * @return 表示任务的JSON对象 - */ - virtual const json toJson() const override; + /** + * @brief 将任务序列化为JSON对象 + * @return 表示任务的JSON对象 + */ + virtual const json toJson() const override; - private: - // 条件函数,用于判断是否执行任务 - std::function condition_fn_; +private: + // 条件函数,用于判断是否执行任务 + std::function condition_fn_; - // 任务参数 - json params_; + // 任务参数 + json params_; - // 任务函数,用于执行任务逻辑 - std::function task_fn_; - }; -} \ No newline at end of file + // 任务函数,用于执行任务逻辑 + std::function task_fn_; +}; \ No newline at end of file diff --git a/src/atom/property/task/daemon_task.cpp b/src/atom/property/task/daemon_task.cpp index 102b1f46..de2b3c93 100644 --- a/src/atom/property/task/daemon_task.cpp +++ b/src/atom/property/task/daemon_task.cpp @@ -31,23 +31,21 @@ Description: Daemon Task Definition #include "daemon_task.hpp" -namespace Lithium +DaemonTask::DaemonTask(const std::function &task_fn, + std::function &stop_fn) + : BasicTask(stop_fn, true), task_fn_(task_fn) { - DaemonTask::DaemonTask(const std::function &task_fn, - std::function &stop_fn) - : BasicTask(stop_fn, true), task_fn_(task_fn) - { - } +} - const json DaemonTask::execute() - { - // 执行任务的具体逻辑实现 +const json DaemonTask::execute() +{ + // 执行任务的具体逻辑实现 #if __cplusplus >= 202002L - std::jthread task_thread([this](std::stop_token stoken) - { + std::jthread task_thread([this](std::stop_token stoken) + { #else - std::jthread task_thread([this](std::stop_token stoken) - { + std::jthread task_thread([this](std::stop_token stoken) + { #endif while (!stoken.stop_requested()) { @@ -57,24 +55,22 @@ namespace Lithium } } done_ = true; }); - task_thread.detach(); // 分离任务线程 - return {{"status", "running"}}; - } + task_thread.detach(); // 分离任务线程 + return {{"status", "running"}}; +} - const json DaemonTask::toJson() const - { - auto json = BasicTask::toJson(); - json["type"] = "daemon"; - return json; - } +const json DaemonTask::toJson() const +{ + auto json = BasicTask::toJson(); + json["type"] = "daemon"; + return json; +} - void DaemonTask::runTask() +void DaemonTask::runTask() +{ + while (!stop_flag_) { - while (!stop_flag_) - { - task_fn_(); - } - done_ = true; + task_fn_(); } - -} \ No newline at end of file + done_ = true; +} diff --git a/src/atom/property/task/daemon_task.hpp b/src/atom/property/task/daemon_task.hpp index bcf9df5a..4353d497 100644 --- a/src/atom/property/task/daemon_task.hpp +++ b/src/atom/property/task/daemon_task.hpp @@ -33,37 +33,34 @@ Description: Daemon Task Definition #include "task.hpp" -namespace Lithium +class DaemonTask : public Atom::Task::BasicTask { - class DaemonTask : public BasicTask - { - public: - /** - * @brief 构造函数 - * @param task_fn 任务函数 - * @param stop_fn 任务停止函数 - */ - DaemonTask(const std::function &task_fn, - std::function &stop_fn); +public: + /** + * @brief 构造函数 + * @param task_fn 任务函数 + * @param stop_fn 任务停止函数 + */ + DaemonTask(const std::function &task_fn, + std::function &stop_fn); - /** - * @brief 执行任务 - * @return JSON对象表示的任务状态 - */ - const json execute() override; + /** + * @brief 执行任务 + * @return JSON对象表示的任务状态 + */ + const json execute() override; - /** - * @brief 将任务序列化为JSON对象 - * @return JSON对象表示的任务 - */ - const json toJson() const override; + /** + * @brief 将任务序列化为JSON对象 + * @return JSON对象表示的任务 + */ + const json toJson() const override; - private: - std::function task_fn_; // 任务函数 +private: + std::function task_fn_; // 任务函数 - /** - * @brief 在循环中运行任务的线程 - */ - void runTask(); - }; -} \ No newline at end of file + /** + * @brief 在循环中运行任务的线程 + */ + void runTask(); +}; \ No newline at end of file diff --git a/src/atom/property/task/device_task.hpp b/src/atom/property/task/device_task.hpp index 1850c899..108443b3 100644 --- a/src/atom/property/task/device_task.hpp +++ b/src/atom/property/task/device_task.hpp @@ -33,7 +33,7 @@ Description: Device Task Definition #include "task.hpp" -class DeviceTask : public Lithium::SimpleTask +class DeviceTask : public Atom::Task::SimpleTask { public: /** diff --git a/src/atom/property/task/loop_task.cpp b/src/atom/property/task/loop_task.cpp index 882258eb..a55beb69 100644 --- a/src/atom/property/task/loop_task.cpp +++ b/src/atom/property/task/loop_task.cpp @@ -31,33 +31,29 @@ Description: Loop Task Definition #include "loop_task.hpp" -namespace Lithium -{ - LoopTask::LoopTask(const std::function &item_fn, - const json ¶ms, - std::function &stop_fn) - : BasicTask(stop_fn, stop_fn != nullptr), item_fn_(item_fn), params_(params) {} +LoopTask::LoopTask(const std::function &item_fn, + const json ¶ms, + std::function &stop_fn) + : BasicTask(stop_fn, stop_fn != nullptr), item_fn_(item_fn), params_(params) {} - const json LoopTask::execute() +const json LoopTask::execute() +{ + for (const auto &item : params_["items"]) { - for (const auto &item : params_["items"]) + if (stop_flag_) { - if (stop_flag_) - { - break; - } - item_fn_({{"item", item}}); + break; } - done_ = true; - return {{"status", "done"}}; - } - - const json LoopTask::toJson() const - { - auto json = BasicTask::toJson(); - json["type"] = "loop"; - json["params"] = params_; - return json; + item_fn_({{"item", item}}); } + done_ = true; + return {{"status", "done"}}; +} +const json LoopTask::toJson() const +{ + auto json = BasicTask::toJson(); + json["type"] = "loop"; + json["params"] = params_; + return json; } \ No newline at end of file diff --git a/src/atom/property/task/loop_task.hpp b/src/atom/property/task/loop_task.hpp index b485c7fb..8291de01 100644 --- a/src/atom/property/task/loop_task.hpp +++ b/src/atom/property/task/loop_task.hpp @@ -33,38 +33,35 @@ Description: Loop Task Definition #include "task.hpp" -namespace Lithium +class LoopTask : public Atom::Task::BasicTask { - class LoopTask : public BasicTask - { - public: - /** - * @brief LoopTask类构造函数 - * @param item_fn 单项任务函数,对每个参数执行一次 - * @param params 任务参数 - * @param stop_fn 一个可选的停止函数,默认为nullptr - */ - LoopTask(const std::function &item_fn, - const json ¶ms, - std::function &stop_fn); +public: + /** + * @brief LoopTask类构造函数 + * @param item_fn 单项任务函数,对每个参数执行一次 + * @param params 任务参数 + * @param stop_fn 一个可选的停止函数,默认为nullptr + */ + LoopTask(const std::function &item_fn, + const json ¶ms, + std::function &stop_fn); - /** - * @brief 执行任务的虚函数,由子类实现具体逻辑 - * @return 以json格式返回任务执行结果 - */ - virtual const json execute() override; + /** + * @brief 执行任务的虚函数,由子类实现具体逻辑 + * @return 以json格式返回任务执行结果 + */ + virtual const json execute() override; - /** - * @brief 将任务序列化为JSON对象 - * @return 表示任务的JSON对象 - */ - virtual const json toJson() const override; + /** + * @brief 将任务序列化为JSON对象 + * @return 表示任务的JSON对象 + */ + virtual const json toJson() const override; - private: - // 单项任务函数,对每个参数执行一次 - std::function item_fn_; +private: + // 单项任务函数,对每个参数执行一次 + std::function item_fn_; - // 任务参数 - json params_; - }; -} \ No newline at end of file + // 任务参数 + json params_; +}; \ No newline at end of file diff --git a/src/atom/property/task/plugin_task.hpp b/src/atom/property/task/plugin_task.hpp index a5ead4cf..9c7a708d 100644 --- a/src/atom/property/task/plugin_task.hpp +++ b/src/atom/property/task/plugin_task.hpp @@ -33,7 +33,7 @@ Description: Plugin Task Definition #include "task.hpp" -class PluginTask : public Lithium::SimpleTask +class PluginTask : public Atom::Task::SimpleTask { public: /** diff --git a/src/atom/property/task/task.cpp b/src/atom/property/task/task.cpp index 71748ea7..3202f315 100644 --- a/src/atom/property/task/task.cpp +++ b/src/atom/property/task/task.cpp @@ -31,7 +31,7 @@ Description: Basic and Simple Task Definition #include "task.hpp" -namespace Lithium +namespace Atom::Task { BasicTask::BasicTask(const std::function &stop_fn, bool can_stop) : stop_fn_(stop_fn), can_stop_(stop_fn != nullptr), stop_flag_(false) {} diff --git a/src/atom/property/task/task.hpp b/src/atom/property/task/task.hpp index ca7026d3..abde275a 100644 --- a/src/atom/property/task/task.hpp +++ b/src/atom/property/task/task.hpp @@ -44,7 +44,7 @@ Description: Basic and Simple Task Definition #include "atom/type/json.hpp" using json = nlohmann::json; -namespace Lithium +namespace Atom::Task { class BasicTask { diff --git a/src/components/device/device_manager.hpp b/src/components/device/device_manager.hpp index 1bbf6a3e..5fb11deb 100644 --- a/src/components/device/device_manager.hpp +++ b/src/components/device/device_manager.hpp @@ -37,9 +37,9 @@ Description: Device Manager #include #include -#include "core/device.hpp" -#include "core/device_type.hpp" -#include "atom/server/message.hpp" +#include "atom/driver/device.hpp" +#include "core/driver/device_type.hpp" +#include "atom/type/message.hpp" #include "error/error_code.hpp" diff --git a/src/task/task_container.cpp b/src/task/task_container.cpp new file mode 100644 index 00000000..9c360280 --- /dev/null +++ b/src/task/task_container.cpp @@ -0,0 +1,39 @@ +#include "task_container.hpp" + +void TaskContainer::AddTask(const std::shared_ptr &task) +{ + std::lock_guard lock(mutex); + tasks[task->getName()] = task; +} + +std::shared_ptr TaskContainer::GetTask(const std::string &name) +{ + std::lock_guard lock(mutex); + auto it = tasks.find(name); + if (it != tasks.end()) + { + return it->second; + } + return nullptr; +} + +void TaskContainer::RemoveTask(const std::string &name) +{ + std::lock_guard lock(mutex); + auto it = tasks.find(name); + if (it != tasks.end()) + { + tasks.erase(it); + } +} + +std::vector> TaskContainer::GetAllTasks() +{ + std::lock_guard lock(mutex); + std::vector> result; + for (const auto &pair : tasks) + { + result.push_back(pair.second); + } + return result; +} diff --git a/src/task/task_container.hpp b/src/task/task_container.hpp new file mode 100644 index 00000000..f376186f --- /dev/null +++ b/src/task/task_container.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include "atom/property/task/task.hpp" + +#include + +#ifdef ENABLE_FASTHASH +#include "emhash/hash_table8.hpp" +#else +#include +#endif + +class TaskContainer +{ +public: + void AddTask(const std::shared_ptr &task); + + std::shared_ptr GetTask(const std::string &name); + + void RemoveTask(const std::string &name); + + std::vector> GetAllTasks(); + +private: + std::unordered_map> tasks; + std::mutex mutex; +}; diff --git a/src/task/task_generator.cpp b/src/task/task_generator.cpp index 99572d86..b2bf3a3c 100644 --- a/src/task/task_generator.cpp +++ b/src/task/task_generator.cpp @@ -38,7 +38,6 @@ Description: Task Generator #include "atom/log/loguru.hpp" namespace fs = std::filesystem; -using json = nlohmann::json; namespace Lithium::Task { diff --git a/src/task/task_generator.hpp b/src/task/task_generator.hpp index f8571be8..d0bd2a44 100644 --- a/src/task/task_generator.hpp +++ b/src/task/task_generator.hpp @@ -40,9 +40,11 @@ Description: Task Generator #endif #include -#include "device/device_manager.hpp" -#include "plugin/plugin_loader.hpp" -#include "core/property/task/task.hpp" +#include "components/device/device_manager.hpp" +#include "components/plugin/plugin_loader.hpp" +#include "atom/property/task/task.hpp" + +using json = nlohmann::json; namespace Lithium::Task { @@ -58,8 +60,8 @@ namespace Lithium::Task bool generateTasks(const std::string &jsonFileName); private: - bool parseJsonFile(const std::string &jsonFileName, nlohmann::json &jsonTasks); - void saveTasksToJson(const std::string &jsonFileName, const nlohmann::json &jsonTasks); + bool parseJsonFile(const std::string &jsonFileName, json &jsonTasks); + void saveTasksToJson(const std::string &jsonFileName, const json &jsonTasks); void getTasksFromManagers(); private: diff --git a/src/task/task_manager.cpp b/src/task/task_manager.cpp index 86d844bf..6916c0de 100644 --- a/src/task/task_manager.cpp +++ b/src/task/task_manager.cpp @@ -39,7 +39,7 @@ namespace Lithium::Task TaskManager::TaskManager(const std::string &fileName) : m_FileName(fileName), m_StopFlag(false) {} - bool TaskManager::addTask(const std::shared_ptr &task) + bool TaskManager::addTask(const std::shared_ptr &task) { if (!task) { @@ -52,7 +52,7 @@ namespace Lithium::Task return true; } - bool TaskManager::insertTask(const std::shared_ptr &task, int position) + bool TaskManager::insertTask(const std::shared_ptr &task, int position) { if (!task) { @@ -139,7 +139,7 @@ namespace Lithium::Task return false; } - bool TaskManager::modifyTask(int index, const std::shared_ptr &task) + bool TaskManager::modifyTask(int index, const std::shared_ptr &task) { if (!task) { @@ -158,7 +158,7 @@ namespace Lithium::Task return true; } - bool TaskManager::modifyTaskByName(const std::string &name, const std::shared_ptr &task) + bool TaskManager::modifyTaskByName(const std::string &name, const std::shared_ptr &task) { auto it = findTaskByName(name); if (it != m_TaskMap.end() && task) @@ -212,7 +212,7 @@ namespace Lithium::Task return false; } - const std::vector> &TaskManager::getTaskList() const + const std::vector> &TaskManager::getTaskList() const { return m_TaskList; } @@ -241,10 +241,10 @@ namespace Lithium::Task return true; } - std::unordered_map>::iterator TaskManager::findTaskByName(const std::string &name) + std::unordered_map>::iterator TaskManager::findTaskByName(const std::string &name) { return std::find_if(m_TaskMap.begin(), m_TaskMap.end(), - [&](const std::pair> &item) + [&](const std::pair> &item) { return item.second->getName() == name; }); diff --git a/src/task/task_manager.hpp b/src/task/task_manager.hpp index 173675d0..5ade865b 100644 --- a/src/task/task_manager.hpp +++ b/src/task/task_manager.hpp @@ -42,7 +42,7 @@ Description: Task Manager #include #include -#include "core/property/task/task.hpp" +#include "atom/property/task/task.hpp" #include "atom/type/json.hpp" namespace Lithium::Task @@ -64,7 +64,7 @@ namespace Lithium::Task * @param task 要添加的任务指针。 * @return 添加成功返回 true,否则返回 false。 */ - bool addTask(const std::shared_ptr &task); + bool addTask(const std::shared_ptr &task); /** * @brief 在指定位置插入任务到任务列表。 @@ -72,7 +72,7 @@ namespace Lithium::Task * @param position 要插入的位置索引。 * @return 插入成功返回 true,否则返回 false。 */ - bool insertTask(const std::shared_ptr &task, int position); + bool insertTask(const std::shared_ptr &task, int position); /** * @brief 执行所有任务。 @@ -98,7 +98,7 @@ namespace Lithium::Task * @param task 新的任务指针。 * @return 修改成功返回 true,否则返回 false。 */ - bool modifyTask(int index, const std::shared_ptr &task); + bool modifyTask(int index, const std::shared_ptr &task); /** * @brief 根据任务名称修改任务。 @@ -106,7 +106,7 @@ namespace Lithium::Task * @param task 新的任务指针。 * @return 修改成功返回 true,否则返回 false。 */ - bool modifyTaskByName(const std::string &name, const std::shared_ptr &task); + bool modifyTaskByName(const std::string &name, const std::shared_ptr &task); /** * @brief 删除指定位置的任务。 @@ -133,7 +133,7 @@ namespace Lithium::Task * @brief 获取任务列表。 * @return 任务列表的常量引用。 */ - const std::vector> &getTaskList() const; + const std::vector> &getTaskList() const; /** * @brief 将任务列表保存为 JSON 文件。 @@ -142,8 +142,8 @@ namespace Lithium::Task bool saveTasksToJson() const; private: - std::vector> m_TaskList; /**< 任务列表 */ - std::unordered_map> m_TaskMap; /**< 任务名称到任务指针的映射表 */ + std::vector> m_TaskList; /**< 任务列表 */ + std::unordered_map> m_TaskMap; /**< 任务名称到任务指针的映射表 */ std::string m_FileName; /**< 任务列表的文件名 */ bool m_StopFlag; /**< 停止标志,用于中止当前正在执行的任务 */ @@ -152,7 +152,7 @@ namespace Lithium::Task * @param name 任务名称。 * @return 找到的任务指针的迭代器,如果未找到则返回 m_TaskMap.end()。 */ - std::unordered_map>::iterator findTaskByName(const std::string &name); + std::unordered_map>::iterator findTaskByName(const std::string &name); }; } // namespace Lithium diff --git a/src/websocket/WsServer.hpp b/src/websocket/WsServer.hpp index 6c627d79..f2195975 100644 --- a/src/websocket/WsServer.hpp +++ b/src/websocket/WsServer.hpp @@ -51,7 +51,7 @@ Description: WebSocket Server #include "atom/server/serialize.hpp" #include "atom/server/deserialize.hpp" -#include "atom/server/message.hpp" +#include "atom/type/message.hpp" class MessageBus;