From b14a42d4c818f19ba6a6e5457820edb1c0cf77da Mon Sep 17 00:00:00 2001 From: wyc <1104749580@qq.com> Date: Sat, 1 Aug 2026 09:53:27 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=94=E7=A6=BB=E9=98=B2=E6=AD=A2=E9=87=8D?= =?UTF-8?q?=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rd/magic_enum/export.h | 579 +++++++++--------- Core/Base/global_include.cpp | 5 - Core/Base/global_include.h | 13 - {Core => src/Psc_Cpp_Core}/Base/Check.cpp | 0 {Core => src/Psc_Cpp_Core}/Base/Check.h | 0 {Core => src/Psc_Cpp_Core}/Base/Coro_Result.h | 0 .../Psc_Cpp_Core}/Base/File_Helper.cpp | 0 {Core => src/Psc_Cpp_Core}/Base/File_Helper.h | 2 +- {Core => src/Psc_Cpp_Core}/Base/JSON.cpp | 0 {Core => src/Psc_Cpp_Core}/Base/JSON.h | 0 {Core => src/Psc_Cpp_Core}/Base/Object_Pool.h | 0 .../Psc_Cpp_Core}/Base/RingBuffer.hpp | 2 +- .../Psc_Cpp_Core}/Base/SM_RingBuffer.cpp | 10 +- .../Psc_Cpp_Core}/Base/SM_RingBuffer.h | 0 .../Psc_Cpp_Core}/Base/ThreadManager.cpp | 0 .../Psc_Cpp_Core}/Base/ThreadManager.h | 12 +- {Core => src/Psc_Cpp_Core}/Base/fmt.h | 0 .../Psc_Cpp_Core}/Net_Adapter/Net_Adapter.cpp | 0 .../Psc_Cpp_Core}/Net_Adapter/Net_Adapter.h | 0 .../Net_Adapter/Net_Adapter_linux.cpp | 4 +- .../Net_Adapter/Net_Adapter_win.cpp | 0 {Core => src/Psc_Cpp_Core}/Serial/Serial.cpp | 18 +- {Core => src/Psc_Cpp_Core}/Serial/Serial.h | 0 .../Psc_Cpp_Core}/Serial/Serial_Coro.h | 0 .../Psc_Cpp_Core}/Serial/Serial_linux.cpp | 0 {Core => src/Psc_Cpp_Core}/Serial/Serial_p.h | 2 +- .../Psc_Cpp_Core}/Serial/Serial_win.cpp | 0 .../Shared_Memory/Shared_Memory.cpp | 4 +- .../Shared_Memory/Shared_Memory.h | 0 .../Shared_Memory/Shared_Memory_linux.cpp | 17 +- .../Shared_Memory/Shared_Memory_win.cpp | 0 .../Statistics/Frequency_Limit.cpp | 0 .../Statistics/Frequency_Limit.h | 0 .../Psc_Cpp_Core}/Statistics/Statistics.cpp | 0 .../Psc_Cpp_Core}/Statistics/Statistics.h | 0 .../Psc_Cpp_Core}/Statistics/export.h | 0 .../Psc_Cpp_Core}/Statistics/global.h | 2 +- .../Psc_Cpp_Core}/socket/ASIO_Utils.h | 2 +- {Core => src/Psc_Cpp_Core}/socket/ByteOrder.h | 0 {Core => src/Psc_Cpp_Core}/socket/Socket.cpp | 0 {Core => src/Psc_Cpp_Core}/socket/Socket.h | 5 +- .../Psc_Cpp_Core}/socket/Socket_Coro.h | 0 .../Psc_Cpp_Core}/socket/TCP_Client.cpp | 0 .../Psc_Cpp_Core}/socket/TCP_Client.h | 0 .../Psc_Cpp_Core}/socket/TCP_Server.cpp | 0 .../Psc_Cpp_Core}/socket/TCP_Server.h | 14 +- .../Psc_Cpp_Core}/socket/UDP_Client.cpp | 0 .../Psc_Cpp_Core}/socket/UDP_Client.h | 0 .../Psc_Cpp_Core}/socket/UDP_Server.cpp | 0 .../Psc_Cpp_Core}/socket/UDP_Server.h | 0 {Core => src/Psc_Cpp_Core}/socket/export.h | 0 {Core => src/Psc_Cpp_Core}/socket/global.h | 0 {Core => src/Psc_Cpp_Core}/spdlog/export.cpp | 49 +- {Core => src/Psc_Cpp_Core}/spdlog/export.h | 0 {Core => src/Psc_Cpp_Core}/system/export.cpp | 39 +- {Core => src/Psc_Cpp_Core}/system/export.h | 0 {Core => src/Psc_Cpp_Core}/system/linux.cpp | 15 +- {Core => src/Psc_Cpp_Core}/system/win.cpp | 64 +- .../Psc_Cpp_Core}/system/windows_include.h | 0 {Core => src/Psc_Cpp_Core}/todolist.txt | 0 .../Channel_Simulator/Channel_Simulator.cpp | 0 .../Channel_Simulator/Channel_Simulator.h | 0 .../Flow_Channel_Simulator.cpp | 0 .../Flow_Channel_Simulator.h | 0 .../Packet_Channel_Simulator.cpp | 0 .../Packet_Channel_Simulator.h | 2 +- .../Channel_Simulator/global.cpp | 0 .../Channel_Simulator/global.h | 0 .../transmit_protocol/core/core.cpp | 4 +- .../transmit_protocol/core/main.h | 0 .../transmit_protocol/core/statistics.cpp | 0 .../transmit_protocol/core/statistics.h | 0 .../transmit_protocol/dtls/handshake.cpp | 0 .../transmit_protocol/dtls/handshake.h | 0 .../transmit_protocol/export.cpp | 0 .../Psc_Cpp_Core}/transmit_protocol/export.h | 0 .../transmit_protocol/feclib/Makefile | 0 .../transmit_protocol/feclib/change_list.txt | 0 .../feclib/documentation.html | 0 .../transmit_protocol/feclib/fec.c | 0 .../transmit_protocol/feclib/fec.h | 0 .../transmit_protocol/feclib/fec.rar | Bin .../transmit_protocol/feclib/feclib.spec | 0 .../transmit_protocol/feclib/fectest.c | 0 .../transmit_protocol/feclib/index.html | 0 .../transmit_protocol/global.cpp | 0 .../Psc_Cpp_Core}/transmit_protocol/global.h | 0 .../transmit_protocol/global_tree.cpp | 0 .../transmit_protocol/kcp深度结合fec.txt | 0 .../transmit_protocol/kfec/FEC_CB.cpp | 5 +- .../transmit_protocol/kfec/FEC_CB.h | 2 +- .../transmit_protocol/kfec/Recv_FEC_Frame.cpp | 0 .../transmit_protocol/kfec/Recv_FEC_Frame.h | 0 .../transmit_protocol/kfec/Send_FEC_Frame.cpp | 0 .../transmit_protocol/kfec/Send_FEC_Frame.h | 0 .../transmit_protocol/kfec/global.cpp | 0 .../transmit_protocol/kfec/global.h | 0 .../transmit_protocol/kfec/这一版很多问题 | 0 .../other_node/Empty_Transmit.cpp | 0 .../other_node/Empty_Transmit.h | 0 .../other_node/SRP_Fixed_CB.cpp | 88 +-- .../other_node/SRP_Fixed_CB.h | 4 +- .../other_node/Transmission_Test.cpp | 0 .../other_node/Transmission_Test.h | 2 +- .../other_node/Universal_Unpacker.h | 2 +- .../other_node/Universal_Unpacker.hpp | 0 .../other_node/Universal_Unpacker_Impl.hpp | 0 .../other_node/udp_serial.cpp | 0 .../transmit_protocol/other_node/udp_serial.h | 0 .../other_node/udp_serial.mermaid | 0 .../transmit_protocol/session/session | 0 .../transmit_protocol/session/tls算法流程 | 0 .../transmit_protocol/udp_fec_s/global.h | 0 .../transmit_protocol/udp_fec_s/udp_fec.cpp | 0 .../transmit_protocol/udp_fec_s/udp_fec.h | 2 +- .../udp_fec_s/udp_fec_recv.cpp | 0 .../udp_fec_s/udp_fec_send.cpp | 0 .../transmit_protocol/uthash/LICENSE | 0 .../transmit_protocol/uthash/utarray.h | 0 .../transmit_protocol/uthash/uthash.h | 0 .../transmit_protocol/uthash/utlist.h | 0 .../transmit_protocol/uthash/utringbuffer.h | 0 .../transmit_protocol/uthash/utstack.h | 0 .../transmit_protocol/uthash/utstring.h | 0 .../transmit_protocol/warp_kcp/LICENSE | 0 .../transmit_protocol/warp_kcp/kcp.cpp | 0 .../transmit_protocol/warp_kcp/kcp.h | 0 .../transmit_protocol/warp_kcp/protocol.txt | 0 .../transmit_protocol/warp_kcp/warp_kcp.cpp | 0 .../transmit_protocol/warp_kcp/warp_kcp.h | 0 .../transmit_protocol/协议分析文档.md | 0 .../性能测试记录/kcp__udp_fec_on_800_1000.png | Bin .../kcp__udp_fec_on_800_1000_自动调整算法.png | Bin .../性能测试记录/udp_fec_on_800_1000.png | Bin .../性能测试记录/修改统计的测试后数据.png | Bin .../性能测试记录/性能测试记录.md | 0 .../Psc_Cpp_Core}/transmit_protocol/文档.md | 0 .../private_psc_global_include}/Bit.cpp | 0 .../private_psc_global_include}/Bit.h | 0 .../private_psc_global_include}/Fail_Fast.cpp | 6 +- .../private_psc_global_include}/Fail_Fast.h | 0 .../private_psc_global_include}/RET.hpp | 0 .../private_psc_global_include}/Singleton.hpp | 0 .../private_psc_global_include}/Spin_Lock.cpp | 11 +- .../private_psc_global_include}/Spin_Lock.h | 0 .../private_psc_global_include}/assert.h | 0 .../private_psc_global_include}/codec.cpp | 0 .../private_psc_global_include}/codec.h | 0 .../core_global_include.h | 0 .../private_psc_global_include}/error.hpp | 0 .../private_psc_global_include}/expected.h | 0 .../private_psc_global_include}/export.h | 0 .../inter_global.h | 0 153 files changed, 478 insertions(+), 508 deletions(-) delete mode 100644 Core/Base/global_include.cpp delete mode 100644 Core/Base/global_include.h rename {Core => src/Psc_Cpp_Core}/Base/Check.cpp (100%) rename {Core => src/Psc_Cpp_Core}/Base/Check.h (100%) rename {Core => src/Psc_Cpp_Core}/Base/Coro_Result.h (100%) rename {Core => src/Psc_Cpp_Core}/Base/File_Helper.cpp (100%) rename {Core => src/Psc_Cpp_Core}/Base/File_Helper.h (97%) rename {Core => src/Psc_Cpp_Core}/Base/JSON.cpp (100%) rename {Core => src/Psc_Cpp_Core}/Base/JSON.h (100%) rename {Core => src/Psc_Cpp_Core}/Base/Object_Pool.h (100%) rename {Core => src/Psc_Cpp_Core}/Base/RingBuffer.hpp (99%) rename {Core => src/Psc_Cpp_Core}/Base/SM_RingBuffer.cpp (97%) rename {Core => src/Psc_Cpp_Core}/Base/SM_RingBuffer.h (100%) rename {Core => src/Psc_Cpp_Core}/Base/ThreadManager.cpp (100%) rename {Core => src/Psc_Cpp_Core}/Base/ThreadManager.h (79%) rename {Core => src/Psc_Cpp_Core}/Base/fmt.h (100%) rename {Core => src/Psc_Cpp_Core}/Net_Adapter/Net_Adapter.cpp (100%) rename {Core => src/Psc_Cpp_Core}/Net_Adapter/Net_Adapter.h (100%) rename {Core => src/Psc_Cpp_Core}/Net_Adapter/Net_Adapter_linux.cpp (99%) rename {Core => src/Psc_Cpp_Core}/Net_Adapter/Net_Adapter_win.cpp (100%) rename {Core => src/Psc_Cpp_Core}/Serial/Serial.cpp (96%) rename {Core => src/Psc_Cpp_Core}/Serial/Serial.h (100%) rename {Core => src/Psc_Cpp_Core}/Serial/Serial_Coro.h (100%) rename {Core => src/Psc_Cpp_Core}/Serial/Serial_linux.cpp (100%) rename {Core => src/Psc_Cpp_Core}/Serial/Serial_p.h (86%) rename {Core => src/Psc_Cpp_Core}/Serial/Serial_win.cpp (100%) rename {Core => src/Psc_Cpp_Core}/Shared_Memory/Shared_Memory.cpp (89%) rename {Core => src/Psc_Cpp_Core}/Shared_Memory/Shared_Memory.h (100%) rename {Core => src/Psc_Cpp_Core}/Shared_Memory/Shared_Memory_linux.cpp (91%) rename {Core => src/Psc_Cpp_Core}/Shared_Memory/Shared_Memory_win.cpp (100%) rename {Core => src/Psc_Cpp_Core}/Statistics/Frequency_Limit.cpp (100%) rename {Core => src/Psc_Cpp_Core}/Statistics/Frequency_Limit.h (100%) rename {Core => src/Psc_Cpp_Core}/Statistics/Statistics.cpp (100%) rename {Core => src/Psc_Cpp_Core}/Statistics/Statistics.h (100%) rename {Core => src/Psc_Cpp_Core}/Statistics/export.h (100%) rename {Core => src/Psc_Cpp_Core}/Statistics/global.h (83%) rename {Core => src/Psc_Cpp_Core}/socket/ASIO_Utils.h (95%) rename {Core => src/Psc_Cpp_Core}/socket/ByteOrder.h (100%) rename {Core => src/Psc_Cpp_Core}/socket/Socket.cpp (100%) rename {Core => src/Psc_Cpp_Core}/socket/Socket.h (96%) rename {Core => src/Psc_Cpp_Core}/socket/Socket_Coro.h (100%) rename {Core => src/Psc_Cpp_Core}/socket/TCP_Client.cpp (100%) rename {Core => src/Psc_Cpp_Core}/socket/TCP_Client.h (100%) rename {Core => src/Psc_Cpp_Core}/socket/TCP_Server.cpp (100%) rename {Core => src/Psc_Cpp_Core}/socket/TCP_Server.h (93%) rename {Core => src/Psc_Cpp_Core}/socket/UDP_Client.cpp (100%) rename {Core => src/Psc_Cpp_Core}/socket/UDP_Client.h (100%) rename {Core => src/Psc_Cpp_Core}/socket/UDP_Server.cpp (100%) rename {Core => src/Psc_Cpp_Core}/socket/UDP_Server.h (100%) rename {Core => src/Psc_Cpp_Core}/socket/export.h (100%) rename {Core => src/Psc_Cpp_Core}/socket/global.h (100%) rename {Core => src/Psc_Cpp_Core}/spdlog/export.cpp (90%) rename {Core => src/Psc_Cpp_Core}/spdlog/export.h (100%) rename {Core => src/Psc_Cpp_Core}/system/export.cpp (92%) rename {Core => src/Psc_Cpp_Core}/system/export.h (100%) rename {Core => src/Psc_Cpp_Core}/system/linux.cpp (97%) rename {Core => src/Psc_Cpp_Core}/system/win.cpp (91%) rename {Core => src/Psc_Cpp_Core}/system/windows_include.h (100%) rename {Core => src/Psc_Cpp_Core}/todolist.txt (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/Channel_Simulator/Channel_Simulator.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/Channel_Simulator/Channel_Simulator.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/Channel_Simulator/Flow_Channel_Simulator.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/Channel_Simulator/Flow_Channel_Simulator.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/Channel_Simulator/Packet_Channel_Simulator.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/Channel_Simulator/Packet_Channel_Simulator.h (97%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/Channel_Simulator/global.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/Channel_Simulator/global.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/core/core.cpp (99%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/core/main.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/core/statistics.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/core/statistics.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/dtls/handshake.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/dtls/handshake.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/export.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/export.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/feclib/Makefile (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/feclib/change_list.txt (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/feclib/documentation.html (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/feclib/fec.c (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/feclib/fec.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/feclib/fec.rar (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/feclib/feclib.spec (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/feclib/fectest.c (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/feclib/index.html (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/global.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/global.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/global_tree.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/kcp深度结合fec.txt (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/kfec/FEC_CB.cpp (98%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/kfec/FEC_CB.h (96%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/kfec/Recv_FEC_Frame.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/kfec/Recv_FEC_Frame.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/kfec/Send_FEC_Frame.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/kfec/Send_FEC_Frame.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/kfec/global.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/kfec/global.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/kfec/这一版很多问题 (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/other_node/Empty_Transmit.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/other_node/Empty_Transmit.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/other_node/SRP_Fixed_CB.cpp (80%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/other_node/SRP_Fixed_CB.h (85%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/other_node/Transmission_Test.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/other_node/Transmission_Test.h (96%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/other_node/Universal_Unpacker.h (97%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/other_node/Universal_Unpacker.hpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/other_node/Universal_Unpacker_Impl.hpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/other_node/udp_serial.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/other_node/udp_serial.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/other_node/udp_serial.mermaid (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/session/session (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/session/tls算法流程 (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/udp_fec_s/global.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/udp_fec_s/udp_fec.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/udp_fec_s/udp_fec.h (96%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/udp_fec_s/udp_fec_recv.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/udp_fec_s/udp_fec_send.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/uthash/LICENSE (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/uthash/utarray.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/uthash/uthash.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/uthash/utlist.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/uthash/utringbuffer.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/uthash/utstack.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/uthash/utstring.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/warp_kcp/LICENSE (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/warp_kcp/kcp.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/warp_kcp/kcp.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/warp_kcp/protocol.txt (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/warp_kcp/warp_kcp.cpp (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/warp_kcp/warp_kcp.h (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/协议分析文档.md (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/性能测试记录/kcp__udp_fec_on_800_1000.png (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/性能测试记录/kcp__udp_fec_on_800_1000_自动调整算法.png (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/性能测试记录/udp_fec_on_800_1000.png (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/性能测试记录/修改统计的测试后数据.png (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/性能测试记录/性能测试记录.md (100%) rename {Core => src/Psc_Cpp_Core}/transmit_protocol/文档.md (100%) rename {psc_global_include => src/private_psc_global_include}/Bit.cpp (100%) rename {psc_global_include => src/private_psc_global_include}/Bit.h (100%) rename {psc_global_include => src/private_psc_global_include}/Fail_Fast.cpp (93%) rename {psc_global_include => src/private_psc_global_include}/Fail_Fast.h (100%) rename {psc_global_include => src/private_psc_global_include}/RET.hpp (100%) rename {psc_global_include => src/private_psc_global_include}/Singleton.hpp (100%) rename {psc_global_include => src/private_psc_global_include}/Spin_Lock.cpp (81%) rename {psc_global_include => src/private_psc_global_include}/Spin_Lock.h (100%) rename {psc_global_include => src/private_psc_global_include}/assert.h (100%) rename {psc_global_include => src/private_psc_global_include}/codec.cpp (100%) rename {psc_global_include => src/private_psc_global_include}/codec.h (100%) rename {psc_global_include => src/private_psc_global_include}/core_global_include.h (100%) rename {psc_global_include => src/private_psc_global_include}/error.hpp (100%) rename {psc_global_include => src/private_psc_global_include}/expected.h (100%) rename {psc_global_include => src/private_psc_global_include}/export.h (100%) rename {psc_global_include => src/private_psc_global_include}/inter_global.h (100%) diff --git a/3rd/magic_enum/export.h b/3rd/magic_enum/export.h index dd19801..08c3eaa 100644 --- a/3rd/magic_enum/export.h +++ b/3rd/magic_enum/export.h @@ -1,319 +1,304 @@ #pragma once - - - #include "magic_enum/include/magic_enum/magic_enum.hpp" #include #include #include - #include - #include "remove_const.hpp" -#include "Core/Base/global_include.h" - - +#include "Psc_Cpp_Core/Base/global_include.h" namespace Psc { - template - class Copyable_Atomic { - public: - using value_type = T; - Copyable_Atomic() = default; - Copyable_Atomic(T value) : value_(value) {} - Copyable_Atomic(const Copyable_Atomic& other) : value_(other.load()) {} - Copyable_Atomic& operator=(const Copyable_Atomic& other) { - store(other.load()); - return *this; - } - - Copyable_Atomic& operator=(T value) { - store(value); - return *this; - } - T load(std::memory_order order = std::memory_order_seq_cst) const { - return value_.load(order); - } - void store(T value, std::memory_order order = std::memory_order_seq_cst) { - value_.store(value, order); - } - operator T() const { - return load(); - } - private: - std::atomic value_{}; - }; - - template - using clean_t = std::remove_cv_t>; - - namespace PV { - template struct is_copyable_atomic_helper : std::false_type {}; - template struct is_copyable_atomic_helper> : std::true_type {}; - template struct is_copyable_atomic : is_copyable_atomic_helper> {}; - template struct copyable_atomic_value; - template struct copyable_atomic_value> { - using type = U; - }; +template +class Copyable_Atomic { +public: + using value_type = T; + Copyable_Atomic() = default; + Copyable_Atomic(T value) : value_(value) {} + Copyable_Atomic(const Copyable_Atomic& other) : value_(other.load()) {} + Copyable_Atomic& operator=(const Copyable_Atomic& other) { + store(other.load()); + return *this; } - - template - constexpr bool is_copyable_atomic_v = PV::is_copyable_atomic::value; - - template - using copyable_atomic_value_t = typename PV::copyable_atomic_value>::type; - - template struct always_false : std::false_type {}; - template using clean_t = std::remove_cv_t>; - namespace PV { - template struct is_optional_helper : std::false_type {}; - template struct is_optional_helper> : std::true_type {}; - template struct is_optional : is_optional_helper> {}; - template struct optional_value; - template struct optional_value> { - using type = U; - }; + Copyable_Atomic& operator=(T value) { + store(value); + return *this; } - template constexpr bool is_optional_v = PV::is_optional::value; - template using optional_value_t = typename PV::optional_value>::type; - - namespace PV { - template struct is_atomic_helper : std::false_type {}; - template struct is_atomic_helper> : std::true_type {}; - template struct is_atomic : is_atomic_helper> {}; - template struct atomic_value; - template struct atomic_value> { - using type = U; - }; + T load(std::memory_order order = std::memory_order_seq_cst) const { + return value_.load(order); } - template constexpr bool is_atomic_v = PV::is_atomic::value; - template using atomic_value_t = typename PV::atomic_value>::type; - - - namespace PV { - template struct is_shared_ptr_helper : std::false_type {}; - template struct is_shared_ptr_helper> : std::true_type {}; - template struct is_shared_ptr : is_shared_ptr_helper> {}; - - template struct shared_ptr_value; - template struct shared_ptr_value> { using type = U; }; + void store(T value, std::memory_order order = std::memory_order_seq_cst) { + value_.store(value, order); } - - template constexpr bool is_shared_ptr_v = PV::is_shared_ptr::value; - template using shared_ptr_value_t = typename PV::shared_ptr_value>::type; - - - // 泛型函数:将枚举类型和所有值转换为字符串,并返回 - template - std::string get_enum_def_str() { - std::string result; - result += "enum " + std::string(magic_enum::enum_type_name()); - result += "{\n"; - for (auto e : magic_enum::enum_values()) { - result += "\t"; - result += magic_enum::enum_name(e); // 获取枚举值的名字 - result += "\n"; - } - result += "}\n"; - return result; + operator T() const { + return load(); } - - - template - EnumType to_enum(const std::string& str) { - auto opt = magic_enum::enum_cast(str); - if (opt.has_value()) { - return opt.value(); // 返回枚举值 - } - std::cerr << std::string(magic_enum::enum_type_name()) + - " 字符串转换枚举值错误!str:" + str + "\n" + - get_enum_def_str() - + "\n"; - Psc::fail_fast(""); - - return EnumType(); +private: + std::atomic value_{}; +}; +template +using clean_t = std::remove_cv_t>; +namespace PV { +template +struct is_copyable_atomic_helper : std::false_type {}; +template +struct is_copyable_atomic_helper> : std::true_type {}; +template +struct is_copyable_atomic : is_copyable_atomic_helper> {}; +template +struct copyable_atomic_value; +template +struct copyable_atomic_value> { + using type = U; +}; +} +template +constexpr bool is_copyable_atomic_v = PV::is_copyable_atomic::value; +template +using copyable_atomic_value_t = typename PV::copyable_atomic_value>::type; +template +struct always_false : std::false_type {}; +template +using clean_t = std::remove_cv_t>; +namespace PV { +template +struct is_optional_helper : std::false_type {}; +template +struct is_optional_helper> : std::true_type {}; +template +struct is_optional : is_optional_helper> {}; +template +struct optional_value; +template +struct optional_value> { + using type = U; +}; +} +template +constexpr bool is_optional_v = PV::is_optional::value; +template +using optional_value_t = typename PV::optional_value>::type; +namespace PV { +template +struct is_atomic_helper : std::false_type {}; +template +struct is_atomic_helper> : std::true_type {}; +template +struct is_atomic : is_atomic_helper> {}; +template +struct atomic_value; +template +struct atomic_value> { + using type = U; +}; +} +template +constexpr bool is_atomic_v = PV::is_atomic::value; +template +using atomic_value_t = typename PV::atomic_value>::type; +namespace PV { +template +struct is_shared_ptr_helper : std::false_type {}; +template +struct is_shared_ptr_helper> : std::true_type {}; +template +struct is_shared_ptr : is_shared_ptr_helper> {}; +template +struct shared_ptr_value; +template +struct shared_ptr_value> { + using type = U; +}; +} +template +constexpr bool is_shared_ptr_v = PV::is_shared_ptr::value; +template +using shared_ptr_value_t = typename PV::shared_ptr_value>::type; +// 泛型函数:将枚举类型和所有值转换为字符串,并返回 +template +std::string get_enum_def_str() { + std::string result; + result += "enum " + std::string(magic_enum::enum_type_name()); + result += "{\n"; + for (auto e : magic_enum::enum_values()) { + result += "\t"; + result += magic_enum::enum_name(e); // 获取枚举值的名字 + result += "\n"; } - - template - std::optional to_enum2(const std::string& str) { - auto opt = magic_enum::enum_cast(str); - if (opt.has_value()) { - return opt.value(); // 返回枚举值 - } - return std::nullopt; + result += "}\n"; + return result; +} +template +EnumType to_enum(const std::string& str) { + auto opt = magic_enum::enum_cast(str); + if (opt.has_value()) { + return opt.value(); // 返回枚举值 } - - - - - // 其余未考虑到的类型直接实现 other_to_string(T) 就可以了。 - template - struct has_free_to_string : std::false_type {}; - - template - struct has_free_to_string()))> - > : std::true_type {}; - - template - struct has_member_to_string : std::false_type {}; - - template - struct has_member_to_string().to_string())> - > : std::true_type {}; - - - template , - typename C = remove_recursive_top_const_t> - > - std::string to_string(T&& v) { - // 处理 std::string - if constexpr (std::is_same_v) { - return std::forward(v); - } - else if constexpr (std::is_same_v) { - std::stringstream ss; - ss << "0x" << std::setw(sizeof(void*) * 2) << std::setfill('0') << std::hex << reinterpret_cast(v); - return ss.str(); - } - // 处理 char* 类型 - else if constexpr (std::is_same_v) { - return std::string(v); - } - else if constexpr (std::is_same_v) { - return std::string(v); - } - // 处理 wchar_t* 类型 - else if constexpr (std::is_same_v) { - std::wstring ws(v); - return std::string(ws.begin(), ws.end()); // 简单转换为 std::string - } - else if constexpr (std::is_same_v) { - std::wstring ws(v); - return std::string(ws.begin(), ws.end()); // 简单转换为 std::string - } - // 处理 std::wstring 类型 - else if constexpr (std::is_same_v) { - return std::string(v.begin(), v.end()); // 将 std::wstring 转为 std::string - } - // 处理枚举类型 - else if constexpr (std::is_enum_v) { - return std::string(magic_enum::enum_name(v)); // 使用 magic_enum 转换枚举 - } - // 处理 bool 类型 - else if constexpr (std::is_same_v) { - return v ? std::string("true") : std::string("false"); // 对 bool 类型进行自定义转换 - } - // 处理 std::nullptr_t 类型 - else if constexpr (std::is_same_v) { - return std::string("null"); // 对 nullptr 做特殊处理 - } - // 处理算术类型(整数或浮点数) - else if constexpr (std::is_arithmetic_v) { - return std::to_string(v); // 使用 std::to_string 转换数值类型 - } - else if constexpr (is_atomic_v) { - return to_string(v.load()); - } - else if constexpr (is_copyable_atomic_v) { - return to_string(v.load()); - } - else if constexpr (is_optional_v) { - return v.has_value() ? to_string(v.value()) : "nullopt"; - } - else if constexpr (is_shared_ptr_v) { - if (v) { - return v->to_string(); - } else { - return std::string("null"); - } - } else { - // 没有匹配上 最后走这条路径 - if constexpr (has_free_to_string::value) { - return other_to_string(v); - } - else if constexpr (has_member_to_string::value) { - return v.to_string(); - } else { - static_assert(sizeof(C) == 0, "Psc to_string not available for this type"); - } - } - return std::string(""); + std::cerr << std::string(magic_enum::enum_type_name()) + + " 字符串转换枚举值错误!str:" + str + "\n" + + get_enum_def_str() + + "\n"; + Psc::fail_fast(""); + return EnumType(); +} +template +std::optional to_enum2(const std::string& str) { + auto opt = magic_enum::enum_cast(str); + if (opt.has_value()) { + return opt.value(); // 返回枚举值 } - - - - - template - std::optional int_to_enum(int enum_value) { - // 静态断言,确保 EnumType 是枚举类型 - static_assert(std::is_enum_v, "EnumType must be an enum type"); - // 使用 magic_enum 获取所有的枚举值 - auto enum_values = magic_enum::enum_values(); - // 检查是否存在匹配的枚举值 - for (auto value : enum_values) { - if (static_cast(value) == enum_value) { - return value; // 返回匹配的枚举值 - } - } - // 如果没有匹配的枚举值,返回 std::nullopt - return std::nullopt; + return std::nullopt; +} +// 其余未考虑到的类型直接实现 other_to_string(T) 就可以了。 +template +struct has_free_to_string : std::false_type {}; +template +struct has_free_to_string()))> +> : std::true_type {}; +template +struct has_member_to_string : std::false_type {}; +template +struct has_member_to_string().to_string())> +> : std::true_type {}; +template , + typename C = remove_recursive_top_const_t>> +std::string to_string(T&& v) { + // 处理 std::string + if constexpr (std::is_same_v) { + return std::forward(v); } - - template - std::optional enum_int_to_string(int enum_value) { - auto tmp = int_to_enum(enum_value); - if (!tmp.has_value()) return std::nullopt; - return to_string(tmp.value()); + else if constexpr (std::is_same_v) { + std::stringstream ss; + ss << "0x" << std::setw(sizeof(void*) * 2) << std::setfill('0') << std::hex << reinterpret_cast(v); + return ss.str(); } - - template - std::vector split_flags(Enum flags) - { - static_assert(std::is_enum_v, "Template parameter must be an enum type"); - std::vector setFlags; - for (auto flag : magic_enum::enum_values()) - { - if ((flags & flag) == flag) - { - setFlags.push_back(flag); - } - } - return setFlags; + // 处理 char* 类型 + else if constexpr (std::is_same_v) { + return std::string(v); } - - template - class enum_error_category : public std::error_category { - static_assert(std::is_enum_v, "E must be an enum"); - - public: - const char* name() const noexcept override { - // enum_type_name 返回 string_view,静态存储即可 - static constexpr auto name_sv = magic_enum::enum_type_name(); - return name_sv.data(); - } - - std::string message(int ev) const override { - auto opt = magic_enum::enum_name(static_cast(ev)); - if (!opt.empty()) - return std::string(opt); - Psc::fail_fast_core_dump(); - return "unknown enum error"; - } - }; - - template - std::error_code make_ec(E e) { - static_assert(std::is_enum_v, "E must be an enum"); - static enum_error_category cat; - return {static_cast(e), cat}; + else if constexpr (std::is_same_v) { + return std::string(v); + } + // 处理 wchar_t* 类型 + else if constexpr (std::is_same_v) { + std::wstring ws(v); + return std::string(ws.begin(), ws.end()); // 简单转换为 std::string + } + else if constexpr (std::is_same_v) { + std::wstring ws(v); + return std::string(ws.begin(), ws.end()); // 简单转换为 std::string + } + // 处理 std::wstring 类型 + else if constexpr (std::is_same_v) { + return std::string(v.begin(), v.end()); // 将 std::wstring 转为 std::string + } + // 处理枚举类型 + else if constexpr (std::is_enum_v) { + return std::string(magic_enum::enum_name(v)); // 使用 magic_enum 转换枚举 + } + // 处理 bool 类型 + else if constexpr (std::is_same_v) { + return v ? std::string("true") : std::string("false"); // 对 bool 类型进行自定义转换 + } + // 处理 std::nullptr_t 类型 + else if constexpr (std::is_same_v) { + return std::string("null"); // 对 nullptr 做特殊处理 + } + // 处理算术类型(整数或浮点数) + else if constexpr (std::is_arithmetic_v) { + return std::to_string(v); // 使用 std::to_string 转换数值类型 + } + else if constexpr (is_atomic_v) { + return to_string(v.load()); + } + else if constexpr (is_copyable_atomic_v) { + return to_string(v.load()); + } + else if constexpr (is_optional_v) { + return v.has_value() ? to_string(v.value()) : "nullopt"; + } + else if constexpr (is_shared_ptr_v) { + if (v) { + return v->to_string(); } - inline std::error_code get_sys_ec() { - return std::error_code(get_error_code(), std::system_category()); - } - - inline unexpected get_sys_ex() { - return unexpected(get_sys_ec()); + else { + return std::string("null"); } } + else { + // 没有匹配上 最后走这条路径 + if constexpr (has_free_to_string::value) { + return other_to_string(v); + } + else if constexpr (has_member_to_string::value) { + return v.to_string(); + } + else { + static_assert(sizeof(C) == 0, "Psc to_string not available for this type"); + } + } + return std::string(""); +} +template +std::optional int_to_enum(int enum_value) { + // 静态断言,确保 EnumType 是枚举类型 + static_assert(std::is_enum_v, "EnumType must be an enum type"); + // 使用 magic_enum 获取所有的枚举值 + auto enum_values = magic_enum::enum_values(); + // 检查是否存在匹配的枚举值 + for (auto value : enum_values) { + if (static_cast(value) == enum_value) { + return value; // 返回匹配的枚举值 + } + } + // 如果没有匹配的枚举值,返回 std::nullopt + return std::nullopt; +} +template +std::optional enum_int_to_string(int enum_value) { + auto tmp = int_to_enum(enum_value); + if (!tmp.has_value()) return std::nullopt; + return to_string(tmp.value()); +} +template +std::vector split_flags(Enum flags) { + static_assert(std::is_enum_v, "Template parameter must be an enum type"); + std::vector setFlags; + for (auto flag : magic_enum::enum_values()) { + if ((flags & flag) == flag) { + setFlags.push_back(flag); + } + } + return setFlags; +} +template +class enum_error_category : public std::error_category { + static_assert(std::is_enum_v, "E must be an enum"); +public: + const char* name() const noexcept override { + // enum_type_name 返回 string_view,静态存储即可 + static constexpr auto name_sv = magic_enum::enum_type_name(); + return name_sv.data(); + } + std::string message(int ev) const override { + auto opt = magic_enum::enum_name(static_cast(ev)); + if (!opt.empty()) + return std::string(opt); + Psc::fail_fast_core_dump(); + return "unknown enum error"; + } +}; +template +std::error_code make_ec(E e) { + static_assert(std::is_enum_v, "E must be an enum"); + static enum_error_category cat; + return {static_cast(e), cat}; +} +inline std::error_code get_sys_ec() { + return std::error_code(get_error_code(), std::system_category()); +} +inline unexpected get_sys_ex() { + return unexpected(get_sys_ec()); +} +} diff --git a/Core/Base/global_include.cpp b/Core/Base/global_include.cpp deleted file mode 100644 index 2428ef2..0000000 --- a/Core/Base/global_include.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once -#include "../../psc_global_include/Bit.cpp" -#include "../../psc_global_include/Fail_Fast.cpp" -#include "../../psc_global_include/Spin_Lock.cpp" -#include "../../psc_global_include/codec.cpp" diff --git a/Core/Base/global_include.h b/Core/Base/global_include.h deleted file mode 100644 index 0cb8a25..0000000 --- a/Core/Base/global_include.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once -#include "../../psc_global_include/Bit.h" -#include "../../psc_global_include/Fail_Fast.h" -#include "../../psc_global_include/RET.hpp" -#include "../../psc_global_include/Singleton.hpp" -#include "../../psc_global_include/Spin_Lock.h" -#include "../../psc_global_include/assert.h" -#include "../../psc_global_include/codec.h" -#include "../../psc_global_include/core_global_include.h" -#include "../../psc_global_include/error.hpp" -#include "../../psc_global_include/expected.h" -#include "../../psc_global_include/export.h" -#include "../../psc_global_include/inter_global.h" diff --git a/Core/Base/Check.cpp b/src/Psc_Cpp_Core/Base/Check.cpp similarity index 100% rename from Core/Base/Check.cpp rename to src/Psc_Cpp_Core/Base/Check.cpp diff --git a/Core/Base/Check.h b/src/Psc_Cpp_Core/Base/Check.h similarity index 100% rename from Core/Base/Check.h rename to src/Psc_Cpp_Core/Base/Check.h diff --git a/Core/Base/Coro_Result.h b/src/Psc_Cpp_Core/Base/Coro_Result.h similarity index 100% rename from Core/Base/Coro_Result.h rename to src/Psc_Cpp_Core/Base/Coro_Result.h diff --git a/Core/Base/File_Helper.cpp b/src/Psc_Cpp_Core/Base/File_Helper.cpp similarity index 100% rename from Core/Base/File_Helper.cpp rename to src/Psc_Cpp_Core/Base/File_Helper.cpp diff --git a/Core/Base/File_Helper.h b/src/Psc_Cpp_Core/Base/File_Helper.h similarity index 97% rename from Core/Base/File_Helper.h rename to src/Psc_Cpp_Core/Base/File_Helper.h index 689cd96..c763912 100644 --- a/Core/Base/File_Helper.h +++ b/src/Psc_Cpp_Core/Base/File_Helper.h @@ -4,7 +4,7 @@ #include #include #include "../system/export.h" -#include "Core/Statistics/Statistics.h" +#include "Psc_Cpp_Core/Statistics/Statistics.h" #include "spdlog/fmt/bundled/os.h" #include "spdlog/fmt/bundled/std.h" namespace Psc { diff --git a/Core/Base/JSON.cpp b/src/Psc_Cpp_Core/Base/JSON.cpp similarity index 100% rename from Core/Base/JSON.cpp rename to src/Psc_Cpp_Core/Base/JSON.cpp diff --git a/Core/Base/JSON.h b/src/Psc_Cpp_Core/Base/JSON.h similarity index 100% rename from Core/Base/JSON.h rename to src/Psc_Cpp_Core/Base/JSON.h diff --git a/Core/Base/Object_Pool.h b/src/Psc_Cpp_Core/Base/Object_Pool.h similarity index 100% rename from Core/Base/Object_Pool.h rename to src/Psc_Cpp_Core/Base/Object_Pool.h diff --git a/Core/Base/RingBuffer.hpp b/src/Psc_Cpp_Core/Base/RingBuffer.hpp similarity index 99% rename from Core/Base/RingBuffer.hpp rename to src/Psc_Cpp_Core/Base/RingBuffer.hpp index c08d845..fa0de0a 100644 --- a/Core/Base/RingBuffer.hpp +++ b/src/Psc_Cpp_Core/Base/RingBuffer.hpp @@ -8,7 +8,7 @@ #include #include #include "../system/export.h" -#include "Core/Base/global_include.h" +#include "Psc_Cpp_Core/Base/global_include.h" namespace Psc { // -------------------- utils -------------------- template diff --git a/Core/Base/SM_RingBuffer.cpp b/src/Psc_Cpp_Core/Base/SM_RingBuffer.cpp similarity index 97% rename from Core/Base/SM_RingBuffer.cpp rename to src/Psc_Cpp_Core/Base/SM_RingBuffer.cpp index c3c4d4a..64833e9 100644 --- a/Core/Base/SM_RingBuffer.cpp +++ b/src/Psc_Cpp_Core/Base/SM_RingBuffer.cpp @@ -1,8 +1,8 @@ #include "SM_RingBuffer.h" #include -#include "Core/Base/global_include.h" -#include "Core/spdlog/export.h" -#include "Core/transmit_protocol/Channel_Simulator/global.h" +#include "Psc_Cpp_Core/Base/global_include.h" +#include "Psc_Cpp_Core/spdlog/export.h" +#include "Psc_Cpp_Core/transmit_protocol/Channel_Simulator/global.h" namespace Psc { // 1. used_space 简化:利用无符号溢出特性或 mask size_t SM_Base_RingBuffer::used_space() const { @@ -44,13 +44,13 @@ void SM_Base_RingBuffer::init(std::string_view name, size_t size) { if (open) { // 注意:打开时也要使用计算出的 total_alloc_size oss << "【打开共享内存】" << VAR_STR_3(name_string, total_alloc_size, size) - << std::endl; + << std::endl; ok = shm.open(name_string, total_alloc_size); create = false; } else { oss << "【创建共享内存】" << VAR_STR_3(name_string, total_alloc_size, size) - << std::endl; + << std::endl; ok = shm.create(name_string, total_alloc_size); create = true; } diff --git a/Core/Base/SM_RingBuffer.h b/src/Psc_Cpp_Core/Base/SM_RingBuffer.h similarity index 100% rename from Core/Base/SM_RingBuffer.h rename to src/Psc_Cpp_Core/Base/SM_RingBuffer.h diff --git a/Core/Base/ThreadManager.cpp b/src/Psc_Cpp_Core/Base/ThreadManager.cpp similarity index 100% rename from Core/Base/ThreadManager.cpp rename to src/Psc_Cpp_Core/Base/ThreadManager.cpp diff --git a/Core/Base/ThreadManager.h b/src/Psc_Cpp_Core/Base/ThreadManager.h similarity index 79% rename from Core/Base/ThreadManager.h rename to src/Psc_Cpp_Core/Base/ThreadManager.h index ce27928..0c8127f 100644 --- a/Core/Base/ThreadManager.h +++ b/src/Psc_Cpp_Core/Base/ThreadManager.h @@ -8,11 +8,11 @@ #include #include #include -#include "Core/Statistics/Frequency_Limit.h" +#include "Psc_Cpp_Core/Statistics/Frequency_Limit.h" struct Detach_Thread { explicit Detach_Thread( - std::string_view name, - const std::function& running)>& func); + std::string_view name, + const std::function & running)>& func); void start(); std::string name; std::thread thread; @@ -22,8 +22,8 @@ struct Detach_Thread { struct Detach_Thread_Manager { Detach_Thread_Manager() = default; void test_and_start_thread( - std::string_view name, - const std::function& running)>& func); + std::string_view name, + const std::function & running)>& func); void test_and_stop_thread(std::string_view name); void stop_all_thread(size_t timeout_milliseconds = 10000, std::set excluded_thread = {}); @@ -33,6 +33,6 @@ protected: std::map thread_map; void exit_thread(std::string_view name); void start_thread(std::string_view name, - const std::function&)>& f); + const std::function &)>& f); std::chrono::time_point exit_time; }; diff --git a/Core/Base/fmt.h b/src/Psc_Cpp_Core/Base/fmt.h similarity index 100% rename from Core/Base/fmt.h rename to src/Psc_Cpp_Core/Base/fmt.h diff --git a/Core/Net_Adapter/Net_Adapter.cpp b/src/Psc_Cpp_Core/Net_Adapter/Net_Adapter.cpp similarity index 100% rename from Core/Net_Adapter/Net_Adapter.cpp rename to src/Psc_Cpp_Core/Net_Adapter/Net_Adapter.cpp diff --git a/Core/Net_Adapter/Net_Adapter.h b/src/Psc_Cpp_Core/Net_Adapter/Net_Adapter.h similarity index 100% rename from Core/Net_Adapter/Net_Adapter.h rename to src/Psc_Cpp_Core/Net_Adapter/Net_Adapter.h diff --git a/Core/Net_Adapter/Net_Adapter_linux.cpp b/src/Psc_Cpp_Core/Net_Adapter/Net_Adapter_linux.cpp similarity index 99% rename from Core/Net_Adapter/Net_Adapter_linux.cpp rename to src/Psc_Cpp_Core/Net_Adapter/Net_Adapter_linux.cpp index cc4effc..e9c9618 100644 --- a/Core/Net_Adapter/Net_Adapter_linux.cpp +++ b/src/Psc_Cpp_Core/Net_Adapter/Net_Adapter_linux.cpp @@ -21,7 +21,7 @@ #include #include #include -#include "Core/Base/global_include.h" +#include "Psc_Cpp_Core/Base/global_include.h" #include "Net_Adapter.h" namespace Psc { // 获取指定 IP 地址的网关(下一跳) @@ -254,7 +254,7 @@ void getGateway() { std::string gatewayIp = hexToIp(gateway); // 将网关的十六进制地址转换为IP地址 std::cout << "Interface: " << iface << " Gateway: " << gatewayIp - << std::endl; + << std::endl; } } } diff --git a/Core/Net_Adapter/Net_Adapter_win.cpp b/src/Psc_Cpp_Core/Net_Adapter/Net_Adapter_win.cpp similarity index 100% rename from Core/Net_Adapter/Net_Adapter_win.cpp rename to src/Psc_Cpp_Core/Net_Adapter/Net_Adapter_win.cpp diff --git a/Core/Serial/Serial.cpp b/src/Psc_Cpp_Core/Serial/Serial.cpp similarity index 96% rename from Core/Serial/Serial.cpp rename to src/Psc_Cpp_Core/Serial/Serial.cpp index 28fedca..4d9e3ec 100644 --- a/Core/Serial/Serial.cpp +++ b/src/Psc_Cpp_Core/Serial/Serial.cpp @@ -2,7 +2,7 @@ #include #include #include -#include "Core/Statistics/Frequency_Limit.h" +#include "Psc_Cpp_Core/Statistics/Frequency_Limit.h" #include "Serial_p.h" void serial_log(Log_Type& log_type, std::string_view MSG) { Frequency_Limit_Multi lm; @@ -12,8 +12,8 @@ void serial_log(Log_Type& log_type, std::string_view MSG) { std::ostringstream oss; BaseLogger::Log_Info info{true, spdlog::level::debug, "", log_type, std::string(MSG)}; oss << Psc::get_error_message() - << BaseLogger::to_log(info) - << std::endl; + << BaseLogger::to_log(info) + << std::endl; if (!Psc::serial::serial_logger) { std::cout << oss.str() << std::endl; } @@ -107,16 +107,16 @@ std::string Serial::to_string() { oss << "{" << std::endl; oss << "\tfd:" << fd << std::endl; oss << "\tbuffer_byte_size: " << serial::get_buffer_byte_size(fd) - << std::endl; + << std::endl; oss << "\tbaud_rate: " << serial::get_baud_rate(serial_info) << std::endl; oss << "\tdataBits: " << Psc::to_string(serial::get_data_bits(serial_info)) - << std::endl; + << std::endl; oss << "\tstopBits: " << Psc::to_string(serial::get_stop_bits(serial_info)) - << std::endl; + << std::endl; oss << "\tparity: " << Psc::to_string(serial::get_parity(serial_info)) - << std::endl; + << std::endl; oss << "\tflow_control: " - << Psc::to_string(serial::get_flow_control(serial_info)) << std::endl; + << Psc::to_string(serial::get_flow_control(serial_info)) << std::endl; oss << "}" << std::endl; return oss.str(); } @@ -233,7 +233,7 @@ int64_t write_all(Serial_FD fd, std::string_view data, int64_t chunkSize, while (cur_written < this_chunk) { int64_t to_write = this_chunk - cur_written; int64_t written = serial::write( - fd, data.data() + total_written + cur_written, to_write); + fd, data.data() + total_written + cur_written, to_write); if (written < 0) { // 写入错误,返回 -1 LOG_ERROR(VAR_STR_2(fd, written)) diff --git a/Core/Serial/Serial.h b/src/Psc_Cpp_Core/Serial/Serial.h similarity index 100% rename from Core/Serial/Serial.h rename to src/Psc_Cpp_Core/Serial/Serial.h diff --git a/Core/Serial/Serial_Coro.h b/src/Psc_Cpp_Core/Serial/Serial_Coro.h similarity index 100% rename from Core/Serial/Serial_Coro.h rename to src/Psc_Cpp_Core/Serial/Serial_Coro.h diff --git a/Core/Serial/Serial_linux.cpp b/src/Psc_Cpp_Core/Serial/Serial_linux.cpp similarity index 100% rename from Core/Serial/Serial_linux.cpp rename to src/Psc_Cpp_Core/Serial/Serial_linux.cpp diff --git a/Core/Serial/Serial_p.h b/src/Psc_Cpp_Core/Serial/Serial_p.h similarity index 86% rename from Core/Serial/Serial_p.h rename to src/Psc_Cpp_Core/Serial/Serial_p.h index aee46d9..f4f40c6 100644 --- a/Core/Serial/Serial_p.h +++ b/src/Psc_Cpp_Core/Serial/Serial_p.h @@ -1,7 +1,7 @@ #pragma once #include -#include "../../Core/spdlog/export.h" #include "Serial.h" +#include "Psc_Cpp_Core/spdlog/export.h" void serial_log(Log_Type& log_type, std::string_view MSG); #define LOG_ERROR(MSG) \ static Log_Type log_type({}, {{"POS", LOG_POS}}); \ diff --git a/Core/Serial/Serial_win.cpp b/src/Psc_Cpp_Core/Serial/Serial_win.cpp similarity index 100% rename from Core/Serial/Serial_win.cpp rename to src/Psc_Cpp_Core/Serial/Serial_win.cpp diff --git a/Core/Shared_Memory/Shared_Memory.cpp b/src/Psc_Cpp_Core/Shared_Memory/Shared_Memory.cpp similarity index 89% rename from Core/Shared_Memory/Shared_Memory.cpp rename to src/Psc_Cpp_Core/Shared_Memory/Shared_Memory.cpp index 83a19b8..215e31e 100644 --- a/Core/Shared_Memory/Shared_Memory.cpp +++ b/src/Psc_Cpp_Core/Shared_Memory/Shared_Memory.cpp @@ -2,8 +2,8 @@ #include #include #include "../Base/global_include.h" -#include "Core/spdlog/export.h" -#include "Core/transmit_protocol/Channel_Simulator/global.h" +#include "Psc_Cpp_Core/spdlog/export.h" +#include "Psc_Cpp_Core/transmit_protocol/Channel_Simulator/global.h" namespace Psc { Pure_Share_Memory::Pure_Share_Memory(std::string_view name, size_t alloc_size) { auto name_string = std::string(name); diff --git a/Core/Shared_Memory/Shared_Memory.h b/src/Psc_Cpp_Core/Shared_Memory/Shared_Memory.h similarity index 100% rename from Core/Shared_Memory/Shared_Memory.h rename to src/Psc_Cpp_Core/Shared_Memory/Shared_Memory.h diff --git a/Core/Shared_Memory/Shared_Memory_linux.cpp b/src/Psc_Cpp_Core/Shared_Memory/Shared_Memory_linux.cpp similarity index 91% rename from Core/Shared_Memory/Shared_Memory_linux.cpp rename to src/Psc_Cpp_Core/Shared_Memory/Shared_Memory_linux.cpp index ce838b6..bf1bf12 100644 --- a/Core/Shared_Memory/Shared_Memory_linux.cpp +++ b/src/Psc_Cpp_Core/Shared_Memory/Shared_Memory_linux.cpp @@ -9,7 +9,7 @@ #include #include #include -#include "Core/spdlog/export.h" +#include "Psc_Cpp_Core/spdlog/export.h" #include "Shared_Memory.h" namespace Psc { bool check_if_shared_memory_exists(std::string_view name) { @@ -68,8 +68,7 @@ struct MutexBlock { pthread_mutex_t mutex; std::atomic initialized; // 0 = 未初始化, 1 = 初始化完成 }; -Cross_Process_Mutex::Cross_Process_Mutex() { -} +Cross_Process_Mutex::Cross_Process_Mutex() {} void Cross_Process_Mutex::init(std::string_view mutexName) { this->m_mutexName = mutexName; bool creator = false; @@ -79,12 +78,12 @@ void Cross_Process_Mutex::init(std::string_view mutexName) { creator = true; if (ftruncate(m_fd, sizeof(MutexBlock)) < 0) { std::cout << "跨进程锁" << mutexName << "创建失败 [" - << get_error_message() << "] " << LOG_POS << std::endl; + << get_error_message() << "] " << LOG_POS << std::endl; Psc::fail_fast(); } if (fchmod(m_fd, 0777) != 0) { std::cerr << "修改共享内存权限失败: " << get_error_message() << LOG_POS - << std::endl; + << std::endl; Psc::fail_fast(); } } @@ -93,13 +92,13 @@ void Cross_Process_Mutex::init(std::string_view mutexName) { m_fd = shm_open(m_mutexName.c_str(), O_RDWR, 0777); if (m_fd < 0) { std::cout << "跨进程锁" << mutexName << "打开失败 [" - << get_error_message() << "] " << LOG_POS << std::endl; + << get_error_message() << "] " << LOG_POS << std::endl; Psc::fail_fast(); } } else { std::cout << "跨进程锁" << mutexName << "检测失败 [" << get_error_message() - << "] " << LOG_POS << std::endl; + << "] " << LOG_POS << std::endl; Psc::fail_fast(); } // 映射 @@ -107,7 +106,7 @@ void Cross_Process_Mutex::init(std::string_view mutexName) { m_fd, 0); if (m_addr == MAP_FAILED) { std::cout << "跨进程锁" << mutexName << "mmap失败 [" << get_error_message() - << "] " << LOG_POS << std::endl; + << "] " << LOG_POS << std::endl; Psc::fail_fast(); } auto block = static_cast(m_addr); @@ -122,7 +121,7 @@ void Cross_Process_Mutex::init(std::string_view mutexName) { if (pthread_mutex_init(&block->mutex, &attr) != 0) { pthread_mutexattr_destroy(&attr); std::cout << "跨进程锁" << mutexName << "init失败 [" - << get_error_message() << "] " << LOG_POS << std::endl; + << get_error_message() << "] " << LOG_POS << std::endl; Psc::fail_fast(); } pthread_mutexattr_destroy(&attr); diff --git a/Core/Shared_Memory/Shared_Memory_win.cpp b/src/Psc_Cpp_Core/Shared_Memory/Shared_Memory_win.cpp similarity index 100% rename from Core/Shared_Memory/Shared_Memory_win.cpp rename to src/Psc_Cpp_Core/Shared_Memory/Shared_Memory_win.cpp diff --git a/Core/Statistics/Frequency_Limit.cpp b/src/Psc_Cpp_Core/Statistics/Frequency_Limit.cpp similarity index 100% rename from Core/Statistics/Frequency_Limit.cpp rename to src/Psc_Cpp_Core/Statistics/Frequency_Limit.cpp diff --git a/Core/Statistics/Frequency_Limit.h b/src/Psc_Cpp_Core/Statistics/Frequency_Limit.h similarity index 100% rename from Core/Statistics/Frequency_Limit.h rename to src/Psc_Cpp_Core/Statistics/Frequency_Limit.h diff --git a/Core/Statistics/Statistics.cpp b/src/Psc_Cpp_Core/Statistics/Statistics.cpp similarity index 100% rename from Core/Statistics/Statistics.cpp rename to src/Psc_Cpp_Core/Statistics/Statistics.cpp diff --git a/Core/Statistics/Statistics.h b/src/Psc_Cpp_Core/Statistics/Statistics.h similarity index 100% rename from Core/Statistics/Statistics.h rename to src/Psc_Cpp_Core/Statistics/Statistics.h diff --git a/Core/Statistics/export.h b/src/Psc_Cpp_Core/Statistics/export.h similarity index 100% rename from Core/Statistics/export.h rename to src/Psc_Cpp_Core/Statistics/export.h diff --git a/Core/Statistics/global.h b/src/Psc_Cpp_Core/Statistics/global.h similarity index 83% rename from Core/Statistics/global.h rename to src/Psc_Cpp_Core/Statistics/global.h index 5e1b86a..c9333ac 100644 --- a/Core/Statistics/global.h +++ b/src/Psc_Cpp_Core/Statistics/global.h @@ -8,4 +8,4 @@ #include #include "../Base/JSON.h" #include "../Base/global_include.h" -#include "Core/spdlog/export.h" +#include "Psc_Cpp_Core/spdlog/export.h" diff --git a/Core/socket/ASIO_Utils.h b/src/Psc_Cpp_Core/socket/ASIO_Utils.h similarity index 95% rename from Core/socket/ASIO_Utils.h rename to src/Psc_Cpp_Core/socket/ASIO_Utils.h index 4fdd1ea..b6eb266 100644 --- a/Core/socket/ASIO_Utils.h +++ b/src/Psc_Cpp_Core/socket/ASIO_Utils.h @@ -1,6 +1,6 @@ #pragma once #include -#include "Core/Base/RingBuffer.hpp" +#include "Psc_Cpp_Core/Base/RingBuffer.hpp" #include "Socket.h" #include "global.h" namespace Psc::asio_socket { diff --git a/Core/socket/ByteOrder.h b/src/Psc_Cpp_Core/socket/ByteOrder.h similarity index 100% rename from Core/socket/ByteOrder.h rename to src/Psc_Cpp_Core/socket/ByteOrder.h diff --git a/Core/socket/Socket.cpp b/src/Psc_Cpp_Core/socket/Socket.cpp similarity index 100% rename from Core/socket/Socket.cpp rename to src/Psc_Cpp_Core/socket/Socket.cpp diff --git a/Core/socket/Socket.h b/src/Psc_Cpp_Core/socket/Socket.h similarity index 96% rename from Core/socket/Socket.h rename to src/Psc_Cpp_Core/socket/Socket.h index 03d7df1..bfde3b2 100644 --- a/Core/socket/Socket.h +++ b/src/Psc_Cpp_Core/socket/Socket.h @@ -5,7 +5,7 @@ #include #include "../Base/JSON.h" #include "../system/export.h" -#include "Core/spdlog/export.h" +#include "Psc_Cpp_Core/spdlog/export.h" namespace Psc::asio_socket { #if _WIN32 using Socket_FD = unsigned long long; @@ -17,8 +17,7 @@ struct Sockaddr_In { std::string ip; std::uint32_t port{}; Sockaddr_In() = default; - Sockaddr_In(std::string_view ip, std::uint32_t port) : ip(ip), port(port) { - } + Sockaddr_In(std::string_view ip, std::uint32_t port) : ip(ip), port(port) {} [[nodiscard]] std::string to_string() const { return ip + ":" + std::to_string(port); } diff --git a/Core/socket/Socket_Coro.h b/src/Psc_Cpp_Core/socket/Socket_Coro.h similarity index 100% rename from Core/socket/Socket_Coro.h rename to src/Psc_Cpp_Core/socket/Socket_Coro.h diff --git a/Core/socket/TCP_Client.cpp b/src/Psc_Cpp_Core/socket/TCP_Client.cpp similarity index 100% rename from Core/socket/TCP_Client.cpp rename to src/Psc_Cpp_Core/socket/TCP_Client.cpp diff --git a/Core/socket/TCP_Client.h b/src/Psc_Cpp_Core/socket/TCP_Client.h similarity index 100% rename from Core/socket/TCP_Client.h rename to src/Psc_Cpp_Core/socket/TCP_Client.h diff --git a/Core/socket/TCP_Server.cpp b/src/Psc_Cpp_Core/socket/TCP_Server.cpp similarity index 100% rename from Core/socket/TCP_Server.cpp rename to src/Psc_Cpp_Core/socket/TCP_Server.cpp diff --git a/Core/socket/TCP_Server.h b/src/Psc_Cpp_Core/socket/TCP_Server.h similarity index 93% rename from Core/socket/TCP_Server.h rename to src/Psc_Cpp_Core/socket/TCP_Server.h index 32dcc35..40fd8b9 100644 --- a/Core/socket/TCP_Server.h +++ b/src/Psc_Cpp_Core/socket/TCP_Server.h @@ -5,7 +5,7 @@ #include #include #include "ASIO_Utils.h" -#include "Core/Statistics/Statistics.h" +#include "Psc_Cpp_Core/Statistics/Statistics.h" namespace Psc::asio_socket { class TCP_Connect { public: @@ -43,11 +43,13 @@ public: Accept_Info info; std::string data; }; - enum State { Not_Created, - Not_Set_Field, - Not_bind, - Not_Listen, - Working }; + enum State { + Not_Created, + Not_Set_Field, + Not_bind, + Not_Listen, + Working + }; State state = Not_Created; std::vector read_from_all_clients(); std::vector client_fds(); diff --git a/Core/socket/UDP_Client.cpp b/src/Psc_Cpp_Core/socket/UDP_Client.cpp similarity index 100% rename from Core/socket/UDP_Client.cpp rename to src/Psc_Cpp_Core/socket/UDP_Client.cpp diff --git a/Core/socket/UDP_Client.h b/src/Psc_Cpp_Core/socket/UDP_Client.h similarity index 100% rename from Core/socket/UDP_Client.h rename to src/Psc_Cpp_Core/socket/UDP_Client.h diff --git a/Core/socket/UDP_Server.cpp b/src/Psc_Cpp_Core/socket/UDP_Server.cpp similarity index 100% rename from Core/socket/UDP_Server.cpp rename to src/Psc_Cpp_Core/socket/UDP_Server.cpp diff --git a/Core/socket/UDP_Server.h b/src/Psc_Cpp_Core/socket/UDP_Server.h similarity index 100% rename from Core/socket/UDP_Server.h rename to src/Psc_Cpp_Core/socket/UDP_Server.h diff --git a/Core/socket/export.h b/src/Psc_Cpp_Core/socket/export.h similarity index 100% rename from Core/socket/export.h rename to src/Psc_Cpp_Core/socket/export.h diff --git a/Core/socket/global.h b/src/Psc_Cpp_Core/socket/global.h similarity index 100% rename from Core/socket/global.h rename to src/Psc_Cpp_Core/socket/global.h diff --git a/Core/spdlog/export.cpp b/src/Psc_Cpp_Core/spdlog/export.cpp similarity index 90% rename from Core/spdlog/export.cpp rename to src/Psc_Cpp_Core/spdlog/export.cpp index 1a02ff0..432a0ed 100644 --- a/Core/spdlog/export.cpp +++ b/src/Psc_Cpp_Core/spdlog/export.cpp @@ -4,7 +4,7 @@ #include #include #include "../system/export.h" -#include "Core/Base/global_include.h" +#include "Psc_Cpp_Core/Base/global_include.h" #include "spdlog/sinks/basic_file_sink.h" #include "spdlog/spdlog.h" #ifdef WIN32 @@ -33,13 +33,10 @@ namespace fs = std::filesystem; void spdlog_close() { spdlog::shutdown(); } -Log_Type::Log_Type(std::vector list) : list(list) { -} -Log_Type::Log_Type(std::vector> map) : map(map) { -} +Log_Type::Log_Type(std::vector list) : list(list) {} +Log_Type::Log_Type(std::vector> map) : map(map) {} Log_Type::Log_Type(std::vector list, - std::vector> map) : list(list), map(map) { -} + std::vector> map) : list(list), map(map) {} std::string get_current_date_string() { // 获取当前时间 auto now = std::chrono::system_clock::now(); @@ -58,13 +55,13 @@ create_rotating_logger(std::string_view key, size_t byte_size, size_t num) { fileName = Psc::utf8_2_platform(fileName); Psc::create_file_if_not_exists(fileName); auto rotating_sink = std::make_shared( - fileName, byte_size, num); + fileName, byte_size, num); std::vector sinks = {rotating_sink}; auto logger = std::make_shared( - key_string, // Logger 名称 - sinks.begin(), sinks.end(), // Sinks 列表 - spdlog::thread_pool(), // 使用初始化的线程池 - spdlog::async_overflow_policy::block // 当队列满时,阻塞写入 + key_string, // Logger 名称 + sinks.begin(), sinks.end(), // Sinks 列表 + spdlog::thread_pool(), // 使用初始化的线程池 + spdlog::async_overflow_policy::block // 当队列满时,阻塞写入 ); return logger; } @@ -96,8 +93,8 @@ void pure_log(std::string_view pure_path, std::string_view info, Psc::create_file_if_not_exists(file_name_string); auto c = spdlog::basic_logger_mt(file_name_string, file_name_string); auto formatter = std::make_unique( - "%v", spdlog::pattern_time_type::local, "", - spdlog::pattern_formatter::custom_flags()); + "%v", spdlog::pattern_time_type::local, "", + spdlog::pattern_formatter::custom_flags()); c->set_formatter(std::move(formatter)); return c; }; @@ -184,9 +181,9 @@ struct my_daily_filename_calculator { std::tie(basename, ext) = details::file_helper::split_by_extension(filename); return fmt_lib::format( - SPDLOG_FMT_STRING(SPDLOG_FILENAME_T("{}_{:04d}-{:02d}-{:02d}{}")), - basename, now_tm.tm_year + 1900, now_tm.tm_mon + 1, now_tm.tm_mday, - ext); + SPDLOG_FMT_STRING(SPDLOG_FILENAME_T("{}_{:04d}-{:02d}-{:02d}{}")), + basename, now_tm.tm_year + 1900, now_tm.tm_mon + 1, now_tm.tm_mday, + ext); } }; } // namespace spdlog @@ -196,13 +193,13 @@ BaseLogger::BaseLogger(std::string_view log_path, size_t byte_size, Psc::create_file_if_not_exists(path); path = Psc::utf8_2_platform(path); auto rotating_sink = std::make_shared( - path, byte_size, piece_num); + path, byte_size, piece_num); std::vector sinks = {rotating_sink}; logger = std::make_shared( - path, // Logger 名称 - sinks.begin(), sinks.end(), // Sinks 列表 - spdlog::thread_pool(), // 使用初始化的线程池 - spdlog::async_overflow_policy::block // 当队列满时,阻塞写入 + path, // Logger 名称 + sinks.begin(), sinks.end(), // Sinks 列表 + spdlog::thread_pool(), // 使用初始化的线程池 + spdlog::async_overflow_policy::block // 当队列满时,阻塞写入 ); // logger->set_level(spdlog::level::debug); logger->set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%l] %v"); @@ -228,7 +225,7 @@ void Base_Logger_Manager::init() const { spdlog::flush_every(std::chrono::seconds(flush_seconds)); std::cout << "Base_Logger_Manager sqdlog init thread pool!" + VAR_STR_3(thread_num, flush_seconds, buffer_size) - << std::endl; + << std::endl; } // 调用 spdlog::shutdown() 会确保: // 所有日志被刷新到磁盘。 @@ -236,10 +233,10 @@ void Base_Logger_Manager::init() const { Base_Logger_Manager::~Base_Logger_Manager() { std::ostringstream oss; oss << "Base_Logger_Manager::~Base_Logger_Manager()" - << VAR_STR_3(buffer_size, flush_seconds, thread_num) << std::flush; + << VAR_STR_3(buffer_size, flush_seconds, thread_num) << std::flush; spdlog::shutdown(); oss << "spdlog::shutdown()!\n" - << std::flush; + << std::flush; std::cout << oss.str(); } std::string BaseLogger::to_log(const Log_Info& log_info) { @@ -250,7 +247,7 @@ void BaseLogger::log_main(const Log_Info& log_info) const { auto msg = to_log(log_info); if (log_info.console) { std::cerr << msg + "\n" - << std::flush; + << std::flush; } // logger->log(level, msg); logger->info(msg); diff --git a/Core/spdlog/export.h b/src/Psc_Cpp_Core/spdlog/export.h similarity index 100% rename from Core/spdlog/export.h rename to src/Psc_Cpp_Core/spdlog/export.h diff --git a/Core/system/export.cpp b/src/Psc_Cpp_Core/system/export.cpp similarity index 92% rename from Core/system/export.cpp rename to src/Psc_Cpp_Core/system/export.cpp index 0d0cf5a..42e189d 100644 --- a/Core/system/export.cpp +++ b/src/Psc_Cpp_Core/system/export.cpp @@ -17,7 +17,7 @@ #include #include #include -#include "Core/Base/global_include.h" +#include "Psc_Cpp_Core/Base/global_include.h" #include "magic_enum/../export.h" #if defined(_WIN32) #include "windows_include.h" @@ -62,7 +62,7 @@ bool local_time_from_time_t(std::time_t value, std::tm& out) noexcept { std::uint64_t get_current_millisecond_timestamp() { const auto now = std::chrono::system_clock::now(); const auto duration = std::chrono::duration_cast( - now.time_since_epoch()); + now.time_since_epoch()); return static_cast(duration.count()); } int redict_main_with_gtest(int argc, char* argv[], @@ -139,18 +139,18 @@ constexpr std::uint8_t alphabet_map[] = constexpr std::uint8_t invalid_base64 = 255; constexpr std::uint8_t decode_char(unsigned char ch) noexcept { return (ch >= 'A' && ch <= 'Z') - ? static_cast(ch - 'A') - : (ch >= 'a' && ch <= 'z') - ? static_cast(ch - 'a' + 26) - : (ch >= '0' && ch <= '9') - ? static_cast(ch - '0' + 52) - : (ch == '+') - ? 62 - : (ch == '/') - ? 63 - : (ch == '=') - ? 64 - : invalid_base64; + ? static_cast(ch - 'A') + : (ch >= 'a' && ch <= 'z') + ? static_cast(ch - 'a' + 26) + : (ch >= '0' && ch <= '9') + ? static_cast(ch - '0' + 52) + : (ch == '+') + ? 62 + : (ch == '/') + ? 63 + : (ch == '=') + ? 64 + : invalid_base64; } std::uint32_t base64_encode_raw(const std::uint8_t* text, std::uint32_t text_len, std::uint8_t* encode) { @@ -281,7 +281,7 @@ void create_file_if_not_exists(std::string_view file_name) { fs::create_directories(parent, ec); if (ec) { std::cerr << "Failed to create parent directory: " << parent.string() - << ", error: " << ec.message() << std::endl; + << ", error: " << ec.message() << std::endl; return; } } @@ -301,7 +301,7 @@ void create_dir_if_not_exists(std::string_view dir_name) { fs::create_directories(dir_path, ec); if (ec) { std::cerr << "Failed to create directory: " << dir_name - << ", error: " << ec.message() << std::endl; + << ", error: " << ec.message() << std::endl; return; } } @@ -318,16 +318,15 @@ void write_stack_trace_to_file(std::string_view stack_trace, } else { std::cerr << "Unable to open file " << filename << " for writing." - << std::endl; + << std::endl; } } void signal_handler(int signal_code) { std::cout << "signal_handler [" << signal_to_string(signal_code) << "]" - << std::endl; + << std::endl; stop_program = signal_code; } -void signal_handler_ignore(int) { -} +void signal_handler_ignore(int) {} void init_signal_config(std::set normal_quit, std::set ignore_signal) { if (is_big_endian) { diff --git a/Core/system/export.h b/src/Psc_Cpp_Core/system/export.h similarity index 100% rename from Core/system/export.h rename to src/Psc_Cpp_Core/system/export.h diff --git a/Core/system/linux.cpp b/src/Psc_Cpp_Core/system/linux.cpp similarity index 97% rename from Core/system/linux.cpp rename to src/Psc_Cpp_Core/system/linux.cpp index 238b668..4d6d161 100644 --- a/Core/system/linux.cpp +++ b/src/Psc_Cpp_Core/system/linux.cpp @@ -31,8 +31,8 @@ #include #include #include "export.h" -#if __has_include("Core/JSON.h") -#include "Core/JSON.h" +#if __has_include("Psc_Cpp_Core/JSON.h") +#include "Psc_Cpp_Core/JSON.h" #elif __has_include("../Base/JSON.h") #include "../Base/JSON.h" #endif @@ -171,15 +171,16 @@ std::string get_stack_trace() { } std::replace(str.begin(), str.end(), '\n', ' '); oss << " " << str << "【0x" << std::hex << addr << std::dec << "】" - << '\n'; + << '\n'; } free(symbols); return oss.str(); } std::string get_computer_serial_number() { static const char* candidates[] = { - "/sys/class/dmi/id/product_serial", "/sys/class/dmi/id/board_serial", - "/sys/class/dmi/id/product_uuid", "/sys/class/dmi/id/chassis_serial"}; + "/sys/class/dmi/id/product_serial", "/sys/class/dmi/id/board_serial", + "/sys/class/dmi/id/product_uuid", "/sys/class/dmi/id/chassis_serial" + }; for (const char* file : candidates) { std::string value = read_first_line(file); if (!value.empty() && value != "None" && value != "Not Specified" && @@ -213,7 +214,7 @@ bool load_library_ec(std::string_view library_path, void*& out, if (!library) { const char* err = dlerror(); std::cerr << library_path - << " Failed to load library: " << (err ? err : "unknown") << '\n'; + << " Failed to load library: " << (err ? err : "unknown") << '\n'; ec = std::make_error_code(std::errc::no_such_file_or_directory); return false; } @@ -342,7 +343,7 @@ bool set_thread_affinity(void* thread_ptr, unsigned cpu_index) { if (ret != 0) { errno = ret; std::cerr << "Error setting thread affinity: " << std::strerror(ret) - << std::endl; + << std::endl; return false; } return true; diff --git a/Core/system/win.cpp b/src/Psc_Cpp_Core/system/win.cpp similarity index 91% rename from Core/system/win.cpp rename to src/Psc_Cpp_Core/system/win.cpp index 01f78c6..05a97be 100644 --- a/Core/system/win.cpp +++ b/src/Psc_Cpp_Core/system/win.cpp @@ -23,7 +23,7 @@ #include #include "../Base/global_include.h" #include "../system/export.h" -#include "Core/Base/JSON.h" +#include "Psc_Cpp_Core/Base/JSON.h" #include "windows_include.h" namespace Psc { namespace { @@ -32,7 +32,7 @@ std::wstring utf8_to_wide_impl(std::string_view input) { return L""; } const int size = MultiByteToWideChar( - CP_UTF8, 0, input.data(), static_cast(input.size()), nullptr, 0); + CP_UTF8, 0, input.data(), static_cast(input.size()), nullptr, 0); if (size <= 0) { return L""; } @@ -66,7 +66,7 @@ std::string codepage_to_utf8(std::string_view input, UINT codepage) { return ""; } const int wide_len = MultiByteToWideChar( - codepage, 0, input.data(), static_cast(input.size()), nullptr, 0); + codepage, 0, input.data(), static_cast(input.size()), nullptr, 0); if (wide_len <= 0) { return ""; } @@ -125,8 +125,7 @@ HANDLE thread_to_win32_handle(std::thread* thread) noexcept { } } struct Bstr_Guard { - explicit Bstr_Guard(const wchar_t* value) : value(SysAllocString(value)) { - } + explicit Bstr_Guard(const wchar_t* value) : value(SysAllocString(value)) {} ~Bstr_Guard() { if (value) SysFreeString(value); @@ -167,13 +166,13 @@ std::string get_stack_trace() { BOOL(WINAPI*)(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINE64); using SymCleanupT = BOOL(WINAPI*)(HANDLE); auto pSymInitialize = reinterpret_cast( - GetProcAddress(dbghelp, "SymInitialize")); + GetProcAddress(dbghelp, "SymInitialize")); auto pSymSetOptions = reinterpret_cast( - GetProcAddress(dbghelp, "SymSetOptions")); + GetProcAddress(dbghelp, "SymSetOptions")); auto pSymFromAddr = reinterpret_cast(GetProcAddress(dbghelp, "SymFromAddr")); auto pSymGetLineFromAddr64 = reinterpret_cast( - GetProcAddress(dbghelp, "SymGetLineFromAddr64")); + GetProcAddress(dbghelp, "SymGetLineFromAddr64")); auto pSymCleanup = reinterpret_cast(GetProcAddress(dbghelp, "SymCleanup")); if (!pSymInitialize || !pSymSetOptions || !pSymFromAddr || @@ -190,7 +189,7 @@ std::string get_stack_trace() { pSymSetOptions(SYMOPT_LOAD_LINES | SYMOPT_UNDNAME); constexpr DWORD max_name_len = MAX_SYM_NAME; std::vector symbol_buffer(sizeof(SYMBOL_INFO) + - max_name_len * sizeof(char)); + max_name_len * sizeof(char)); auto* symbol = reinterpret_cast(symbol_buffer.data()); symbol->SizeOfStruct = sizeof(SYMBOL_INFO); symbol->MaxNameLen = max_name_len; @@ -209,7 +208,7 @@ std::string get_stack_trace() { DWORD displacement = 0; if (pSymGetLineFromAddr64(process, address, &displacement, &line)) { oss << line.FileName << ':' << line.LineNumber << " at 0x" << std::hex - << address << std::dec << '\n'; + << address << std::dec << '\n'; } else { oss << "at 0x" << std::hex << address << std::dec << '\n'; @@ -229,9 +228,10 @@ void set_current_thread_name(std::string_view name) { using SetThreadDescriptionT = HRESULT(WINAPI*)(HANDLE, PCWSTR); HMODULE kernel32 = GetModuleHandleW(L"Kernel32.dll"); auto pSetThreadDescription = - kernel32 ? reinterpret_cast( - GetProcAddress(kernel32, "SetThreadDescription")) - : nullptr; + kernel32 + ? reinterpret_cast( + GetProcAddress(kernel32, "SetThreadDescription")) + : nullptr; if (pSetThreadDescription) { (void)pSetThreadDescription(GetCurrentThread(), wname.c_str()); } @@ -255,7 +255,7 @@ bool load_library_ec(std::string_view library_path, void*& out, ec = std::error_code(static_cast(GetLastError()), std::system_category()); std::cerr << "加载库失败:【" << library_path << "】 " << ec.message() - << " (code=" << ec.value() << ")\n"; + << " (code=" << ec.value() << ")\n"; return false; } out = reinterpret_cast(h); @@ -281,7 +281,7 @@ bool load_function_ec(void* library, std::string_view function_name, if (!library) { ec = std::make_error_code(std::errc::invalid_argument); std::cerr << "load_function: " << function_name - << " but library == nullptr\n"; + << " but library == nullptr\n"; return false; } auto function_name_string = std::string(function_name); @@ -291,7 +291,7 @@ bool load_function_ec(void* library, std::string_view function_name, ec = std::error_code(static_cast(GetLastError()), std::system_category()); std::cerr << "Failed to get function pointer for: " << function_name - << " : " << ec.message() << " (code=" << ec.value() << ")\n"; + << " : " << ec.message() << " (code=" << ec.value() << ")\n"; return false; } out = reinterpret_cast(p); @@ -311,8 +311,8 @@ std::string get_computer_serial_number() { return ""; } hr = CoInitializeSecurity( - nullptr, -1, nullptr, nullptr, RPC_C_AUTHN_LEVEL_DEFAULT, - RPC_C_IMP_LEVEL_IMPERSONATE, nullptr, EOAC_NONE, nullptr); + nullptr, -1, nullptr, nullptr, RPC_C_AUTHN_LEVEL_DEFAULT, + RPC_C_IMP_LEVEL_IMPERSONATE, nullptr, EOAC_NONE, nullptr); if (FAILED(hr) && hr != RPC_E_TOO_LATE) { if (need_uninit) { CoUninitialize(); @@ -372,10 +372,10 @@ std::string get_computer_serial_number() { std::string error_code_to_string(DWORD error_code) { wchar_t* message = nullptr; DWORD size = FormatMessageW( - FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - nullptr, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - reinterpret_cast(&message), 0, nullptr); + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + nullptr, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + reinterpret_cast(&message), 0, nullptr); std::string result = "错误码:" + std::to_string(error_code) + ": "; if (size > 0 && message) { result += wide_to_utf8_impl(message, static_cast(size)); @@ -513,28 +513,30 @@ std::string get_memory_info() { } auto ret = JSON::object(); ret.append( - {"Total physical memory (MB)", status.ullTotalPhys / (1024 * 1024)}); + {"Total physical memory (MB)", status.ullTotalPhys / (1024 * 1024)}); ret.append( - {"Available physical memory (MB)", status.ullAvailPhys / (1024 * 1024)}); + {"Available physical memory (MB)", status.ullAvailPhys / (1024 * 1024)}); ret.append( - {"Total virtual memory (MB)", status.ullTotalVirtual / (1024 * 1024)}); - ret.append({"Available virtual memory (MB)", - status.ullAvailVirtual / (1024 * 1024)}); + {"Total virtual memory (MB)", status.ullTotalVirtual / (1024 * 1024)}); + ret.append({ + "Available virtual memory (MB)", + status.ullAvailVirtual / (1024 * 1024) + }); ret.append({"Total page file (MB)", status.ullTotalPageFile / (1024 * 1024)}); ret.append( - {"Available page file (MB)", status.ullAvailPageFile / (1024 * 1024)}); + {"Available page file (MB)", status.ullAvailPageFile / (1024 * 1024)}); return ret.to_json_string(); } int GenerateMiniDump(PEXCEPTION_POINTERS pExceptionPointers) { using MiniDumpWriteDumpT = BOOL(WINAPI*)( - HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION, - PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION); + HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION, + PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION); HMODULE hDbgHelp = LoadLibraryW(L"DbgHelp.dll"); if (!hDbgHelp) { return EXCEPTION_CONTINUE_EXECUTION; } auto pfnMiniDumpWriteDump = reinterpret_cast( - GetProcAddress(hDbgHelp, "MiniDumpWriteDump")); + GetProcAddress(hDbgHelp, "MiniDumpWriteDump")); if (!pfnMiniDumpWriteDump) { FreeLibrary(hDbgHelp); return EXCEPTION_CONTINUE_EXECUTION; diff --git a/Core/system/windows_include.h b/src/Psc_Cpp_Core/system/windows_include.h similarity index 100% rename from Core/system/windows_include.h rename to src/Psc_Cpp_Core/system/windows_include.h diff --git a/Core/todolist.txt b/src/Psc_Cpp_Core/todolist.txt similarity index 100% rename from Core/todolist.txt rename to src/Psc_Cpp_Core/todolist.txt diff --git a/Core/transmit_protocol/Channel_Simulator/Channel_Simulator.cpp b/src/Psc_Cpp_Core/transmit_protocol/Channel_Simulator/Channel_Simulator.cpp similarity index 100% rename from Core/transmit_protocol/Channel_Simulator/Channel_Simulator.cpp rename to src/Psc_Cpp_Core/transmit_protocol/Channel_Simulator/Channel_Simulator.cpp diff --git a/Core/transmit_protocol/Channel_Simulator/Channel_Simulator.h b/src/Psc_Cpp_Core/transmit_protocol/Channel_Simulator/Channel_Simulator.h similarity index 100% rename from Core/transmit_protocol/Channel_Simulator/Channel_Simulator.h rename to src/Psc_Cpp_Core/transmit_protocol/Channel_Simulator/Channel_Simulator.h diff --git a/Core/transmit_protocol/Channel_Simulator/Flow_Channel_Simulator.cpp b/src/Psc_Cpp_Core/transmit_protocol/Channel_Simulator/Flow_Channel_Simulator.cpp similarity index 100% rename from Core/transmit_protocol/Channel_Simulator/Flow_Channel_Simulator.cpp rename to src/Psc_Cpp_Core/transmit_protocol/Channel_Simulator/Flow_Channel_Simulator.cpp diff --git a/Core/transmit_protocol/Channel_Simulator/Flow_Channel_Simulator.h b/src/Psc_Cpp_Core/transmit_protocol/Channel_Simulator/Flow_Channel_Simulator.h similarity index 100% rename from Core/transmit_protocol/Channel_Simulator/Flow_Channel_Simulator.h rename to src/Psc_Cpp_Core/transmit_protocol/Channel_Simulator/Flow_Channel_Simulator.h diff --git a/Core/transmit_protocol/Channel_Simulator/Packet_Channel_Simulator.cpp b/src/Psc_Cpp_Core/transmit_protocol/Channel_Simulator/Packet_Channel_Simulator.cpp similarity index 100% rename from Core/transmit_protocol/Channel_Simulator/Packet_Channel_Simulator.cpp rename to src/Psc_Cpp_Core/transmit_protocol/Channel_Simulator/Packet_Channel_Simulator.cpp diff --git a/Core/transmit_protocol/Channel_Simulator/Packet_Channel_Simulator.h b/src/Psc_Cpp_Core/transmit_protocol/Channel_Simulator/Packet_Channel_Simulator.h similarity index 97% rename from Core/transmit_protocol/Channel_Simulator/Packet_Channel_Simulator.h rename to src/Psc_Cpp_Core/transmit_protocol/Channel_Simulator/Packet_Channel_Simulator.h index eb3f6d5..3474771 100644 --- a/Core/transmit_protocol/Channel_Simulator/Packet_Channel_Simulator.h +++ b/src/Psc_Cpp_Core/transmit_protocol/Channel_Simulator/Packet_Channel_Simulator.h @@ -1,5 +1,5 @@ #pragma once -#include "../../../Core/Statistics/Statistics.h" +#include "Psc_Cpp_Core/Statistics/Statistics.h" #include "Channel_Simulator.h" #include "global.h" void itimeofday(long* sec, long* usec); diff --git a/Core/transmit_protocol/Channel_Simulator/global.cpp b/src/Psc_Cpp_Core/transmit_protocol/Channel_Simulator/global.cpp similarity index 100% rename from Core/transmit_protocol/Channel_Simulator/global.cpp rename to src/Psc_Cpp_Core/transmit_protocol/Channel_Simulator/global.cpp diff --git a/Core/transmit_protocol/Channel_Simulator/global.h b/src/Psc_Cpp_Core/transmit_protocol/Channel_Simulator/global.h similarity index 100% rename from Core/transmit_protocol/Channel_Simulator/global.h rename to src/Psc_Cpp_Core/transmit_protocol/Channel_Simulator/global.h diff --git a/Core/transmit_protocol/core/core.cpp b/src/Psc_Cpp_Core/transmit_protocol/core/core.cpp similarity index 99% rename from Core/transmit_protocol/core/core.cpp rename to src/Psc_Cpp_Core/transmit_protocol/core/core.cpp index e381042..78ca5ac 100644 --- a/Core/transmit_protocol/core/core.cpp +++ b/src/Psc_Cpp_Core/transmit_protocol/core/core.cpp @@ -1,8 +1,8 @@ #include #include #include -#include "../../../Core/Base/global_include.h" -#include "../../../Core/Serial/Serial.h" +#include "Psc_Cpp_Core/Base/global_include.h" +#include "Psc_Cpp_Core/Serial/Serial.h" #include "main.h" #include "spdlog/fmt/bundled/format.h" Malloc_Func cache_g_malloc_func = NULL; diff --git a/Core/transmit_protocol/core/main.h b/src/Psc_Cpp_Core/transmit_protocol/core/main.h similarity index 100% rename from Core/transmit_protocol/core/main.h rename to src/Psc_Cpp_Core/transmit_protocol/core/main.h diff --git a/Core/transmit_protocol/core/statistics.cpp b/src/Psc_Cpp_Core/transmit_protocol/core/statistics.cpp similarity index 100% rename from Core/transmit_protocol/core/statistics.cpp rename to src/Psc_Cpp_Core/transmit_protocol/core/statistics.cpp diff --git a/Core/transmit_protocol/core/statistics.h b/src/Psc_Cpp_Core/transmit_protocol/core/statistics.h similarity index 100% rename from Core/transmit_protocol/core/statistics.h rename to src/Psc_Cpp_Core/transmit_protocol/core/statistics.h diff --git a/Core/transmit_protocol/dtls/handshake.cpp b/src/Psc_Cpp_Core/transmit_protocol/dtls/handshake.cpp similarity index 100% rename from Core/transmit_protocol/dtls/handshake.cpp rename to src/Psc_Cpp_Core/transmit_protocol/dtls/handshake.cpp diff --git a/Core/transmit_protocol/dtls/handshake.h b/src/Psc_Cpp_Core/transmit_protocol/dtls/handshake.h similarity index 100% rename from Core/transmit_protocol/dtls/handshake.h rename to src/Psc_Cpp_Core/transmit_protocol/dtls/handshake.h diff --git a/Core/transmit_protocol/export.cpp b/src/Psc_Cpp_Core/transmit_protocol/export.cpp similarity index 100% rename from Core/transmit_protocol/export.cpp rename to src/Psc_Cpp_Core/transmit_protocol/export.cpp diff --git a/Core/transmit_protocol/export.h b/src/Psc_Cpp_Core/transmit_protocol/export.h similarity index 100% rename from Core/transmit_protocol/export.h rename to src/Psc_Cpp_Core/transmit_protocol/export.h diff --git a/Core/transmit_protocol/feclib/Makefile b/src/Psc_Cpp_Core/transmit_protocol/feclib/Makefile similarity index 100% rename from Core/transmit_protocol/feclib/Makefile rename to src/Psc_Cpp_Core/transmit_protocol/feclib/Makefile diff --git a/Core/transmit_protocol/feclib/change_list.txt b/src/Psc_Cpp_Core/transmit_protocol/feclib/change_list.txt similarity index 100% rename from Core/transmit_protocol/feclib/change_list.txt rename to src/Psc_Cpp_Core/transmit_protocol/feclib/change_list.txt diff --git a/Core/transmit_protocol/feclib/documentation.html b/src/Psc_Cpp_Core/transmit_protocol/feclib/documentation.html similarity index 100% rename from Core/transmit_protocol/feclib/documentation.html rename to src/Psc_Cpp_Core/transmit_protocol/feclib/documentation.html diff --git a/Core/transmit_protocol/feclib/fec.c b/src/Psc_Cpp_Core/transmit_protocol/feclib/fec.c similarity index 100% rename from Core/transmit_protocol/feclib/fec.c rename to src/Psc_Cpp_Core/transmit_protocol/feclib/fec.c diff --git a/Core/transmit_protocol/feclib/fec.h b/src/Psc_Cpp_Core/transmit_protocol/feclib/fec.h similarity index 100% rename from Core/transmit_protocol/feclib/fec.h rename to src/Psc_Cpp_Core/transmit_protocol/feclib/fec.h diff --git a/Core/transmit_protocol/feclib/fec.rar b/src/Psc_Cpp_Core/transmit_protocol/feclib/fec.rar similarity index 100% rename from Core/transmit_protocol/feclib/fec.rar rename to src/Psc_Cpp_Core/transmit_protocol/feclib/fec.rar diff --git a/Core/transmit_protocol/feclib/feclib.spec b/src/Psc_Cpp_Core/transmit_protocol/feclib/feclib.spec similarity index 100% rename from Core/transmit_protocol/feclib/feclib.spec rename to src/Psc_Cpp_Core/transmit_protocol/feclib/feclib.spec diff --git a/Core/transmit_protocol/feclib/fectest.c b/src/Psc_Cpp_Core/transmit_protocol/feclib/fectest.c similarity index 100% rename from Core/transmit_protocol/feclib/fectest.c rename to src/Psc_Cpp_Core/transmit_protocol/feclib/fectest.c diff --git a/Core/transmit_protocol/feclib/index.html b/src/Psc_Cpp_Core/transmit_protocol/feclib/index.html similarity index 100% rename from Core/transmit_protocol/feclib/index.html rename to src/Psc_Cpp_Core/transmit_protocol/feclib/index.html diff --git a/Core/transmit_protocol/global.cpp b/src/Psc_Cpp_Core/transmit_protocol/global.cpp similarity index 100% rename from Core/transmit_protocol/global.cpp rename to src/Psc_Cpp_Core/transmit_protocol/global.cpp diff --git a/Core/transmit_protocol/global.h b/src/Psc_Cpp_Core/transmit_protocol/global.h similarity index 100% rename from Core/transmit_protocol/global.h rename to src/Psc_Cpp_Core/transmit_protocol/global.h diff --git a/Core/transmit_protocol/global_tree.cpp b/src/Psc_Cpp_Core/transmit_protocol/global_tree.cpp similarity index 100% rename from Core/transmit_protocol/global_tree.cpp rename to src/Psc_Cpp_Core/transmit_protocol/global_tree.cpp diff --git a/Core/transmit_protocol/kcp深度结合fec.txt b/src/Psc_Cpp_Core/transmit_protocol/kcp深度结合fec.txt similarity index 100% rename from Core/transmit_protocol/kcp深度结合fec.txt rename to src/Psc_Cpp_Core/transmit_protocol/kcp深度结合fec.txt diff --git a/Core/transmit_protocol/kfec/FEC_CB.cpp b/src/Psc_Cpp_Core/transmit_protocol/kfec/FEC_CB.cpp similarity index 98% rename from Core/transmit_protocol/kfec/FEC_CB.cpp rename to src/Psc_Cpp_Core/transmit_protocol/kfec/FEC_CB.cpp index 28f2566..e1cab2a 100644 --- a/Core/transmit_protocol/kfec/FEC_CB.cpp +++ b/src/Psc_Cpp_Core/transmit_protocol/kfec/FEC_CB.cpp @@ -2,7 +2,7 @@ #include #include #include "../other_node/Transmission_Test.h" -#include "Core/Base/fmt.h" +#include "Psc_Cpp_Core/Base/fmt.h" namespace Psc { // #define Packet_0_9_check_enable FEC_CB::~FEC_CB() { @@ -170,7 +170,8 @@ void FEC_CB::recv(Buf_Type buf, Len_Type len, void* user) { continue; } bool ok = Cache_Recv_Frame_decode(f); - if (ok == true) { // 一帧解码成功 + if (ok == true) { + // 一帧解码成功 printf("%d 解码成功! buf_len:%d cb->order_buf_len:%d cb->recv_seq:%d \r\n", f->seq, rcv_buf->len, order_buf->len, recv_seq); Recv_FEC_Frame* f = (Recv_FEC_Frame*)Ptr_List_pop_ptr(rcv_buf, t); // 按照顺序尾插 列表 diff --git a/Core/transmit_protocol/kfec/FEC_CB.h b/src/Psc_Cpp_Core/transmit_protocol/kfec/FEC_CB.h similarity index 96% rename from Core/transmit_protocol/kfec/FEC_CB.h rename to src/Psc_Cpp_Core/transmit_protocol/kfec/FEC_CB.h index 6cef205..398a298 100644 --- a/Core/transmit_protocol/kfec/FEC_CB.h +++ b/src/Psc_Cpp_Core/transmit_protocol/kfec/FEC_CB.h @@ -1,5 +1,5 @@ #pragma once -#include "../../../Core/Statistics/Statistics.h" +#include "Psc_Cpp_Core/Statistics/Statistics.h" #include "Recv_FEC_Frame.h" #include "Send_FEC_Frame.h" #include "global.h" diff --git a/Core/transmit_protocol/kfec/Recv_FEC_Frame.cpp b/src/Psc_Cpp_Core/transmit_protocol/kfec/Recv_FEC_Frame.cpp similarity index 100% rename from Core/transmit_protocol/kfec/Recv_FEC_Frame.cpp rename to src/Psc_Cpp_Core/transmit_protocol/kfec/Recv_FEC_Frame.cpp diff --git a/Core/transmit_protocol/kfec/Recv_FEC_Frame.h b/src/Psc_Cpp_Core/transmit_protocol/kfec/Recv_FEC_Frame.h similarity index 100% rename from Core/transmit_protocol/kfec/Recv_FEC_Frame.h rename to src/Psc_Cpp_Core/transmit_protocol/kfec/Recv_FEC_Frame.h diff --git a/Core/transmit_protocol/kfec/Send_FEC_Frame.cpp b/src/Psc_Cpp_Core/transmit_protocol/kfec/Send_FEC_Frame.cpp similarity index 100% rename from Core/transmit_protocol/kfec/Send_FEC_Frame.cpp rename to src/Psc_Cpp_Core/transmit_protocol/kfec/Send_FEC_Frame.cpp diff --git a/Core/transmit_protocol/kfec/Send_FEC_Frame.h b/src/Psc_Cpp_Core/transmit_protocol/kfec/Send_FEC_Frame.h similarity index 100% rename from Core/transmit_protocol/kfec/Send_FEC_Frame.h rename to src/Psc_Cpp_Core/transmit_protocol/kfec/Send_FEC_Frame.h diff --git a/Core/transmit_protocol/kfec/global.cpp b/src/Psc_Cpp_Core/transmit_protocol/kfec/global.cpp similarity index 100% rename from Core/transmit_protocol/kfec/global.cpp rename to src/Psc_Cpp_Core/transmit_protocol/kfec/global.cpp diff --git a/Core/transmit_protocol/kfec/global.h b/src/Psc_Cpp_Core/transmit_protocol/kfec/global.h similarity index 100% rename from Core/transmit_protocol/kfec/global.h rename to src/Psc_Cpp_Core/transmit_protocol/kfec/global.h diff --git a/Core/transmit_protocol/kfec/这一版很多问题 b/src/Psc_Cpp_Core/transmit_protocol/kfec/这一版很多问题 similarity index 100% rename from Core/transmit_protocol/kfec/这一版很多问题 rename to src/Psc_Cpp_Core/transmit_protocol/kfec/这一版很多问题 diff --git a/Core/transmit_protocol/other_node/Empty_Transmit.cpp b/src/Psc_Cpp_Core/transmit_protocol/other_node/Empty_Transmit.cpp similarity index 100% rename from Core/transmit_protocol/other_node/Empty_Transmit.cpp rename to src/Psc_Cpp_Core/transmit_protocol/other_node/Empty_Transmit.cpp diff --git a/Core/transmit_protocol/other_node/Empty_Transmit.h b/src/Psc_Cpp_Core/transmit_protocol/other_node/Empty_Transmit.h similarity index 100% rename from Core/transmit_protocol/other_node/Empty_Transmit.h rename to src/Psc_Cpp_Core/transmit_protocol/other_node/Empty_Transmit.h diff --git a/Core/transmit_protocol/other_node/SRP_Fixed_CB.cpp b/src/Psc_Cpp_Core/transmit_protocol/other_node/SRP_Fixed_CB.cpp similarity index 80% rename from Core/transmit_protocol/other_node/SRP_Fixed_CB.cpp rename to src/Psc_Cpp_Core/transmit_protocol/other_node/SRP_Fixed_CB.cpp index e3fedd0..e23d801 100644 --- a/Core/transmit_protocol/other_node/SRP_Fixed_CB.cpp +++ b/src/Psc_Cpp_Core/transmit_protocol/other_node/SRP_Fixed_CB.cpp @@ -1,7 +1,7 @@ #include "SRP_Fixed_CB.h" #include -#include "Core/transmit_protocol/Channel_Simulator/Flow_Channel_Simulator.h" -#include "Core/transmit_protocol/Channel_Simulator/global.h" +#include "Psc_Cpp_Core/transmit_protocol/Channel_Simulator/Flow_Channel_Simulator.h" +#include "Psc_Cpp_Core/transmit_protocol/Channel_Simulator/global.h" #include "Transmission_Test.h" namespace Psc { void test_SRP_Fixed_CB_While(Get_Millisecond get_millisecond) { @@ -12,9 +12,13 @@ void test_SRP_Fixed_CB_While(Get_Millisecond get_millisecond) { Proto_Tree* t2 = create_single_test(s2, get_millisecond).tree; Flow_Channel_Simulator fcs(t1, t2, 0.00); t1->pack_send = [&fcs](Proto_Tree* tr, Buf_Type buf, Len_Type len, - void* user) { fcs.send(tr, buf, len); }; + void* user) { + fcs.send(tr, buf, len); + }; t2->pack_send = [&fcs](Proto_Tree* tr, Buf_Type buf, Len_Type len, - void* user) { fcs.send(tr, buf, len); }; + void* user) { + fcs.send(tr, buf, len); + }; Len_Type buf_len = 10 * max_packet_len; auto buf = new char[buf_len]; auto data = new char[max_packet_len]; @@ -57,7 +61,7 @@ void test_SRP_Fixed_CB(Get_Millisecond get_millisecond) { SRP_Fixed_CB* cb = create_default_SRP_Fixed_CB(max_packet_len); Len_Type all_len = 500; std::vector data = create_order_vec( - all_len, sizeof(Default_Serial_Packet_Header), max_packet_len); + all_len, sizeof(Default_Serial_Packet_Header), max_packet_len); std::vector spilt = create_order_vec(all_len, 1, max_packet_len * 2); printf("data = {"); @@ -111,16 +115,16 @@ SRP_Fixed_CB::SRP_Fixed_CB(Len_Type total_len) : unpacker(total_len) { } SRP_Fixed_CB* create_default_SRP_Fixed_CB(Len_Type total_len) { auto ret = new SRP_Fixed_CB(total_len); - ret->unpacker.set_header_external((Buf_Type)&default_serial_packet_header, 4); + ret->unpacker.set_header_external((Buf_Type) & default_serial_packet_header, 4); ret->unpacker.set_check( - [ret](Buf_Type buf, Len_Type len, Len_Type cur_skip_bytes) -> bool { - // std::cout << "check_crc_cur_skip_bytes:" << cur_skip_bytes << - // std::endl; - auto h = reinterpret_cast(buf); - uint32_t new_crc = xcrc32(buf + ret->unpacker.length_offset(), - len - ret->unpacker.length_offset()); - return h->crc == new_crc; - }); + [ret](Buf_Type buf, Len_Type len, Len_Type cur_skip_bytes) -> bool { + // std::cout << "check_crc_cur_skip_bytes:" << cur_skip_bytes << + // std::endl; + auto h = reinterpret_cast(buf); + uint32_t new_crc = xcrc32(buf + ret->unpacker.length_offset(), + len - ret->unpacker.length_offset()); + return h->crc == new_crc; + }); ret->unpacker.set_length(offsetof(Default_Serial_Packet_Header, len), sizeof(Default_Serial_Packet_Header::len)); ret->add_pack = [](SRP_Fixed_CB* bcb, Buf_Type data_buf, Len_Type data_len, @@ -136,22 +140,22 @@ SRP_Fixed_CB* create_default_SRP_Fixed_CB(Len_Type total_len) { bcb->next_send(bcb, buf, total_len, user); #if Debug_SRP_Fixed_CB std::cout << "add_pack_send:" - << Psc:: ::mem2hex(std::string(buf, total_len)) << std::endl; + << Psc::::mem2hex(std::string(buf, total_len)) << std::endl; #endif g_free(buf); }; ret->next_send = [](Base_CB* bcb, Buf_Type buf, Len_Type len, void* user) { #if Debug_SRP_Fixed_CB std::cout << "next_send:" - << Psc:: ::mem2hex(std::string((const char*)buf, len)) - << std::endl; + << Psc::::mem2hex(std::string((const char*)buf, len)) + << std::endl; #endif }; ret->next_recv = [](Base_CB* bcb, Buf_Type buf, Len_Type len, void* user) { #if Debug_SRP_Fixed_CB std::cout << "next_recv:" - << Psc:: ::mem2hex(std::string((const char*)buf, len)) - << std::endl; + << Psc::::mem2hex(std::string((const char*)buf, len)) + << std::endl; #endif }; return ret; @@ -171,8 +175,8 @@ public: Get_Millisecond get_millisecond = []() { auto now = std::chrono::steady_clock::now(); auto millis = std::chrono::duration_cast( - now.time_since_epoch()) - .count(); + now.time_since_epoch()) + .count(); return static_cast(millis); }; const Len_Type max_packet_len = 50; @@ -183,9 +187,13 @@ public: s2 = create_default_SRP_Fixed_CB(max_packet_len); fcs = new Flow_Channel_Simulator(s1, s2, 0.00); s1->next_send = [this](Base_CB* bcb, Buf_Type buf, Len_Type len, - void* user) { fcs->send(s1, buf, len); }; + void* user) { + fcs->send(s1, buf, len); + }; s2->next_recv = [this](Base_CB* bcb, Buf_Type buf, Len_Type len, - void* user) { s2_recv_num++; }; + void* user) { + s2_recv_num++; + }; // fcs->send(tr, buf, len); // // @@ -196,8 +204,7 @@ public: memset(data, 0, max_packet_len); memset(buffer, 0, max_packet_len); } - void TearDown() override { - } + void TearDown() override {} }; // 测试在通道无错误的情况下,任意位置断开可以解析出所有的包 TEST_F(SRP_Fixed_CB_Test, Test_No_Error_Prase_all_packet_ok2) { @@ -236,8 +243,8 @@ public: Get_Millisecond get_millisecond = []() { auto now = std::chrono::steady_clock::now(); auto millis = std::chrono::duration_cast( - now.time_since_epoch()) - .count(); + now.time_since_epoch()) + .count(); return static_cast(millis); }; const Len_Type max_packet_len = 50; @@ -247,22 +254,21 @@ public: t1 = create_single_test(s1, get_millisecond); t2 = create_single_test(s2, get_millisecond); #if !Test_CB_Print - t1.ttc->print = false; - t2.ttc->print = false; +t1.ttc->print=false; +t2.ttc->print=false; #endif - fcs = new Flow_Channel_Simulator(t1.tree, t2.tree, 0.00); - t1.tree->pack_send = [this](Proto_Tree* tr, Buf_Type buf, Len_Type len, - void* user) { fcs->send(tr, buf, len); }; - t2.tree->pack_send = [this](Proto_Tree* tr, Buf_Type buf, Len_Type len, - void* user) { fcs->send(tr, buf, len); }; - buf_len = 10 * max_packet_len; - buffer = new char[buf_len]; - data = new char[max_packet_len]; - memset(data, 0, max_packet_len); - memset(buffer, 0, max_packet_len); - } - void TearDown() override { +fcs=new Flow_Channel_Simulator (t1.tree, t2.tree, 0.00); +t1.tree->pack_send= [this](Proto_Tree*tr, Buf_Type buf, Len_Type len, +void* user) { fcs->send(tr, buf, len); }; +t2.tree->pack_send= [this](Proto_Tree*tr, Buf_Type buf, Len_Type len, +void* user) { fcs->send(tr, buf, len); }; +buf_len=10 * max_packet_len; +buffer=new char [buf_len]; +data=new char [max_packet_len]; +memset(data, 0, max_packet_len); +memset(buffer, 0, max_packet_len); } +void TearDown() override {} }; // 测试在通道无错误的情况下,任意位置断开可以解析出所有的包 TEST_F(SRP_Fixed_CB_Test_With_Tree, Test_No_Error_Prase_all_packet_ok) { diff --git a/Core/transmit_protocol/other_node/SRP_Fixed_CB.h b/src/Psc_Cpp_Core/transmit_protocol/other_node/SRP_Fixed_CB.h similarity index 85% rename from Core/transmit_protocol/other_node/SRP_Fixed_CB.h rename to src/Psc_Cpp_Core/transmit_protocol/other_node/SRP_Fixed_CB.h index 9608c15..ab92766 100644 --- a/Core/transmit_protocol/other_node/SRP_Fixed_CB.h +++ b/src/Psc_Cpp_Core/transmit_protocol/other_node/SRP_Fixed_CB.h @@ -1,5 +1,5 @@ #pragma once -#include "../../../Core/transmit_protocol/global.h" +#include "Psc_Cpp_Core/transmit_protocol/global.h" #include "Universal_Unpacker.h" namespace Psc { struct SRP_Fixed_CB : Base_CB { @@ -7,7 +7,7 @@ struct SRP_Fixed_CB : Base_CB { void recv(Buf_Type rcv_buf, Len_Type rcv_len, void* user) override; Normal_Universal_Unpacker unpacker; explicit SRP_Fixed_CB(Len_Type total_len); - std::function + std::function add_pack{}; }; // 测试代码 diff --git a/Core/transmit_protocol/other_node/Transmission_Test.cpp b/src/Psc_Cpp_Core/transmit_protocol/other_node/Transmission_Test.cpp similarity index 100% rename from Core/transmit_protocol/other_node/Transmission_Test.cpp rename to src/Psc_Cpp_Core/transmit_protocol/other_node/Transmission_Test.cpp diff --git a/Core/transmit_protocol/other_node/Transmission_Test.h b/src/Psc_Cpp_Core/transmit_protocol/other_node/Transmission_Test.h similarity index 96% rename from Core/transmit_protocol/other_node/Transmission_Test.h rename to src/Psc_Cpp_Core/transmit_protocol/other_node/Transmission_Test.h index 0ffbada..fabfc42 100644 --- a/Core/transmit_protocol/other_node/Transmission_Test.h +++ b/src/Psc_Cpp_Core/transmit_protocol/other_node/Transmission_Test.h @@ -1,5 +1,5 @@ #pragma once -#include "../../../Core/Statistics/Statistics.h" +#include "Psc_Cpp_Core/Statistics/Statistics.h" #include "../global.h" #include "udp_serial.h" namespace Psc { diff --git a/Core/transmit_protocol/other_node/Universal_Unpacker.h b/src/Psc_Cpp_Core/transmit_protocol/other_node/Universal_Unpacker.h similarity index 97% rename from Core/transmit_protocol/other_node/Universal_Unpacker.h rename to src/Psc_Cpp_Core/transmit_protocol/other_node/Universal_Unpacker.h index 05b0aac..f01b04f 100644 --- a/Core/transmit_protocol/other_node/Universal_Unpacker.h +++ b/src/Psc_Cpp_Core/transmit_protocol/other_node/Universal_Unpacker.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include "../../../Core/transmit_protocol/core/main.h" +#include "Psc_Cpp_Core/transmit_protocol/core/main.h" namespace Psc { // 在单包长度一定长度范围内(超过会被丢弃) // 保证可以传入任意长度,任意内容的数据解析 diff --git a/Core/transmit_protocol/other_node/Universal_Unpacker.hpp b/src/Psc_Cpp_Core/transmit_protocol/other_node/Universal_Unpacker.hpp similarity index 100% rename from Core/transmit_protocol/other_node/Universal_Unpacker.hpp rename to src/Psc_Cpp_Core/transmit_protocol/other_node/Universal_Unpacker.hpp diff --git a/Core/transmit_protocol/other_node/Universal_Unpacker_Impl.hpp b/src/Psc_Cpp_Core/transmit_protocol/other_node/Universal_Unpacker_Impl.hpp similarity index 100% rename from Core/transmit_protocol/other_node/Universal_Unpacker_Impl.hpp rename to src/Psc_Cpp_Core/transmit_protocol/other_node/Universal_Unpacker_Impl.hpp diff --git a/Core/transmit_protocol/other_node/udp_serial.cpp b/src/Psc_Cpp_Core/transmit_protocol/other_node/udp_serial.cpp similarity index 100% rename from Core/transmit_protocol/other_node/udp_serial.cpp rename to src/Psc_Cpp_Core/transmit_protocol/other_node/udp_serial.cpp diff --git a/Core/transmit_protocol/other_node/udp_serial.h b/src/Psc_Cpp_Core/transmit_protocol/other_node/udp_serial.h similarity index 100% rename from Core/transmit_protocol/other_node/udp_serial.h rename to src/Psc_Cpp_Core/transmit_protocol/other_node/udp_serial.h diff --git a/Core/transmit_protocol/other_node/udp_serial.mermaid b/src/Psc_Cpp_Core/transmit_protocol/other_node/udp_serial.mermaid similarity index 100% rename from Core/transmit_protocol/other_node/udp_serial.mermaid rename to src/Psc_Cpp_Core/transmit_protocol/other_node/udp_serial.mermaid diff --git a/Core/transmit_protocol/session/session b/src/Psc_Cpp_Core/transmit_protocol/session/session similarity index 100% rename from Core/transmit_protocol/session/session rename to src/Psc_Cpp_Core/transmit_protocol/session/session diff --git a/Core/transmit_protocol/session/tls算法流程 b/src/Psc_Cpp_Core/transmit_protocol/session/tls算法流程 similarity index 100% rename from Core/transmit_protocol/session/tls算法流程 rename to src/Psc_Cpp_Core/transmit_protocol/session/tls算法流程 diff --git a/Core/transmit_protocol/udp_fec_s/global.h b/src/Psc_Cpp_Core/transmit_protocol/udp_fec_s/global.h similarity index 100% rename from Core/transmit_protocol/udp_fec_s/global.h rename to src/Psc_Cpp_Core/transmit_protocol/udp_fec_s/global.h diff --git a/Core/transmit_protocol/udp_fec_s/udp_fec.cpp b/src/Psc_Cpp_Core/transmit_protocol/udp_fec_s/udp_fec.cpp similarity index 100% rename from Core/transmit_protocol/udp_fec_s/udp_fec.cpp rename to src/Psc_Cpp_Core/transmit_protocol/udp_fec_s/udp_fec.cpp diff --git a/Core/transmit_protocol/udp_fec_s/udp_fec.h b/src/Psc_Cpp_Core/transmit_protocol/udp_fec_s/udp_fec.h similarity index 96% rename from Core/transmit_protocol/udp_fec_s/udp_fec.h rename to src/Psc_Cpp_Core/transmit_protocol/udp_fec_s/udp_fec.h index 6e0c3d0..d3454b2 100644 --- a/Core/transmit_protocol/udp_fec_s/udp_fec.h +++ b/src/Psc_Cpp_Core/transmit_protocol/udp_fec_s/udp_fec.h @@ -1,6 +1,6 @@ #ifndef UDP_FEC_H #define UDP_FEC_H -#include "../../../Core/Statistics/Statistics.h" +#include "Psc_Cpp_Core/Statistics/Statistics.h" #include "../feclib/fec.h" #include "../global.h" #include "global.h" diff --git a/Core/transmit_protocol/udp_fec_s/udp_fec_recv.cpp b/src/Psc_Cpp_Core/transmit_protocol/udp_fec_s/udp_fec_recv.cpp similarity index 100% rename from Core/transmit_protocol/udp_fec_s/udp_fec_recv.cpp rename to src/Psc_Cpp_Core/transmit_protocol/udp_fec_s/udp_fec_recv.cpp diff --git a/Core/transmit_protocol/udp_fec_s/udp_fec_send.cpp b/src/Psc_Cpp_Core/transmit_protocol/udp_fec_s/udp_fec_send.cpp similarity index 100% rename from Core/transmit_protocol/udp_fec_s/udp_fec_send.cpp rename to src/Psc_Cpp_Core/transmit_protocol/udp_fec_s/udp_fec_send.cpp diff --git a/Core/transmit_protocol/uthash/LICENSE b/src/Psc_Cpp_Core/transmit_protocol/uthash/LICENSE similarity index 100% rename from Core/transmit_protocol/uthash/LICENSE rename to src/Psc_Cpp_Core/transmit_protocol/uthash/LICENSE diff --git a/Core/transmit_protocol/uthash/utarray.h b/src/Psc_Cpp_Core/transmit_protocol/uthash/utarray.h similarity index 100% rename from Core/transmit_protocol/uthash/utarray.h rename to src/Psc_Cpp_Core/transmit_protocol/uthash/utarray.h diff --git a/Core/transmit_protocol/uthash/uthash.h b/src/Psc_Cpp_Core/transmit_protocol/uthash/uthash.h similarity index 100% rename from Core/transmit_protocol/uthash/uthash.h rename to src/Psc_Cpp_Core/transmit_protocol/uthash/uthash.h diff --git a/Core/transmit_protocol/uthash/utlist.h b/src/Psc_Cpp_Core/transmit_protocol/uthash/utlist.h similarity index 100% rename from Core/transmit_protocol/uthash/utlist.h rename to src/Psc_Cpp_Core/transmit_protocol/uthash/utlist.h diff --git a/Core/transmit_protocol/uthash/utringbuffer.h b/src/Psc_Cpp_Core/transmit_protocol/uthash/utringbuffer.h similarity index 100% rename from Core/transmit_protocol/uthash/utringbuffer.h rename to src/Psc_Cpp_Core/transmit_protocol/uthash/utringbuffer.h diff --git a/Core/transmit_protocol/uthash/utstack.h b/src/Psc_Cpp_Core/transmit_protocol/uthash/utstack.h similarity index 100% rename from Core/transmit_protocol/uthash/utstack.h rename to src/Psc_Cpp_Core/transmit_protocol/uthash/utstack.h diff --git a/Core/transmit_protocol/uthash/utstring.h b/src/Psc_Cpp_Core/transmit_protocol/uthash/utstring.h similarity index 100% rename from Core/transmit_protocol/uthash/utstring.h rename to src/Psc_Cpp_Core/transmit_protocol/uthash/utstring.h diff --git a/Core/transmit_protocol/warp_kcp/LICENSE b/src/Psc_Cpp_Core/transmit_protocol/warp_kcp/LICENSE similarity index 100% rename from Core/transmit_protocol/warp_kcp/LICENSE rename to src/Psc_Cpp_Core/transmit_protocol/warp_kcp/LICENSE diff --git a/Core/transmit_protocol/warp_kcp/kcp.cpp b/src/Psc_Cpp_Core/transmit_protocol/warp_kcp/kcp.cpp similarity index 100% rename from Core/transmit_protocol/warp_kcp/kcp.cpp rename to src/Psc_Cpp_Core/transmit_protocol/warp_kcp/kcp.cpp diff --git a/Core/transmit_protocol/warp_kcp/kcp.h b/src/Psc_Cpp_Core/transmit_protocol/warp_kcp/kcp.h similarity index 100% rename from Core/transmit_protocol/warp_kcp/kcp.h rename to src/Psc_Cpp_Core/transmit_protocol/warp_kcp/kcp.h diff --git a/Core/transmit_protocol/warp_kcp/protocol.txt b/src/Psc_Cpp_Core/transmit_protocol/warp_kcp/protocol.txt similarity index 100% rename from Core/transmit_protocol/warp_kcp/protocol.txt rename to src/Psc_Cpp_Core/transmit_protocol/warp_kcp/protocol.txt diff --git a/Core/transmit_protocol/warp_kcp/warp_kcp.cpp b/src/Psc_Cpp_Core/transmit_protocol/warp_kcp/warp_kcp.cpp similarity index 100% rename from Core/transmit_protocol/warp_kcp/warp_kcp.cpp rename to src/Psc_Cpp_Core/transmit_protocol/warp_kcp/warp_kcp.cpp diff --git a/Core/transmit_protocol/warp_kcp/warp_kcp.h b/src/Psc_Cpp_Core/transmit_protocol/warp_kcp/warp_kcp.h similarity index 100% rename from Core/transmit_protocol/warp_kcp/warp_kcp.h rename to src/Psc_Cpp_Core/transmit_protocol/warp_kcp/warp_kcp.h diff --git a/Core/transmit_protocol/协议分析文档.md b/src/Psc_Cpp_Core/transmit_protocol/协议分析文档.md similarity index 100% rename from Core/transmit_protocol/协议分析文档.md rename to src/Psc_Cpp_Core/transmit_protocol/协议分析文档.md diff --git a/Core/transmit_protocol/性能测试记录/kcp__udp_fec_on_800_1000.png b/src/Psc_Cpp_Core/transmit_protocol/性能测试记录/kcp__udp_fec_on_800_1000.png similarity index 100% rename from Core/transmit_protocol/性能测试记录/kcp__udp_fec_on_800_1000.png rename to src/Psc_Cpp_Core/transmit_protocol/性能测试记录/kcp__udp_fec_on_800_1000.png diff --git a/Core/transmit_protocol/性能测试记录/kcp__udp_fec_on_800_1000_自动调整算法.png b/src/Psc_Cpp_Core/transmit_protocol/性能测试记录/kcp__udp_fec_on_800_1000_自动调整算法.png similarity index 100% rename from Core/transmit_protocol/性能测试记录/kcp__udp_fec_on_800_1000_自动调整算法.png rename to src/Psc_Cpp_Core/transmit_protocol/性能测试记录/kcp__udp_fec_on_800_1000_自动调整算法.png diff --git a/Core/transmit_protocol/性能测试记录/udp_fec_on_800_1000.png b/src/Psc_Cpp_Core/transmit_protocol/性能测试记录/udp_fec_on_800_1000.png similarity index 100% rename from Core/transmit_protocol/性能测试记录/udp_fec_on_800_1000.png rename to src/Psc_Cpp_Core/transmit_protocol/性能测试记录/udp_fec_on_800_1000.png diff --git a/Core/transmit_protocol/性能测试记录/修改统计的测试后数据.png b/src/Psc_Cpp_Core/transmit_protocol/性能测试记录/修改统计的测试后数据.png similarity index 100% rename from Core/transmit_protocol/性能测试记录/修改统计的测试后数据.png rename to src/Psc_Cpp_Core/transmit_protocol/性能测试记录/修改统计的测试后数据.png diff --git a/Core/transmit_protocol/性能测试记录/性能测试记录.md b/src/Psc_Cpp_Core/transmit_protocol/性能测试记录/性能测试记录.md similarity index 100% rename from Core/transmit_protocol/性能测试记录/性能测试记录.md rename to src/Psc_Cpp_Core/transmit_protocol/性能测试记录/性能测试记录.md diff --git a/Core/transmit_protocol/文档.md b/src/Psc_Cpp_Core/transmit_protocol/文档.md similarity index 100% rename from Core/transmit_protocol/文档.md rename to src/Psc_Cpp_Core/transmit_protocol/文档.md diff --git a/psc_global_include/Bit.cpp b/src/private_psc_global_include/Bit.cpp similarity index 100% rename from psc_global_include/Bit.cpp rename to src/private_psc_global_include/Bit.cpp diff --git a/psc_global_include/Bit.h b/src/private_psc_global_include/Bit.h similarity index 100% rename from psc_global_include/Bit.h rename to src/private_psc_global_include/Bit.h diff --git a/psc_global_include/Fail_Fast.cpp b/src/private_psc_global_include/Fail_Fast.cpp similarity index 93% rename from psc_global_include/Fail_Fast.cpp rename to src/private_psc_global_include/Fail_Fast.cpp index 5c0eeae..37b53fc 100644 --- a/psc_global_include/Fail_Fast.cpp +++ b/src/private_psc_global_include/Fail_Fast.cpp @@ -1,8 +1,8 @@ #include #include -#include "Core/Base/global_include.h" -#include "Core/spdlog/export.h" -#include "Core/system/export.h" +#include "Psc_Cpp_Core/Base/global_include.h" +#include "Psc_Cpp_Core/spdlog/export.h" +#include "Psc_Cpp_Core/system/export.h" #include "export.h" namespace Psc { // std::exit std::terminate 的核心区别就是 是否需要生成core_dump 文件 diff --git a/psc_global_include/Fail_Fast.h b/src/private_psc_global_include/Fail_Fast.h similarity index 100% rename from psc_global_include/Fail_Fast.h rename to src/private_psc_global_include/Fail_Fast.h diff --git a/psc_global_include/RET.hpp b/src/private_psc_global_include/RET.hpp similarity index 100% rename from psc_global_include/RET.hpp rename to src/private_psc_global_include/RET.hpp diff --git a/psc_global_include/Singleton.hpp b/src/private_psc_global_include/Singleton.hpp similarity index 100% rename from psc_global_include/Singleton.hpp rename to src/private_psc_global_include/Singleton.hpp diff --git a/psc_global_include/Spin_Lock.cpp b/src/private_psc_global_include/Spin_Lock.cpp similarity index 81% rename from psc_global_include/Spin_Lock.cpp rename to src/private_psc_global_include/Spin_Lock.cpp index 705e4a4..4ba60ec 100644 --- a/psc_global_include/Spin_Lock.cpp +++ b/src/private_psc_global_include/Spin_Lock.cpp @@ -1,10 +1,8 @@ #include -#include "Core/Base/global_include.h" +#include "Psc_Cpp_Core/Base/global_include.h" namespace Psc { -void Empty_Lock::lock() { -} -void Empty_Lock::unlock() { -} +void Empty_Lock::lock() {} +void Empty_Lock::unlock() {} bool Empty_Lock::tryLock() { return true; } @@ -12,8 +10,7 @@ bool Empty_Lock::tryLock(int durationMillis) { return true; } void Spin_Lock::lock() { - while (flag.test_and_set(std::memory_order_acquire)) { - } + while (flag.test_and_set(std::memory_order_acquire)) {} } bool Spin_Lock::tryLock() { return !flag.test_and_set(std::memory_order_acquire); diff --git a/psc_global_include/Spin_Lock.h b/src/private_psc_global_include/Spin_Lock.h similarity index 100% rename from psc_global_include/Spin_Lock.h rename to src/private_psc_global_include/Spin_Lock.h diff --git a/psc_global_include/assert.h b/src/private_psc_global_include/assert.h similarity index 100% rename from psc_global_include/assert.h rename to src/private_psc_global_include/assert.h diff --git a/psc_global_include/codec.cpp b/src/private_psc_global_include/codec.cpp similarity index 100% rename from psc_global_include/codec.cpp rename to src/private_psc_global_include/codec.cpp diff --git a/psc_global_include/codec.h b/src/private_psc_global_include/codec.h similarity index 100% rename from psc_global_include/codec.h rename to src/private_psc_global_include/codec.h diff --git a/psc_global_include/core_global_include.h b/src/private_psc_global_include/core_global_include.h similarity index 100% rename from psc_global_include/core_global_include.h rename to src/private_psc_global_include/core_global_include.h diff --git a/psc_global_include/error.hpp b/src/private_psc_global_include/error.hpp similarity index 100% rename from psc_global_include/error.hpp rename to src/private_psc_global_include/error.hpp diff --git a/psc_global_include/expected.h b/src/private_psc_global_include/expected.h similarity index 100% rename from psc_global_include/expected.h rename to src/private_psc_global_include/expected.h diff --git a/psc_global_include/export.h b/src/private_psc_global_include/export.h similarity index 100% rename from psc_global_include/export.h rename to src/private_psc_global_include/export.h diff --git a/psc_global_include/inter_global.h b/src/private_psc_global_include/inter_global.h similarity index 100% rename from psc_global_include/inter_global.h rename to src/private_psc_global_include/inter_global.h