Skip to content

Commit

Permalink
[feat] remove CErrStatus, no use now.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunelFeng committed Oct 3, 2024
1 parent f279714 commit 194edc1
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 16 deletions.
10 changes: 2 additions & 8 deletions src/CBasic/CFuncType.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,17 @@ 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) \
if (unlikely(cond)) { CGRAPH_RETURN_ERROR_STATUS(info); } \

/** 不支持当前功能 */
#define CGRAPH_NO_SUPPORT \
return CErrStatus(CGRAPH_FUNCTION_NO_SUPPORT); \
return CStatus(CGRAPH_FUNCTION_NO_SUPPORT); \

/** 定义为不能赋值和拷贝的对象类型 */
#define CGRAPH_NO_ALLOWED_COPY(CType) \
Expand Down
2 changes: 1 addition & 1 deletion src/GraphCtrl/GraphAspect/GAspectManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/GraphCtrl/GraphMessage/GMessageManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class GMessageManager : public GMessageObject,
// 如果类型和size完全匹配的话,则直接返回创建成功。否则返回错误
auto curTopic = result->second;
status = (typeid(*curTopic).name() == typeid(GMessage<TImpl>).name() && curTopic->getCapacity() == size)
? CStatus() : CErrStatus("create topic [" + topic + "] duplicate");
? CStatus() : CStatus("create topic [" + topic + "] duplicate");
} else {
// 创建一个 topic信息
auto message = UAllocator::safeMallocTemplateCObject<GMessage<TImpl>>(size);
Expand Down
2 changes: 1 addition & 1 deletion src/GraphCtrl/GraphParam/GParamManager.inl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/UtilsCtrl/ThreadPool/UThreadPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/UtilsCtrl/UtilsDefine.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ using CGRAPH_UNIQUE_LOCK = std::unique_lock<std::mutex>;
template<typename T>
CStatus __ASSERT_NOT_NULL(T t) {
return (unlikely(nullptr == t))
? CErrStatus(CGRAPH_INPUT_IS_NULL)
? CStatus(CGRAPH_INPUT_IS_NULL)
: CStatus();
}

Expand Down
2 changes: 1 addition & 1 deletion tutorial/T27-Trim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void tutorial_trim() {
pipeline->registerGElement<MyNode2>(&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();
Expand Down

0 comments on commit 194edc1

Please sign in to comment.