From 194edc112691363b72123c52998a1cf16695d597 Mon Sep 17 00:00:00 2001 From: ChunelFeng Date: Thu, 3 Oct 2024 13:28:20 +0800 Subject: [PATCH] [feat] remove CErrStatus, no use now. --- src/CBasic/CFuncType.h | 10 ++-------- src/GraphCtrl/GraphAspect/GAspectManager.cpp | 2 +- src/GraphCtrl/GraphMessage/GMessageManager.h | 2 +- src/GraphCtrl/GraphParam/GParamManager.inl | 2 +- src/UtilsCtrl/ThreadPool/UThreadPool.cpp | 6 +++--- src/UtilsCtrl/UtilsDefine.h | 2 +- tutorial/T27-Trim.cpp | 2 +- 7 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/CBasic/CFuncType.h b/src/CBasic/CFuncType.h index de86c583..a26b3e15 100644 --- a/src/CBasic/CFuncType.h +++ b/src/CBasic/CFuncType.h @@ -52,15 +52,9 @@ enum class CFunctionType { + " | line = [" + ::std::to_string( __LINE__) + "]") -/** 生成一个包含异常位置的 CStatus - * 这里这样实现,是为了符合 CStatus 类似写法 - * */ -#define CErrStatus(info) \ - CStatus(info) \ - /** 返回异常信息和状态 */ #define CGRAPH_RETURN_ERROR_STATUS(info) \ - return CErrStatus(info); \ + return CStatus(info); \ /** 根据条件判断是否返回错误状态 */ #define CGRAPH_RETURN_ERROR_STATUS_BY_CONDITION(cond, info) \ @@ -68,7 +62,7 @@ enum class CFunctionType { /** 不支持当前功能 */ #define CGRAPH_NO_SUPPORT \ - return CErrStatus(CGRAPH_FUNCTION_NO_SUPPORT); \ + return CStatus(CGRAPH_FUNCTION_NO_SUPPORT); \ /** 定义为不能赋值和拷贝的对象类型 */ #define CGRAPH_NO_ALLOWED_COPY(CType) \ diff --git a/src/GraphCtrl/GraphAspect/GAspectManager.cpp b/src/GraphCtrl/GraphAspect/GAspectManager.cpp index 81fe9939..e94ec781 100644 --- a/src/GraphCtrl/GraphAspect/GAspectManager.cpp +++ b/src/GraphCtrl/GraphAspect/GAspectManager.cpp @@ -52,7 +52,7 @@ CStatus GAspectManager::reflect(const internal::GAspectType &type, aspect->enterCrashed(); break; default: - status = CErrStatus("unknown aspect type"); + status = CStatus("unknown aspect type"); } CGRAPH_FUNCTION_CHECK_STATUS diff --git a/src/GraphCtrl/GraphMessage/GMessageManager.h b/src/GraphCtrl/GraphMessage/GMessageManager.h index 8566fd05..a189d68a 100644 --- a/src/GraphCtrl/GraphMessage/GMessageManager.h +++ b/src/GraphCtrl/GraphMessage/GMessageManager.h @@ -42,7 +42,7 @@ class GMessageManager : public GMessageObject, // 如果类型和size完全匹配的话,则直接返回创建成功。否则返回错误 auto curTopic = result->second; status = (typeid(*curTopic).name() == typeid(GMessage).name() && curTopic->getCapacity() == size) - ? CStatus() : CErrStatus("create topic [" + topic + "] duplicate"); + ? CStatus() : CStatus("create topic [" + topic + "] duplicate"); } else { // 创建一个 topic信息 auto message = UAllocator::safeMallocTemplateCObject>(size); diff --git a/src/GraphCtrl/GraphParam/GParamManager.inl b/src/GraphCtrl/GraphParam/GParamManager.inl index 4033a608..92d25d8c 100644 --- a/src/GraphCtrl/GraphParam/GParamManager.inl +++ b/src/GraphCtrl/GraphParam/GParamManager.inl @@ -23,7 +23,7 @@ CStatus GParamManager::create(const std::string& key, CBool backtrace) { /* 如果是重复创建,则返回ok;非重复创建(类型不同)则返回err */ auto param = result->second; return (typeid(*param).name() == typeid(T).name()) ? - CStatus() : CErrStatus("create [" + key + "] param duplicate"); + CStatus() : CStatus("create [" + key + "] param duplicate"); } T* ptr = CGRAPH_SAFE_MALLOC_COBJECT(T) diff --git a/src/UtilsCtrl/ThreadPool/UThreadPool.cpp b/src/UtilsCtrl/ThreadPool/UThreadPool.cpp index a4d91d54..988be0ed 100644 --- a/src/UtilsCtrl/ThreadPool/UThreadPool.cpp +++ b/src/UtilsCtrl/ThreadPool/UThreadPool.cpp @@ -106,9 +106,9 @@ CStatus UThreadPool::submit(const UTaskGroup& taskGroup, CMSec ttl) { const auto& futStatus = fut.wait_until(deadline); switch (futStatus) { case std::future_status::ready: break; // 正常情况,直接返回了 - case std::future_status::timeout: status += CErrStatus("thread status timeout"); break; - case std::future_status::deferred: status += CErrStatus("thread status deferred"); break; - default: status += CErrStatus("thread status unknown"); + case std::future_status::timeout: status += CStatus("thread status timeout"); break; + case std::future_status::deferred: status += CStatus("thread status deferred"); break; + default: status += CStatus("thread status unknown"); } } diff --git a/src/UtilsCtrl/UtilsDefine.h b/src/UtilsCtrl/UtilsDefine.h index 48766e3b..6f84d39f 100644 --- a/src/UtilsCtrl/UtilsDefine.h +++ b/src/UtilsCtrl/UtilsDefine.h @@ -46,7 +46,7 @@ using CGRAPH_UNIQUE_LOCK = std::unique_lock; template CStatus __ASSERT_NOT_NULL(T t) { return (unlikely(nullptr == t)) - ? CErrStatus(CGRAPH_INPUT_IS_NULL) + ? CStatus(CGRAPH_INPUT_IS_NULL) : CStatus(); } diff --git a/tutorial/T27-Trim.cpp b/tutorial/T27-Trim.cpp index d7128b58..5e23601a 100644 --- a/tutorial/T27-Trim.cpp +++ b/tutorial/T27-Trim.cpp @@ -27,7 +27,7 @@ void tutorial_trim() { pipeline->registerGElement(&d, {a, b, c}, "nodeD"); auto trimSize = pipeline->trim(); - CGRAPH_ECHO("trim size is: %u", trimSize); + CGRAPH_ECHO("trim size is: %d", (int)trimSize); // 查看 trim后的效果 pipeline->dump();