diff --git a/src/CBasic/CBasicDefine.h b/src/CBasic/CBasicDefine.h index 8c83e299..1d3d68df 100644 --- a/src/CBasic/CBasicDefine.h +++ b/src/CBasic/CBasicDefine.h @@ -19,6 +19,14 @@ namespace CGraph { \ CGRAPH_NAMESPACE_BEGIN +#define CGRAPH_INTERNAL_NAMESPACE_BEGIN \ +namespace internal { \ + +#define CGRAPH_INTERNAL_NAMESPACE_END \ +} /* end of namespace internal */ \ + +CGRAPH_INTERNAL_NAMESPACE_BEGIN + using CCHAR = char; using CUINT = unsigned int; using CVOID = void; @@ -32,6 +40,7 @@ using CDOUBLE = double; using CCONSTR = const char*; using CSIZE = size_t; +CGRAPH_INTERNAL_NAMESPACE_END CGRAPH_NAMESPACE_END #endif //CGRAPH_CBASICDEFINE_H diff --git a/src/CBasic/CException.h b/src/CBasic/CException.h index 90335f44..7bafc07b 100644 --- a/src/CBasic/CException.h +++ b/src/CBasic/CException.h @@ -15,6 +15,7 @@ #include "CStrDefine.h" CGRAPH_NAMESPACE_BEGIN +CGRAPH_INTERNAL_NAMESPACE_BEGIN class CEXCEPTION : public std::exception { public: @@ -39,6 +40,7 @@ class CEXCEPTION : public std::exception { std::string exception_info_; // 异常状态信息 }; +CGRAPH_INTERNAL_NAMESPACE_END CGRAPH_NAMESPACE_END #endif //CGRAPH_CEXCEPTION_H diff --git a/src/CBasic/CStatus.h b/src/CBasic/CStatus.h index 3d68f975..ca417b90 100644 --- a/src/CBasic/CStatus.h +++ b/src/CBasic/CStatus.h @@ -15,6 +15,7 @@ #include "CStrDefine.h" CGRAPH_NAMESPACE_BEGIN +CGRAPH_INTERNAL_NAMESPACE_BEGIN /** * 说明: @@ -66,7 +67,7 @@ class CSTATUS { } CSTATUS& operator=(const CSTATUS& status) { - if (!status.isOK()) { + if (this->error_code_ != status.error_code_) { // 如果status是正常的话,则所有数据保持不变 this->error_code_ = status.error_code_; this->error_info_ = status.error_info_; @@ -89,6 +90,15 @@ class CSTATUS { return (*this); } + /** + * 恢复状态信息 + */ + void reset() { + this->error_code_ = STATUS_OK; + this->error_info_.clear(); + this->error_locate_.clear(); + } + /** * 获取异常值信息 * @return @@ -143,6 +153,7 @@ class CSTATUS { std::string error_locate_; // 错误发生的具体位置,形如:file|function|line }; +CGRAPH_INTERNAL_NAMESPACE_END CGRAPH_NAMESPACE_END #endif //CGRAPH_CSTATUS_H diff --git a/src/CBasic/CValType.h b/src/CBasic/CValType.h index 267942f6..6a43b4eb 100644 --- a/src/CBasic/CValType.h +++ b/src/CBasic/CValType.h @@ -13,27 +13,27 @@ #include "CStatus.h" #include "CException.h" -using CChar = CGraph::CCHAR; -using CUint = CGraph::CUINT; -using CSize = CGraph::CSIZE; -using CVoid = CGraph::CVOID; -using CVoidPtr = CGraph::CVOID *; -using CInt = CGraph::CINT; -using CLong = CGraph::CLONG; -using CULong = CGraph::CULONG; -using CBool = CGraph::CBOOL; -using CIndex = CGraph::CINT; // 表示标识信息,可以为负数 -using CFloat = CGraph::CFLOAT; -using CDouble = CGraph::CDOUBLE; -using CConStr = CGraph::CCONSTR; // 表示 const char* -using CBigBool = CGraph::CBIGBOOL; +using CChar = CGraph::internal::CCHAR; +using CUint = CGraph::internal::CUINT; +using CSize = CGraph::internal::CSIZE; +using CVoid = CGraph::internal::CVOID; +using CVoidPtr = CGraph::internal::CVOID *; +using CInt = CGraph::internal::CINT; +using CLong = CGraph::internal::CLONG; +using CULong = CGraph::internal::CULONG; +using CBool = CGraph::internal::CBOOL; +using CIndex = CGraph::internal::CINT; // 表示标识信息,可以为负数 +using CFloat = CGraph::internal::CFLOAT; +using CDouble = CGraph::internal::CDOUBLE; +using CConStr = CGraph::internal::CCONSTR; // 表示 const char* +using CBigBool = CGraph::internal::CBIGBOOL; -using CLevel = CGraph::CINT; -using CSec = CGraph::CLONG; // 表示秒信息, for second -using CMSec = CGraph::CLONG; // 表示毫秒信息, for millisecond -using CFMSec = CGraph::CDOUBLE; // 表示毫秒信息,包含小数点信息 +using CLevel = CGraph::internal::CINT; +using CSec = CGraph::internal::CLONG; // 表示秒信息, for second +using CMSec = CGraph::internal::CLONG; // 表示毫秒信息, for millisecond +using CFMSec = CGraph::internal::CDOUBLE; // 表示毫秒信息,包含小数点信息 -using CStatus = CGraph::CSTATUS; -using CException = CGraph::CEXCEPTION; +using CStatus = CGraph::internal::CSTATUS; +using CException = CGraph::internal::CEXCEPTION; #endif //CGRAPH_CVALTYPE_H diff --git a/src/GraphCtrl/GraphElement/GElement.cpp b/src/GraphCtrl/GraphElement/GElement.cpp index 7def4bc1..1041ddb9 100644 --- a/src/GraphCtrl/GraphElement/GElement.cpp +++ b/src/GraphCtrl/GraphElement/GElement.cpp @@ -317,7 +317,7 @@ CBool GElement::isMutable() const { CStatus GElement::crashed(const CException& ex) { - return CStatus(STATUS_CRASH, ex.what(), CGRAPH_GET_LOCATE); + return CStatus(internal::STATUS_CRASH, ex.what(), CGRAPH_GET_LOCATE); } diff --git a/src/GraphCtrl/GraphElement/GGroup/GMutable/GMutable.cpp b/src/GraphCtrl/GraphElement/GGroup/GMutable/GMutable.cpp index a096ade3..c6b815e8 100644 --- a/src/GraphCtrl/GraphElement/GGroup/GMutable/GMutable.cpp +++ b/src/GraphCtrl/GraphElement/GGroup/GMutable/GMutable.cpp @@ -47,11 +47,12 @@ CStatus GMutable::run() { /** * 1. 初始化内容 - * 2. 通过外部复写 translate(),来实现关系设定。其中,通过 --> 设定的,是会自动恢复visible的 + * 2. 通过外部复写 reshape(),来实现关系设定。其中,通过 --> 设定的,是会自动恢复visible的 * 3. 通过 manager 执行 */ setup(); - convert(group_elements_arr_); + status = reshape(group_elements_arr_); + CGRAPH_FUNCTION_CHECK_STATUS status = manager_->process({group_elements_arr_.begin(), group_elements_arr_.end()}); CGRAPH_FUNCTION_END diff --git a/src/GraphCtrl/GraphElement/GGroup/GMutable/GMutable.h b/src/GraphCtrl/GraphElement/GGroup/GMutable/GMutable.h index 21555133..da90e6e8 100644 --- a/src/GraphCtrl/GraphElement/GGroup/GMutable/GMutable.h +++ b/src/GraphCtrl/GraphElement/GGroup/GMutable/GMutable.h @@ -17,11 +17,11 @@ CGRAPH_NAMESPACE_BEGIN class GMutable : public GGroup { protected: /** - * 修改内部数据的 + * 重新设定内部数据的结构信息 * @param elements * @return */ - virtual CVoid convert(GElementPtrArr& elements) = 0; + virtual CStatus reshape(GElementPtrArr& elements) = 0; explicit GMutable(); diff --git a/src/GraphCtrl/GraphPipeline/GPipeline.cpp b/src/GraphCtrl/GraphPipeline/GPipeline.cpp index 50d7dbe3..581fcb38 100644 --- a/src/GraphCtrl/GraphPipeline/GPipeline.cpp +++ b/src/GraphCtrl/GraphPipeline/GPipeline.cpp @@ -185,6 +185,7 @@ CStatus GPipeline::dump(std::ostream& oss) { } oss << "}\n\n"; + std::cout.unsetf(std::ios::fixed); CGRAPH_FUNCTION_END } diff --git a/tutorial/MyGMutable/MyMutable.h b/tutorial/MyGMutable/MyMutable.h index e5f50e91..4e651a4f 100644 --- a/tutorial/MyGMutable/MyMutable.h +++ b/tutorial/MyGMutable/MyMutable.h @@ -14,7 +14,7 @@ class MyMutable : public CGraph::GMutable { public: - CVoid convert(CGraph::GElementPtrArr& elements) override { + CStatus reshape(CGraph::GElementPtrArr& elements) override { auto param = CGRAPH_GET_GPARAM_WITH_NO_EMPTY(MyParam, "param1") int count = param->iCount % 4; if (0 == count) { @@ -36,6 +36,8 @@ class MyMutable : public CGraph::GMutable { } else { CGraph::CGRAPH_ECHO("---- run nothing"); // 理论不会进入这种情况 } + + return CStatus(); } };