- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How can I use the broadcast_node of TBB to customize the copying of node data? Since my data is quite large and encapsulated with std::shared_ptr, now I need to automatically complete the customized copying when the broadcast_node outputs. How should I achieve this?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To customize the copying behavior in TBB's broadcast_node, you can use a function_node to apply custom logic to each message before it reaches the broadcast stage:
Steps:
- Create a Custom Node: Use a function_node to process or modify messages as needed (e.g., apply a custom copy or transformation). This node will handle any pre-broadcast customization.
- Connect to Broadcast: Link the function_node to a broadcast_node, which will then distribute the modified message to all connected receivers.
Example Workflow:
- The custom node processes each message, performing the desired customization (e.g., doubling the value or applying a specific transformation).
- The broadcast node receives the modified message from the custom node and forwards it to multiple receiver nodes.
- Receiver nodes then process the final message.
This approach gives you flexibility in how each message is copied or transformed before being sent to multiple destinations.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page