Ask Your Question

Subcriber able to switch between multiple callback function

asked 2015-03-19 14:43:20 -0500

215 gravatar image

I have a class which contains a 2 callback function, and based on a boolean it determines which one to use.. The problem is that the state of the boolean get sets in the constructor, and main kept spinning it. so the boolean gets reset..

How overcome this problem, they the callback function both retrieve images and based on the boolean perform different vision actions.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-03-20 02:42:56 -0500

The easiest way to do what you want is having a single subscriber callback and taking the decision which processing step to perform based on the boolean from within the callback.

Like so:

imageCallback(ImageConstPtr img)
  //Check the bool
  if (use_default_image_processing){
edit flag offensive delete link more


Where should i initialize it, and how / where should i change it?

215 gravatar image 215  ( 2015-03-20 03:02:55 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-03-19 14:43:20 -0500

Seen: 206 times

Last updated: Mar 20 '15