fastflow
fastflow copied to clipboard
ff_visitor: implementing a walking strategy for a fastflow node
This is the first attempt to make a generic walk inside the fast flow node.
In addition, this is only a proof of concept, any feedbacks are welcome.
This is my small example to run the visitor over a node
template <typename T>
std::vector<T> ff_map(std::vector<T> &input, std::size_t core, std::size_t chunc) {
ff::ParallelFor map(core);
map.parallel_for(0L, input.size(), [&input](T const item){
std::this_thread::sleep_for (std::chrono::milliseconds(1));
//cpstl::cp_log(LOG, "Finish run...");
std::court << "Finish run...\n";
});
ff::ff_str_visitor visit;
map.accept(visit);
std::court << "Fast flow patter" << visit.get_result() << "\n";
return input;
}
- [X] Implementing Visitor pattern
- [ ] Implementing the visit on the other ff node types
With this type of visitor, we could have the external plugin, that can custom implement visit on the fast flow node, one that I have in mind is to use json library to convert the ff pattern into a json file.
Signed-off-by: Vincenzo Palazzo [email protected]