trackable.xml 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!DOCTYPE header PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
  3. "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
  4. <!--
  5. Copyright Douglas Gregor 2001-2004
  6. Copyright Frank Mori Hess 2007-2009
  7. Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. -->
  10. <header name="boost/signals2/trackable.hpp">
  11. <namespace name="boost">
  12. <namespace name="signals2">
  13. <class name="trackable">
  14. <purpose>Provided to ease porting for code using the boost::signals::trackable class from
  15. the original Boost.Signals library.</purpose>
  16. <description>
  17. <para>Use of the <code>trackable</code> class is not recommended
  18. for new code. The <code>trackable</code> class is not thread-safe
  19. since <code>trackable</code> objects disconnect their associated
  20. connections in the <code>trackable</code> destructor.
  21. Since the <code>trackable</code> destructor is not run until
  22. after the destructors of any derived classes have completed,
  23. that leaves open a window where a partially destructed
  24. object can still have active connections.
  25. </para>
  26. <para>
  27. The preferred method of automatic connection management
  28. with Boost.Signals2 is to manage the lifetime of
  29. tracked objects with <code>shared_ptr</code>s and
  30. to use the <methodname>signals2::slot::track</methodname>
  31. method to track their lifetimes.</para>
  32. <para>The <code>trackable</code> class provides automatic
  33. disconnection of signals and slots when objects bound in
  34. slots (via pointer or reference) are destroyed.
  35. <code>trackable</code> class may only be used as a public
  36. base class for some other class; when used as such, that
  37. class may be bound to function objects used as part of
  38. slots. The manner in which a <code>trackable</code> object
  39. tracks the set of signal-slot connections it is a part of is
  40. unspecified.</para>
  41. <para>The actual use of <code>trackable</code> is contingent
  42. on the presence of appropriate
  43. <functionname>visit_each</functionname> overloads for any
  44. type that may contain pointers or references to trackable
  45. objects.</para>
  46. </description>
  47. <constructor>
  48. <effects><para>Sets the list of connected slots to empty.</para></effects>
  49. <throws><para>Will not throw.</para></throws>
  50. </constructor>
  51. <constructor>
  52. <parameter name="other">
  53. <paramtype>const <classname>trackable</classname>&amp;</paramtype>
  54. </parameter>
  55. <effects><para>Sets the list of connected slots to empty.</para></effects>
  56. <throws><para>Will not throw.</para></throws>
  57. <rationale><para>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.</para></rationale>
  58. </constructor>
  59. <destructor>
  60. <effects><para>Disconnects all signal/slot connections that
  61. contain a pointer or reference to this trackable object that
  62. can be found by
  63. <functionname>visit_each</functionname>.</para></effects>
  64. </destructor>
  65. <copy-assignment>
  66. <parameter name="other">
  67. <paramtype>const <classname>trackable</classname>&amp;</paramtype>
  68. </parameter>
  69. <effects><para>Sets the list of connected slots to empty.</para></effects>
  70. <returns><para><code>*this</code></para></returns>
  71. <throws><para>Will not throw.</para></throws>
  72. <rationale><para>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.</para></rationale>
  73. </copy-assignment>
  74. </class>
  75. </namespace>
  76. </namespace>
  77. </header>