diff options
author | Anas Nashif <anas.nashif@intel.com> | 2013-08-26 08:15:55 -0400 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2013-08-26 08:15:55 -0400 |
commit | bb4dd8289b351fae6b55e303f189127a394a1edd (patch) | |
tree | 77c9c35a31b1459dd7988c2448e797d142530c41 /doc/html/signals/tutorial.html | |
parent | 1a78a62555be32868418fe52f8e330c9d0f95d5a (diff) | |
download | boost-bb4dd8289b351fae6b55e303f189127a394a1edd.tar.gz boost-bb4dd8289b351fae6b55e303f189127a394a1edd.tar.bz2 boost-bb4dd8289b351fae6b55e303f189127a394a1edd.zip |
Imported Upstream version 1.51.0upstream/1.51.0
Diffstat (limited to 'doc/html/signals/tutorial.html')
-rw-r--r--[-rwxr-xr-x] | doc/html/signals/tutorial.html | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/doc/html/signals/tutorial.html b/doc/html/signals/tutorial.html index e9541782ba..7648eeabf1 100755..100644 --- a/doc/html/signals/tutorial.html +++ b/doc/html/signals/tutorial.html @@ -26,18 +26,18 @@ <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="signals.tutorial"></a>Tutorial</h2></div></div></div> <div class="toc"><dl> -<dt><span class="section"><a href="tutorial.html#id3136968">How to Read this Tutorial</a></span></dt> -<dt><span class="section"><a href="tutorial.html#id3137031">Compatibility Note</a></span></dt> -<dt><span class="section"><a href="tutorial.html#id3137144">Hello, World! (Beginner)</a></span></dt> -<dt><span class="section"><a href="tutorial.html#id3137299">Calling multiple slots</a></span></dt> -<dt><span class="section"><a href="tutorial.html#id3137713">Passing values to and from slots</a></span></dt> -<dt><span class="section"><a href="tutorial.html#id3138628">Connection Management</a></span></dt> -<dt><span class="section"><a href="tutorial.html#id3139402">Example: Document-View</a></span></dt> -<dt><span class="section"><a href="tutorial.html#id3139530">Linking against the Signals library</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3193099">How to Read this Tutorial</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3193162">Compatibility Note</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3193274">Hello, World! (Beginner)</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3193430">Calling multiple slots</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3193844">Passing values to and from slots</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3194758">Connection Management</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3195532">Example: Document-View</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3195660">Linking against the Signals library</a></span></dt> </dl></div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="id3136968"></a>How to Read this Tutorial</h3></div></div></div> +<a name="id3193099"></a>How to Read this Tutorial</h3></div></div></div> <p>This tutorial is not meant to be read linearly. Its top-level structure roughly separates different concepts in the library (e.g., handling calling multiple slots, passing values to and from @@ -57,7 +57,7 @@ will not need to read the <span class="emphasis"><em>Advanced</em></span> sectio </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="id3137031"></a>Compatibility Note</h3></div></div></div> +<a name="id3193162"></a>Compatibility Note</h3></div></div></div> <p>Boost.Signals has two syntactical forms: the preferred form and the compatibility form. The preferred form fits more closely with the C++ language and reduces the number of separate template parameters @@ -105,7 +105,7 @@ we can keep this table up-to-date.</p> </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="id3137144"></a>Hello, World! (Beginner)</h3></div></div></div> +<a name="id3193274"></a>Hello, World! (Beginner)</h3></div></div></div> <p>The following example writes "Hello, World!" using signals and slots. First, we create a signal <code class="computeroutput">sig</code>, a signal that takes no arguments and has a void return value. Next, we connect @@ -141,7 +141,7 @@ struct HelloWorld // Connect a HelloWorld slot HelloWorld hello; -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(hello); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(hello); // Call all of the slots sig(); @@ -164,7 +164,7 @@ struct HelloWorld // Connect a HelloWorld slot HelloWorld hello; -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(hello); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(hello); // Call all of the slots sig(); @@ -175,14 +175,14 @@ sig(); </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="id3137299"></a>Calling multiple slots</h3></div></div></div> +<a name="id3193430"></a>Calling multiple slots</h3></div></div></div> <div class="toc"><dl> -<dt><span class="section"><a href="tutorial.html#id3137304">Connecting multiple slots (Beginner)</a></span></dt> -<dt><span class="section"><a href="tutorial.html#id3137489">Ordering slot call groups (Intermediate)</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3193435">Connecting multiple slots (Beginner)</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3193620">Ordering slot call groups (Intermediate)</a></span></dt> </dl></div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> -<a name="id3137304"></a>Connecting multiple slots (Beginner)</h4></div></div></div> +<a name="id3193435"></a>Connecting multiple slots (Beginner)</h4></div></div></div> <p>Calling a single slot from a signal isn't very interesting, so we can make the Hello, World program more interesting by splitting the work of printing "Hello, World!" into two completely separate @@ -227,8 +227,8 @@ signal, and when we call the signal both slots will be called.</p> <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <code class="computeroutput"><a class="link" href="../boost/signal.html" title="Class template signal">boost::signal</a></code><void ()> sig; -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(Hello()); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(World()); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(Hello()); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(World()); sig(); </pre> @@ -237,8 +237,8 @@ sig(); <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <code class="computeroutput"><a class="link" href="../boost/signalN.html" title="Class template signalN">boost::signal0</a></code><void> sig; -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(Hello()); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(World()); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(Hello()); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(World()); sig(); </pre> @@ -253,7 +253,7 @@ Hello, World! </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> -<a name="id3137489"></a>Ordering slot call groups (Intermediate)</h4></div></div></div> +<a name="id3193620"></a>Ordering slot call groups (Intermediate)</h4></div></div></div> <p>Slots are free to have side effects, and that can mean that some slots will have to be called before others even if they are not connected in that order. The Boost.Signals library allows slots to be placed into groups that are ordered in @@ -277,16 +277,16 @@ are, by default, <code class="computeroutput">int</code>s, and are ordered by th <td align="left"> <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <code class="computeroutput"><a class="link" href="../boost/signal.html" title="Class template signal">boost::signal</a></code><void ()> sig; -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(1, World()); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(0, Hello()); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(1, World()); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(0, Hello()); sig(); </pre> </td> <td align="left"> <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <code class="computeroutput"><a class="link" href="../boost/signalN.html" title="Class template signalN">boost::signal0</a></code><void> sig; -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(1, World()); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(0, Hello()); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(1, World()); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(0, Hello()); sig(); </pre> </td> @@ -302,7 +302,7 @@ group parameter and those that don't? The "unnamed" slots (i.e., those that have been connected without specifying a group name) can be placed at the front or back of the slot list (by passing <code class="computeroutput">boost::signals::at_front</code> or <code class="computeroutput">boost::signals::at_back</code> -as the last parameter to <code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>, respectively), and defaults to the end of the list. When +as the last parameter to <code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>, respectively), and defaults to the end of the list. When a group is specified, the final parameter describes where the slot will be placed within the group ordering. If we add a new slot to our example like this:</p> @@ -315,7 +315,7 @@ struct GoodMorning } }; -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(GoodMorning()); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(GoodMorning()); </pre> <p>... we will get the result we wanted:</p> <pre class="programlisting"> @@ -326,14 +326,14 @@ Hello, World! </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="id3137713"></a>Passing values to and from slots</h3></div></div></div> +<a name="id3193844"></a>Passing values to and from slots</h3></div></div></div> <div class="toc"><dl> -<dt><span class="section"><a href="tutorial.html#id3137718">Slot Arguments (Beginner)</a></span></dt> -<dt><span class="section"><a href="tutorial.html#id3137963">Signal Return Values (Advanced)</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3193849">Slot Arguments (Beginner)</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3194094">Signal Return Values (Advanced)</a></span></dt> </dl></div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> -<a name="id3137718"></a>Slot Arguments (Beginner)</h4></div></div></div> +<a name="id3193849"></a>Slot Arguments (Beginner)</h4></div></div></div> <p>Signals can propagate arguments to each of the slots they call. For instance, a signal that propagates mouse motion events might want to pass along the new mouse coordinates and whether the mouse @@ -377,10 +377,10 @@ void print_quotient(float x, float y) <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <code class="computeroutput"><a class="link" href="../boost/signal.html" title="Class template signal">boost::signal</a></code><void (float, float)> sig; -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&print_sum); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&print_product); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&print_difference); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&print_quotient); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&print_sum); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&print_product); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&print_difference); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&print_quotient); sig(5, 3); </pre> @@ -389,10 +389,10 @@ sig(5, 3); <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <code class="computeroutput"><a class="link" href="../boost/signalN.html" title="Class template signalN">boost::signal2</a></code><void, float, float> sig; -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&print_sum); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&print_product); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&print_difference); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&print_quotient); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&print_sum); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&print_product); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&print_difference); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&print_quotient); sig(5, 3); </pre> @@ -417,7 +417,7 @@ connected to <code class="computeroutput">sig</code> must therefore be able to t </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> -<a name="id3137963"></a>Signal Return Values (Advanced)</h4></div></div></div> +<a name="id3194094"></a>Signal Return Values (Advanced)</h4></div></div></div> <p>Just as slots can receive arguments, they can also return values. These values can then be returned back to the caller of the signal through a <em class="firstterm">combiner</em>. The combiner is a mechanism @@ -451,10 +451,10 @@ float difference(float x, float y) { return x-y; } <code class="computeroutput"><a class="link" href="../boost/signal.html" title="Class template signal">boost::signal</a></code><float (float x, float y)> sig; -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&product); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&quotient); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&sum); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&difference); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&product); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&quotient); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&sum); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&difference); std::cout << sig(5, 3) << std::endl; </pre> @@ -468,10 +468,10 @@ float difference(float x, float y) { return x-y; } <code class="computeroutput"><a class="link" href="../boost/signalN.html" title="Class template signalN">boost::signal2</a></code><float, float, float> sig; -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&product); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&quotient); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&sum); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&difference); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&product); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&quotient); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&sum); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&difference); std::cout << sig(5, 3) << std::endl; </pre> @@ -553,10 +553,10 @@ follows the signal's calling signature:</p> <p>Now we can connect slots that perform arithmetic functions and use the signal:</p> <pre class="programlisting"> -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&quotient); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&product); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&sum); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&difference); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&quotient); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&product); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&sum); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&difference); std::cout << sig(5, 3) << std::endl; </pre> @@ -598,10 +598,10 @@ Again, we can create a signal with this new combiner: <code class="computeroutput"><a class="link" href="../boost/signal.html" title="Class template signal">boost::signal</a></code><float (float, float), aggregate_values<std::vector<float> > > sig; -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&quotient); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&product); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&sum); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&difference); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&quotient); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&product); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&sum); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&difference); std::vector<float> results = sig(5, 3); std::copy(results.begin(), results.end(), @@ -613,10 +613,10 @@ std::copy(results.begin(), results.end(), <code class="computeroutput"><a class="link" href="../boost/signalN.html" title="Class template signalN">boost::signal2</a></code><float, float, float, aggregate_values<std::vector<float> > > sig; -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&quotient); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&product); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&sum); -sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(&difference); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&quotient); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&product); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&sum); +sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(&difference); std::vector<float> results = sig(5, 3); std::copy(results.begin(), results.end(), @@ -667,19 +667,19 @@ struct DistributeRequest { </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="id3138628"></a>Connection Management</h3></div></div></div> +<a name="id3194758"></a>Connection Management</h3></div></div></div> <div class="toc"><dl> -<dt><span class="section"><a href="tutorial.html#id3138632">Disconnecting Slots (Beginner)</a></span></dt> -<dt><span class="section"><a href="tutorial.html#id3138755">Blocking Slots (Beginner)</a></span></dt> -<dt><span class="section"><a href="tutorial.html#id3138834">Scoped connections (Intermediate)</a></span></dt> -<dt><span class="section"><a href="tutorial.html#id3138884">Disconnecting equivalent slots (Intermediate)</a></span></dt> -<dt><span class="section"><a href="tutorial.html#id3138969">Automatic connection management (Intermediate)</a></span></dt> -<dt><span class="section"><a href="tutorial.html#id3139173">When can disconnections occur? (Intermediate)</a></span></dt> -<dt><span class="section"><a href="tutorial.html#id3139243">Passing slots (Intermediate)</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3194763">Disconnecting Slots (Beginner)</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3194886">Blocking Slots (Beginner)</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3194965">Scoped connections (Intermediate)</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3195015">Disconnecting equivalent slots (Intermediate)</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3195099">Automatic connection management (Intermediate)</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3195302">When can disconnections occur? (Intermediate)</a></span></dt> +<dt><span class="section"><a href="tutorial.html#id3195373">Passing slots (Intermediate)</a></span></dt> </dl></div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> -<a name="id3138632"></a>Disconnecting Slots (Beginner)</h4></div></div></div> +<a name="id3194763"></a>Disconnecting Slots (Beginner)</h4></div></div></div> <p>Slots aren't expected to exist indefinately after they are connected. Often slots are only used to receive a few events and are then disconnected, and the programmer needs control to decide @@ -688,14 +688,14 @@ when a slot should no longer be connected.</p> <code class="computeroutput"><a class="link" href="../boost/signals/connection.html" title="Class connection">boost::signals::connection</a></code> class. The <code class="computeroutput"><a class="link" href="../boost/signals/connection.html" title="Class connection">connection</a></code> class uniquely represents the connection between a particular signal and a particular slot. The -<code class="computeroutput"><a class="link" href="../boost/signals/connection.html#id804447-bb">connected</a>()</code> method checks if the signal and slot are -still connected, and the <code class="computeroutput"><a class="link" href="../boost/signals/connection.html#id804411-bb">disconnect()</a></code> method +<code class="computeroutput"><a class="link" href="../boost/signals/connection.html#id833913-bb">connected</a>()</code> method checks if the signal and slot are +still connected, and the <code class="computeroutput"><a class="link" href="../boost/signals/connection.html#id799010-bb">disconnect()</a></code> method disconnects the signal and slot if they are connected before it is called. Each call to the signal's <code class="computeroutput">connect()</code> method returns a connection object, which can be used to determine if the connection still exists or to disconnect the signal and slot.</p> <pre class="programlisting"> -boost::signals::connection c = sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(HelloWorld()); +boost::signals::connection c = sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(HelloWorld()); if (c.<code class="computeroutput">connected</code>()) { <span class="emphasis"><em>// c is still connected to the signal</em></span> sig(); <span class="emphasis"><em>// Prints "Hello, World!"</em></span> @@ -709,7 +709,7 @@ sig(); <span class="emphasis"><em>// Does nothing: there are no connected slots< </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> -<a name="id3138755"></a>Blocking Slots (Beginner)</h4></div></div></div> +<a name="id3194886"></a>Blocking Slots (Beginner)</h4></div></div></div> <p>Slots can be temporarily "blocked", meaning that they will be ignored when the signal is invoked but have not been disconnected. The <code class="computeroutput">block</code> member function @@ -717,7 +717,7 @@ temporarily blocks a slot, which can be unblocked via <code class="computeroutput">unblock</code>. Here is an example of blocking/unblocking slots:</p> <pre class="programlisting"> -boost::signals::connection c = sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(HelloWorld()); +boost::signals::connection c = sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(HelloWorld()); sig(); <span class="emphasis"><em>// Prints "Hello, World!"</em></span> c.<code class="computeroutput">block</code>(); <span class="emphasis"><em>// block the slot</em></span> @@ -730,7 +730,7 @@ sig(); <span class="emphasis"><em>// Prints "Hello, World!"</em></span> </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> -<a name="id3138834"></a>Scoped connections (Intermediate)</h4></div></div></div> +<a name="id3194965"></a>Scoped connections (Intermediate)</h4></div></div></div> <p>The <code class="computeroutput">boost::signals::scoped_connection</code> class references a signal/slot connection that will be disconnected when the <code class="computeroutput">scoped_connection</code> class goes out of scope. This @@ -738,7 +738,7 @@ ability is useful when a connection need only be temporary, e.g.,</p> <pre class="programlisting"> { - boost::signals::scoped_connection c = sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(ShortLived()); + boost::signals::scoped_connection c = sig.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(ShortLived()); sig(); <span class="emphasis"><em>// will call ShortLived function object</em></span> } sig(); <span class="emphasis"><em>// ShortLived function object no longer connected to sig</em></span> @@ -746,10 +746,10 @@ sig(); <span class="emphasis"><em>// ShortLived function object no longer connec </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> -<a name="id3138884"></a>Disconnecting equivalent slots (Intermediate)</h4></div></div></div> +<a name="id3195015"></a>Disconnecting equivalent slots (Intermediate)</h4></div></div></div> <p>One can disconnect slots that are equivalent to a given function object using a form of the -<code class="computeroutput"><a class="link" href="../boost/signalN.html#id824916-bb">disconnect</a></code> method, so long as +<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1420589-bb">disconnect</a></code> method, so long as the type of the function object has an accessible <code class="computeroutput">==</code> operator. For instance: @@ -797,7 +797,7 @@ sig.disconnect(&foo); </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> -<a name="id3138969"></a>Automatic connection management (Intermediate)</h4></div></div></div> +<a name="id3195099"></a>Automatic connection management (Intermediate)</h4></div></div></div> <p>Boost.Signals can automatically track the lifetime of objects involved in signal/slot connections, including automatic disconnection of slots when objects involved in the slot call are @@ -852,7 +852,7 @@ public: // ... NewsMessageArea newsMessageArea = new NewsMessageArea(/* ... */); // ... -deliverNews.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(boost::bind(&NewsMessageArea::displayNews, +deliverNews.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(boost::bind(&NewsMessageArea::displayNews, newsMessageArea, _1)); </pre> <p>However, what if the user closes the news message area, @@ -885,7 +885,7 @@ this limitation.</p> </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> -<a name="id3139173"></a>When can disconnections occur? (Intermediate)</h4></div></div></div> +<a name="id3195302"></a>When can disconnections occur? (Intermediate)</h4></div></div></div> <p>Signal/slot disconnections occur when any of these conditions occur:</p> <div class="itemizedlist"><ul class="itemizedlist" type="disc"> @@ -912,7 +912,7 @@ signal.</p> </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> -<a name="id3139243"></a>Passing slots (Intermediate)</h4></div></div></div> +<a name="id3195373"></a>Passing slots (Intermediate)</h4></div></div></div> <p>Slots in the Boost.Signals library are created from arbitrary function objects, and therefore have no fixed type. However, it is commonplace to require that slots be passed through interfaces that @@ -947,7 +947,7 @@ void Button::doOnClick( const OnClick::slot_type& slot ) { - onClick.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(slot); + onClick.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(slot); } void printCoordinates(long x, long y) @@ -978,7 +978,7 @@ void Button::doOnClick( const OnClick::slot_type& slot ) { - onClick.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1292363-bb">connect</a></code>(slot); + onClick.<code class="computeroutput"><a class="link" href="../boost/signalN.html#id829361-bb">connect</a></code>(slot); } void printCoordinates(long x, long y) @@ -1002,7 +1002,7 @@ hidden in an implementation detail file.</p> </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="id3139402"></a>Example: Document-View</h3></div></div></div> +<a name="id3195532"></a>Example: Document-View</h3></div></div></div> <p>Signals can be used to implement flexible Document-View architectures. The document will contain a signal to which each of the views can connect. The following <code class="computeroutput">Document</code> class @@ -1127,7 +1127,7 @@ public: </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="id3139530"></a>Linking against the Signals library</h3></div></div></div> +<a name="id3195660"></a>Linking against the Signals library</h3></div></div></div> <p>Part of the Boost.Signals library is compiled into a binary library that must be linked into your application to use Signals. Please refer to |