diff options
Diffstat (limited to 'docs/doxygen/nel/entity__id_8h-source.html')
-rw-r--r-- | docs/doxygen/nel/entity__id_8h-source.html | 597 |
1 files changed, 597 insertions, 0 deletions
diff --git a/docs/doxygen/nel/entity__id_8h-source.html b/docs/doxygen/nel/entity__id_8h-source.html new file mode 100644 index 00000000..78412817 --- /dev/null +++ b/docs/doxygen/nel/entity__id_8h-source.html @@ -0,0 +1,597 @@ +<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + <TITLE>nevrax.org : docs</TITLE> + <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css"> + <link href="doxygen.css" rel="stylesheet" type="text/css"> +</HEAD> +<BODY MARGINHEIGHT="0" MARGINWIDTH="0"> + +<!-- uplinks --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </TD> + </TR> +</TABLE> + +<!-- banner Nevrax --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%> + <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR> +</TABLE> + +<!-- main table --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + + <!------ Begin Box ------> + <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black> + <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF> + <TABLE cellspacing=0 cellpadding=1 border=0> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr> + </TABLE> + </TD></TR></TABLE></TD></TR></TABLE> + <!------ End Box ------> + + </TD> + <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + +<!-- title --> +<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td> +<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A> +</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""> +</td></tr></table> + + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>Documentation</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<!-- Generated by Doxygen 1.2.14 --> +<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="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> </center> +<hr><h1>entity_id.h</h1><a href="entity__id_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 +00007 <font class="comment">/* Copyright, 2001 Nevrax Ltd.</font> +00008 <font class="comment"> *</font> +00009 <font class="comment"> * This file is part of NEVRAX NEL.</font> +00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font> +00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font> +00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font> +00013 <font class="comment"> * any later version.</font> +00014 <font class="comment"></font> +00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font> +00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font> +00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font> +00018 <font class="comment"> * General Public License for more details.</font> +00019 <font class="comment"></font> +00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font> +00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font> +00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font> +00023 <font class="comment"> * MA 02111-1307, USA.</font> +00024 <font class="comment"> */</font> +00025 +00026 <font class="preprocessor">#ifndef NL_ENTITY_ID_H</font> +00027 <font class="preprocessor"></font><font class="preprocessor">#define NL_ENTITY_ID_H</font> +00028 <font class="preprocessor"></font> +00029 <font class="preprocessor">#include "<a class="code" href="types__nl_8h.html">nel/misc/types_nl.h</a>"</font> +00030 <font class="preprocessor">#include "<a class="code" href="debug_8h.html">nel/misc/debug.h</a>"</font> +00031 <font class="preprocessor">#include "<a class="code" href="common_8h.html">nel/misc/common.h</a>"</font> +00032 <font class="preprocessor">#include "<a class="code" href="stream_8h.html">nel/misc/stream.h</a>"</font> +00033 +00034 <font class="keyword">namespace </font>NLMISC { +00035 +<a name="l00042"></a><a class="code" href="structNLMISC_1_1CEntityId.html">00042</a> <font class="keyword">struct </font>CEntityId +00043 { +00044 +00045 <font class="keyword">private</font> : +00046 <font class="comment">// ---------------------------------------------------------------------------------</font> +00047 <font class="comment">// instantiated data</font> +00048 +00049 <font class="keyword">union </font> +00050 <font class="keyword"> </font>{ +00051 <font class="keyword">struct</font> +00052 <font class="keyword"> </font>{ +<a name="l00054"></a><a class="code" href="structNLMISC_1_1CEntityId.html#o0">00054</a> uint64 <a class="code" href="structNLMISC_1_1CEntityId.html#o0">DynamicId</a> : 8; +<a name="l00056"></a><a class="code" href="structNLMISC_1_1CEntityId.html#o1">00056</a> uint64 <a class="code" href="structNLMISC_1_1CEntityId.html#o1">CreatorId</a> : 8; +<a name="l00058"></a><a class="code" href="structNLMISC_1_1CEntityId.html#o2">00058</a> uint64 <a class="code" href="structNLMISC_1_1CEntityId.html#o2">Type</a> : 8; +<a name="l00060"></a><a class="code" href="structNLMISC_1_1CEntityId.html#o3">00060</a> uint64 <a class="code" href="structNLMISC_1_1CEntityId.html#o3">Id</a> : 40; +00061 } <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>; +00062 +<a name="l00063"></a><a class="code" href="structNLMISC_1_1CEntityId.html#o5">00063</a> uint64 <a class="code" href="structNLMISC_1_1CEntityId.html#o5">FullId</a>; +00064 }; +00065 +00066 <font class="keyword">public</font> : +00067 +00068 <font class="comment">// ---------------------------------------------------------------------------------</font> +00069 <font class="comment">// static data</font> +00070 +00072 <font class="keyword">static</font> uint8 <a class="code" href="structNLMISC_1_1CEntityId.html#p0">ServerId</a>; +00074 <font class="keyword">static</font> <font class="keyword">const</font> uint64 <a class="code" href="structNLMISC_1_1CEntityId.html#p1">MaxEntityId</a>; +00076 <font class="keyword">static</font> <font class="keyword">const</font> <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> <a class="code" href="structNLMISC_1_1CEntityId.html#p2">Unknown</a>; +00077 +00078 <font class="comment">// ---------------------------------------------------------------------------------</font> +00079 <font class="comment">// constructors</font> +00080 +00082 +00083 +<a name="l00084"></a><a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">00084</a> <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> () +00085 { +00086 <a class="code" href="structNLMISC_1_1CEntityId.html#o5">FullId</a> = 0; +00087 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Type = 127; +00088 +00089 <font class="comment">/*</font> +00090 <font class="comment"> DynamicId = 0;</font> +00091 <font class="comment"> CreatorId = 0;</font> +00092 <font class="comment"> Type = 127;</font> +00093 <font class="comment"> Id = 0;</font> +00094 <font class="comment"> */</font> +00095 } +00096 +<a name="l00097"></a><a class="code" href="structNLMISC_1_1CEntityId.html#z283_1">00097</a> <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> (uint8 <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, uint64 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, uint8 creator, uint8 dynamic) +00098 { +00099 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.DynamicId = dynamic; +00100 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.CreatorId = creator; +00101 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Type = <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>; +00102 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Id = <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>; +00103 } +00104 +<a name="l00105"></a><a class="code" href="structNLMISC_1_1CEntityId.html#z283_2">00105</a> <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> (uint8 <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, uint64 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>) +00106 { +00107 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Type = <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>; +00108 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Id = <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>; +00109 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.CreatorId = <a class="code" href="structNLMISC_1_1CEntityId.html#p0">ServerId</a>; +00110 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.DynamicId = <a class="code" href="structNLMISC_1_1CEntityId.html#p0">ServerId</a>; +00111 } +00112 +<a name="l00113"></a><a class="code" href="structNLMISC_1_1CEntityId.html#z283_3">00113</a> <font class="keyword">explicit</font> <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> (uint64 p) +00114 { +00115 <a class="code" href="structNLMISC_1_1CEntityId.html#o5">FullId</a> = p; +00116 <font class="comment">/*</font> +00117 <font class="comment"> DynamicId = (p & 0xff);</font> +00118 <font class="comment"> p >>= 8;</font> +00119 <font class="comment"> CreatorId = (p & 0xff);</font> +00120 <font class="comment"> p >>= 8;</font> +00121 <font class="comment"> Type = (p & 0xff);</font> +00122 <font class="comment"> p >>= 8;</font> +00123 <font class="comment"> Id = (p); </font> +00124 <font class="comment"> */</font> +00125 } +00126 +<a name="l00127"></a><a class="code" href="structNLMISC_1_1CEntityId.html#z283_4">00127</a> <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> (<font class="keyword">const</font> <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> &a) +00128 { +00129 <a class="code" href="structNLMISC_1_1CEntityId.html#o5">FullId</a> = a.FullId; +00130 <font class="comment">/*</font> +00131 <font class="comment"> DynamicId = a.DynamicId;</font> +00132 <font class="comment"> CreatorId = a.CreatorId; </font> +00133 <font class="comment"> Type = a.Type;</font> +00134 <font class="comment"> Id = a.Id;</font> +00135 <font class="comment"> */</font> +00136 } +00137 +<a name="l00139"></a><a class="code" href="structNLMISC_1_1CEntityId.html#z283_5">00139</a> <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> (<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &is) +00140 { +00141 is.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="structNLMISC_1_1CEntityId.html#o5">FullId</a>); +00142 <font class="comment">/*</font> +00143 <font class="comment"> uint64 p;</font> +00144 <font class="comment"> is.serial(p);</font> +00145 <font class="comment"></font> +00146 <font class="comment"> DynamicId = (p & 0xff);</font> +00147 <font class="comment"> p >>= 8;</font> +00148 <font class="comment"> CreatorId = (p & 0xff);</font> +00149 <font class="comment"> p >>= 8;</font> +00150 <font class="comment"> Type = (p & 0xff);</font> +00151 <font class="comment"> p >>= 8;</font> +00152 <font class="comment"> Id = p;</font> +00153 <font class="comment"> */</font> +00154 } +00155 +<a name="l00156"></a><a class="code" href="structNLMISC_1_1CEntityId.html#z283_6">00156</a> <font class="keyword">explicit</font> <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> (<font class="keyword">const</font> <font class="keywordtype">char</font> *str) +00157 { +00158 <font class="keywordtype">char</font> *ident = (<font class="keywordtype">char</font>*)str; +00159 <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>; +00160 <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>; +00161 <font class="keywordtype">char</font> *creator; +00162 <font class="keywordtype">char</font> *dyn; +00163 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a> = ident; +00164 uint base = 10; +00165 +00166 <font class="comment">//Sameh si le nombre est en hexa alors mettre la base à 16.</font> +00167 <font class="keywordflow">if</font>(str[0] == <font class="charliteral">'0'</font> && (str[1] == <font class="charliteral">'x'</font> || str[1] == <font class="charliteral">'X'</font>)) +00168 { +00169 base = 16; +00170 str+=2; +00171 } +00172 +00173 ident = (<font class="keywordtype">char</font>*)str; +00174 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a> = ident; +00175 +00176 <font class="keywordflow">while</font>(*ident != <font class="charliteral">':'</font>) <font class="keywordflow">if</font> (*ident!=0) ++ident; <font class="keywordflow">else</font> {*<font class="keyword">this</font>=Unknown; <font class="keywordflow">return</font>;} +00177 <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a> = ident; +00178 <font class="keywordflow">while</font>(*ident != <font class="charliteral">':'</font>) <font class="keywordflow">if</font> (*ident!=0) ++ident; <font class="keywordflow">else</font> {*<font class="keyword">this</font>=Unknown; <font class="keywordflow">return</font>;} +00179 creator = ident; +00180 <font class="keywordflow">while</font>(*ident != <font class="charliteral">':'</font>) <font class="keywordflow">if</font> (*ident!=0) ++ident; <font class="keywordflow">else</font> {*<font class="keyword">this</font>=Unknown; <font class="keywordflow">return</font>;} +00181 dyn = ident; +00182 +00183 <font class="comment">//Sameh conversion en fonction de la base.</font> +00184 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.DynamicId = <a class="code" href="namespaceNLMISC.html#a239">atoiInt64</a>(dyn, base); +00185 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.CreatorId = <a class="code" href="namespaceNLMISC.html#a239">atoiInt64</a>(creator, base); +00186 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Type = <a class="code" href="namespaceNLMISC.html#a239">atoiInt64</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, base); +00187 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Id = <a class="code" href="namespaceNLMISC.html#a239">atoiInt64</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, base); +00188 } +00190 +00191 +00192 <font class="comment">// ---------------------------------------------------------------------------------</font> +00193 <font class="comment">// accessors</font> +00194 +<a name="l00195"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a0">00195</a> uint64 <a class="code" href="structNLMISC_1_1CEntityId.html#a0">getRawId</a>()<font class="keyword"> const</font> +00196 <font class="keyword"> </font>{ +00197 <font class="keywordflow">return</font> <a class="code" href="structNLMISC_1_1CEntityId.html#o5">FullId</a>; +00198 <font class="comment">/*</font> +00199 <font class="comment"> return (uint64)*this;</font> +00200 <font class="comment"> */</font> +00201 } +00202 +<a name="l00203"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a1">00203</a> uint64 <a class="code" href="structNLMISC_1_1CEntityId.html#a1">getShortId</a>()<font class="keyword"> const</font> +00204 <font class="keyword"> </font>{ +00205 <font class="keywordflow">return</font> <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Id; +00206 } +00207 +<a name="l00208"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a2">00208</a> <font class="keywordtype">void</font> <a class="code" href="structNLMISC_1_1CEntityId.html#a2">setShortId</a>( uint64 shortId ) +00209 { +00210 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Id = shortId; +00211 } +00212 +<a name="l00213"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a3">00213</a> uint8 <a class="code" href="structNLMISC_1_1CEntityId.html#a3">getDynamicId</a>()<font class="keyword"> const</font> +00214 <font class="keyword"> </font>{ +00215 <font class="keywordflow">return</font> <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.DynamicId; +00216 } +00217 +<a name="l00218"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a4">00218</a> <font class="keywordtype">void</font> <a class="code" href="structNLMISC_1_1CEntityId.html#a4">setDynamicId</a>( uint8 dynId ) +00219 { +00220 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.DynamicId = dynId; +00221 } +00222 +<a name="l00223"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a5">00223</a> uint8 <a class="code" href="structNLMISC_1_1CEntityId.html#a5">getCreatorId</a>()<font class="keyword"> const</font> +00224 <font class="keyword"> </font>{ +00225 <font class="keywordflow">return</font> <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.CreatorId; +00226 } +00227 +<a name="l00228"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a6">00228</a> <font class="keywordtype">void</font> <a class="code" href="structNLMISC_1_1CEntityId.html#a6">setCreatorId</a>( uint8 creatorId ) +00229 { +00230 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.CreatorId = creatorId; +00231 } +00232 +<a name="l00233"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a7">00233</a> uint8 <a class="code" href="structNLMISC_1_1CEntityId.html#a7">getType</a>()<font class="keyword"> const</font> +00234 <font class="keyword"> </font>{ +00235 <font class="keywordflow">return</font> (uint8)<a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Type; +00236 } +00237 +<a name="l00238"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a8">00238</a> <font class="keywordtype">void</font> <a class="code" href="structNLMISC_1_1CEntityId.html#a8">setType</a>( uint8 <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a> ) +00239 { +00240 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Type = <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>; +00241 } +00242 +<a name="l00243"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a9">00243</a> uint64 <a class="code" href="structNLMISC_1_1CEntityId.html#a9">getUniqueId</a>()<font class="keyword"> const</font> +00244 <font class="keyword"> </font>{ +00245 <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>; +00246 id.FullId = <a class="code" href="structNLMISC_1_1CEntityId.html#o5">FullId</a>; +00247 id.DetailedId.DynamicId = 0; +00248 <font class="keywordflow">return</font> id.FullId; +00249 } +00250 +<a name="l00251"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a10">00251</a> <font class="keywordtype">bool</font> <a class="code" href="structNLMISC_1_1CEntityId.html#a10">isUnknownId</a>()<font class="keyword"> const</font> +00252 <font class="keyword"> </font>{ +00253 <font class="keywordflow">return</font> <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Type == 127; +00254 } +00255 +00256 +00257 <font class="comment">// ---------------------------------------------------------------------------------</font> +00258 <font class="comment">// operators</font> +00259 +00261 +<a name="l00262"></a><a class="code" href="structNLMISC_1_1CEntityId.html#z284_0">00262</a> <font class="keywordtype">bool</font> <a class="code" href="structNLMISC_1_1CEntityId.html#z284_0">operator == </a>(<font class="keyword">const</font> <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> &a) <font class="keyword">const</font> +00263 <font class="comment">// virtual bool operator == (const CEntityId &a) const</font> +00264 { +00265 +00266 <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> testId ( <a class="code" href="structNLMISC_1_1CEntityId.html#o5">FullId</a> ^ a.FullId ); +00267 testId.DetailedId.DynamicId = 0; +00268 <font class="keywordflow">return</font> testId.FullId == 0; +00269 +00270 <font class="comment">/*</font> +00271 <font class="comment"> return (Id == a.DetailedId.Id && DetailedId.CreatorId == a.DetailedId.CreatorId && DetailedId.Type == a.DetailedId.Type);</font> +00272 <font class="comment"> */</font> +00273 } +00274 +<a name="l00275"></a><a class="code" href="structNLMISC_1_1CEntityId.html#z284_1">00275</a> <font class="keywordtype">bool</font> <a class="code" href="structNLMISC_1_1CEntityId.html#z284_1">operator < </a>(<font class="keyword">const</font> <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> &a) <font class="keyword">const</font> +00276 <font class="comment">// virtual bool operator < (const CEntityId &a) const</font> +00277 { +00278 <font class="keywordflow">return</font> <a class="code" href="structNLMISC_1_1CEntityId.html#a9">getUniqueId</a>() < a.getUniqueId(); +00279 +00280 <font class="comment">/*</font> +00281 <font class="comment"> if (Type < a.Type)</font> +00282 <font class="comment"> {</font> +00283 <font class="comment"> return true;</font> +00284 <font class="comment"> }</font> +00285 <font class="comment"> else if (Type == a.Type)</font> +00286 <font class="comment"> {</font> +00287 <font class="comment"> if (Id < a.Id)</font> +00288 <font class="comment"> {</font> +00289 <font class="comment"> return true;</font> +00290 <font class="comment"> }</font> +00291 <font class="comment"> else if (Id == a.Id)</font> +00292 <font class="comment"> {</font> +00293 <font class="comment"> return (CreatorId < a.CreatorId);</font> +00294 <font class="comment"> }</font> +00295 <font class="comment"> } </font> +00296 <font class="comment"> return false;</font> +00297 <font class="comment"> */</font> +00298 } +00299 +<a name="l00300"></a><a class="code" href="structNLMISC_1_1CEntityId.html#z284_2">00300</a> <font class="keywordtype">bool</font> <a class="code" href="structNLMISC_1_1CEntityId.html#z284_2">operator > </a>(<font class="keyword">const</font> <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> &a) <font class="keyword">const</font> +00301 <font class="comment">// virtual bool operator > (const CEntityId &a) const</font> +00302 { +00303 <font class="keywordflow">return</font> <a class="code" href="structNLMISC_1_1CEntityId.html#a9">getUniqueId</a>() > a.getUniqueId(); +00304 +00305 <font class="comment">/*</font> +00306 <font class="comment"> if (Type > a.Type)</font> +00307 <font class="comment"> {</font> +00308 <font class="comment"> return true;</font> +00309 <font class="comment"> }</font> +00310 <font class="comment"> else if (Type == a.Type)</font> +00311 <font class="comment"> {</font> +00312 <font class="comment"> if (Id > a.Id)</font> +00313 <font class="comment"> {</font> +00314 <font class="comment"> return true;</font> +00315 <font class="comment"> }</font> +00316 <font class="comment"> else if (Id == a.Id)</font> +00317 <font class="comment"> {</font> +00318 <font class="comment"> return (CreatorId > a.CreatorId);</font> +00319 <font class="comment"> }</font> +00320 <font class="comment"> }</font> +00321 <font class="comment"> // lesser</font> +00322 <font class="comment"> return false;</font> +00323 <font class="comment"> */</font> +00324 } +00326 +<a name="l00327"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a11">00327</a> <font class="keyword">const</font> <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> &<a class="code" href="structNLMISC_1_1CEntityId.html#a11">operator ++</a>(<font class="keywordtype">int</font>) +00328 { +00329 <font class="keywordflow">if</font>(<a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Id < <a class="code" href="structNLMISC_1_1CEntityId.html#p1">MaxEntityId</a>) +00330 { +00331 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Id ++; +00332 } +00333 <font class="keywordflow">else</font> +00334 { +00335 <a class="code" href="debug_8h.html#a3">nlerror</a> (<font class="stringliteral">"CEntityId looped (max was %"</font>NL_I64<font class="stringliteral">"d"</font>, <a class="code" href="structNLMISC_1_1CEntityId.html#p1">MaxEntityId</a>); +00336 } +00337 <font class="keywordflow">return</font> *<font class="keyword">this</font>; +00338 } +00339 +<a name="l00340"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a12">00340</a> <font class="keyword">const</font> <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> &<a class="code" href="structNLMISC_1_1CEntityId.html#a12">operator = </a>(<font class="keyword">const</font> <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> &a) +00341 { +00342 <a class="code" href="structNLMISC_1_1CEntityId.html#o5">FullId</a> = a.FullId; +00343 <font class="comment">/*</font> +00344 <font class="comment"> DynamicId = a.DynamicId;</font> +00345 <font class="comment"> CreatorId = a.CreatorId;</font> +00346 <font class="comment"> Type = a.Type;</font> +00347 <font class="comment"> Id = a.Id;</font> +00348 <font class="comment"> */</font> +00349 <font class="keywordflow">return</font> *<font class="keyword">this</font>; +00350 } +00351 +<a name="l00352"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a13">00352</a> <font class="keyword">const</font> <a class="code" href="structNLMISC_1_1CEntityId.html#z283_0">CEntityId</a> &<a class="code" href="structNLMISC_1_1CEntityId.html#a12">operator = </a>(uint64 p) +00353 { +00354 <a class="code" href="structNLMISC_1_1CEntityId.html#o5">FullId</a> = p; +00355 <font class="comment">/*</font> +00356 <font class="comment"> DynamicId = (uint64)(p & 0xff);</font> +00357 <font class="comment"> p >>= 8;</font> +00358 <font class="comment"> CreatorId = (uint64)(p & 0xff);</font> +00359 <font class="comment"> p >>= 8;</font> +00360 <font class="comment"> Type = (uint64)(p & 0xff);</font> +00361 <font class="comment"> p >>= 8;</font> +00362 <font class="comment"> Id = (uint64)(p);</font> +00363 <font class="comment"> */</font> +00364 <font class="keywordflow">return</font> *<font class="keyword">this</font>; +00365 } +00366 +00367 +00368 <font class="comment">// ---------------------------------------------------------------------------------</font> +00369 <font class="comment">// other methods...</font> +00370 +<a name="l00371"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a14">00371</a> <a class="code" href="structNLMISC_1_1CEntityId.html#a14">operator uint64 </a>()<font class="keyword"> const</font> +00372 <font class="keyword"> </font>{ +00373 <font class="keywordflow">return</font> <a class="code" href="structNLMISC_1_1CEntityId.html#o5">FullId</a>; +00374 <font class="comment">/*</font> +00375 <font class="comment"> uint64 p = Id;</font> +00376 <font class="comment"> p <<= 8;</font> +00377 <font class="comment"> p |= (uint64)Type;</font> +00378 <font class="comment"> p <<= 8;</font> +00379 <font class="comment"> p |= (uint64)CreatorId;</font> +00380 <font class="comment"> p <<= 8;</font> +00381 <font class="comment"> p |= (uint64)DynamicId;</font> +00382 <font class="comment"></font> +00383 <font class="comment"> return p;</font> +00384 <font class="comment"> */</font> +00385 } +00386 +<a name="l00387"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a15">00387</a> <font class="keywordtype">void</font> <a class="code" href="structNLMISC_1_1CEntityId.html#a15">setServiceId</a> (uint8 sid) +00388 { +00389 <font class="comment">/*</font> +00390 <font class="comment"> </font> +00391 <font class="comment"> Daniel says: Who wrote this?! It's horrible!!!</font> +00392 <font class="comment"> you're mixing statics and non-statics indisciminately</font> +00393 <font class="comment"> This needs to be fixed!!!</font> +00394 <font class="comment"> </font> +00395 <font class="comment"> */</font> +00396 +00397 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.DynamicId = sid; +00398 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.CreatorId = sid; +00399 <a class="code" href="structNLMISC_1_1CEntityId.html#p0">ServerId</a> = sid; +00400 } +00401 +00402 +00403 <font class="comment">// ---------------------------------------------------------------------------------</font> +00404 <font class="comment">// loading, saving, serialising...</font> +00405 +<a name="l00407"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a16">00407</a> <font class="keywordtype">void</font> <a class="code" href="structNLMISC_1_1CEntityId.html#a16">save</a>(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &os) +00408 <font class="comment">// virtual void save(NLMISC::IStream &os)</font> +00409 { +00410 os.serial(<a class="code" href="structNLMISC_1_1CEntityId.html#o5">FullId</a>); +00411 <font class="comment">/*</font> +00412 <font class="comment"> uint64 p = Id;</font> +00413 <font class="comment"> p <<= 8;</font> +00414 <font class="comment"> p |= (uint64)Type;</font> +00415 <font class="comment"> p <<= 8;</font> +00416 <font class="comment"> p |= (uint64)CreatorId;</font> +00417 <font class="comment"> p <<= 8;</font> +00418 <font class="comment"> p |= (uint64)DynamicId;</font> +00419 <font class="comment"> os.serial(p);</font> +00420 <font class="comment"> */</font> +00421 } +00422 +<a name="l00424"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a17">00424</a> <font class="keywordtype">void</font> <a class="code" href="structNLMISC_1_1CEntityId.html#a17">load</a>(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &is) +00425 <font class="comment">// virtual void load(NLMISC::IStream &is)</font> +00426 { +00427 is.serial(<a class="code" href="structNLMISC_1_1CEntityId.html#o5">FullId</a>); +00428 <font class="comment">/*</font> +00429 <font class="comment"> uint64 p;</font> +00430 <font class="comment"> is.serial(p);</font> +00431 <font class="comment"></font> +00432 <font class="comment"> DynamicId = (uint64)(p & 0xff);</font> +00433 <font class="comment"> p >>= 8;</font> +00434 <font class="comment"> CreatorId = (uint64)(p & 0xff);</font> +00435 <font class="comment"> p >>= 8;</font> +00436 <font class="comment"> Type = (uint64)(p & 0xff);</font> +00437 <font class="comment"> p >>= 8;</font> +00438 <font class="comment"> Id = (uint64)(p);</font> +00439 <font class="comment"> */</font> +00440 } +00441 +<a name="l00442"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a18">00442</a> <font class="keywordtype">void</font> <a class="code" href="structNLMISC_1_1CEntityId.html#a18">serial</a> (<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &f) <font class="keywordflow">throw</font> (NLMISC::EStream) +00443 <font class="comment">// virtual void serial (NLMISC::IStream &f) throw (NLMISC::EStream)</font> +00444 { +00445 <font class="keywordflow">if</font> (f.isReading ()) +00446 { +00447 <a class="code" href="structNLMISC_1_1CEntityId.html#a17">load</a> (f); +00448 } +00449 <font class="keywordflow">else</font> +00450 { +00451 <a class="code" href="structNLMISC_1_1CEntityId.html#a16">save</a> (f); +00452 } +00453 } +00454 +00455 +00456 <font class="comment">// ---------------------------------------------------------------------------------</font> +00457 <font class="comment">// string convertions</font> +00458 +<a name="l00460"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a19">00460</a> std::string <a class="code" href="structNLMISC_1_1CEntityId.html#a19">toString</a>()<font class="keyword"> const</font> +00461 <font class="keyword"> </font>{ +00462 std::string <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>; +00463 <a class="code" href="structNLMISC_1_1CEntityId.html#a21">getDebugString</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>); +00464 <font class="keywordflow">return</font> <font class="stringliteral">"("</font> + <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a> + <font class="stringliteral">")"</font>; +00465 } +00466 +<a name="l00468"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a20">00468</a> <font class="keywordtype">void</font> <a class="code" href="structNLMISC_1_1CEntityId.html#a20">fromString</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *str) +00469 <font class="comment">// virtual void fromString(const char *str)</font> +00470 { +00471 uint64 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>; +00472 uint <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>; +00473 uint creatorId; +00474 uint dynamicId; +00475 +00476 <font class="keywordflow">if</font> (sscanf(str, <font class="stringliteral">"(%"</font>NL_I64<font class="stringliteral">"x:%x:%x:%x)"</font>, &<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, &<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, &creatorId, &dynamicId) != 4) +00477 <font class="keywordflow">return</font>; +00478 +00479 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Id = <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>; +00480 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Type = <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>; +00481 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.CreatorId = creatorId; +00482 <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.DynamicId = dynamicId; +00483 } +00484 +<a name="l00486"></a><a class="code" href="structNLMISC_1_1CEntityId.html#a21">00486</a> <font class="keywordtype">void</font> <a class="code" href="structNLMISC_1_1CEntityId.html#a21">getDebugString</a>(std::string &str) <font class="keyword">const</font> +00487 <font class="comment">// virtual void getDebugString(std::string &str) const</font> +00488 { +00489 <font class="keywordtype">char</font> b[256]; +00490 memset(b,0,255); +00491 memset(b,<font class="charliteral">'0'</font>,19); +00492 sint n; +00493 +00494 uint64 <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> = <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Id; +00495 <font class="keywordtype">char</font> baseTable[] = <font class="stringliteral">"0123456789abcdef"</font>; +00496 <font class="keywordflow">for</font>(n = 10; n < 19; n ++) +00497 { +00498 b[19 - n] = baseTable[(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> & 15)]; +00499 <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> >>= 4; +00500 } +00501 b[19 - 9] = <font class="charliteral">':'</font>; +00502 +00503 <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> = <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.Type; +00504 <font class="keywordflow">for</font>(n = 7; n < 9; n ++) +00505 { +00506 b[19 - n] = baseTable[(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> & 15)]; +00507 <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> >>= 4; +00508 } +00509 b[19 - 6] = <font class="charliteral">':'</font>; +00510 +00511 <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> = <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.CreatorId; +00512 <font class="keywordflow">for</font>(n = 4; n < 6; n ++) +00513 { +00514 b[19 - n] = baseTable[(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> & 15)]; +00515 <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> >>= 4; +00516 } +00517 b[19 - 3] = <font class="charliteral">':'</font>; +00518 +00519 <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> = <a class="code" href="structNLMISC_1_1CEntityId.html#o4">DetailedId</a>.DynamicId; +00520 <font class="keywordflow">for</font>(n = 1; n < 3; n ++) +00521 { +00522 b[19 - n] = baseTable[(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> & 15)]; +00523 <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> >>= 4; +00524 } +00525 <font class="comment">//Sameh To be sure that the number is in hexa.</font> +00526 str += <font class="stringliteral">"0x"</font> + std::string(b); +00527 } +00528 <font class="comment">/*</font> +00530 <font class="comment"></font> +00531 <font class="comment"> std::string getClassName ()</font> +00532 <font class="comment">// virtual std::string getClassName ()</font> +00533 <font class="comment"> {</font> +00534 <font class="comment"> return std::string ("<CEntityId>");</font> +00535 <font class="comment"> }</font> +00536 <font class="comment"></font> +00538 <font class="comment">*/</font> +00539 +00540 <font class="comment">// friend std::stringstream &operator << (std::stringstream &__os, const CEntityId &__t);</font> +00541 }; +00542 +00543 <font class="keyword">inline</font> std::stringstream &<a class="code" href="namespaceNLMISC.html#a251">operator << </a>(std::stringstream &__os, <font class="keyword">const</font> CEntityId &__t) +00544 { +00545 __os << __t.toString (); +00546 <font class="keywordflow">return</font> __os; +00547 } +00548 +00549 } <font class="comment">// NLMISC</font> +00550 +00551 <font class="preprocessor">#endif // NL_ENTITY_ID_H</font> +00552 <font class="preprocessor"></font> +00553 <font class="comment">/* End of entity_id.h */</font> +</pre></div> + +<!-- footer --> +<BR><FONT Size=+5> </FONT> +</TD> +<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD> +</TR> +</TABLE> +</BODY> +</HTML> |