CLASS TRACKABLE(3)

NAME
boost::signals2::trackable - Provided to ease porting for code using the boost::signals::trackable class from the original Boost.Signals library.

SYNOPSIS

// In header: <boost/signals2/trackable.hpp>
class trackable {
public:
  // construct/copy/destruct
  trackable();
  trackable(const trackable&);
  trackable& operator=(const trackable&);
  ~trackable();
};

DESCRIPTION

Use of the trackable class is not recommended for new code. The trackable class is not thread-safe since trackable objects disconnect their associated connections in the trackable destructor. Since the trackable destructor is not run until after the destructors of any derived classes have completed, that leaves open a window where a partially destructed object can still have active connections.

The preferred method of automatic connection management with Boost.Signals2 is to manage the lifetime of tracked objects with shared_ptrs and to use the signals2::slot::track method to track their lifetimes.

The trackable class provides automatic disconnection of signals and slots when objects bound in slots (via pointer or reference) are destroyed. trackable class may only be used as a public base class for some other class; when used as such, that class may be bound to function objects used as part of slots. The manner in which a trackable object tracks the set of signal-slot connections it is a part of is unspecified.

The actual use of trackable is contingent on the presence of appropriate visit_each overloads for any type that may contain pointers or references to trackable objects.

  trackable public construct/copy/destruct

    1.

    trackable();

    Effects:
        Sets the list of connected slots to empty.

    Throws:
        Will not throw.

    2.

    trackable(const trackable& other);

    Effects:
        Sets the list of connected slots to empty.

    Throws:
        Will not throw.

    Rationale:
        Signal-slot connections can only be created via calls to an explicit connect method, and therefore cannot be created here when trackable objects are copied.

    3.

    trackable& operator=(const trackable& other);

    Effects:
        Sets the list of connected slots to empty.

    Returns:
        *this

    Throws:
        Will not throw.

    Rationale:
        Signal-slot connections can only be created via calls to an explicit connect method, and therefore cannot be created here when trackable objects are copied.

    4.

    ~trackable();

    Effects:
        Disconnects all signal/slot connections that contain a pointer or reference to this trackable object that can be found by visit_each.