signal_header.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  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/signal.hpp" last-revision="$Date: 2007-03-06 16:51:55 -0500 (Tue, 06 Mar 2007) $">
  11. <using-namespace name="boost::signals2"/>
  12. <using-namespace name="boost"/>
  13. <namespace name="boost">
  14. <namespace name="signals2">
  15. <enum name="connect_position">
  16. <enumvalue name="at_front"/>
  17. <enumvalue name="at_back"/>
  18. </enum>
  19. <class name="signal">
  20. <template>
  21. <template-type-parameter name="Signature">
  22. <purpose>Function type R (T1, T2, ..., TN)</purpose>
  23. </template-type-parameter>
  24. <template-type-parameter name="Combiner">
  25. <default><classname>boost::signals2::optional_last_value</classname>&lt;R&gt;</default>
  26. </template-type-parameter>
  27. <template-type-parameter name="Group">
  28. <default>int</default>
  29. </template-type-parameter>
  30. <template-type-parameter name="GroupCompare">
  31. <default><classname>std::less</classname>&lt;Group&gt;</default>
  32. </template-type-parameter>
  33. <template-type-parameter name="SlotFunction">
  34. <default><classname>boost::function</classname>&lt;Signature&gt;</default>
  35. </template-type-parameter>
  36. <template-type-parameter name="ExtendedSlotFunction">
  37. <default><classname>boost::function</classname>&lt;R (const <classname alt="signals2::connection">connection</classname> &amp;, T1, T2, ..., TN)&gt;</default>
  38. </template-type-parameter>
  39. <template-type-parameter name="Mutex">
  40. <default><classname>boost::signals2::mutex</classname></default>
  41. </template-type-parameter>
  42. </template>
  43. <inherit access="public">
  44. <type><classname>boost::signals2::signal_base</classname></type>
  45. </inherit>
  46. <purpose>Safe multicast callback.</purpose>
  47. <description>
  48. <para>
  49. See the <link linkend="signals2.tutorial">tutorial</link>
  50. for more information on how to use the signal class.
  51. </para>
  52. </description>
  53. <typedef name="signature_type"><type>Signature</type></typedef>
  54. <typedef name="result_type">
  55. <type>typename Combiner::result_type</type>
  56. </typedef>
  57. <typedef name="combiner_type"><type>Combiner</type></typedef>
  58. <typedef name="group_type"><type>Group</type></typedef>
  59. <typedef name="group_compare_type"><type>GroupCompare</type></typedef>
  60. <typedef name="slot_function_type"><type>SlotFunction</type></typedef>
  61. <typedef name="slot_type">
  62. <type>typename <classname>signals2::slot</classname>&lt;Signature, SlotFunction&gt;</type>
  63. </typedef>
  64. <typedef name="extended_slot_function_type"><type>ExtendedSlotFunction</type></typedef>
  65. <typedef name="extended_slot_type">
  66. <type>typename <classname>signals2::slot</classname>&lt;R (const <classname alt="signals2::connection">connection</classname> &amp;, T1, ..., TN), ExtendedSlotFunction&gt;</type>
  67. <description>
  68. <para>Slots of the <code>extended_slot_type</code> may be connected to the signal using the
  69. <methodname>connect_extended</methodname> methods. The <code>extended_slot_type</code>
  70. has an additional <classname>signals2::connection</classname> argument in its signature,
  71. which gives slot functions access to their connection to the signal
  72. invoking them.
  73. </para>
  74. </description>
  75. </typedef>
  76. <typedef name="slot_result_type">
  77. <type>typename SlotFunction::result_type</type>
  78. <description>
  79. <para>
  80. This is the type returned when dereferencing the input iterators passed to the signal's
  81. combiner.
  82. </para>
  83. </description>
  84. </typedef>
  85. <typedef name="slot_call_iterator">
  86. <type><emphasis>unspecified</emphasis></type>
  87. <description>
  88. <para>
  89. The input iterator type passed to the combiner when the signal is invoked.
  90. </para>
  91. </description>
  92. </typedef>
  93. <typedef name="argument_type">
  94. <type>T1</type>
  95. <purpose>Exists iff arity == 1</purpose>
  96. </typedef>
  97. <typedef name="first_argument_type">
  98. <type>T1</type>
  99. <purpose>Exists iff arity == 2</purpose>
  100. </typedef>
  101. <typedef name="second_argument_type">
  102. <type>T2</type>
  103. <purpose>Exists iff arity == 2</purpose>
  104. </typedef>
  105. <class name="arg">
  106. <template>
  107. <template-nontype-parameter name="n">
  108. <type>unsigned</type>
  109. </template-nontype-parameter>
  110. </template>
  111. <typedef name="type">
  112. <type>Tn</type>
  113. <purpose>The type of the <classname alt="signals2::signal">signal</classname>'s (n+1)th argument</purpose>
  114. </typedef>
  115. </class>
  116. <static-constant name="arity">
  117. <type>int</type>
  118. <default>N</default>
  119. <purpose>The number of arguments taken by the signal.</purpose>
  120. </static-constant>
  121. <constructor>
  122. <parameter name="combiner">
  123. <paramtype>const combiner_type&amp;</paramtype>
  124. <default>combiner_type()</default>
  125. </parameter>
  126. <parameter name="compare">
  127. <paramtype>const group_compare_type&amp;</paramtype>
  128. <default>group_compare_type()</default>
  129. </parameter>
  130. <effects><para>Initializes the signal to contain no slots, copies the given combiner into internal storage, and stores the given group comparison function object to compare groups.</para></effects>
  131. <postconditions><para><computeroutput>this-&gt;<methodname>empty</methodname>()</computeroutput></para></postconditions>
  132. </constructor>
  133. <constructor>
  134. <parameter name="other">
  135. <paramtype>signal &amp;&amp;</paramtype>
  136. </parameter>
  137. <description><para>Move constructor.</para></description>
  138. <postconditions><para>The signal <computeroutput>other</computeroutput>
  139. is in a "moved-from" state where it may only be destroyed, swapped, or move assigned.
  140. Any other operation on a "moved-from" signal is invalid.</para></postconditions>
  141. <throws><para>Will not throw.</para></throws>
  142. </constructor>
  143. <copy-assignment>
  144. <parameter name="rhs">
  145. <paramtype>signal &amp;&amp;</paramtype>
  146. </parameter>
  147. <description><para>Move assignment.</para></description>
  148. <postconditions><para>The signal <computeroutput>rhs</computeroutput>
  149. is in a "moved-from" state where it may only be destroyed, swapped, or move assigned.
  150. Any other operation on a "moved-from" signal is invalid.</para></postconditions>
  151. <throws><para>Will not throw.</para></throws>
  152. </copy-assignment>
  153. <method-group name="connection management">
  154. <overloaded-method name="connect">
  155. <signature>
  156. <type><classname alt="signals2::connection">connection</classname></type>
  157. <parameter name="slot">
  158. <paramtype>const slot_type&amp;</paramtype>
  159. </parameter>
  160. <parameter name="at">
  161. <paramtype>connect_position</paramtype>
  162. <default>at_back</default>
  163. </parameter>
  164. </signature>
  165. <signature>
  166. <type><classname alt="signals2::connection">connection</classname></type>
  167. <parameter name="group">
  168. <paramtype>const group_type&amp;</paramtype>
  169. </parameter>
  170. <parameter name="slot">
  171. <paramtype>const slot_type&amp;</paramtype>
  172. </parameter>
  173. <parameter name="at">
  174. <paramtype>connect_position</paramtype>
  175. <default>at_back</default>
  176. </parameter>
  177. </signature>
  178. <effects><para>Connects the signal this to the incoming
  179. slot. If the slot is inactive, i.e., any of the slots's tracked
  180. objects have been destroyed, then the
  181. call to connect is a no-op. If the second version of
  182. <computeroutput>connect</computeroutput> is invoked, the
  183. slot is associated with the given group. The <code>at</code>
  184. parameter specifies where the slot should be connected:
  185. <code>at_front</code> indicates that the slot will be
  186. connected at the front of the list or group of slots and
  187. <code>at_back</code> indicates that the slot will be
  188. connected at the back of the list or group of
  189. slots.</para></effects>
  190. <returns><para>A
  191. <computeroutput><classname>signals2::connection</classname></computeroutput>
  192. object that references the newly-created connection between
  193. the signal and the slot; if the slot is inactive, returns a
  194. disconnected connection.</para></returns>
  195. <throws><para>This routine meets the strong exception guarantee,
  196. where any exception thrown will cause the slot to not be
  197. connected to the signal.</para></throws>
  198. <complexity><para>Constant time when connecting a slot
  199. without a group name or logarithmic in the number of groups
  200. when connecting to a particular
  201. group.</para></complexity>
  202. <notes><para>It is unspecified whether connecting a slot while the
  203. signal is calling will result in the slot being called
  204. immediately.</para></notes>
  205. </overloaded-method>
  206. <overloaded-method name="connect_extended">
  207. <signature>
  208. <type><classname alt="signals2::connection">connection</classname></type>
  209. <parameter name="slot">
  210. <paramtype>const extended_slot_type&amp;</paramtype>
  211. </parameter>
  212. <parameter name="at">
  213. <paramtype>connect_position</paramtype>
  214. <default>at_back</default>
  215. </parameter>
  216. </signature>
  217. <signature>
  218. <type><classname alt="signals2::connection">connection</classname></type>
  219. <parameter name="group">
  220. <paramtype>const group_type&amp;</paramtype>
  221. </parameter>
  222. <parameter name="slot">
  223. <paramtype>const extended_slot_type&amp;</paramtype>
  224. </parameter>
  225. <parameter name="at">
  226. <paramtype>connect_position</paramtype>
  227. <default>at_back</default>
  228. </parameter>
  229. </signature>
  230. <description>
  231. <para>
  232. The <code>connect_extended</code> methods work the same as the <methodname>connect</methodname>
  233. methods, except they take slots of type <classname>extended_slot_type</classname>.
  234. This is useful if a slot needs to access the connection between it and the
  235. signal invoking it, for example if it wishes to disconnect or block its own connection.
  236. </para>
  237. </description>
  238. </overloaded-method>
  239. <overloaded-method name="disconnect">
  240. <signature>
  241. <type>void</type>
  242. <parameter name="group">
  243. <paramtype>const group_type&amp;</paramtype>
  244. </parameter>
  245. </signature>
  246. <signature>
  247. <template>
  248. <template-type-parameter name="S"/>
  249. </template>
  250. <type>void</type>
  251. <parameter name="slot_func">
  252. <paramtype>const S&amp;</paramtype>
  253. </parameter>
  254. </signature>
  255. <effects><para>If the parameter is (convertible to) a
  256. group name, any slots in the given group are
  257. disconnected. Otherwise, any slots equal to the
  258. given slot function
  259. are disconnected.
  260. </para>
  261. <para>Note, the <code>slot_func</code>
  262. argument should not be an actual <classname>signals2::slot</classname>
  263. object (which does not even support <code>operator==</code>), but rather
  264. the functor you wrapped inside a <classname>signals2::slot</classname>
  265. when you initially made the connection.
  266. </para></effects>
  267. <throws><para>Will not throw unless a user destructor or
  268. equality operator <code>==</code> throws. If either throws,
  269. not all slots may be disconnected.</para></throws>
  270. <complexity><para>If a group is given, O(lg g) + k where
  271. g is the number of groups in the signal and k is the
  272. number of slots in the group. Otherwise, linear in the
  273. number of slots connected to the
  274. signal.</para></complexity>
  275. </overloaded-method>
  276. <method name="disconnect_all_slots">
  277. <type>void</type>
  278. <effects><para>Disconnects all slots connected to the signal.</para></effects>
  279. <postconditions><para><computeroutput>this-&gt;<methodname>empty</methodname>()</computeroutput>.</para></postconditions>
  280. <throws><para>If disconnecting a slot causes an exception to be
  281. thrown, not all slots may be disconnected.</para></throws>
  282. <complexity><para>Linear in the number of slots known to the
  283. signal.</para></complexity>
  284. <notes><para>May be called at any time within the lifetime of the
  285. signal, including during calls to the signal's slots.</para></notes>
  286. </method>
  287. <method name="empty" cv="const">
  288. <type>bool</type>
  289. <returns><para><computeroutput>true</computeroutput> if no slots
  290. are connected to the signal, and
  291. <computeroutput>false</computeroutput> otherwise.</para></returns>
  292. <throws><para>Will not throw.</para></throws>
  293. <complexity><para>Linear in the number of slots known to the
  294. signal.</para></complexity>
  295. <rationale><para>Slots can disconnect at any point in time,
  296. including while those same slots are being invoked. It is
  297. therefore possible that the implementation must search
  298. through a list of disconnected slots to determine if any
  299. slots are still connected.</para></rationale>
  300. </method>
  301. <method name="num_slots" cv="const">
  302. <type>std::size_t</type>
  303. <returns><para>The number of slots connected to the signal</para></returns>
  304. <throws><para>Will not throw.</para></throws>
  305. <complexity><para>Linear in the number of slots known to the
  306. signal.</para></complexity>
  307. <rationale><para>Slots can disconnect at any point in time,
  308. including while those same slots are being invoked. It is
  309. therefore possible that the implementation must search
  310. through a list of disconnected slots to determine how many
  311. slots are still connected.</para></rationale>
  312. </method>
  313. </method-group>
  314. <method-group name="invocation">
  315. <overloaded-method name="operator()">
  316. <signature>
  317. <type>result_type</type>
  318. <parameter name="a1"><paramtype>arg&lt;0&gt;::type</paramtype></parameter>
  319. <parameter name="a2"><paramtype>arg&lt;1&gt;::type</paramtype></parameter>
  320. <parameter><paramtype>...</paramtype></parameter>
  321. <parameter name="aN"><paramtype>arg&lt;N-1&gt;::type</paramtype></parameter>
  322. </signature>
  323. <signature cv="const">
  324. <type>result_type</type>
  325. <parameter name="a1"><paramtype>arg&lt;0&gt;::type</paramtype></parameter>
  326. <parameter name="a2"><paramtype>arg&lt;1&gt;::type</paramtype></parameter>
  327. <parameter><paramtype>...</paramtype></parameter>
  328. <parameter name="aN"><paramtype>arg&lt;N-1&gt;::type</paramtype></parameter>
  329. </signature>
  330. <effects><para>Invokes the combiner with a
  331. <computeroutput>slot_call_iterator</computeroutput> range
  332. [first, last) corresponding to the sequence of calls to the
  333. slots connected to signal
  334. <computeroutput>*this</computeroutput>. Dereferencing an
  335. iterator in this range causes a slot call with the given set
  336. of parameters <computeroutput>(a1, a2, ...,
  337. aN)</computeroutput>, the result of which is returned from
  338. the iterator dereference operation.</para></effects>
  339. <returns><para>The result returned by the combiner.</para></returns>
  340. <throws><para>If an exception is thrown by a slot call, or if the
  341. combiner does not dereference any slot past some given slot,
  342. all slots after that slot in the internal list of connected
  343. slots will not be invoked.</para></throws>
  344. <notes><para>Only the slots associated with iterators that are
  345. actually dereferenced will be invoked. Multiple dereferences
  346. of the same iterator will not result in multiple slot
  347. invocations, because the return value of the slot will be
  348. cached.</para>
  349. <para>The <computeroutput>const</computeroutput> version of
  350. the function call operator will invoke the combiner as
  351. <computeroutput>const</computeroutput>, whereas the
  352. non-<computeroutput>const</computeroutput> version will
  353. invoke the combiner as
  354. non-<computeroutput>const</computeroutput>.</para>
  355. </notes>
  356. </overloaded-method>
  357. </method-group>
  358. <method-group name="combiner access">
  359. <method name="combiner" cv="const">
  360. <type>combiner_type</type>
  361. <returns><para>A copy of the stored combiner.</para></returns>
  362. <throws><para>Will not throw.</para></throws>
  363. </method>
  364. <method name="set_combiner">
  365. <type>void</type>
  366. <parameter name="combiner"><paramtype>const combiner_type&amp;</paramtype></parameter>
  367. <effects><para>Copies a new combiner into the signal for use with
  368. future signal invocations.</para></effects>
  369. <throws><para>Will not throw.</para></throws>
  370. </method>
  371. </method-group>
  372. <method-group name="modifiers">
  373. <method name="swap">
  374. <type>void</type>
  375. <parameter name="other">
  376. <paramtype><classname alt="signals2::signal">signal</classname>&amp;</paramtype>
  377. </parameter>
  378. <effects><para>Swaps the signal referenced in
  379. <computeroutput>this</computeroutput> and
  380. <computeroutput>other</computeroutput>.</para></effects>
  381. <throws><para>Will not throw.</para></throws>
  382. </method>
  383. </method-group>
  384. <free-function-group name="specialized algorithms">
  385. <function name="swap">
  386. <template>
  387. <template-type-parameter name="Signature"/>
  388. <template-type-parameter name="Combiner"/>
  389. <template-type-parameter name="Group"/>
  390. <template-type-parameter name="GroupCompare"/>
  391. <template-type-parameter name="SlotFunction"/>
  392. <template-type-parameter name="ExtendedSlotFunction"/>
  393. <template-type-parameter name="Mutex"/>
  394. </template>
  395. <type>void</type>
  396. <parameter name="x">
  397. <paramtype><classname alt="signals2::signal">signal</classname>&lt;Signature, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex&gt;&amp;</paramtype>
  398. </parameter>
  399. <parameter name="y">
  400. <paramtype><classname alt="signals2::signal">signal</classname>&lt;Signature, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex&gt;&amp;</paramtype>
  401. </parameter>
  402. <effects><para><computeroutput>x.swap(y)</computeroutput></para></effects>
  403. <throws><para>Will not throw.</para></throws>
  404. </function>
  405. </free-function-group>
  406. </class>
  407. </namespace>
  408. </namespace>
  409. </header>