Multiple NodeHandle instances vs shared NodeHandle

asked 2021-02-06 17:36:07 -0500

joaocandre gravatar image

Conceptually, when writing a C++ node wherein several classes are instantiated, each responsible for their own publications and subscriptions, one can either instantiate a NodeHandle within each different class, on instantiate a single NodeHandle at top-level/outside, and pass pointers to that NodeHandle to each class.

Performance-wise, is one approach advisable over the other, or are they equivalent? How "expensive" is instantiating a NodeHandle object?

edit retag flag offensive close merge delete