Boost logo

Boost-Commit :

From: mconsoni_at_[hidden]
Date: 2007-06-13 17:32:39


Author: mconsoni
Date: 2007-06-13 17:32:37 EDT (Wed, 13 Jun 2007)
New Revision: 7035
URL: http://svn.boost.org/trac/boost/changeset/7035

Log:
- I've written tutorial 3. This tutorial is about using arguments in the constructors of the registered class.
It follows the example describing the differences with a class with a default constructor.

Text files modified:
   sandbox/libs/extension/doc/html/boost_extension/appendices.html | 10 +-
   sandbox/libs/extension/doc/html/boost_extension/factories.html | 10 +-
   sandbox/libs/extension/doc/html/boost_extension/introduction.html | 6
   sandbox/libs/extension/doc/html/boost_extension/performance_analysis.html | 10 +-
   sandbox/libs/extension/doc/html/boost_extension/shared_libraries.html | 10 +-
   sandbox/libs/extension/doc/html/boost_extension/tutorials.html | 8 +-
   sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial01.html | 8 +-
   sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial02.html | 10 +-
   sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial03.html | 145 ++++++++++++++++++++++++++++++++++++++-
   sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial04.html | 10 +-
   sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial05.html | 10 +-
   sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial06.html | 10 +-
   sandbox/libs/extension/doc/html/index.html | 8 +-
   sandbox/libs/extension/doc/tutorial3.qbk | 104 ++++++++++++++++++++++++++++
   14 files changed, 297 insertions(+), 62 deletions(-)

Modified: sandbox/libs/extension/doc/html/boost_extension/appendices.html
==============================================================================
--- sandbox/libs/extension/doc/html/boost_extension/appendices.html (original)
+++ sandbox/libs/extension/doc/html/boost_extension/appendices.html 2007-06-13 17:32:37 EDT (Wed, 13 Jun 2007)
@@ -1,13 +1,13 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Appendices</title>
+<title> Appendices</title>
 <link rel="stylesheet" href="../boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
 <link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
 <link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
-<link rel="prev" href="performance_analysis.html" title="Performance Analysis">
-<link rel="next" href="appendices/appendix_a.html" title="Appendix A - Windows Export and Import Declarations">
+<link rel="prev" href="performance_analysis.html" title=" Performance Analysis">
+<link rel="next" href="appendices/appendix_a.html" title=" Appendix A - Windows Export and Import Declarations">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 <table cellpadding="2" width="100%">
@@ -27,7 +27,7 @@
 <a name="boost_extension.appendices"></a> Appendices</h2></div></div></div>
 <div class="toc"><dl><dt><span class="section"> Appendix A - Windows Export and Import Declarations</span></dt></dl></div>
 </div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<table width="100%"><tr>
 <td align="left"></td>
 <td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
 </tr></table>

Modified: sandbox/libs/extension/doc/html/boost_extension/factories.html
==============================================================================
--- sandbox/libs/extension/doc/html/boost_extension/factories.html (original)
+++ sandbox/libs/extension/doc/html/boost_extension/factories.html 2007-06-13 17:32:37 EDT (Wed, 13 Jun 2007)
@@ -1,13 +1,13 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Factories</title>
+<title> Factories</title>
 <link rel="stylesheet" href="../boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
 <link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
 <link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
-<link rel="prev" href="tutorials/tutorial06.html" title="Tutorial 6">
-<link rel="next" href="shared_libraries.html" title="Shared Libraries">
+<link rel="prev" href="tutorials/tutorial06.html" title=" Tutorial 6">
+<link rel="next" href="shared_libraries.html" title=" Shared Libraries">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 <table cellpadding="2" width="100%">
@@ -29,7 +29,7 @@
       Insert content here.
     </p>
 </div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<table width="100%"><tr>
 <td align="left"></td>
 <td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
 </tr></table>

Modified: sandbox/libs/extension/doc/html/boost_extension/introduction.html
==============================================================================
--- sandbox/libs/extension/doc/html/boost_extension/introduction.html (original)
+++ sandbox/libs/extension/doc/html/boost_extension/introduction.html 2007-06-13 17:32:37 EDT (Wed, 13 Jun 2007)
@@ -1,9 +1,9 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Introduction</title>
+<title> Introduction</title>
 <link rel="stylesheet" href="../boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
 <link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
 <link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
 <link rel="prev" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
@@ -60,7 +60,7 @@
       </li>
 </ol></div>
 </div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<table width="100%"><tr>
 <td align="left"></td>
 <td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
 </tr></table>

Modified: sandbox/libs/extension/doc/html/boost_extension/performance_analysis.html
==============================================================================
--- sandbox/libs/extension/doc/html/boost_extension/performance_analysis.html (original)
+++ sandbox/libs/extension/doc/html/boost_extension/performance_analysis.html 2007-06-13 17:32:37 EDT (Wed, 13 Jun 2007)
@@ -1,13 +1,13 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Performance Analysis</title>
+<title> Performance Analysis</title>
 <link rel="stylesheet" href="../boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
 <link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
 <link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
-<link rel="prev" href="shared_libraries.html" title="Shared Libraries">
-<link rel="next" href="appendices.html" title="Appendices">
+<link rel="prev" href="shared_libraries.html" title=" Shared Libraries">
+<link rel="next" href="appendices.html" title=" Appendices">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 <table cellpadding="2" width="100%">
@@ -29,7 +29,7 @@
       Insert content here.
     </p>
 </div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<table width="100%"><tr>
 <td align="left"></td>
 <td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
 </tr></table>

Modified: sandbox/libs/extension/doc/html/boost_extension/shared_libraries.html
==============================================================================
--- sandbox/libs/extension/doc/html/boost_extension/shared_libraries.html (original)
+++ sandbox/libs/extension/doc/html/boost_extension/shared_libraries.html 2007-06-13 17:32:37 EDT (Wed, 13 Jun 2007)
@@ -1,13 +1,13 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Shared Libraries</title>
+<title> Shared Libraries</title>
 <link rel="stylesheet" href="../boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
 <link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
 <link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
-<link rel="prev" href="factories.html" title="Factories">
-<link rel="next" href="performance_analysis.html" title="Performance Analysis">
+<link rel="prev" href="factories.html" title=" Factories">
+<link rel="next" href="performance_analysis.html" title=" Performance Analysis">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 <table cellpadding="2" width="100%">
@@ -29,7 +29,7 @@
       Insert content here.
     </p>
 </div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<table width="100%"><tr>
 <td align="left"></td>
 <td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
 </tr></table>

Modified: sandbox/libs/extension/doc/html/boost_extension/tutorials.html
==============================================================================
--- sandbox/libs/extension/doc/html/boost_extension/tutorials.html (original)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorials.html 2007-06-13 17:32:37 EDT (Wed, 13 Jun 2007)
@@ -3,11 +3,11 @@
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 <title>Tutorials</title>
 <link rel="stylesheet" href="../boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
 <link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
 <link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
-<link rel="prev" href="introduction.html" title="Introduction">
-<link rel="next" href="tutorials/tutorial01.html" title="Tutorial 1">
+<link rel="prev" href="introduction.html" title=" Introduction">
+<link rel="next" href="tutorials/tutorial01.html" title=" Tutorial 1">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 <table cellpadding="2" width="100%">
@@ -42,7 +42,7 @@
       each tutorial.
     </p>
 </div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<table width="100%"><tr>
 <td align="left"></td>
 <td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
 </tr></table>

Modified: sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial01.html
==============================================================================
--- sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial01.html (original)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial01.html 2007-06-13 17:32:37 EDT (Wed, 13 Jun 2007)
@@ -1,13 +1,13 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Tutorial 1</title>
+<title> Tutorial 1</title>
 <link rel="stylesheet" href="../../boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
 <link rel="start" href="../../index.html" title="Chapter 1. Boost.Extension 1.0">
 <link rel="up" href="../tutorials.html" title="Tutorials">
 <link rel="prev" href="../tutorials.html" title="Tutorials">
-<link rel="next" href="tutorial02.html" title="Tutorial 2">
+<link rel="next" href="tutorial02.html" title=" Tutorial 2">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 <table cellpadding="2" width="100%">
@@ -161,7 +161,7 @@
         shared library (dll, so, dylib etc.) is renamed correctly.
       </p>
 </div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<table width="100%"><tr>
 <td align="left"></td>
 <td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
 </tr></table>

Modified: sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial02.html
==============================================================================
--- sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial02.html (original)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial02.html 2007-06-13 17:32:37 EDT (Wed, 13 Jun 2007)
@@ -1,13 +1,13 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Tutorial 2</title>
+<title> Tutorial 2</title>
 <link rel="stylesheet" href="../../boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
 <link rel="start" href="../../index.html" title="Chapter 1. Boost.Extension 1.0">
 <link rel="up" href="../tutorials.html" title="Tutorials">
-<link rel="prev" href="tutorial01.html" title="Tutorial 1">
-<link rel="next" href="tutorial03.html" title="Tutorial 3">
+<link rel="prev" href="tutorial01.html" title=" Tutorial 1">
+<link rel="next" href="tutorial03.html" title=" Tutorial 3">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 <table cellpadding="2" width="100%">
@@ -163,7 +163,7 @@
 <p>
       </p>
 </div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<table width="100%"><tr>
 <td align="left"></td>
 <td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
 </tr></table>

Modified: sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial03.html
==============================================================================
--- sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial03.html (original)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial03.html 2007-06-13 17:32:37 EDT (Wed, 13 Jun 2007)
@@ -1,13 +1,13 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Tutorial 3</title>
+<title> Tutorial 3</title>
 <link rel="stylesheet" href="../../boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
 <link rel="start" href="../../index.html" title="Chapter 1. Boost.Extension 1.0">
 <link rel="up" href="../tutorials.html" title="Tutorials">
-<link rel="prev" href="tutorial02.html" title="Tutorial 2">
-<link rel="next" href="tutorial04.html" title="Tutorial 4">
+<link rel="prev" href="tutorial02.html" title=" Tutorial 2">
+<link rel="next" href="tutorial04.html" title=" Tutorial 4">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 <table cellpadding="2" width="100%">
@@ -26,10 +26,143 @@
 <div class="titlepage"><div><div><h3 class="title">
 <a name="boost_extension.tutorials.tutorial03"></a> Tutorial 3</h3></div></div></div>
 <p>
- Insert content here.
+ This tutorial shows how to register and instance classes that have multi-argument
+ constructors (not default constructors) in Boost.Extensions. In the example
+ that we will describe in this tutorial we create a dummy class with a constructor
+ that have six arguments. We'll register this class in a factory map and then
+ get it from the main file.
+ </p>
+<p>
+ It is expected that before following this tutorial you have gone trough the
+ first tutorial at least, and you are familiar with the basic use of Boost.Extensions
+ </p>
+<p>
+ Let's start defining our class. Its constructor receives six parameters (we
+ chose that number because it's the current argument limit of the library),
+ each one of a different type including a class defined in the interface (class
+ A) and a smart pointer to this class. It shows via stdout the received parameters
+ at construction.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">class</span> <span class="identifier">six_parameters</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">lots_of_parameters_interface</span>
+<span class="special">{</span>
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">six_parameters</span><span class="special">(</span><span class="keyword">bool</span> <span class="identifier">b</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">i</span><span class="special">,</span> <span class="keyword">char</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">A</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">ptr_a</span><span class="special">)</span>
+ <span class="identifier">lots_of_parameters_interface</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">i</span><span class="special">,</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">ptr_a</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Constructor called."</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Parameters:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"\tbool: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">b</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"\tunsigned int: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">i</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"\tchar: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">c</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"\tstring: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">s</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"\tA.i: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">i</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"\tptr_a-&gt;i: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">ptr_a</span><span class="special">-&gt;</span><span class="identifier">i</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">six_parameters</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ <br> The interface that we are inheriting is just the bare minimum needed
+ to make it compile:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">class</span> <span class="identifier">A</span>
+<span class="special">{</span>
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">A</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">i</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">i</span><span class="special">(</span><span class="identifier">i</span><span class="special">)</span> <span class="special">{}</span>
+ <span class="keyword">int</span> <span class="identifier">i</span><span class="special">;</span>
+<span class="special">};</span>
+
+
+<span class="keyword">class</span> <span class="identifier">lots_of_parameters_interface</span>
+<span class="special">{</span>
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">lots_of_parameters_interface</span><span class="special">(</span><span class="keyword">bool</span> <span class="identifier">b</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">i</span><span class="special">,</span> <span class="keyword">char</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">A</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">ptr_a</span><span class="special">)</span> <span class="special">{}</span>
+ <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">lots_of_parameters_interface</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ <br> Having the class defined, we should write the export function to register
+ the class in the passed factory map. The point here is that the factory_map::add
+ method must be set with the first type as the third argument, and with the
+ second type as the fourth argument and so on.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">extern</span> <span class="string">"C"</span> <span class="keyword">void</span> <span class="identifier">BOOST_EXTENSION_EXPORT_DECL</span> <span class="identifier">extension_export</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">extensions</span><span class="special">::</span><span class="identifier">factory_map</span> <span class="special">&amp;</span> <span class="identifier">fm</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="identifier">fm</span><span class="special">.</span><span class="identifier">add</span><span class="special">&lt;</span> <span class="identifier">six_parameters</span><span class="special">,</span> <span class="identifier">lots_of_parameters_interface</span><span class="special">,</span> <span class="keyword">int</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">A</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="speci
al">&gt;(</span><span class="number">6</span><span class="special">);</span>
+<span class="special">}</span>
+</pre>
+<p>
+ <br> Finally, let's see how it is used in the main file.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">extensions</span><span class="special">;</span>
+
+ <span class="comment">// Create the factory_map object - it will hold all of the available
+</span> <span class="comment">// constructors. Multiple factory_maps can be constructed.
+</span> <span class="identifier">factory_map</span> <span class="identifier">fm</span><span class="special">;</span>
+
+ <span class="comment">// load the shared library with
+</span> <span class="identifier">load_single_library</span><span class="special">(</span><span class="identifier">fm</span><span class="special">,</span> <span class="string">"libParametersLib.extension"</span><span class="special">,</span> <span class="string">"extension_export"</span><span class="special">);</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span><span class="special">&lt;</span><span class="identifier">factory</span><span class="special">&lt;</span><span class="identifier">lots_of_parameters_interface</span><span class="special">,</span> <span class="keyword">int</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">A</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="special"
>&gt;</span> <span class="special">&gt;</span> <span class="special">&amp;</span> <span class="identifier">factory_list</span> <span class="special">=</span>
+ <span class="identifier">fm</span><span class="special">.</span><span class="identifier">get</span><span class="special">&lt;</span><span class="identifier">lots_of_parameters_interface</span><span class="special">,</span> <span class="keyword">int</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">A</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="special">&gt;();</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">factory_list</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span> <span class="special">!=</span> <span class="number">1</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Error - the class was not found."</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span><span class="special">&lt;</span> <span class="identifier">factory</span><span class="special">&lt;</span><span class="identifier">lots_of_parameters_interface</span><span class="special">,</span> <span class="keyword">int</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">A</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="special
">&gt;</span> <span class="special">&gt;::</span><span class="identifier">iterator</span> <span class="identifier">par</span> <span class="special">=</span> <span class="identifier">factory_list</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">auto_ptr</span><span class="special">&lt;</span> <span class="identifier">lots_of_parameters_interface</span> <span class="special">&gt;</span> <span class="identifier">par_ptr</span><span class="special">(</span><span class="identifier">par</span><span class="special">-&gt;</span><span class="identifier">create</span><span class="special">(</span><span class="keyword">true</span><span class="special">,</span> <span class="number">4</span><span class="special">,</span> <span class="char">'c'</span><span class="special">,</span> <span class="string">"test"</span><span class="special">,</span> <span class="identifier">A</span><span class="special">(</span><span class="number">2</span><span class="special">),</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;(</s
pan><span class="keyword">new</span> <span class="identifier">A</span><span class="special">(</span><span class="number">15</span><span class="special">))));</span>
+
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ Please note the following details:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ Shared library loading is exactly the same.
+ </li>
+<li>
+ When we get the factory we should specify the template parameters, as we
+ did in the factory_map::add method.
+ </li>
+<li>
+ When we call the create method we just supply the needed arguments and
+ just works!
+ </li>
+</ul></div>
+<p>
+ <br>
+ </p>
+<p>
+ It is expected that at this point you can create your own classes with multi-argument
+ contructors and use them via Boost.extensions without problems.
       </p>
 </div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<table width="100%"><tr>
 <td align="left"></td>
 <td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
 </tr></table>

Modified: sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial04.html
==============================================================================
--- sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial04.html (original)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial04.html 2007-06-13 17:32:37 EDT (Wed, 13 Jun 2007)
@@ -1,13 +1,13 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Tutorial 4</title>
+<title> Tutorial 4</title>
 <link rel="stylesheet" href="../../boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
 <link rel="start" href="../../index.html" title="Chapter 1. Boost.Extension 1.0">
 <link rel="up" href="../tutorials.html" title="Tutorials">
-<link rel="prev" href="tutorial03.html" title="Tutorial 3">
-<link rel="next" href="tutorial05.html" title="Tutorial 5">
+<link rel="prev" href="tutorial03.html" title=" Tutorial 3">
+<link rel="next" href="tutorial05.html" title=" Tutorial 5">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 <table cellpadding="2" width="100%">
@@ -29,7 +29,7 @@
         Insert content here.
       </p>
 </div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<table width="100%"><tr>
 <td align="left"></td>
 <td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
 </tr></table>

Modified: sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial05.html
==============================================================================
--- sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial05.html (original)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial05.html 2007-06-13 17:32:37 EDT (Wed, 13 Jun 2007)
@@ -1,13 +1,13 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Tutorial 5</title>
+<title> Tutorial 5</title>
 <link rel="stylesheet" href="../../boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
 <link rel="start" href="../../index.html" title="Chapter 1. Boost.Extension 1.0">
 <link rel="up" href="../tutorials.html" title="Tutorials">
-<link rel="prev" href="tutorial04.html" title="Tutorial 4">
-<link rel="next" href="tutorial06.html" title="Tutorial 6">
+<link rel="prev" href="tutorial04.html" title=" Tutorial 4">
+<link rel="next" href="tutorial06.html" title=" Tutorial 6">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 <table cellpadding="2" width="100%">
@@ -29,7 +29,7 @@
         Insert content here.
       </p>
 </div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<table width="100%"><tr>
 <td align="left"></td>
 <td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
 </tr></table>

Modified: sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial06.html
==============================================================================
--- sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial06.html (original)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial06.html 2007-06-13 17:32:37 EDT (Wed, 13 Jun 2007)
@@ -1,13 +1,13 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Tutorial 6</title>
+<title> Tutorial 6</title>
 <link rel="stylesheet" href="../../boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
 <link rel="start" href="../../index.html" title="Chapter 1. Boost.Extension 1.0">
 <link rel="up" href="../tutorials.html" title="Tutorials">
-<link rel="prev" href="tutorial05.html" title="Tutorial 5">
-<link rel="next" href="../factories.html" title="Factories">
+<link rel="prev" href="tutorial05.html" title=" Tutorial 5">
+<link rel="next" href="../factories.html" title=" Factories">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 <table cellpadding="2" width="100%">
@@ -29,7 +29,7 @@
         Insert content here.
       </p>
 </div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<table width="100%"><tr>
 <td align="left"></td>
 <td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
 </tr></table>

Modified: sandbox/libs/extension/doc/html/index.html
==============================================================================
--- sandbox/libs/extension/doc/html/index.html (original)
+++ sandbox/libs/extension/doc/html/index.html 2007-06-13 17:32:37 EDT (Wed, 13 Jun 2007)
@@ -3,9 +3,9 @@
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 <title>Chapter 1. Boost.Extension 1.0</title>
 <link rel="stylesheet" href="boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
 <link rel="start" href="index.html" title="Chapter 1. Boost.Extension 1.0">
-<link rel="next" href="boost_extension/introduction.html" title="Introduction">
+<link rel="next" href="boost_extension/introduction.html" title=" Introduction">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 <table cellpadding="2" width="100%">
@@ -24,7 +24,7 @@
 <a name="boost_extension"></a>Chapter 1. Boost.Extension 1.0</h2></div>
 <div><p class="copyright">Copyright © 2007 Jeremy Pack</p></div>
 <div><div class="legalnotice">
-<a name="id965072"></a><p>
+<a name="id2552220"></a><p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>
@@ -51,7 +51,7 @@
 </dl>
 </div>
 </div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<table width="100%"><tr>
 <td align="left"><small><p>Last revised: April 30, 2007 at 12:00:00 GMT</p></small></td>
 <td align="right"><small></small></td>
 </tr></table>

Modified: sandbox/libs/extension/doc/tutorial3.qbk
==============================================================================
--- sandbox/libs/extension/doc/tutorial3.qbk (original)
+++ sandbox/libs/extension/doc/tutorial3.qbk 2007-06-13 17:32:37 EDT (Wed, 13 Jun 2007)
@@ -1,5 +1,107 @@
 [section:tutorial03 Tutorial 3]
 
-Insert content here.
+This tutorial shows how to register and instance classes that have multi-argument constructors (not default constructors)
+in Boost.Extensions. In the example that we will describe in this tutorial we create a dummy class with a constructor
+that have six arguments. We'll register this class in a factory map and then get it from the main file.
+
+It is expected that before following this tutorial you have gone trough the first tutorial at least, and you are
+familiar with the basic use of Boost.Extensions
+
+
+Let's start defining our class. Its constructor receives six parameters (we chose that number because it's the current argument limit of
+the library), each one of a different type including a class defined in the interface (class A) and a smart pointer to this class. It
+shows via stdout the received parameters at construction.
+
+
+``
+class six_parameters : public lots_of_parameters_interface
+{
+ public:
+ six_parameters(bool b, unsigned int i, char c, std::string s, A a, boost::shared_ptr<A> ptr_a)
+ lots_of_parameters_interface(b, i, c, s, a, ptr_a)
+ {
+ std::cout << "Constructor called." << std::endl << std::endl;
+ std::cout << "Parameters:" << std::endl;
+ std::cout << "\tbool: " << b << std::endl;
+ std::cout << "\tunsigned int: " << i << std::endl;
+ std::cout << "\tchar: " << c << std::endl;
+ std::cout << "\tstring: " << s << std::endl;
+ std::cout << "\tA.i: " << a.i << std::endl;
+ std::cout << "\tptr_a->i: " << ptr_a->i << std::endl;
+ std::cout << std::endl;
+ }
+
+ virtual ~six_parameters(void) {}
+};
+``
+\n
+The interface that we are inheriting is just the bare minimum needed to make it compile:
+
+``
+class A
+{
+ public:
+ A(unsigned int i) : i(i) {}
+ int i;
+};
+
+
+class lots_of_parameters_interface
+{
+ public:
+ lots_of_parameters_interface(bool b, unsigned int i, char c, std::string s, A a, boost::shared_ptr<A> ptr_a) {}
+ virtual ~lots_of_parameters_interface(void) {}
+};
+``
+\n
+Having the class defined, we should write the export function to register the class in the passed factory map. The point here
+is that the factory_map::add method must be set with the first type as the third argument, and with the second type as the fourth argument
+and so on.
+
+``
+extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export(boost::extensions::factory_map & fm)
+{
+ fm.add< six_parameters, lots_of_parameters_interface, int, bool, unsigned int, char, std::string, A, boost::shared_ptr<A> >(6);
+}
+``
+\n
+Finally, let's see how it is used in the main file.
+
+``
+int main(void)
+{
+ using namespace boost::extensions;
+
+ // Create the factory_map object - it will hold all of the available
+ // constructors. Multiple factory_maps can be constructed.
+ factory_map fm;
+
+ // load the shared library with
+ load_single_library(fm, "libParametersLib.extension", "extension_export");
+
+ std::list<factory<lots_of_parameters_interface, int, bool, unsigned int, char, std::string, A, boost::shared_ptr<A> > > & factory_list =
+ fm.get<lots_of_parameters_interface, int, bool, unsigned int, char, std::string, A, boost::shared_ptr<A> >();
+ if (factory_list.size() != 1) {
+ std::cout << "Error - the class was not found.";
+ return 1;
+ }
+
+ std::list< factory<lots_of_parameters_interface, int, bool, unsigned int, char, std::string, A, boost::shared_ptr<A> > >::iterator par = factory_list.begin();
+ std::auto_ptr< lots_of_parameters_interface > par_ptr(par->create(true, 4, 'c', "test", A(2), boost::shared_ptr<A>(new A(15))));
+
+ return 0;
+}
+``
+
+Please note the following details:
+
+* Shared library loading is exactly the same.
+* When we get the factory we should specify the template parameters, as we did in the factory_map::add method.
+* When we call the create method we just supply the needed arguments and just works!
+
+\n
+
+It is expected that at this point you can create your own classes with multi-argument contructors and use them via
+Boost.extensions without problems.
 
 [endsect]
\ No newline at end of file


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk