envire / envire-envire_core

Core part for the Environment Representation library
BSD 2-Clause "Simplified" License
7 stars 13 forks source link

boost signal for item changed (trigger must be manual) #27

Closed planthaber closed 6 years ago

planthaber commented 6 years ago

Adds boost signal2 to trigger callbacks on changed item content (manually).

When someone changes item content, (s)he can call the contentsChanged() function to signal the change to all connected functions (receiving the changed item).

As boost/signals2 is used callback functions (slots) can be everything that is supported by the connect() function of the signal (boost::bind, lambda functions, etc.).

This will hopefully help to solve this issue: https://github.com/envire/envire-envire_visualizer/issues/5 because items don't have to be re-added to the graph to get a signal about the change.

planthaber commented 6 years ago

The fist version had a getChangedSignal() exposing the boost signal itself to the user, but I thought it might be better to "hide" boost::sinals2 a bit more from the user.

But I am not sure whether we loose functionality by hiding it behind function calls.

Also the signal is the first actual variable in ItemBase making the memory footprint bigger

planthaber commented 6 years ago

Any comments, if not, i'll merge soon