Skip to content

Commit

Permalink
[feat] add CStruct type info.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunelFeng committed Jul 16, 2023
1 parent ad559f6 commit 39d74ef
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 12 deletions.
Binary file modified doc/xmind/CGraph Intro.xmind
Binary file not shown.
1 change: 1 addition & 0 deletions src/CBasic/CBasicInclude.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
#include "CStrDefine.h"
#include "CStdEx.h"
#include "CDescInfo.h"
#include "CStruct.h"

#endif //CGRAPH_CBASICINCLUDE_H
35 changes: 35 additions & 0 deletions src/CBasic/CStruct.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/***************************
@Author: Chunel
@Contact: [email protected]
@File: CStruct.h
@Time: 2023/7/16 11:36
@Desc:
***************************/

#ifndef CGRAPH_CSTRUCT_H
#define CGRAPH_CSTRUCT_H

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

CGRAPH_NAMESPACE_BEGIN

/**
* 所有框架内部结构体定义的基类
* 仅针对类似 bean 数据类型的定义
*/
class CStruct {
/**
* 初始化所有字段的值信息
* @return
*/
public:
virtual CStatus setup() {
CGRAPH_EMPTY_FUNCTION
}
};

CGRAPH_NAMESPACE_END

#endif //CGRAPH_CSTRUCT_H
7 changes: 1 addition & 6 deletions src/GraphCtrl/GraphElement/GElementRelation.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,11 @@ CGRAPH_NAMESPACE_BEGIN

class GElement;

struct GElementRelation : public GElementObject {
struct GElementRelation : public CStruct {
public:
std::set<GElement *> predecessors_; // 前驱信息
std::set<GElement *> successors_; // 后继信息
GElement* belong_ = nullptr; // 从属信息。如果从属于group,则为该group的值;如果从属于pipeline,则为nullptr

private:
CStatus run() override {
CGRAPH_NO_SUPPORT
}
};

CGRAPH_NAMESPACE_END
Expand Down
7 changes: 1 addition & 6 deletions src/GraphCtrl/GraphElement/GElementSorter.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

CGRAPH_NAMESPACE_BEGIN

class GElementSorter : public GElementObject {
class GElementSorter : public CStruct {
public:
/**
* 当level不同的时候,level值小的element优先被init和destroy
Expand All @@ -27,11 +27,6 @@ class GElementSorter : public GElementObject {
CBool operator()(GElementPtr a, GElementPtr b) const {
return (a->level_ == b->level_) ? (a < b) : (a->level_ < b->level_);
}

private:
CStatus run() override {
CGRAPH_NO_SUPPORT
}
};

using GSortedGElementPtrSet = std::set<GElementPtr, GElementSorter>;
Expand Down

0 comments on commit 39d74ef

Please sign in to comment.