Skip to content

Commit

Permalink
[perf] optimize include method
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunelFeng committed Jul 19, 2023
1 parent 57984f7 commit 2e0c9ae
Show file tree
Hide file tree
Showing 37 changed files with 39 additions and 45 deletions.
File renamed without changes.
3 changes: 3 additions & 0 deletions cmake/CGraph-env-include.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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动态库
Expand Down
9 changes: 0 additions & 9 deletions src/CBasic/CStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#define CGRAPH_CSTRUCT_H

#include "CBasicDefine.h"
#include "CStatus.h"
#include "CFuncType.h"

CGRAPH_NAMESPACE_BEGIN

Expand All @@ -20,13 +18,6 @@ CGRAPH_NAMESPACE_BEGIN
* 仅针对类似 bean 数据类型的定义
*/
class CStruct {
/**
* 初始化所有字段的值信息
* @return
*/
virtual CStatus setup() {
CGRAPH_EMPTY_FUNCTION
}
};

CGRAPH_NAMESPACE_END
Expand Down
2 changes: 1 addition & 1 deletion src/CBasic/CValType.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/GraphCtrl/GraphPipeline/GPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 1 addition & 2 deletions src/GraphCtrl/GraphPipeline/GPipeline.inl
Original file line number Diff line number Diff line change
Expand Up @@ -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<TParam>(param)
->setInterval(ms);
daemon->setDParam<TParam>(param)->setInterval(ms);
daemon->setGParamManager(this->param_manager_);
daemon->setGEventManager(this->event_manager_);
status = daemon_manager_->add(daemon);
Expand Down
2 changes: 1 addition & 1 deletion src/UtilsCtrl/ThreadPool/UThreadPoolConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGAspect/MyConnAspect.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGAspect/MyPipelineParamAspect.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGAspect/MyTemplateAspect.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef CGRAPH_MYTEMPLATEASPECT_H
#define CGRAPH_MYTEMPLATEASPECT_H

#include "../../src/CGraph.h"
#include "CGraph.h"

template<class ...Args>
class MyTemplateAspect : public CGraph::GTemplateAspect<Args...> {
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGAspect/MyTimerAspect.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include <chrono>

#include "../../src/CGraph.h"
#include "CGraph.h"

class MyTimerAspect : public CGraph::GAspect {
public:
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGAspect/MyTraceAspect.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGCondition/MyCondition.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGCondition/MyParamCondition.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGDaemon/MyMonitorDaemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGDaemon/MyParamDaemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGDaemon/MyTemplateDaemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include <string>

#include "../../src/CGraph.h"
#include "CGraph.h"

template<class ...Args>
class MyTemplateDaemon : public CGraph::GTemplateDaemon<Args...> {
Expand Down
3 changes: 1 addition & 2 deletions tutorial/MyGEvent/MyPrintEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGNode/HelloCGraphNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGNode/MyEParamNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions tutorial/MyGNode/MyEventNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGNode/MyHoldNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGNode/MyNode1.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGNode/MyNode2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGNode/MyPubMessageNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGNode/MyReadParamNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGNode/MyRecvMessageNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGNode/MySendMessageNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGNode/MyShowAddressNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGNode/MySubMessageNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef CGRAPH_MYSUBMESSAGENODE_H
#define CGRAPH_MYSUBMESSAGENODE_H

#include "../../src/CGraph.h"
#include "CGraph.h"
#include "../MyParams/MyMessageParam.h"

template <typename ...Args>
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGNode/MyTemplateNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef CGRAPH_MYTEMPLATENODE_H
#define CGRAPH_MYTEMPLATENODE_H

#include "../../src/CGraph.h"
#include "CGraph.h"

template <typename ...Args>
class MyTemplateNode : public CGraph::GTemplateNode<Args ...> {
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyGNode/MyWriteParamNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyParams/MyConnParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyParams/MyMessageParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyParams/MyParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef CGRAPH_MYPARAM_H
#define CGRAPH_MYPARAM_H

#include "../../src/CGraph.h"
#include "CGraph.h"

/**
* MyParam 是GParam的具体实现类
Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyParams/MyVersionParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 1 addition & 1 deletion tutorial/MyUtils/MyDistance.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef CGRAPH_MYDISTANCE_H
#define CGRAPH_MYDISTANCE_H

#include "../../src/CGraph.h"
#include "CGraph.h"

template<typename TSrc, typename TRes> // 自定义距离类型
class MyDistance : public CGraph::UDistance<TSrc, TRes> {
Expand Down

0 comments on commit 2e0c9ae

Please sign in to comment.