📄 plugin_8h-source.html
字号:
00117 <span class="comment">// the service type, such as PSoundChannel, </span>00118 <span class="comment">//</span>00119 <span class="comment">// serviceName - the name of the service provided by the plugin. This will usually</span>00120 <span class="comment">// be related to the class implementing the service, such as:</span>00121 <span class="comment">// service name = OSS, class name = PSoundChannelOSS</span>00122 <span class="comment">//</span>00123 <span class="comment">// descriptor - a pointer to a class containing pointers to any static functions</span>00124 <span class="comment">// for this class</span>00125 <span class="comment">// </span>00126 <span class="comment">//</span>00127 <a name="l00128"></a><a class="code" href="classPPluginService.html">00128</a> <span class="keyword">class </span><a class="code" href="classPPluginService.html">PPluginService</a>: <span class="keyword">public</span> <a class="code" href="classPObject.html">PObject</a>00129 {00130 <span class="keyword">public</span>:<a name="l00131"></a><a class="code" href="classPPluginService.html#a0">00131</a> <a class="code" href="classPPluginService.html#a0">PPluginService</a>(<span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> & _serviceName,00132 <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> & _serviceType,00133 <a class="code" href="classPPluginServiceDescriptor.html">PPluginServiceDescriptor</a> *_descriptor)00134 {00135 <a class="code" href="classPPluginService.html#m0">serviceName</a> = _serviceName;00136 <a class="code" href="classPPluginService.html#m1">serviceType</a> = _serviceType;00137 <a class="code" href="classPPluginService.html#m2">descriptor</a> = _descriptor;00138 }00139 <a name="l00140"></a><a class="code" href="classPPluginService.html#m0">00140</a> <a class="code" href="classPString.html">PString</a> <a class="code" href="classPPluginService.html#m0">serviceName</a>;<a name="l00141"></a><a class="code" href="classPPluginService.html#m1">00141</a> <a class="code" href="classPString.html">PString</a> <a class="code" href="classPPluginService.html#m1">serviceType</a>;<a name="l00142"></a><a class="code" href="classPPluginService.html#m2">00142</a> <a class="code" href="classPPluginServiceDescriptor.html">PPluginServiceDescriptor</a> * <a class="code" href="classPPluginService.html#m2">descriptor</a>;00143 };00144 00146 <a name="l00147"></a><a class="code" href="plugin_8h.html#a1">00147</a> <span class="preprocessor">#define PCREATE_PLUGIN_VERSION_DECLARE </span>00148 <span class="preprocessor"></span><a name="l00149"></a><a class="code" href="plugin_8h.html#a2">00149</a> <span class="preprocessor">#define PCREATE_STATIC_PLUGIN_VERSION_FN(serviceName, serviceType) \</span>00150 <span class="preprocessor">unsigned PPlugin_##serviceType##_##serviceName##_GetVersion() \</span>00151 <span class="preprocessor"> { return PWLIB_PLUGIN_API_VERSION; } </span>00152 <span class="preprocessor"></span><a name="l00153"></a><a class="code" href="plugin_8h.html#a3">00153</a> <span class="preprocessor">#define PCREATE_DYNAMIC_PLUGIN_VERSION_FN(serviceName, serviceType) \</span>00154 <span class="preprocessor">extern "C" unsigned PWLibPlugin_GetAPIVersion (void) \</span>00155 <span class="preprocessor">{ return PWLIB_PLUGIN_API_VERSION; } </span>00156 <span class="preprocessor"></span>00158 <span class="comment">//</span>00159 <span class="comment">// These crazy macros are needed to cause automatic registration of </span>00160 <span class="comment">// static plugins. They are made more complex by the arcane behaviour</span>00161 <span class="comment">// of the Windows link system that requires an external reference in the</span>00162 <span class="comment">// object module before it will instantiate any globals in in it</span>00163 <span class="comment">//</span>00164 <a name="l00165"></a><a class="code" href="plugin_8h.html#a4">00165</a> <span class="preprocessor">#define PCREATE_PLUGIN_REGISTERER(serviceName, serviceType, descriptor) \</span>00166 <span class="preprocessor">class PPlugin_##serviceType##_##serviceName##_Registration { \</span>00167 <span class="preprocessor"> public: \</span>00168 <span class="preprocessor"> PPlugin_##serviceType##_##serviceName##_Registration(PPluginManager * pluginMgr) \</span>00169 <span class="preprocessor"> { \</span>00170 <span class="preprocessor"> static PDevicePluginFactory<serviceType>::Worker factory(#serviceName); \</span>00171 <span class="preprocessor"> pluginMgr->RegisterService(#serviceName, #serviceType, descriptor); \</span>00172 <span class="preprocessor"> } \</span>00173 <span class="preprocessor"> int kill_warning; \</span>00174 <span class="preprocessor">}; \</span>00175 <span class="preprocessor"></span>00176 <span class="preprocessor"></span><span class="preprocessor">#ifdef _WIN32</span>00177 <span class="preprocessor"></span>00178 <span class="preprocessor">#define PCREATE_PLUGIN_STATIC(serviceName, serviceType, descriptor) \</span>00179 <span class="preprocessor">PCREATE_PLUGIN_REGISTERER(serviceName, serviceType, descriptor) \</span>00180 <span class="preprocessor">PPlugin_##serviceType##_##serviceName##_Registration \</span>00181 <span class="preprocessor"> PPlugin_##serviceType##_##serviceName##_Registration_Instance(&PPluginManager::GetPluginManager()); \</span>00182 <span class="preprocessor"></span>00183 <span class="preprocessor"></span><span class="preprocessor">#define PWLIB_STATIC_LOAD_PLUGIN(cls) \</span>00184 <span class="preprocessor"> class PPlugin_##cls##_Registration; \</span>00185 <span class="preprocessor"> extern PPlugin_##cls##_Registration PPlugin_##cls##_Registration_Instance; \</span>00186 <span class="preprocessor"> static PPlugin_##cls##_Registration * PPlugin_##cls##_Registration_Static_Library_Loader = &PPlugin_##cls##_Registration_Instance</span>00187 <span class="preprocessor"></span>00188 <span class="preprocessor">#else</span>00189 <span class="preprocessor"></span><a name="l00190"></a><a class="code" href="plugin_8h.html#a5">00190</a> <span class="preprocessor">#define PCREATE_PLUGIN_STATIC(serviceName, serviceType, descriptor) \</span>00191 <span class="preprocessor">static void __attribute__ (( constructor )) PWLIB_StaticLoader_##serviceName##_##serviceType() \</span>00192 <span class="preprocessor">{ PPluginManager::GetPluginManager().RegisterService(#serviceName, #serviceType, descriptor); } \</span>00193 <span class="preprocessor"></span><a name="l00194"></a><a class="code" href="plugin_8h.html#a6">00194</a> <span class="preprocessor"></span><span class="preprocessor">#define PWLIB_STATIC_LOAD_PLUGIN(cls) </span>00195 <span class="preprocessor"></span>00196 <span class="preprocessor">#endif</span>00197 <span class="preprocessor"></span><a name="l00198"></a><a class="code" href="plugin_8h.html#a7">00198</a> <span class="preprocessor">#define PCREATE_PLUGIN_DYNAMIC(serviceName, serviceType, descriptor) \</span>00199 <span class="preprocessor">PCREATE_PLUGIN_REGISTERER(serviceName, serviceType, descriptor) \</span>00200 <span class="preprocessor">extern "C" void PWLibPlugin_TriggerRegister (PPluginManager * pluginMgr) { \</span>00201 <span class="preprocessor">PPlugin_##serviceType##_##serviceName##_Registration \</span>00202 <span class="preprocessor"> pplugin_##serviceType##_##serviceName##_Registration_Instance(pluginMgr); \</span>00203 <span class="preprocessor"> pplugin_##serviceType##_##serviceName##_Registration_Instance.kill_warning = 0; \</span>00204 <span class="preprocessor">} </span>00205 <span class="preprocessor"></span>00207 00208 <span class="preprocessor">#if defined(P_HAS_PLUGINS) && ! defined(P_FORCE_STATIC_PLUGIN)</span>00209 <span class="preprocessor"></span><span class="preprocessor"># define PCREATE_PLUGIN(serviceName, serviceType, descriptor) \</span>00210 <span class="preprocessor"> PCREATE_PLUGIN_DYNAMIC(serviceName, serviceType, descriptor)</span>00211 <span class="preprocessor"></span>00212 <span class="preprocessor"># define PCREATE_PLUGIN_VERSION_FN(serviceName, serviceType) \</span>00213 <span class="preprocessor"> PCREATE_DYNAMIC_PLUGIN_VERSION_FN(serviceName, serviceType)</span>00214 <span class="preprocessor"></span>00215 <span class="preprocessor"># define PPLUGIN_VERSION_FN(serviceName, serviceType) \</span>00216 <span class="preprocessor"> PWLibPlugin_GetAPIVersion</span>00217 <span class="preprocessor"></span>00218 <span class="preprocessor">#else</span>00219 <span class="preprocessor"></span><a name="l00220"></a><a class="code" href="plugin_8h.html#a8">00220</a> <span class="preprocessor"># define PCREATE_PLUGIN(serviceName, serviceType, descriptor) \</span>00221 <span class="preprocessor"> PCREATE_PLUGIN_STATIC(serviceName, serviceType, descriptor)</span>00222 <span class="preprocessor"></span><a name="l00223"></a><a class="code" href="plugin_8h.html#a9">00223</a> <span class="preprocessor"># define PCREATE_PLUGIN_VERSION_FN(serviceName, serviceType) \</span>00224 <span class="preprocessor"> PCREATE_STATIC_PLUGIN_VERSION_FN(serviceName, serviceType)</span>00225 <span class="preprocessor"></span><a name="l00226"></a><a class="code" href="plugin_8h.html#a10">00226</a> <span class="preprocessor"># define PPLUGIN_VERSION_FN(serviceName, serviceType) \</span>00227 <span class="preprocessor"> PPlugin_##serviceType##_##serviceName##_GetVersion</span>00228 <span class="preprocessor"></span>00229 <span class="preprocessor">#endif</span>00230 <span class="preprocessor"></span>00232 00233 <span class="preprocessor">#endif</span></pre></div><hr><address style="align: right;"><small>Generated on Wed Sep 29 22:44:11 2004 for PWLib by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -