Skip to content

Commit

Permalink
[feat] change getRelation function.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunelFeng committed Dec 30, 2023
1 parent 5be28c3 commit 3e19417
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 30 deletions.
7 changes: 3 additions & 4 deletions src/GraphCtrl/GraphElement/GElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,14 +448,13 @@ CIndex GElement::getBindingIndex() const {
}


CStatus GElement::buildRelation(GElementRelation& relation) {
CGRAPH_FUNCTION_BEGIN

GElementRelation GElement::getRelation() const {
GElementRelation relation;
relation.predecessors_ = this->dependence_; // 前驱
relation.successors_ = this->run_before_; // 后继
relation.belong_ = this->belong_; // 从属信息

CGRAPH_FUNCTION_END
return relation;
}


Expand Down
17 changes: 8 additions & 9 deletions src/GraphCtrl/GraphElement/GElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,6 @@ class GElement : public GElementObject,
*/
virtual CStatus prepareRun();

/**
* 判断当前是否超时
* @return
*/
CBool isTimeout() const;

/**
* 是否持续进行
* 默认为false,表示执行且仅执行一次
Expand Down Expand Up @@ -201,19 +195,24 @@ class GElement : public GElementObject,
*/
CIndex getThreadIndex();

/**
* 判断当前是否超时
* @return
*/
CBool isTimeout() const;

/**
* 获取绑定线程id信息
* @return
* @notice 不同的group类型,获取 binding index 的方式不同
*/
virtual CIndex getBindingIndex() const;
CIndex getBindingIndex() const;

/**
* 获取当前节点的相关关系信息,包含前驱、后继、从属关系
* @param relation
* @return
*/
CStatus buildRelation(GElementRelation& relation);
GElementRelation getRelation() const;

CGRAPH_NO_ALLOWED_COPY(GElement);

Expand Down
11 changes: 0 additions & 11 deletions src/GraphCtrl/GraphElement/GGroup/GCluster/GCluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,6 @@ CBool GCluster::isDone() {
}


CIndex GCluster::getBindingIndex() const {
if (group_elements_arr_.empty()) {
// 防止未注入的情况发生
return CGRAPH_DEFAULT_BINDING_INDEX;
}

// 实际就是返回第一个元素的 binding index 值
return group_elements_arr_[0]->getBindingIndex();
}


CVoid GCluster::dump(std::ostream& oss) {
dumpElement(oss);
dumpGroupLabelBegin(oss);
Expand Down
6 changes: 0 additions & 6 deletions src/GraphCtrl/GraphElement/GGroup/GCluster/GCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ class GCluster : public GGroup {
*/
CSize getElementNum();

/**
* 获取绑定信息
* @return
*/
CIndex getBindingIndex() const override;

private:
/**
* 线程池中的运行函数,依次执行beforeRun,run和afterRun方法,
Expand Down

0 comments on commit 3e19417

Please sign in to comment.