source: NonGTP/FCollada/Documentation/_f_u_singleton_8h-source.html @ 964

Revision 964, 8.9 KB checked in by igarcia, 19 years ago (diff)
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3<title>FCollada: FUtils/FUSingleton.h Source File</title>
4<link href="doxygen.css" rel="stylesheet" type="text/css">
5<link href="tabs.css" rel="stylesheet" type="text/css">
6</head><body>
7<!-- Generated by Doxygen 1.4.6-NO -->
8<div class="tabs">
9  <ul>
10    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
11    <li><a href="modules.html"><span>Modules</span></a></li>
12    <li><a href="namespaces.html"><span>Namespaces</span></a></li>
13    <li><a href="classes.html"><span>Classes</span></a></li>
14    <li id="current"><a href="files.html"><span>Files</span></a></li>
15    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
16  </ul></div>
17<div class="tabs">
18  <ul>
19    <li><a href="files.html"><span>File&nbsp;List</span></a></li>
20    <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
21  </ul></div>
22<h1>FUtils/FUSingleton.h</h1><a href="_f_u_singleton_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
23<a name="l00002"></a>00002 <span class="comment">    Copyright (C) 2005-2006 Feeling Software Inc.</span>
24<a name="l00003"></a>00003 <span class="comment">    MIT License: http://www.opensource.org/licenses/mit-license.php</span>
25<a name="l00004"></a>00004 <span class="comment">*/</span>
26<a name="l00005"></a>00005 <span class="comment">/*</span>
27<a name="l00006"></a>00006 <span class="comment">    Taken off the Protect project in 2005.</span>
28<a name="l00007"></a>00007 <span class="comment">*/</span>
29<a name="l00008"></a>00008
30<a name="l00019"></a>00019 <span class="preprocessor">#ifndef _FU_SINGLETON_H_</span>
31<a name="l00020"></a>00020 <span class="preprocessor"></span><span class="preprocessor">#define _FU_SINGLETON_H_</span>
32<a name="l00021"></a>00021 <span class="preprocessor"></span>
33<a name="l00025"></a><a class="code" href="_f_u_singleton_8h.html#80054a33903b7388a16714e1c1457930">00025</a> <span class="preprocessor">#define DECLARE_SINGLETON_CLASS(className) \</span>
34<a name="l00026"></a>00026 <span class="preprocessor">private: \</span>
35<a name="l00027"></a>00027 <span class="preprocessor">    static className* m_pSingleton; \</span>
36<a name="l00028"></a>00028 <span class="preprocessor">public: \</span>
37<a name="l00029"></a>00029 <span class="preprocessor">    static bool CreateSingleton(); \</span>
38<a name="l00030"></a>00030 <span class="preprocessor">    static void DestroySingleton(); \</span>
39<a name="l00031"></a>00031 <span class="preprocessor">    friend className* Get##className();</span>
40<a name="l00032"></a>00032 <span class="preprocessor"></span>
41<a name="l00037"></a><a class="code" href="_f_u_singleton_8h.html#f2d3b45004590100a9ae266559574553">00037</a> <span class="preprocessor">#define DECLARE_SINGLETON_CLASS_WITH_ARGS(className, createArgs) \</span>
42<a name="l00038"></a>00038 <span class="preprocessor">private: \</span>
43<a name="l00039"></a>00039 <span class="preprocessor">    static className* m_pSingleton; \</span>
44<a name="l00040"></a>00040 <span class="preprocessor">public: \</span>
45<a name="l00041"></a>00041 <span class="preprocessor">    static bool CreateSingleton(createArgs); \</span>
46<a name="l00042"></a>00042 <span class="preprocessor">    static void DestroySingleton(); \</span>
47<a name="l00043"></a>00043 <span class="preprocessor">    friend className* Get##className();</span>
48<a name="l00044"></a>00044 <span class="preprocessor"></span>
49<a name="l00050"></a><a class="code" href="_f_u_singleton_8h.html#31c26841707708d2b0e202fabc858975">00050</a> <span class="preprocessor">#define DECLARE_SINGLETON_CLASS_WITH_ARGS2(className, createArgs1, createArgs2) \</span>
50<a name="l00051"></a>00051 <span class="preprocessor">private: \</span>
51<a name="l00052"></a>00052 <span class="preprocessor">    static className* m_pSingleton; \</span>
52<a name="l00053"></a>00053 <span class="preprocessor">public: \</span>
53<a name="l00054"></a>00054 <span class="preprocessor">    static bool CreateSingleton(createArgs1, createArgs2); \</span>
54<a name="l00055"></a>00055 <span class="preprocessor">    static void DestroySingleton(); \</span>
55<a name="l00056"></a>00056 <span class="preprocessor">    friend className* Get##className();</span>
56<a name="l00057"></a>00057 <span class="preprocessor"></span>
57<a name="l00061"></a><a class="code" href="_f_u_singleton_8h.html#80acae0250e4fc33321a5f6da796ad64">00061</a> <span class="preprocessor">#define IMPLEMENT_SINGLETON(className) \</span>
58<a name="l00062"></a>00062 <span class="preprocessor">    IMPLEMENT_CREATE_SINGLETON(className) \</span>
59<a name="l00063"></a>00063 <span class="preprocessor">    IMPLEMENT_DESTROY_SINGLETON(className)</span>
60<a name="l00064"></a>00064 <span class="preprocessor"></span>
61<a name="l00069"></a><a class="code" href="_f_u_singleton_8h.html#776404929fb249f921d3b0c8e6a05e9d">00069</a> <span class="preprocessor">#define IMPLEMENT_SINGLETON_WITH_ARGS(className, createArg1) \</span>
62<a name="l00070"></a>00070 <span class="preprocessor">    IMPLEMENT_CREATE_SINGLETON_WITH_ARGS(className, createArg1) \</span>
63<a name="l00071"></a>00071 <span class="preprocessor">    IMPLEMENT_DESTROY_SINGLETON(className)</span>
64<a name="l00072"></a>00072 <span class="preprocessor"></span>
65<a name="l00078"></a><a class="code" href="_f_u_singleton_8h.html#fcc40e57d68dfdcea02b58e165bdb6b8">00078</a> <span class="preprocessor">#define IMPLEMENT_SINGLETON_WITH_ARGS2(className, createArg1, createArg2) \</span>
66<a name="l00079"></a>00079 <span class="preprocessor">    IMPLEMENT_CREATE_SINGLETON_WITH_ARGS2(className, createArg1, createArg2) \</span>
67<a name="l00080"></a>00080 <span class="preprocessor">    IMPLEMENT_DESTROY_SINGLETON(className)</span>
68<a name="l00081"></a>00081 <span class="preprocessor"></span>
69<a name="l00085"></a><a class="code" href="_f_u_singleton_8h.html#390d687886630a4dad79aef45111a70c">00085</a> <span class="preprocessor">#define IMPLEMENT_CREATE_SINGLETON(className) \</span>
70<a name="l00086"></a>00086 <span class="preprocessor">    className* className::m_pSingleton; \</span>
71<a name="l00087"></a>00087 <span class="preprocessor">    className* Get##className() { return className::m_pSingleton; } \</span>
72<a name="l00088"></a>00088 <span class="preprocessor">    bool className::CreateSingleton() { \</span>
73<a name="l00089"></a>00089 <span class="preprocessor">        m_pSingleton = new className(); \</span>
74<a name="l00090"></a>00090 <span class="preprocessor">        return true; }</span>
75<a name="l00091"></a>00091 <span class="preprocessor"></span>
76<a name="l00096"></a><a class="code" href="_f_u_singleton_8h.html#d1545f4568a68e793011396ae2d814c1">00096</a> <span class="preprocessor">#define IMPLEMENT_CREATE_SINGLETON_WITH_ARGS(className, createArg1) \</span>
77<a name="l00097"></a>00097 <span class="preprocessor">    className* className::m_pSingleton; \</span>
78<a name="l00098"></a>00098 <span class="preprocessor">    className* Get##className() { return className::m_pSingleton; } \</span>
79<a name="l00099"></a>00099 <span class="preprocessor">    bool className::CreateSingleton(createArg1 argument1) { \</span>
80<a name="l00100"></a>00100 <span class="preprocessor">        m_pSingleton = new className(argument1); }</span>
81<a name="l00101"></a>00101 <span class="preprocessor"></span>
82<a name="l00107"></a><a class="code" href="_f_u_singleton_8h.html#214b07876da80015ee7272f64afb50c9">00107</a> <span class="preprocessor">#define IMPLEMENT_CREATE_SINGLETON_WITH_ARGS2(className, createArg1, createArg2) \</span>
83<a name="l00108"></a>00108 <span class="preprocessor">    className* className::m_pSingleton; \</span>
84<a name="l00109"></a>00109 <span class="preprocessor">    className* Get##className() { return className::m_pSingleton; } \</span>
85<a name="l00110"></a>00110 <span class="preprocessor">    bool className::CreateSingleton(createArg1 argument1, createArg2 argument2) { \</span>
86<a name="l00111"></a>00111 <span class="preprocessor">        m_pSingleton = new className(argument1, argument2); }</span>
87<a name="l00112"></a>00112 <span class="preprocessor"></span>
88<a name="l00116"></a><a class="code" href="_f_u_singleton_8h.html#97a5dd49a538ad3054fdd6a77acb08f1">00116</a> <span class="preprocessor">#define IMPLEMENT_DESTROY_SINGLETON(className) \</span>
89<a name="l00117"></a>00117 <span class="preprocessor">    void className::DestroySingleton() \</span>
90<a name="l00118"></a>00118 <span class="preprocessor">    { SAFE_DELETE(m_pSingleton); }</span>
91<a name="l00119"></a>00119 <span class="preprocessor"></span>
92<a name="l00120"></a>00120 <span class="preprocessor">#endif // _FU_SINGLETON_H_</span>
93</pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri May 12 16:44:39 2006 for FCollada by&nbsp;
94<a href="http://www.doxygen.org/index.html">
95<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6-NO </small></address>
96</body>
97</html>
Note: See TracBrowser for help on using the repository browser.