|
<!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::singleton< T > 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_1singleton.html">singleton</a></div>
<h1>template_patterns::singleton< T > Class Template Reference</h1>Singleton template class.
<a href="#_details">More...</a>
<p>
<code>#include <<a class="el" href="singleton_8h-source.html">singleton.h</a>></code>
<p>
<a href="classtemplate__patterns_1_1singleton-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">T & </td><td class="memItemRight" valign="bottom"><a class="el" href="classtemplate__patterns_1_1singleton.html#a0">instance</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Retrieve the instance. <a href="#a0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">T & </td><td class="memItemRight" valign="bottom"><a class="el" href="classtemplate__patterns_1_1singleton.html#a1">operator *</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Retrieve the instance. <a href="#a1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const & </td><td class="memItemRight" valign="bottom"><a class="el" href="classtemplate__patterns_1_1singleton.html#a2">operator *</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Retrieve the const instance. <a href="#a2"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<h3>template<class T><br>
class template_patterns::singleton< T ></h3>
Singleton template class.
<p>
The singleton creates a singleton instance from a given class, T, and allows it to be reached globally and uniquely within the application. Say you have class C and want to turn it into a singleton, simply add the following code: <em>typedef singleton<C> c_singleton;</em>. Whenever you need to hook up with the singleton just write <em>c_singleton.instance().my_function(params);</em>. <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 to allow singleton behaviour </td></tr>
</table>
</dl>
<p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="a0" doxytag="template_patterns::singleton::instance"></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> </td>
</tr>
<tr>
<td class="md" nowrap valign="top">T& <a class="el" href="classtemplate__patterns_1_1singleton.html">template_patterns::singleton</a>< T >::instance </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]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Retrieve the instance.
<p>
<dl compact><dt><b>Returns:</b></dt><dd>the instance of type T </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="a2" doxytag="template_patterns::singleton::operator *"></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> </td>
</tr>
<tr>
<td class="md" nowrap valign="top">const& <a class="el" href="classtemplate__patterns_1_1singleton.html">template_patterns::singleton</a>< T >::operator * </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> const<code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Retrieve the const instance.
<p>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="classtemplate__patterns_1_1singleton.html#a0">instance</a> </dd></dl>
<dl compact><dt><b>Returns:</b></dt><dd>the const instance of type T </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="a1" doxytag="template_patterns::singleton::operator *"></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> </td>
</tr>
<tr>
<td class="md" nowrap valign="top">T& <a class="el" href="classtemplate__patterns_1_1singleton.html">template_patterns::singleton</a>< T >::operator * </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]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Retrieve the instance.
<p>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="classtemplate__patterns_1_1singleton.html#a0">instance</a> </dd></dl>
<dl compact><dt><b>Returns:</b></dt><dd>the instance of type T </dd></dl>
</td>
</tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="singleton_8h-source.html">singleton.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.