⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 notifier_8h-source.html

📁 pwlib开发文档
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>notifier.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center><hr><h1>notifier.h</h1><a href="notifier_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="preprocessor">#ifndef _PNOTIFIER_H</span>00002 <span class="preprocessor"></span><span class="preprocessor">#define _PNOTIFIER_H</span>00003 <span class="preprocessor"></span>00004 <span class="preprocessor">#include &lt;ptlib.h&gt;</span>00005 <span class="preprocessor">#include &lt;<a class="code" href="smartptr_8h.html">ptlib/smartptr.h</a>&gt;</span>00006 00008 <span class="comment">// General notification mechanism from one object to another</span>00009 <a name="l00034"></a><a class="code" href="classPNotifierFunction.html">00034</a> <span class="keyword">class </span><a class="code" href="classPNotifierFunction.html">PNotifierFunction</a> : <span class="keyword">public</span> <a class="code" href="classPSmartObject.html">PSmartObject</a>00035 {00036   <a class="code" href="object_8h.html#a27">PCLASSINFO</a>(<a class="code" href="classPNotifierFunction.html">PNotifierFunction</a>, <a class="code" href="classPSmartObject.html">PSmartObject</a>);00037 00038   <span class="keyword">public</span>:<a name="l00040"></a><a class="code" href="classPNotifierFunction.html#a0">00040</a>     <a class="code" href="classPNotifierFunction.html#a0">PNotifierFunction</a>(00041       <span class="keywordtype">void</span> * obj    00042     ) { <a class="code" href="classPNotifierFunction.html#n0">object</a> = <a class="code" href="object_8h.html#a8">PAssertNULL</a>(obj); }00043 00047     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPNotifierFunction.html#a1">Call</a>(00048       <a class="code" href="classPObject.html">PObject</a> &amp; notifier,  00049       INT extra            00050     ) <span class="keyword">const</span> = 0;00051 00052   <span class="keyword">protected</span>:00053     <span class="comment">// Member variables</span><a name="l00055"></a><a class="code" href="classPNotifierFunction.html#n0">00055</a> <span class="comment"></span>    <span class="keywordtype">void</span> * <a class="code" href="classPNotifierFunction.html#n0">object</a>;00056 };00057 00058 <a name="l00079"></a><a class="code" href="classPNotifier.html">00079</a> <span class="keyword">class </span><a class="code" href="classPNotifier.html">PNotifier</a> : <span class="keyword">public</span> <a class="code" href="classPSmartPointer.html">PSmartPointer</a>00080 {00081   <a class="code" href="object_8h.html#a27">PCLASSINFO</a>(<a class="code" href="classPNotifier.html">PNotifier</a>, <a class="code" href="classPSmartPointer.html">PSmartPointer</a>);00082 00083   <span class="keyword">public</span>:<a name="l00085"></a><a class="code" href="classPNotifier.html#a0">00085</a>     <a class="code" href="classPNotifier.html#a0">PNotifier</a>(00086       <a class="code" href="classPNotifierFunction.html">PNotifierFunction</a> * func = NULL   00087     ) : <a class="code" href="classPSmartPointer.html">PSmartPointer</a>(func) { }00088 <a name="l00094"></a><a class="code" href="classPNotifier.html#a1">00094</a>     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPNotifier.html#a1">operator()</a>(00095       <a class="code" href="classPObject.html">PObject</a> &amp; notifier,  00096       INT extra            00097     )<span class="keyword"> const </span>{((<a class="code" href="classPNotifierFunction.html">PNotifierFunction</a>*)<a class="code" href="object_8h.html#a8">PAssertNULL</a>(<a class="code" href="classPSmartPointer.html#n0">object</a>))-&gt;Call(notifier,extra);}00098 };00099 00100 <a name="l00124"></a><a class="code" href="notifier_8h.html#a0">00124</a> <span class="preprocessor">#define PDECLARE_NOTIFIER(notifier, notifiee, func) \</span>00125 <span class="preprocessor">  class func##_PNotifier : public PNotifierFunction { \</span>00126 <span class="preprocessor">    public: \</span>00127 <span class="preprocessor">      func##_PNotifier(notifiee * obj) : PNotifierFunction(obj) { } \</span>00128 <span class="preprocessor">      virtual void Call(PObject &amp; note, INT extra) const \</span>00129 <span class="preprocessor">        { ((notifiee*)object)-&gt;func((notifier &amp;)note, extra); } \</span>00130 <span class="preprocessor">  }; \</span>00131 <span class="preprocessor">  friend class func##_PNotifier; \</span>00132 <span class="preprocessor">  virtual void func(notifier &amp; note, INT extra)</span>00133 <span class="preprocessor"></span><a name="l00142"></a><a class="code" href="notifier_8h.html#a1">00142</a> <span class="preprocessor">#define PCREATE_NOTIFIER2(obj, func) PNotifier(new func##_PNotifier(obj))</span>00143 <span class="preprocessor"></span><a name="l00152"></a><a class="code" href="notifier_8h.html#a2">00152</a> <span class="preprocessor">#define PCREATE_NOTIFIER(func) PCREATE_NOTIFIER2(this, func)</span>00153 <span class="preprocessor"></span>00154 <span class="preprocessor">#endif</span>00155 <span class="preprocessor"></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 + -