diff --git a/CGraph-test.sh b/CGraph-run-tutorials.sh similarity index 100% rename from CGraph-test.sh rename to CGraph-run-tutorials.sh diff --git a/cmake/CGraph-env-include.cmake b/cmake/CGraph-env-include.cmake index c757df2d..3dcaf16c 100644 --- a/cmake/CGraph-env-include.cmake +++ b/cmake/CGraph-env-include.cmake @@ -27,8 +27,11 @@ ELSEIF(WIN32) add_compile_options(/wd4267) add_compile_options(/wd4018) ENDIF() + # 本工程也支持在windows平台上的mingw环境使用 ENDIF() +include_directories(${CGRAPH_PROJECT_ROOT_DIR}/src/) # 直接加入"CGraph.h"文件对应的位置 + # 以下三选一,本地编译执行,推荐OBJECT方式 add_library(CGraph OBJECT ${CGRAPH_PROJECT_SRC_LIST}) # 通过代码编译 # add_library(CGraph SHARED ${CGRAPH_PROJECT_SRC_LIST}) # 编译libCGraph动态库 diff --git a/src/CBasic/CStruct.h b/src/CBasic/CStruct.h index 920f4e89..65e8ea48 100644 --- a/src/CBasic/CStruct.h +++ b/src/CBasic/CStruct.h @@ -10,8 +10,6 @@ #define CGRAPH_CSTRUCT_H #include "CBasicDefine.h" -#include "CStatus.h" -#include "CFuncType.h" CGRAPH_NAMESPACE_BEGIN @@ -20,13 +18,6 @@ CGRAPH_NAMESPACE_BEGIN * 仅针对类似 bean 数据类型的定义 */ class CStruct { - /** - * 初始化所有字段的值信息 - * @return - */ - virtual CStatus setup() { - CGRAPH_EMPTY_FUNCTION - } }; CGRAPH_NAMESPACE_END diff --git a/src/CBasic/CValType.h b/src/CBasic/CValType.h index fbfb5a2d..9c604ab9 100644 --- a/src/CBasic/CValType.h +++ b/src/CBasic/CValType.h @@ -27,7 +27,7 @@ using CBool = CGraph::CBOOL; using CIndex = CGraph::CINT; // 表示标识信息,可以为负数 using CFloat = CGraph::CFLOAT; using CDouble = CGraph::CDOUBLE; -using CConStr = CGraph::CCONSTR; // 表示 const char* +using CConStr = CGraph::CCONSTR; // 表示 const char* using CBigBool = CGraph::CBIGBOOL; using CStatus = CGraph::CSTATUS; diff --git a/src/GraphCtrl/GraphPipeline/GPipeline.cpp b/src/GraphCtrl/GraphPipeline/GPipeline.cpp index 9e8c750f..2b32348c 100644 --- a/src/GraphCtrl/GraphPipeline/GPipeline.cpp +++ b/src/GraphCtrl/GraphPipeline/GPipeline.cpp @@ -229,7 +229,9 @@ CStatus GPipeline::makeSerial() { UThreadPoolConfig config; config.default_thread_size_ = 0; // 设置之后,不再开辟线程池,直接通过主线程执行pipeline的逻辑 + config.secondary_thread_size_ = 0; config.max_thread_size_ = 0; + config.monitor_enable_ = false; schedule_.config_ = config; CGRAPH_FUNCTION_END } diff --git a/src/GraphCtrl/GraphPipeline/GPipeline.inl b/src/GraphCtrl/GraphPipeline/GPipeline.inl index f7c00ffa..db8ae444 100644 --- a/src/GraphCtrl/GraphPipeline/GPipeline.inl +++ b/src/GraphCtrl/GraphPipeline/GPipeline.inl @@ -173,8 +173,7 @@ GPipeline* GPipeline::addGDaemon(CMSec ms, TParam* param) { CGRAPH_ASSERT_NOT_NULL_THROW_ERROR(param_manager_, daemon_manager_) GDaemonPtr daemon = CGRAPH_SAFE_MALLOC_COBJECT(TDaemon) - daemon->setDParam(param) - ->setInterval(ms); + daemon->setDParam(param)->setInterval(ms); daemon->setGParamManager(this->param_manager_); daemon->setGEventManager(this->event_manager_); status = daemon_manager_->add(daemon); diff --git a/src/UtilsCtrl/ThreadPool/UThreadPoolConfig.h b/src/UtilsCtrl/ThreadPool/UThreadPoolConfig.h index 6b4c5842..a16c5241 100644 --- a/src/UtilsCtrl/ThreadPool/UThreadPoolConfig.h +++ b/src/UtilsCtrl/ThreadPool/UThreadPoolConfig.h @@ -14,7 +14,7 @@ CGRAPH_NAMESPACE_BEGIN -struct UThreadPoolConfig : public UThreadObject { +struct UThreadPoolConfig : public CStruct { /** 具体值含义,参考UThreadPoolDefine.h文件 */ int default_thread_size_ = CGRAPH_DEFAULT_THREAD_SIZE; int secondary_thread_size_ = CGRAPH_SECONDARY_THREAD_SIZE; diff --git a/tutorial/MyGAspect/MyConnAspect.h b/tutorial/MyGAspect/MyConnAspect.h index c0b7e731..aa87acce 100644 --- a/tutorial/MyGAspect/MyConnAspect.h +++ b/tutorial/MyGAspect/MyConnAspect.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYCONNASPECT_H #define CGRAPH_MYCONNASPECT_H -#include "../../src/CGraph.h" +#include "CGraph.h" #include "../MyParams/MyConnParam.h" class MyConnAspect : public CGraph::GAspect { diff --git a/tutorial/MyGAspect/MyPipelineParamAspect.h b/tutorial/MyGAspect/MyPipelineParamAspect.h index cd596e3d..f10f90f3 100644 --- a/tutorial/MyGAspect/MyPipelineParamAspect.h +++ b/tutorial/MyGAspect/MyPipelineParamAspect.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYPIPELINEPARAMASPECT_H #define CGRAPH_MYPIPELINEPARAMASPECT_H -#include "../../src/CGraph.h" +#include "CGraph.h" #include "../MyParams/MyParam.h" class MyPipelineParamAspect : public CGraph::GAspect { diff --git a/tutorial/MyGAspect/MyTemplateAspect.h b/tutorial/MyGAspect/MyTemplateAspect.h index 0ddca67f..ab827076 100644 --- a/tutorial/MyGAspect/MyTemplateAspect.h +++ b/tutorial/MyGAspect/MyTemplateAspect.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYTEMPLATEASPECT_H #define CGRAPH_MYTEMPLATEASPECT_H -#include "../../src/CGraph.h" +#include "CGraph.h" template class MyTemplateAspect : public CGraph::GTemplateAspect { diff --git a/tutorial/MyGAspect/MyTimerAspect.h b/tutorial/MyGAspect/MyTimerAspect.h index 1d65a0ff..90583049 100644 --- a/tutorial/MyGAspect/MyTimerAspect.h +++ b/tutorial/MyGAspect/MyTimerAspect.h @@ -11,7 +11,7 @@ #include -#include "../../src/CGraph.h" +#include "CGraph.h" class MyTimerAspect : public CGraph::GAspect { public: diff --git a/tutorial/MyGAspect/MyTraceAspect.h b/tutorial/MyGAspect/MyTraceAspect.h index aa443200..ba1643d6 100644 --- a/tutorial/MyGAspect/MyTraceAspect.h +++ b/tutorial/MyGAspect/MyTraceAspect.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYTRACEASPECT_H #define CGRAPH_MYTRACEASPECT_H -#include "../../src/CGraph.h" +#include "CGraph.h" class MyTraceAspect : public CGraph::GAspect { public: diff --git a/tutorial/MyGCondition/MyCondition.h b/tutorial/MyGCondition/MyCondition.h index 75f4ee67..4d4f15ec 100644 --- a/tutorial/MyGCondition/MyCondition.h +++ b/tutorial/MyGCondition/MyCondition.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYCONDITION_H #define CGRAPH_MYCONDITION_H -#include "../../src/CGraph.h" +#include "CGraph.h" class MyCondition : public CGraph::GCondition { public: diff --git a/tutorial/MyGCondition/MyParamCondition.h b/tutorial/MyGCondition/MyParamCondition.h index e74b8b30..83e12857 100644 --- a/tutorial/MyGCondition/MyParamCondition.h +++ b/tutorial/MyGCondition/MyParamCondition.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYPARAMCONDITION_H #define CGRAPH_MYPARAMCONDITION_H -#include "../../src/CGraph.h" +#include "CGraph.h" #include "../MyParams/MyParam.h" class MyParamCondition : public CGraph::GCondition { diff --git a/tutorial/MyGDaemon/MyMonitorDaemon.h b/tutorial/MyGDaemon/MyMonitorDaemon.h index b73edb86..f34a9520 100644 --- a/tutorial/MyGDaemon/MyMonitorDaemon.h +++ b/tutorial/MyGDaemon/MyMonitorDaemon.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYMONITORDAEMON_H #define CGRAPH_MYMONITORDAEMON_H -#include "../../src/CGraph.h" +#include "CGraph.h" class MyMonitorDaemon : public CGraph::GDaemon { public: diff --git a/tutorial/MyGDaemon/MyParamDaemon.h b/tutorial/MyGDaemon/MyParamDaemon.h index b5d8b689..b968fead 100644 --- a/tutorial/MyGDaemon/MyParamDaemon.h +++ b/tutorial/MyGDaemon/MyParamDaemon.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYPARAMDAEMON_H #define CGRAPH_MYPARAMDAEMON_H -#include "../../src/CGraph.h" +#include "CGraph.h" #include "../MyParams/MyParam.h" #include "../MyParams/MyConnParam.h" diff --git a/tutorial/MyGDaemon/MyTemplateDaemon.h b/tutorial/MyGDaemon/MyTemplateDaemon.h index 5e6024b2..77154366 100644 --- a/tutorial/MyGDaemon/MyTemplateDaemon.h +++ b/tutorial/MyGDaemon/MyTemplateDaemon.h @@ -11,7 +11,7 @@ #include -#include "../../src/CGraph.h" +#include "CGraph.h" template class MyTemplateDaemon : public CGraph::GTemplateDaemon { diff --git a/tutorial/MyGEvent/MyPrintEvent.h b/tutorial/MyGEvent/MyPrintEvent.h index ff95db2d..5567ee9f 100644 --- a/tutorial/MyGEvent/MyPrintEvent.h +++ b/tutorial/MyGEvent/MyPrintEvent.h @@ -9,8 +9,7 @@ #ifndef CGRAPH_MYPRINTEVENT_H #define CGRAPH_MYPRINTEVENT_H -#include "../../src/CGraph.h" - +#include "CGraph.h" #include "../MyParams/MyParam.h" class MyPrintEvent : public CGraph::GEvent { diff --git a/tutorial/MyGNode/HelloCGraphNode.h b/tutorial/MyGNode/HelloCGraphNode.h index 4290121b..a772b802 100644 --- a/tutorial/MyGNode/HelloCGraphNode.h +++ b/tutorial/MyGNode/HelloCGraphNode.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_HELLOCGRAPHNODE_H #define CGRAPH_HELLOCGRAPHNODE_H -#include "../../src/CGraph.h" +#include "CGraph.h" class HelloCGraphNode : public CGraph::GNode { public: diff --git a/tutorial/MyGNode/MyEParamNode.h b/tutorial/MyGNode/MyEParamNode.h index 4618798f..44ca9b61 100644 --- a/tutorial/MyGNode/MyEParamNode.h +++ b/tutorial/MyGNode/MyEParamNode.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYEPARAMNODE_H #define CGRAPH_MYEPARAMNODE_H -#include "../../src/CGraph.h" +#include "CGraph.h" #include "../MyParams/MyVersionParam.h" #include "../MyParams/MyConnParam.h" diff --git a/tutorial/MyGNode/MyEventNode.h b/tutorial/MyGNode/MyEventNode.h index 73dec146..5d88661f 100644 --- a/tutorial/MyGNode/MyEventNode.h +++ b/tutorial/MyGNode/MyEventNode.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYEVENTNODE_H #define CGRAPH_MYEVENTNODE_H -#include "../../src/CGraph.h" +#include "CGraph.h" class MyEventNode : public CGraph::GNode { public: @@ -21,7 +21,7 @@ class MyEventNode : public CGraph::GNode { * 从打印结果可以看出,after event send 这条信息,提前执行 * 执行的时候,和pipeline公用同一个线程池资源 */ - notify("my-print-event", GEventType::ASYNC); + notify("my-print-event", GEventType::SYNC); CGraph::CGRAPH_ECHO("[%s], after event notify", this->getName().c_str()); return status; diff --git a/tutorial/MyGNode/MyHoldNode.h b/tutorial/MyGNode/MyHoldNode.h index 92975e91..f7e76a61 100644 --- a/tutorial/MyGNode/MyHoldNode.h +++ b/tutorial/MyGNode/MyHoldNode.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYHOLDNODE_H #define CGRAPH_MYHOLDNODE_H -#include "../../src/CGraph.h" +#include "CGraph.h" #include "../MyParams/MyParam.h" static const char* HOLD_PARAM_NAME = "hold-param"; diff --git a/tutorial/MyGNode/MyNode1.h b/tutorial/MyGNode/MyNode1.h index b8e7541f..0d7fb17d 100644 --- a/tutorial/MyGNode/MyNode1.h +++ b/tutorial/MyGNode/MyNode1.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYNODE1_H #define CGRAPH_MYNODE1_H -#include "../../src/CGraph.h" +#include "CGraph.h" class MyNode1 : public CGraph::GNode { public: diff --git a/tutorial/MyGNode/MyNode2.h b/tutorial/MyGNode/MyNode2.h index 6b6dabfc..ecb5f60a 100644 --- a/tutorial/MyGNode/MyNode2.h +++ b/tutorial/MyGNode/MyNode2.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYNODE2_H #define CGRAPH_MYNODE2_H -#include "../../src/CGraph.h" +#include "CGraph.h" class MyNode2 : public CGraph::GNode { public: diff --git a/tutorial/MyGNode/MyPubMessageNode.h b/tutorial/MyGNode/MyPubMessageNode.h index 9991dda3..191b219b 100644 --- a/tutorial/MyGNode/MyPubMessageNode.h +++ b/tutorial/MyGNode/MyPubMessageNode.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYPUBMESSAGENODE_H #define CGRAPH_MYPUBMESSAGENODE_H -#include "../../src/CGraph.h" +#include "CGraph.h" #include "../MyParams/MyMessageParam.h" class MyPubMessageNode : public CGraph::GNode { diff --git a/tutorial/MyGNode/MyReadParamNode.h b/tutorial/MyGNode/MyReadParamNode.h index 3e7731b5..dcadaed4 100644 --- a/tutorial/MyGNode/MyReadParamNode.h +++ b/tutorial/MyGNode/MyReadParamNode.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYREADPARAMNODE_H #define CGRAPH_MYREADPARAMNODE_H -#include "../../src/CGraph.h" +#include "CGraph.h" #include "../MyParams/MyParam.h" class MyReadParamNode : public CGraph::GNode { diff --git a/tutorial/MyGNode/MyRecvMessageNode.h b/tutorial/MyGNode/MyRecvMessageNode.h index b702f97f..a73eb6d5 100644 --- a/tutorial/MyGNode/MyRecvMessageNode.h +++ b/tutorial/MyGNode/MyRecvMessageNode.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYRECVMESSAGENODE_H #define CGRAPH_MYRECVMESSAGENODE_H -#include "../../src/CGraph.h" +#include "CGraph.h" #include "../MyParams/MyMessageParam.h" class MyRecvMessageNode : public CGraph::GNode { diff --git a/tutorial/MyGNode/MySendMessageNode.h b/tutorial/MyGNode/MySendMessageNode.h index e0881138..d1e4b291 100644 --- a/tutorial/MyGNode/MySendMessageNode.h +++ b/tutorial/MyGNode/MySendMessageNode.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYSENDMESSAGENODE_H #define CGRAPH_MYSENDMESSAGENODE_H -#include "../../src/CGraph.h" +#include "CGraph.h" #include "../MyParams/MyMessageParam.h" class MySendMessageNode : public CGraph::GNode { diff --git a/tutorial/MyGNode/MyShowAddressNode.h b/tutorial/MyGNode/MyShowAddressNode.h index aada1d26..77c14355 100644 --- a/tutorial/MyGNode/MyShowAddressNode.h +++ b/tutorial/MyGNode/MyShowAddressNode.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYSHOWADDRESSNODE_H #define CGRAPH_MYSHOWADDRESSNODE_H -#include "../../src/CGraph.h" +#include "CGraph.h" #include "../MyParams/MyParam.h" class MyShowAddressNode : public CGraph::GNode { diff --git a/tutorial/MyGNode/MySubMessageNode.h b/tutorial/MyGNode/MySubMessageNode.h index e2278959..785751ab 100644 --- a/tutorial/MyGNode/MySubMessageNode.h +++ b/tutorial/MyGNode/MySubMessageNode.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYSUBMESSAGENODE_H #define CGRAPH_MYSUBMESSAGENODE_H -#include "../../src/CGraph.h" +#include "CGraph.h" #include "../MyParams/MyMessageParam.h" template diff --git a/tutorial/MyGNode/MyTemplateNode.h b/tutorial/MyGNode/MyTemplateNode.h index 3ef6e2d7..abf49e56 100644 --- a/tutorial/MyGNode/MyTemplateNode.h +++ b/tutorial/MyGNode/MyTemplateNode.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYTEMPLATENODE_H #define CGRAPH_MYTEMPLATENODE_H -#include "../../src/CGraph.h" +#include "CGraph.h" template class MyTemplateNode : public CGraph::GTemplateNode { diff --git a/tutorial/MyGNode/MyWriteParamNode.h b/tutorial/MyGNode/MyWriteParamNode.h index 4eeae791..131266bf 100644 --- a/tutorial/MyGNode/MyWriteParamNode.h +++ b/tutorial/MyGNode/MyWriteParamNode.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYWRITEPARAMNODE_H #define CGRAPH_MYWRITEPARAMNODE_H -#include "../../src/CGraph.h" +#include "CGraph.h" #include "../MyParams/MyParam.h" class MyWriteParamNode : public CGraph::GNode { diff --git a/tutorial/MyParams/MyConnParam.h b/tutorial/MyParams/MyConnParam.h index 085c01a3..a5576867 100644 --- a/tutorial/MyParams/MyConnParam.h +++ b/tutorial/MyParams/MyConnParam.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYCONNPARAM_H #define CGRAPH_MYCONNPARAM_H -#include "../../src/CGraph.h" +#include "CGraph.h" const static char* CONN_PARAM_KEY = "conn"; diff --git a/tutorial/MyParams/MyMessageParam.h b/tutorial/MyParams/MyMessageParam.h index 44a605e3..d8715cf8 100644 --- a/tutorial/MyParams/MyMessageParam.h +++ b/tutorial/MyParams/MyMessageParam.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYMESSAGEPARAM_H #define CGRAPH_MYMESSAGEPARAM_H -#include "../../src/CGraph.h" +#include "CGraph.h" struct MyMessageParam : public CGraph::GMessageParam { int num = 0; diff --git a/tutorial/MyParams/MyParam.h b/tutorial/MyParams/MyParam.h index 8600d592..7c46f540 100644 --- a/tutorial/MyParams/MyParam.h +++ b/tutorial/MyParams/MyParam.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYPARAM_H #define CGRAPH_MYPARAM_H -#include "../../src/CGraph.h" +#include "CGraph.h" /** * MyParam 是GParam的具体实现类 diff --git a/tutorial/MyParams/MyVersionParam.h b/tutorial/MyParams/MyVersionParam.h index 8f656b4d..1205d352 100644 --- a/tutorial/MyParams/MyVersionParam.h +++ b/tutorial/MyParams/MyVersionParam.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYVERSIONPARAM_H #define CGRAPH_MYVERSIONPARAM_H -#include "../../src/CGraph.h" +#include "CGraph.h" const static char* VERSION_PARAM_KEY = "version"; diff --git a/tutorial/MyUtils/MyDistance.h b/tutorial/MyUtils/MyDistance.h index 1a18477b..85eb90ff 100644 --- a/tutorial/MyUtils/MyDistance.h +++ b/tutorial/MyUtils/MyDistance.h @@ -9,7 +9,7 @@ #ifndef CGRAPH_MYDISTANCE_H #define CGRAPH_MYDISTANCE_H -#include "../../src/CGraph.h" +#include "CGraph.h" template // 自定义距离类型 class MyDistance : public CGraph::UDistance {