- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to make a counting_node out of the continue_node.
I'm not sure I understand the documentation of the continue_node regaring the value of the internal threshold, T. If I provide a value in constructor, would it still be incremented as I add a predecessor? Also, is it okay to want to have T=2 and only one predecessor? For example, in the code below what is the value of T?
continue_node<continue_msg> count2(g, 1, MessageForward());
make_edge(some_message_generator, count2);
T==2?
Also, is there a predefined simple message forwarder body as follows?
class MessageForward {
continue_msg operator()(continue_msg /*m*/) {
return continue_msg();
}
};
Thanks,
Igor
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, Igor,
Sorry I didn't respond earlier. Yes, I've also noticed the documentation should be improved. The continue_node's internal threshold tells how many continue_msg()s are received before the body of the node is executed, but the node doesn't care which predecessors send it a message. The threshold is incremented when edge is added from a predecessor, and decremented when an edge is removed.
So if you specify 1 as the initial value for the threshold (somewhat misleadingly-named number_of_predecessors), then add one edge from another node to the continue_node, the node will execute its body after every second continue_msg() received.
If the number_of_predecessors is 0, and you add edges from two nodes to the continue_node, after receiving two continue_msg()s from either of the nodes (in any combination) the continue_node will execute its body and attempt to forward the message. It doesn't require the messages to come from any particular node.
There is no predefined body for the continue_node.
Best Regards,
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Chris, continue_node works as you described. This way I can decimate the messages flowing through the graph.
Igor
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page