📄 notifier_8h-source.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> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </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 <ptlib.h></span>00005 <span class="preprocessor">#include <<a class="code" href="smartptr_8h.html">ptlib/smartptr.h</a>></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> & 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> & 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>))->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 & note, INT extra) const \</span>00129 <span class="preprocessor"> { ((notifiee*)object)->func((notifier &)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 & 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 + -