| 15 | class MyMutable : public CGraph::GMutable { |
| 16 | public: |
| 17 | CStatus reshape(CGraph::GElementPtrArr& elements) override { |
| 18 | auto param = CGRAPH_GET_GPARAM_WITH_NO_EMPTY(MyParam, "param1") |
| 19 | int count = param->iCount % 4; |
| 20 | if (0 == count) { |
| 21 | CGraph::CGRAPH_ECHO("---- run as a->[b,c]"); |
| 22 | (*elements[0])-->elements[1] & elements[2]; |
| 23 | } else if (1 == count) { |
| 24 | CGraph::CGRAPH_ECHO("---- run as c(*3)->b->a"); |
| 25 | (*elements[2])--*3>elements[1]; // (*elements[2]) 循环3次,并且在 elements[1] 之前执行 |
| 26 | (*elements[1])-->elements[0]; |
| 27 | } else if (2 == count) { |
| 28 | // 只有在这里,显示描述的element,被激活执行。这里, elements[1] 不执行 |
| 29 | CGraph::CGRAPH_ECHO("---- run as a->c, do not run b"); |
| 30 | (*elements[0])-->elements[2]; |
| 31 | } else if (3 == count) { |
| 32 | CGraph::CGRAPH_ECHO("---- run as [a,b(*2),c]"); |
| 33 | (*elements[0])--; |
| 34 | (*elements[1])--*2; |
| 35 | (*elements[2])--; |
| 36 | } else { |
| 37 | CGraph::CGRAPH_ECHO("---- run nothing"); // 理论不会进入这种情况 |
| 38 | } |
| 39 | |
| 40 | return CStatus(); |
| 41 | } |
| 42 | }; |
| 43 | |
| 44 | #endif //CGRAPH_MYMUTABLE_H |
nothing calls this directly
no test coverage detected