MCPcopy Create free account
hub / github.com/ChunelFeng/CGraph / clone

Method clone

tutorial/MyParams/MyConnParam.h:25–33  ·  view source on GitHub ↗

* 必须实现 clone 函数 * GAspectParam 和 GDaemonParam 均为 GPassedParam的同名内容 * 继承自GPassedParam的参数,可以用于在 aspect 或 daemon 之间传递 * 本例中,MyConnParam既用于GAspectParam(T10)传递,有用于GDaemonParam(T13)传递 * 故写法为 `: public CGraph::GPassedParam` * @param param */

Source from the content-addressed store, hash-verified

23 * @param param
24 */
25 CVoid clone(CGraph::GPassedParamPtr param) override {
26 if (nullptr == param) {
27 return; // 异常判断,理论不可能出现此情况
28 }
29
30 auto* ptr = dynamic_cast<MyConnParam *>(param); // 将传入的参数进行强转,并且赋值到本地
31 ip_ = ptr->ip_;
32 port_ = ptr->port_;
33 }
34
35 std::string ip_ {"0.0.0.0" };
36 short port_ { 0 };

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected