• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<title>Class template signal_type</title>
6<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
8<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
9<link rel="up" href="../../signals2/reference.html#header.boost.signals2.signal_type_hpp" title="Header &lt;boost/signals2/signal_type.hpp&gt;">
10<link rel="prev" href="keywords/mutex_type.html" title="Class template mutex_type">
11<link rel="next" href="slot.html" title="Class template slot">
12</head>
13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
14<table cellpadding="2" width="100%"><tr>
15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
16<td align="center"><a href="../../../../index.html">Home</a></td>
17<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
20<td align="center"><a href="../../../../more/index.htm">More</a></td>
21</tr></table>
22<hr>
23<div class="spirit-nav">
24<a accesskey="p" href="keywords/mutex_type.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../signals2/reference.html#header.boost.signals2.signal_type_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="slot.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
25</div>
26<div class="refentry">
27<a name="boost.signals2.signal_type"></a><div class="titlepage"></div>
28<div class="refnamediv">
29<h2><span class="refentrytitle">Class template signal_type</span></h2>
30<p>boost::signals2::signal_type — Specify a the template type parameters of a <a class="link" href="signal.html" title="Class template signal">boost::signals2::signal</a> using named parameters.</p>
31</div>
32<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
33<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../signals2/reference.html#header.boost.signals2.signal_type_hpp" title="Header &lt;boost/signals2/signal_type.hpp&gt;">boost/signals2/signal_type.hpp</a>&gt;
34
35</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> A0<span class="special">,</span> <span class="keyword">typename</span> A1 <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">parameter</span><span class="special">::</span><span class="identifier">void_</span><span class="special">,</span>
36         <span class="keyword">typename</span> A2 <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">parameter</span><span class="special">::</span><span class="identifier">void_</span><span class="special">,</span>
37         <span class="keyword">typename</span> A3 <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">parameter</span><span class="special">::</span><span class="identifier">void_</span><span class="special">,</span>
38         <span class="keyword">typename</span> A4 <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">parameter</span><span class="special">::</span><span class="identifier">void_</span><span class="special">,</span>
39         <span class="keyword">typename</span> A5 <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">parameter</span><span class="special">::</span><span class="identifier">void_</span><span class="special">,</span>
40         <span class="keyword">typename</span> A6 <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">parameter</span><span class="special">::</span><span class="identifier">void_</span><span class="special">&gt;</span>
41<span class="keyword">class</span> <a class="link" href="signal_type.html" title="Class template signal_type">signal_type</a> <span class="special">{</span>
42<span class="keyword">public</span><span class="special">:</span>
43  <span class="comment">// types</span>
44  <span class="keyword">typedef</span> <span class="emphasis"><em><span class="identifier">implementation</span><span class="special">-</span><span class="identifier">detail</span></em></span>                                           <a name="boost.signals2.signal_type.signature_type"></a><span class="identifier">signature_type</span><span class="special">;</span>
45  <span class="keyword">typedef</span> <span class="emphasis"><em><span class="identifier">implementation</span><span class="special">-</span><span class="identifier">detail</span></em></span>                                           <a name="boost.signals2.signal_type.combiner_type"></a><span class="identifier">combiner_type</span><span class="special">;</span>
46  <span class="keyword">typedef</span> <span class="emphasis"><em><span class="identifier">implementation</span><span class="special">-</span><span class="identifier">detail</span></em></span>                                           <a name="boost.signals2.signal_type.group_type"></a><span class="identifier">group_type</span><span class="special">;</span>
47  <span class="keyword">typedef</span> <span class="emphasis"><em><span class="identifier">implementation</span><span class="special">-</span><span class="identifier">detail</span></em></span>                                           <a name="boost.signals2.signal_type.group_compare_type"></a><span class="identifier">group_compare_type</span><span class="special">;</span>
48  <span class="keyword">typedef</span> <span class="emphasis"><em><span class="identifier">implementation</span><span class="special">-</span><span class="identifier">detail</span></em></span>                                           <a name="boost.signals2.signal_type.slot_function_type"></a><span class="identifier">slot_function_type</span><span class="special">;</span>
49  <span class="keyword">typedef</span> <span class="emphasis"><em><span class="identifier">implementation</span><span class="special">-</span><span class="identifier">detail</span></em></span>                                           <a name="boost.signals2.signal_type.extend_1_3_36_6_11_1_1_2_9"></a><span class="identifier">extended_slot_function_type</span><span class="special">;</span>
50  <span class="keyword">typedef</span> <span class="emphasis"><em><span class="identifier">implementation</span><span class="special">-</span><span class="identifier">detail</span></em></span>                                           <a name="boost.signals2.signal_type.mutex_type"></a><span class="identifier">mutex_type</span><span class="special">;</span>
51  <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">signal</span><span class="special">&lt;</span><span class="identifier">signature_type</span><span class="special">,</span> <span class="identifier">combiner_type</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">mutex_type</span><span class="special">&gt;</span> <a name="boost.signals2.signal_type.type"></a><span class="identifier">type</span><span class="special">;</span>
52<span class="special">}</span><span class="special">;</span></pre></div>
53<div class="refsect1">
54<a name="id-1.3.36.6.12.10.4"></a><h2>Description</h2>
55<p>The <code class="computeroutput">signal_type</code> metafunction employs the Boost.Parameter library to
56            allow users to specify the template type parameters of a <a class="link" href="signal.html" title="Class template signal">signals2::signal</a>
57            using named parameters.  The resulting signal type is provided through the
58            <code class="computeroutput">signal_type::type</code> typedef.  Named template type parameters
59            can enhance readability of code, and provide convenience for specifying classes
60            which have a large number of template parameters.
61          </p>
62<p>The template type parameters may be passed positionally, similarly to passing them
63            to the <a class="link" href="signal.html" title="Class template signal">signals2::signal</a> class directly.  Or, they may be passed as named template parameters
64            by wrapping them in one of the template keyword classes provided in the
65            <code class="computeroutput">boost::signals2::keywords</code> namespace.  The supported template keywords are:
66            <a class="link" href="keywords/signature_type.html" title="Class template signature_type">keywords::signature_type</a>, <a class="link" href="keywords/combiner_type.html" title="Class template combiner_type">keywords::combiner_type</a>,
67            <a class="link" href="keywords/group_type.html" title="Class template group_type">keywords::group_type</a>, <a class="link" href="keywords/group_compare_type.html" title="Class template group_compare_type">keywords::group_compare_type</a>,
68            <a class="link" href="keywords/slot_function_type.html" title="Class template slot_function_type">keywords::slot_function_type</a>, <a class="link" href="keywords/extend_1_3_36_6_11_1_1_1_6.html" title="Class template extended_slot_function_type">keywords::extended_slot_function_type</a>,
69            and <a class="link" href="keywords/mutex_type.html" title="Class template mutex_type">keywords::mutex_type</a>.
70          </p>
71<p>The default types for unspecified template type parameters are the same as those for the
72            <a class="link" href="signal.html" title="Class template signal">signal</a> class.
73          </p>
74<p>
75            Named template type parameters are especially convenient when you only wish to change a
76            few of a signal's template type parameters from their defaults, and the parameters
77            you wish to change are near the end of the signal's template parameter list.
78            For example, if you only wish to change the <code class="computeroutput">Mutex</code> template type
79            parameter of a signal, you might write:
80          </p>
81<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">bs2</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">signals2</span><span class="special">;</span>
82<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">bs2</span><span class="special">::</span><span class="identifier">keywords</span><span class="special">;</span>
83<span class="identifier">bs2</span><span class="special">::</span><span class="identifier">signal_type</span><span class="special">&lt;</span><span class="keyword">void</span> <span class="special">(</span><span class="special">)</span><span class="special">,</span> <span class="identifier">mutex_type</span><span class="special">&lt;</span><span class="identifier">bs2</span><span class="special">::</span><span class="identifier">dummy_mutex</span><span class="special">&gt;</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <span class="identifier">sig</span><span class="special">;</span>
84</pre>
85<p>For comparison, to specify the same type using the signal class directly looks like:</p>
86<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">bs2</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">signals2</span><span class="special">;</span>
87<span class="identifier">bs2</span><span class="special">::</span><span class="identifier">signal</span>
88  <span class="special">&lt;</span>
89    <span class="keyword">void</span> <span class="special">(</span><span class="special">)</span><span class="special">,</span>
90    <span class="identifier">bs2</span><span class="special">::</span><span class="identifier">optional_last_value</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">&gt;</span><span class="special">,</span>
91    <span class="keyword">int</span><span class="special">,</span>
92    <span class="identifier">std</span><span class="special">::</span><span class="identifier">less</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;</span><span class="special">,</span>
93    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span><span class="keyword">void</span> <span class="special">(</span><span class="special">)</span><span class="special">&gt;</span><span class="special">,</span>
94    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span><span class="keyword">void</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">connection</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">&gt;</span><span class="special">,</span>
95    <span class="identifier">bs2</span><span class="special">::</span><span class="identifier">dummy_mutex</span>
96  <span class="special">&gt;</span> <span class="identifier">sig</span><span class="special">;</span>
97</pre>
98</div>
99</div>
100<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
101<td align="left"></td>
102<td align="right"><div class="copyright-footer">Copyright © 2001-2004 Douglas Gregor<br>Copyright © 2007-2009 Frank Mori Hess<p>Distributed under the Boost
103    Software License, Version 1.0. (See accompanying file
104    <code class="filename">LICENSE_1_0.txt</code> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)</p>
105</div></td>
106</tr></table>
107<hr>
108<div class="spirit-nav">
109<a accesskey="p" href="keywords/mutex_type.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../signals2/reference.html#header.boost.signals2.signal_type_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="slot.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
110</div>
111</body>
112</html>
113