?? shared_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>shared.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="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>shared.h</h1><div class="fragment"><pre>00001 <span class="comment">/*</span>00002 <span class="comment"> ZIG - An extendable, portable game engine focused on networking & scripting</span>00003 <span class="comment"> Project Home: http://zige.sourceforge.net</span>00004 <span class="comment"> Copyright (C) 2002 F醔io Reis Cecin <fcecin AT inf DOT ufrgs DOT br></span>00005 <span class="comment"></span>00006 <span class="comment"> This library is free software; you can redistribute it and/or</span>00007 <span class="comment"> modify it under the terms of the GNU Lesser General Public</span>00008 <span class="comment"> License as published by the Free Software Foundation; either</span>00009 <span class="comment"> version 2.1 of the License, or (at your option) any later version.</span>00010 <span class="comment"></span>00011 <span class="comment"> This library is distributed in the hope that it will be useful,</span>00012 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span>00013 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>00014 <span class="comment"> Lesser General Public License for more details.</span>00015 <span class="comment"></span>00016 <span class="comment"> You should have received a copy of the GNU Lesser General Public</span>00017 <span class="comment"> License along with this library; if not, write to the Free Software</span>00018 <span class="comment"> Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA </span>00019 <span class="comment">*/</span>00020 <span class="comment">/*</span>00021 <span class="comment"></span>00022 <span class="comment"> LEETNET 2</span>00023 <span class="comment"></span>00024 <span class="comment"> shared object -- "abstract" (incomplete) base class</span>00025 <span class="comment"></span>00026 <span class="comment"> shared resource with reference counting & copy-on-write</span>00027 <span class="comment"></span>00028 <span class="comment"> *** THIS IS NOT BEING USED ****</span>00029 <span class="comment"></span>00030 <span class="comment">*/</span>00031 00032 <span class="preprocessor">#ifndef _ZIG_HEADER_SHARED_H_</span>00033 <span class="preprocessor"></span><span class="preprocessor">#define _ZIG_HEADER_SHARED_H_</span>00034 <span class="preprocessor"></span>00035 <span class="preprocessor">#ifndef NO_DOXYGEN // internal class -- do not document</span>00036 <span class="preprocessor"></span>00037 <span class="preprocessor">#include <nl.h></span>00038 00039 <span class="keyword">class </span>shared_c {00040 <span class="keyword">public</span>:00041 00042 <span class="comment">//default ctor</span>00043 shared_c();00044 00045 <span class="comment">//copy ctor</span>00046 shared_c(<span class="keyword">const</span> shared_c &s);00047 00048 <span class="comment">//assignment operator</span>00049 shared_c& operator=(<span class="keyword">const</span> shared_c &s);00050 00051 <span class="comment">//~dtor</span>00052 <span class="keyword">virtual</span> ~shared_c(); 00053 00054 <span class="comment">//MUST BE CALLED BY SUBCLASS before writing to the shared object, triggers copy if refs > 1</span>00055 <span class="comment">//this is to implement the copy-on-write thingy.</span>00056 <span class="keywordtype">void</span> writeAnnounce();00057 00058 <span class="comment">//delete shared object (last client's destructor called). MUST BE OVERRIDEN</span>00059 <span class="keyword">virtual</span> <span class="keywordtype">void</span> deleteSharedObject() { } <span class="comment">// OVERRIDE ME</span>00060 00061 <span class="comment">//make a private copy of the object -- prior to writing/updating when there </span>00062 <span class="comment">//is more than one reference. MUST BE OVERRIDEN</span>00063 <span class="keyword">virtual</span> <span class="keywordtype">void</span> copySharedObject() { } <span class="comment">// OVERRIDE ME</span>00064 00065 <span class="comment">//make a shallow copy of the object</span>00066 <span class="keyword">virtual</span> <span class="keywordtype">void</span> shallowCopyObject(shared_c *other) { } <span class="comment">// OVERRIDE ME</span>00067 00068 <span class="comment">//shared state</span>00069 NLmutex *m; <span class="comment">//mutex for shared state</span>00070 <span class="keywordtype">int</span> *clientcount; <span class="comment">//how many clients are sharing the resource</span>00071 };00072 00073 <span class="preprocessor">#endif // #ifndef NO_DOXYGEN // internal class -- do not document</span>00074 <span class="preprocessor"></span>00075 <span class="preprocessor">#endif</span>00076 <span class="preprocessor"></span>00077 </pre></div><hr><address style="align: right;"><small>Generated on Mon Jan 24 21:14:23 2005 for ZIG 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 + -