|
CGraph
|
CGraph所有广义"结点"的基类,可派生出GNode/GGroup/GAdapter类 public: 提供addGAspect加入切面/addDependGElement加入前序依赖/removeDepend删除前序依赖的能力 提供setName更新名称/setLoop设置循环次数/setLevel设置优先级/setVisible隐藏当前元素/setBindingIndex设置亲和线程等能力 提供setTimeout设置元素执行的超时时间/setMacro设置为微任务的能力 提供addEParam添加GElement内部参数(GElementParam,实际上就是GPassedParam) 还额外提供运算符重载:–(setVisible)、>(设置后继依赖)、&(设置后继依赖)、*(setLoop) More...
#include <GElement.h>


Public Member Functions | |
| template<typename TAspect , typename TParam = GAspectDefaultParam, c_enable_if_t< std::is_base_of< GAspect, TAspect >::value, int > = 0, c_enable_if_t< std::is_base_of< GAspectParam, TParam >::value, int > = 0> | |
| GElement * | addGAspect (TParam *param=nullptr) |
| template<typename TAspect , typename ... Args, c_enable_if_t< std::is_base_of< GTemplateAspect< Args... >, TAspect >::value, int > = 0> | |
| GElement * | addGAspect (Args... args) |
| template<typename T , c_enable_if_t< std::is_base_of< GElementParam, T >::value, int > = 0> | |
| GElement * | addEParam (const std::string &key, T *param) |
| CStatus | addDependGElements (const std::set< GElement * > &elements) |
| GElement * | setName (const std::string &name) override |
| GElement * | setLoop (CSize loop) |
| GElement * | setLevel (CLevel level) |
| GElement * | setVisible (CBool visible) |
| GElement * | setBindingIndex (CIndex index) |
| GElement * | setTimeout (CMSec timeout, GElementTimeoutStrategy strategy=GElementTimeoutStrategy::AS_ERROR) |
| GElement * | setMacro (CBool macro) |
| CBool | isGGroup () const |
| CBool | isGAdaptor () const |
| CBool | isGNode () const |
| GElementState | getCurState () const |
| CStatus | removeDepend (GElement *element) |
| GElement & | operator-- (int) noexcept |
| GElement & | operator> (GElement *element) |
| GElement & | operator& (GElement *element) |
| GElement & | operator* (CSize loop) noexcept |
| template<typename TAspect , typename TParam , c_enable_if_t< std::is_base_of< GAspect, TAspect >::value, int > , c_enable_if_t< std::is_base_of< GAspectParam, TParam >::value, int > > | |
| CGRAPH_NAMESPACE_BEGIN GElementPtr | addGAspect (TParam *param) |
| template<typename TAspect , typename ... Args, c_enable_if_t< std::is_base_of< GTemplateAspect< Args... >, TAspect >::value, int > > | |
| GElementPtr | addGAspect (Args... args) |
| template<typename T , c_enable_if_t< std::is_base_of< GElementParam, T >::value, int > > | |
| GElementPtr | addEParam (const std::string &key, T *param) |
Public Member Functions inherited from CObject | |
| CObject ()=default | |
| virtual CStatus | init () |
| virtual CStatus | run ()=0 |
| virtual CStatus | destroy () |
| virtual | ~CObject ()=default |
Public Member Functions inherited from CDescInfo | |
| virtual const std::string & | getName () const |
| const std::string & | getSession () const |
| const std::string & | getDescription () const |
| virtual auto | setDescription (const std::string &description) -> decltype(this) |
| virtual | ~CDescInfo ()=default |
Protected Member Functions | |
| GElement ()=default | |
| ~GElement () override | |
| virtual CStatus | prepareRun () |
| virtual CStatus | checkRunResult () |
| virtual CBool | isHold () |
| virtual CBool | isMatch () |
| CStatus | crashed (const CException &ex) |
| template<typename T , c_enable_if_t< std::is_base_of< GElementParam, T >::value, int > = 0> | |
| T * | getEParam (const std::string &key) |
| CIndex | getThreadIndex () |
| CBool | isTimeout () const |
| CIndex | getBindingIndex () const |
| GElementRelation | getRelation () const |
| CGRAPH_NO_ALLOWED_COPY (GElement) | |
Private Member Functions | |
| CVoid | refresh () |
| CBool | isAsync () const |
| CBool | isMutable () const |
| CBool | isMacro () const |
| virtual CBool | isRegistered () const |
| CStatus | doAspect (const internal::GAspectType &aspectType, const CStatus &curStatus=CStatus()) |
| virtual CStatus | addElementInfo (const std::set< GElement * > &depends, const std::string &name, CSize loop) |
| virtual CStatus | addManagers (GParamManagerPtr paramManager, GEventManagerPtr eventManager, GStageManagerPtr stageManager) |
| CStatus | fatProcessor (const CFunctionType &type) |
| GElement * | setThreadPool (UThreadPoolPtr ptr) |
| virtual CVoid | dump (std::ostream &oss) |
| CVoid | dumpEdge (std::ostream &oss, GElement *src, GElement *dst, const std::string &label=CGRAPH_EMPTY) |
| virtual CVoid | dumpElement (std::ostream &oss) |
| CVoid | dumpElementHeader (std::ostream &oss) |
| CVoid | dumpPerfInfo (std::ostream &oss) |
| CVoid | checkYield () |
| virtual CBool | isSerializable () const |
| CStatus | popLastAspect () |
| CStatus | asyncRun () |
| CStatus | getAsyncResult () |
| virtual CStatus | checkSuitable () |
| std::vector< GElement * > | getDeepPath (CBool reverse) const |
| CBool | isDefaultBinding () const |
Friends | |
| class | GNode |
| class | GGroup |
| class | GCluster |
| class | GRegion |
| class | GCondition |
| class | GMutable |
| template<CInt > | |
| class | GSome |
| template<GMultiConditionType > | |
| class | GMultiCondition |
| class | GPipeline |
| class | GElementManager |
| class | GElementSorter |
| class | GAdapter |
| class | GFunction |
| class | GFence |
| template<CInt > | |
| class | GCoordinator |
| template<typename T > | |
| class | GSingleton |
| class | GEngine |
| class | GDynamicEngine |
| class | GTopoEngine |
| class | GStaticEngine |
| class | GAspectObject |
| class | GOptimizer |
| class | GMaxParaOptimizer |
| class | GTrimOptimizer |
| class | GSeparateOptimizer |
| class | GElementRepository |
| class | GPerf |
Additional Inherited Members | |
Protected Attributes inherited from CDescInfo | |
| std::string | name_ |
| std::string | session_ |
| std::string | description_ |
CGraph所有广义"结点"的基类,可派生出GNode/GGroup/GAdapter类 public: 提供addGAspect加入切面/addDependGElement加入前序依赖/removeDepend删除前序依赖的能力 提供setName更新名称/setLoop设置循环次数/setLevel设置优先级/setVisible隐藏当前元素/setBindingIndex设置亲和线程等能力 提供setTimeout设置元素执行的超时时间/setMacro设置为微任务的能力 提供addEParam添加GElement内部参数(GElementParam,实际上就是GPassedParam) 还额外提供运算符重载:–(setVisible)、>(设置后继依赖)、&(设置后继依赖)、*(setLoop)
protected: 支持设置GAspectManager/GParamManager/GEventManager(后两者通过宏来实现,doxygen分析不出来)
|
explicitprotecteddefault |
构造函数
|
overrideprotected |
析构函数
添加依赖节点信息
| elements |

|
privatevirtual |
设置element信息
| depends | |
| name | |
| loop |

| GElement* GElement::addEParam | ( | const std::string & | key, |
| T * | param | ||
| ) |
添加当前element内部参数
| T |
| key | |
| param |
| GElementPtr GElement::addEParam | ( | const std::string & | key, |
| T * | param | ||
| ) |
| GElement* GElement::addGAspect | ( | Args... | args | ) |
实现添加模板切面的逻辑
| TAspect | |
| Args |
| GElementPtr GElement::addGAspect | ( | Args... | args | ) |

| CGRAPH_NAMESPACE_BEGIN GElementPtr GElement::addGAspect | ( | TParam * | param | ) |
采用懒加载的方式执行,这里不会有并发问题,故不需要采用单例模式了

| GElement* GElement::addGAspect | ( | TParam * | param = nullptr | ) |
实现添加切面的逻辑
| TAspect | |
| TParam |
| param |
|
privatevirtual |
设置manager信息
| paramManager | |
| eventManager | |
| stageManager |
Reimplemented in GGroup, GRegion, and GSingleton< T >.

|
private |
异步执行

|
protected |
|
protectedvirtual |
run() 方法完成之后(包含所有循环次数和 isHold逻辑)的校验函数
|
privatevirtual |
判断当前节点,是否符合执行逻辑。主要用于init的早期阶段
Reimplemented in GSome< TriggerNum >, GFence, and GCoordinator< SIZE >.

|
private |
判断是否进入 yield状态。如果是的话,则等待恢复。未进入yield状态,则继续运行
|
protected |
崩溃流程处理
| ex |
|
private |
执行切面逻辑
| aspectType | |
| curStatus |

|
privatevirtual |
graphviz dump 逻辑
| oss |
Reimplemented in GSome< TriggerNum >, GRegion, GCondition, and GCluster.

|
private |
graphviz dump 边逻辑
| oss | |
| src | 表示开始的元素 |
| dst | 表示结束的元素 |
| label |

|
privatevirtual |
graphviz dump 点逻辑
| oss |
Reimplemented in GFence, and GCoordinator< SIZE >.

|
private |
dump 当前element的header。主要就是为了代码
| oss |
|
private |
graphviz dump perf逻辑
| oss |
|
private |
包含切面相关功能的函数,fat取自fatjar的意思
| type |
如果当前的 element 因为被remove等原因,变成 不可见的状态 则不运行。但不是实际删除当前节点信息
第一次执行的时候,预先执行一下 prepareRun方法
执行带切面的run方法
在实际run结束之后,首先需要判断一下是否进入yield状态了。 接下来,如果状态是ok的,并且被条件hold住,则循环执行 默认所有element的isHold条件均为false,即不hold,即执行一次 可以根据需求,对任意element类型,添加特定的isHold条件

|
private |
异步获取结果信息
|
protected |
获取绑定线程id信息
| GElementState GElement::getCurState | ( | ) | const |
获取当前节点状态信息
如果有超时逻辑的话,优先判断 否则就是当前的状态

|
private |
获取链路所有的 belong信息
| reverse |
|
protected |
获取当前element内部参数
| T |
| key |
|
protected |
获取当前节点的相关关系信息,包含前驱、后继、从属关系

|
protected |
获取执行线程对应的信息

|
private |
判定当前的内容,是否需要异步执行
|
private |
判断是否是默认绑定策略
| CBool GElement::isGAdaptor | ( | ) | const |
当前element是否是一个 adaptor逻辑
| CBool GElement::isGGroup | ( | ) | const |
当前element是否是一个 group逻辑
| CBool GElement::isGNode | ( | ) | const |
当前element是否是一个 node逻辑
|
protectedvirtual |
是否持续进行 默认为false,表示执行且仅执行一次
默认仅返回false 可以根据自己逻辑,来实现"持续循环执行,直到特定条件出现的时候停止"的逻辑
Reimplemented in GSome< TriggerNum >, and GSingleton< T >.
|
private |
判断当前是否是微节点
|
protectedvirtual |
用于在MultiCondition中被判定,是否可以执行。
默认仅返回false 主要面对写入 MultiCondition 的时候,做判断当前element是否被执行
Reimplemented in GSingleton< T >.
|
private |
判断当前是否可以在运行时更新图结构逻辑
|
privatevirtual |
|
privatevirtual |
判断当前元素,是否可以线性执行。默认返回true
Reimplemented in GMutable, GGroup, GMultiCondition< type >, GSome< TriggerNum >, and GRegion.
|
protected |
判断当前是否超时
判断的标准是:
| GElementRef GElement::operator& | ( | GElement * | element | ) |

|
noexcept |
实现连续注册的语法糖,形如: (*a)-->b (*b)-->d; (*c)-->d; (*b)*2;

| GElementRef GElement::operator> | ( | GElement * | element | ) |

|
private |
弹出一个最后一个切面

|
protectedvirtual |
init()后,第一次执行run之前,会执行的函数
|
private |
使用者请勿复写private中的函数 恢复运行最初的信息

删除一个依赖的节点信息
| element |

| GElementPtr GElement::setBindingIndex | ( | CIndex | index | ) |
设定绑定的线程id
| index,需要绑定的 | thread id 信息 |
由于内部有调度机制,不保证绑定线程后,一定在固定线程上执行。 仅保证优先考虑使用绑定线程执行
| GElementPtr GElement::setLevel | ( | CLevel | level | ) |
设置level信息,用于控制init和destroy方法的执行顺序 level值越低,函数越先执行
| level |
| GElementPtr GElement::setLoop | ( | CSize | loop | ) |
设置循环次数
| loop |
| GElementPtr GElement::setMacro | ( | CBool | macro | ) |
设置为微任务
| macro |

|
overridevirtual |
|
private |
设置线程池信息
| ptr |
| GElementPtr GElement::setTimeout | ( | CMSec | timeout, |
| GElementTimeoutStrategy | strategy = GElementTimeoutStrategy::AS_ERROR |
||
| ) |
设定当前算子的超时时间
| timeout | 超时时间 |
| strategy | 当超时的时候,处理的策略 |
| GElementPtr GElement::setVisible | ( | CBool | visible | ) |
设置visible信息。当 visible = false 的时候,算子实际不执行
| visible |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
|
private |
异步执行相关信息
|
private |
|
private |
|
private |
|
private |
|
private |
状态相关信息
|
private |
|
private |
|
private |
|
private |
|
private |
图相关信息
|
private |
|
private |
执行期间相关信息
|
private |
配置相关信息
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |