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

Class MapGNode

example/E04-MapReduce.cpp:50–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48
49template<int MAP_TAG>
50class MapGNode : public GNode {
51public:
52 CStatus run() override {
53 auto param = CGRAPH_GET_GPARAM_WITH_NO_EMPTY(NumsGParam, PARAM_KEY);
54 for (int i = 0; i < NUMS_PER_MAP; i++) {
55 int num = param->random_nums_[MAP_TAG * NUMS_PER_MAP + i];
56 param->map_results_[MAP_TAG][num]++; // 实际上是线程安全的
57 }
58 return CStatus();
59 }
60};
61
62
63class ReduceGNode : public GNode {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected