Boost logo

Boost Users :

Subject: Re: [Boost-users] Connecting signals2::signal to another signals2::signal: trackable?
From: Chris Stankevitz (chrisstankevitz_at_[hidden])
Date: 2012-08-03 14:34:03


On Fri, Aug 3, 2012 at 10:06 AM, Igor R <boost.lists_at_[hidden]> wrote:
> Excuse my ignorance, but what does connecting one signal to another
> mean? Is it chaining the signals? Where is it documented?

Igor,

You are correct, it is not documented. I assumed that it chains the
signals. Using GDB, this is what happens (not that I understand any
of it):

1. SignalA.connect(SignalB);

2. SignalB is passed as argument "f" to this function:

      template<typename F>
      BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)(const F& f)
      {
        init_slot_function(f);
      }

3. Then SignalB is passed to:
      template<typename F>
      void init_slot_function(const F& f)
      {
        _slot_function = detail::get_invocable_slot(f, detail::tag_type(f));
        signals2::detail::tracked_objects_visitor visitor(this);
        boost::visit_each(visitor, f);
      }

===

It appears that SignalB is converted to a slot. I don't know what
tracked_objects_visitor is, but perhaps it is the magic that keeps the
test program from crashing.

Chris


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net