connection.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  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/connection.hpp" last-revision="$Date: 2007-03-06 16:51:55 -0500 (Tue, 06 Mar 2007) $">
  11. <namespace name="boost">
  12. <namespace name="signals2">
  13. <class name="connection">
  14. <!-- Models LessThanComparable and EqualityComparable -->
  15. <purpose>Query/disconnect a signal-slot connection.</purpose>
  16. <description>
  17. <para>The <classname>signals2::connection</classname> class represents
  18. a connection between a Signal and a Slot. It is a
  19. lightweight object that has the ability to query whether the
  20. signal and slot are currently connected, and to disconnect
  21. the signal and slot. It is always safe to query or
  22. disconnect a connection.</para>
  23. <section>
  24. <title>Thread Safety</title>
  25. <para>The methods of the <code>connection</code> class are thread-safe with the exception
  26. of <methodname>swap</methodname> and the assignment operator. A <code>connection</code> object
  27. should not be accessed concurrently when either of these operations is in progress.
  28. However, it is always safe to access a different <code>connection</code> object
  29. in another thread, even if the two <code>connection</code> objects are copies
  30. of each other which refer to the same underlying connection.
  31. </para>
  32. </section>
  33. </description>
  34. <constructor>
  35. <effects><para>Sets the currently represented connection to the
  36. NULL connection.</para></effects>
  37. <postconditions><para><computeroutput>!this-><methodname>connected</methodname>()</computeroutput>.</para></postconditions>
  38. <throws><para>Will not throw.</para></throws>
  39. </constructor>
  40. <constructor>
  41. <parameter name="other">
  42. <paramtype>const <classname alt="signals2::connection">connection</classname>&amp;</paramtype>
  43. </parameter>
  44. <effects><para><computeroutput>this</computeroutput> references
  45. the connection referenced by
  46. <computeroutput>other</computeroutput>.</para></effects>
  47. <throws><para>Will not throw.</para></throws>
  48. </constructor>
  49. <constructor>
  50. <parameter name="other">
  51. <paramtype><classname alt="signals2::connection">connection</classname>&amp;&amp;</paramtype>
  52. </parameter>
  53. <description><para>Move constructor.</para></description>
  54. <effects><para><computeroutput>this</computeroutput> references
  55. the connection formerly referenced by
  56. <computeroutput>other</computeroutput>. The moved-from <computeroutput>other</computeroutput>
  57. no longer references any connection.</para></effects>
  58. <throws><para>Will not throw.</para></throws>
  59. </constructor>
  60. <copy-assignment>
  61. <parameter name="rhs">
  62. <paramtype>const <classname alt="signals2::connection">connection</classname>&amp;</paramtype>
  63. </parameter>
  64. <effects><para><computeroutput>this</computeroutput> references
  65. the connection referenced by
  66. <computeroutput>rhs</computeroutput>.</para></effects>
  67. <throws><para>Will not throw.</para></throws>
  68. </copy-assignment>
  69. <copy-assignment>
  70. <parameter name="rhs">
  71. <paramtype><classname alt="signals2::connection">connection</classname>&amp;&amp;</paramtype>
  72. </parameter>
  73. <description><para>Move assignment.</para></description>
  74. <effects><para><computeroutput>this</computeroutput> references
  75. the connection formerly referenced by
  76. <computeroutput>rhs</computeroutput>. The moved-from <computeroutput>rhs</computeroutput>
  77. no longer references any connection.</para></effects>
  78. <throws><para>Will not throw.</para></throws>
  79. </copy-assignment>
  80. <method-group name="connection management">
  81. <method name="disconnect" cv="const">
  82. <type>void</type>
  83. <effects><para>If
  84. <computeroutput>this-&gt;<methodname>connected</methodname>()</computeroutput>,
  85. disconnects the signal and slot referenced by this;
  86. otherwise, this operation is a no-op.</para></effects>
  87. <postconditions><para><computeroutput>!this-&gt;<methodname>connected</methodname>()</computeroutput>.</para></postconditions>
  88. </method>
  89. <method name="connected" cv="const">
  90. <type>bool</type>
  91. <returns><para><computeroutput>true</computeroutput> if this
  92. references a non-NULL connection that is still active
  93. (connected), and <computeroutput>false</computeroutput>
  94. otherwise.</para></returns>
  95. <throws><para>Will not throw.</para></throws>
  96. </method>
  97. </method-group>
  98. <method-group name="blocking">
  99. <method name="blocked" cv="const">
  100. <type>bool</type>
  101. <description>
  102. <para>
  103. Queries if the connection is blocked. A connection may be blocked by creating a
  104. <classname>boost::signals2::shared_connection_block</classname> object.
  105. </para>
  106. </description>
  107. <returns><para><code>true</code> if the associated slot is either disconnected or blocked, <code>false</code> otherwise.</para></returns>
  108. <throws><para>Will not throw.</para></throws>
  109. </method>
  110. </method-group>
  111. <method-group name="modifiers">
  112. <method name="swap">
  113. <type>void</type>
  114. <parameter name="other">
  115. <paramtype><classname alt="signals2::connection">connection</classname>&amp;</paramtype>
  116. </parameter>
  117. <effects><para>Swaps the connections referenced in
  118. <computeroutput>this</computeroutput> and
  119. <computeroutput>other</computeroutput>.</para></effects>
  120. <throws><para>Will not throw.</para></throws>
  121. </method>
  122. </method-group>
  123. <method-group name="comparisons">
  124. <method name="operator==" cv="const">
  125. <type>bool</type>
  126. <parameter name="other">
  127. <paramtype>const <classname alt="signals2::connection">connection</classname>&amp;</paramtype>
  128. </parameter>
  129. <returns><para><computeroutput>true</computeroutput> if
  130. <computeroutput>this</computeroutput> and
  131. <computeroutput>other</computeroutput> reference the same
  132. connection or both reference the NULL connection, and
  133. <computeroutput>false</computeroutput>
  134. otherwise.</para></returns>
  135. <throws><para>Will not throw.</para></throws>
  136. </method>
  137. <method name="operator!=" cv="const">
  138. <type>bool</type>
  139. <parameter name="other">
  140. <paramtype>const <classname alt="signals2::connection">connection</classname>&amp;</paramtype>
  141. </parameter>
  142. <returns><para><computeroutput>!(*this == other)</computeroutput></para></returns>
  143. <throws><para>Will not throw.</para></throws>
  144. </method>
  145. <method name="operator&lt;" cv="const">
  146. <type>bool</type>
  147. <parameter name="other">
  148. <paramtype>const <classname alt="signals2::connection">connection</classname>&amp;</paramtype>
  149. </parameter>
  150. <returns><para><computeroutput>true</computeroutput> if the
  151. connection referenced by
  152. <computeroutput>this</computeroutput> precedes the
  153. connection referenced by
  154. <computeroutput>other</computeroutput> based on some
  155. unspecified ordering, and
  156. <computeroutput>false</computeroutput>
  157. otherwise.</para></returns>
  158. <throws><para>Will not throw.</para></throws>
  159. </method>
  160. </method-group>
  161. <free-function-group name="specialized algorithms">
  162. <function name="swap">
  163. <type>void</type>
  164. <parameter name="x">
  165. <paramtype><classname alt="signals2::connection">connection</classname>&amp;</paramtype>
  166. </parameter>
  167. <parameter name="y">
  168. <paramtype><classname alt="signals2::connection">connection</classname>&amp;</paramtype>
  169. </parameter>
  170. <effects><para><computeroutput>x.swap(y)</computeroutput></para></effects>
  171. <throws><para>Will not throw.</para></throws>
  172. </function>
  173. </free-function-group>
  174. </class>
  175. <class name="scoped_connection">
  176. <inherit access="public">
  177. <type><classname alt="signals2::connection">connection</classname></type>
  178. </inherit>
  179. <purpose>Limits a signal-slot connection lifetime to a particular scope.</purpose>
  180. <access name="public">
  181. <constructor>
  182. <postconditions>
  183. <para><code><methodname alt="connection::connected">connected</methodname>() == false </code></para>
  184. </postconditions>
  185. <description>
  186. <para>Default constructs an empty scoped_connection.</para>
  187. </description>
  188. <throws><para>Will not throw.</para></throws>
  189. </constructor>
  190. <constructor>
  191. <parameter name="other">
  192. <paramtype>const <classname alt="signals2::connection">connection</classname>&amp;</paramtype>
  193. </parameter>
  194. <effects><para><computeroutput>this</computeroutput> references
  195. the connection referenced by
  196. <computeroutput>other</computeroutput>.</para></effects>
  197. <postconditions>
  198. <para><code><methodname alt="connection::connected">connected</methodname>() == other.connected()</code></para>
  199. </postconditions>
  200. <throws><para>Will not throw.</para></throws>
  201. </constructor>
  202. <constructor>
  203. <parameter name="other">
  204. <paramtype><classname alt="signals2::scoped_connection">scoped_connection</classname>&amp;&amp;</paramtype>
  205. </parameter>
  206. <description><para>Move constructor.</para></description>
  207. <effects><para><computeroutput>this</computeroutput> references
  208. the connection formerly referenced by
  209. <computeroutput>other</computeroutput>. The moved-from <computeroutput>other</computeroutput>
  210. no longer references any connection.</para></effects>
  211. <throws><para>Will not throw.</para></throws>
  212. </constructor>
  213. <constructor>
  214. <parameter name="other">
  215. <paramtype><classname alt="signals2::connection">connection</classname>&amp;&amp;</paramtype>
  216. </parameter>
  217. <description><para>Move constructor.</para></description>
  218. <effects><para><computeroutput>this</computeroutput> references
  219. the connection formerly referenced by
  220. <computeroutput>other</computeroutput>. The moved-from <computeroutput>other</computeroutput>
  221. no longer references any connection.</para></effects>
  222. <throws><para>Will not throw.</para></throws>
  223. </constructor>
  224. <copy-assignment>
  225. <parameter name="rhs">
  226. <paramtype>const <classname alt="signals2::connection">connection</classname>&amp;</paramtype>
  227. </parameter>
  228. <description><para>Copy assignment from unscoped connection.</para></description>
  229. <effects><para><computeroutput>this</computeroutput> references
  230. the connection referenced by
  231. <computeroutput>rhs</computeroutput>. If <code>this</code> already references another
  232. connection, the old connection will be disconnected first.</para></effects>
  233. <postconditions>
  234. <para><code><methodname alt="connection::connected">connected</methodname>() == other.connected()</code></para>
  235. </postconditions>
  236. <throws><para>Will not throw.</para></throws>
  237. </copy-assignment>
  238. <copy-assignment>
  239. <parameter name="rhs">
  240. <paramtype><classname alt="signals2::scoped_connection">scoped_connection</classname>&amp;&amp;</paramtype>
  241. </parameter>
  242. <description><para>Move assignment.</para></description>
  243. <effects><para><computeroutput>this</computeroutput> references
  244. the connection formerly referenced by
  245. <computeroutput>rhs</computeroutput>. The moved-from <computeroutput>rhs</computeroutput>
  246. no longer references any connection. If <code>this</code> already references another
  247. connection, the old connection will be disconnected first.</para></effects>
  248. <throws><para>Will not throw.</para></throws>
  249. </copy-assignment>
  250. <copy-assignment>
  251. <parameter name="rhs">
  252. <paramtype><classname alt="signals2::connection">connection</classname>&amp;&amp;</paramtype>
  253. </parameter>
  254. <description><para>Move assignment.</para></description>
  255. <effects><para><computeroutput>this</computeroutput> references
  256. the connection formerly referenced by
  257. <computeroutput>rhs</computeroutput>. The moved-from <computeroutput>rhs</computeroutput>
  258. no longer references any connection. If <code>this</code> already references another
  259. connection, the old connection will be disconnected first.</para></effects>
  260. <throws><para>Will not throw.</para></throws>
  261. </copy-assignment>
  262. <destructor>
  263. <effects><para>If
  264. <computeroutput>this-&gt;<methodname alt="connection::connected">connected</methodname>()</computeroutput>,
  265. disconnects the signal-slot connection.</para></effects>
  266. </destructor>
  267. <method-group name="public methods">
  268. <method name="release">
  269. <type><classname alt="signals2::connection">connection</classname></type>
  270. <effects>
  271. <para>
  272. Releases the connection so it will not be disconnected by the <code>scoped_connection</code>
  273. when it is destroyed or reassigned. The <code>scoped_connection</code> is reset to
  274. the NULL connection after this call completes.
  275. </para>
  276. </effects>
  277. <postconditions>
  278. <para><code><methodname alt="connection::connected">connected</methodname>() == false</code></para>
  279. </postconditions>
  280. <returns>
  281. <para>A <classname alt="signals2::connection">connection</classname> object referencing the connection which was
  282. released by the <code>scoped_connection</code>.
  283. </para>
  284. </returns>
  285. </method>
  286. </method-group>
  287. </access>
  288. <access name="private">
  289. <constructor>
  290. <parameter name="other">
  291. <paramtype>const <classname alt="signals2::scoped_connection">scoped_connection</classname>&amp;</paramtype>
  292. </parameter>
  293. <description>
  294. <para>The scoped_connection class is not copyable. It may only be copy constructed from an unscoped
  295. <classname alt="signals2::connection">connection</classname> object.</para>
  296. </description>
  297. </constructor>
  298. <copy-assignment>
  299. <parameter name="rhs">
  300. <paramtype>const <classname alt="signals2::scoped_connection">scoped_connection</classname>&amp;</paramtype>
  301. </parameter>
  302. <description>
  303. <para>The scoped_connection class is not copyable. It may only be copy assigned from an unscoped
  304. <classname alt="signals2::connection">connection</classname> object.</para>
  305. </description>
  306. </copy-assignment>
  307. </access>
  308. <description>
  309. <para>A <classname alt="signals2::connection">connection</classname> which automatically disconnects on destruction.</para>
  310. <section>
  311. <title>Thread Safety</title>
  312. <para>The methods of the <code>scoped_connection</code> class (including those
  313. inherited from its base <code>connection</code> class) are thread-safe with the exception
  314. of <methodname>signals2::connection::swap</methodname>, <methodname>release</methodname>, and
  315. the assignment operator. A <code>scoped_connection</code> object
  316. should not be accessed concurrently when any of these operations is in progress.
  317. However, it is always safe to access a different <code>connection</code> object
  318. in another thread, even if it references the same underlying signal-slot connection.
  319. </para>
  320. </section>
  321. </description>
  322. </class>
  323. </namespace>
  324. </namespace>
  325. </header>