|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Templated design pattern implementation for C++: template_patterns::factory< T, I > Class Template Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.2 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a></div>
<div class="nav">
<a class="el" href="namespacetemplate__patterns.html">template_patterns</a>::<a class="el" href="classtemplate__patterns_1_1factory.html">factory</a></div>
<h1>template_patterns::factory< T, I > Class Template Reference</h1>Factory template class.
<a href="#_details">More...</a>
<p>
<code>#include <<a class="el" href="factory_8h-source.html">factory.h</a>></code>
<p>
<a href="classtemplate__patterns_1_1factory-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static T * </td><td class="memItemRight" valign="bottom"><a class="el" href="classtemplate__patterns_1_1factory.html#e0">create</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Create new instance. <a href="#e0"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<h3>template<class T, class I><br>
class template_patterns::factory< T, I ></h3>
Factory template class.
<p>
The factory design pattern allows for easily replacement of implementation of classes. It facilitate a central repository where all dependencies are bound to the interface of the base class. The template factory is created using a simple definition: <em>typedef factory<C,B> c_factory;</em>. New instances implementing the C interface can be build using the <em>c_factory::create()</em> function, where B is a class implementing the C interface.<p>
The template factory does not handle resource management, however it would be a good idea to manage the allocated instances with smart pointers, e.g. <em>boost::scoped_ptr<C> my_c_pointer(c_factory::create());</em>. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="classtemplate__patterns_1_1factory__with__initializer.html">factory_with_initializer</a></dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>T</em> </td><td>class type of the return value </td></tr>
<tr><td valign="top"></td><td valign="top"><em>I</em> </td><td>actual implementation class, a derivate of T </td></tr>
</table>
</dl>
<p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="e0" doxytag="template_patterns::factory::create"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="mdPrefix" colspan="4">
template<class T, class I> </td>
</tr>
<tr>
<td class="md" nowrap valign="top">static T* <a class="el" href="classtemplate__patterns_1_1factory.html">template_patterns::factory</a>< T, I >::create </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [inline, static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Create new instance.
<p>
Create a new, unmananged, instance of T. <dl compact><dt><b>Returns:</b></dt><dd>a new instance of T </dd></dl>
</td>
</tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="factory_8h-source.html">factory.h</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Wed Feb 1 08:22:32 2006 for Templated design pattern implementation for C++ by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
</body>
</html>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.