From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/identtype_8h-source.html | 441 ++++++++++++++++++++++++++++++ 1 file changed, 441 insertions(+) create mode 100644 docs/doxygen/nel/identtype_8h-source.html (limited to 'docs/doxygen/nel/identtype_8h-source.html') diff --git a/docs/doxygen/nel/identtype_8h-source.html b/docs/doxygen/nel/identtype_8h-source.html new file mode 100644 index 00000000..b6dd5e3c --- /dev/null +++ b/docs/doxygen/nel/identtype_8h-source.html @@ -0,0 +1,441 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

identtype.h

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2000 Nevrax Ltd.
+00008  *
+00009  * This file is part of NEVRAX NEL.
+00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
+00011  * it under the terms of the GNU General Public License as published by
+00012  * the Free Software Foundation; either version 2, or (at your option)
+00013  * any later version.
+00014 
+00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
+00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00018  * General Public License for more details.
+00019 
+00020  * You should have received a copy of the GNU General Public License
+00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
+00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00023  * MA 02111-1307, USA.
+00024  */
+00025 
+00026 
+00027 #ifndef NL_IDENTTYPE_H
+00028 #define NL_IDENTTYPE_H
+00029 #include <stdlib.h>
+00030 #include "nel/misc/file.h"
+00031 #include "nel/misc/entity_id.h"
+00032 #include "nel/ai/e/ai_exception.h"
+00033 #include "nel/ai/agent/agent_string.h"
+00034 
+00035 namespace NLAIAGENT
+00036 {       
+00037 #ifndef _MAX__INDEX_DEFINED
+00038                 const sint32 maxIndex = 2;
+00039                 #define _MAX__INDEX_DEFINED
+00040 
+00041                 const uint64 maxResolutionNumer = ((uint64)2 << 48) - (uint64)1;
+00042 #else
+00043                 extern const sint32 maxIndex;
+00044                 extern const uint64 maxResolutionNumer;
+00045 #endif
+00046 
+00047         struct CAgentNumber: public NLMISC::CEntityId
+00048         {               
+00051                 static const uint8 AgentTypeBit;                
+00052 
+00053                 CAgentNumber()
+00054                 {
+00055                         setType( CAgentNumber::AgentTypeBit );
+00056                 }
+00057                 CAgentNumber(uint64 id,uint8 creator,uint8 dyn):NLMISC::CEntityId(AgentTypeBit,id,creator,dyn)
+00058                 {                       
+00059                 }
+00060 
+00061                 CAgentNumber(uint64 id, uint8 t,uint8 creator,uint8 dyn):NLMISC::CEntityId(t,id,creator,dyn)
+00062                 {               
+00063                 }
+00064 
+00065                 CAgentNumber(uint64 p):NLMISC::CEntityId(p)
+00066                 {
+00067                 }
+00068 
+00069                 CAgentNumber(const CAgentNumber &a):NLMISC::CEntityId(a)
+00070                 {
+00071                 }
+00072 
+00073                 CAgentNumber(NLMISC::IStream &is):NLMISC::CEntityId(is)
+00074                 {
+00075                 }
+00076 
+00077                 CAgentNumber(const char *id):NLMISC::CEntityId(id)
+00078                 {
+00079                 }
+00080 
+00081                 bool isAgentId() const
+00082                 {
+00083                         return (getType() & AgentTypeBit) != 0;
+00084                 }
+00085 
+00086                 virtual bool operator < (const NLMISC::CEntityId &a) const
+00087                 {
+00088                         
+00089                         if(isAgentId())
+00090                         {
+00091                                 if (getShortId() < a.getShortId())
+00092                                 {
+00093                                         return true;
+00094                                 }
+00095                                 else 
+00096                                 if (getShortId() == a.getShortId())
+00097                                 {
+00098                                         if(getCreatorId() < a.getCreatorId())
+00099                                         {
+00100                                                 return true;
+00101                                         }
+00102                                         else
+00103                                                 if(getCreatorId() == a.getCreatorId())
+00104                                                 {
+00105                                                         return getDynamicId() < a.getDynamicId();
+00106                                                 }
+00107                                 }
+00108                                 return false;
+00109                         }
+00110                         else
+00111                         {
+00112                                 return CEntityId::operator < (a);
+00113                         }
+00114                 }
+00115 
+00117                 void setTypeAt(uint64 t)
+00118                 {
+00119                         uint8 type = getType();
+00120                         type |= (t & 0x7f);
+00121                         setType( type );
+00122                 }
+00123 
+00124         };
+00125 
+00126         /*struct CAgentNumber: public NLMISC::IStreamable
+00127         {
+00128                 static uint8 ServerID;
+00129 
+00131                 uint64  DynamicId   :  8;
+00133                 uint64  CreatorId   :  8;
+00135                 uint64  AgentNumber : 48;
+00136 
+00137                 CAgentNumber()
+00138                 {
+00139                         CreatorId = (uint64)ServerID;
+00140                         DynamicId = (uint64)ServerID;
+00141                         AgentNumber = 0;
+00142                 }               
+00143 
+00144                 CAgentNumber(uint64 id,uint64 creator,uint64 dyn)
+00145                 {
+00146                         CreatorId = creator;
+00147                         DynamicId = dyn;
+00148                         AgentNumber = id;
+00149                 }
+00150 
+00151                 CAgentNumber(uint64 p)
+00152                 {                       
+00153                         DynamicId = (uint64)(p & 0xff);
+00154                         p >>= 8;
+00155                         CreatorId = (uint64)(p & 0xff);
+00156                         p >>= 8;
+00157                         AgentNumber = (uint64)(p);                      
+00158                 }
+00159 
+00160                 CAgentNumber(const CAgentNumber &a)
+00161                 {
+00162                         CreatorId = a.CreatorId;                        
+00163                         DynamicId = a.DynamicId;
+00164                         AgentNumber = a.AgentNumber;
+00165                 }
+00166 
+00168                 CAgentNumber(NLMISC::IStream &is)
+00169                 {
+00170                         uint64 p;
+00171                         is.serial(p);
+00172 
+00173                         DynamicId = (uint64)(p & 0xff);
+00174                         p >>= 8;
+00175                         CreatorId = (uint64)(p & 0xff);
+00176                         p >>= 8;
+00177                         AgentNumber = (uint64)(p);                      
+00178                 }
+00179 
+00180                 CAgentNumber(const char *id);
+00181 
+00183 
+00184                 bool operator == (const CAgentNumber &a) const
+00185                 {                       
+00186                         return (AgentNumber == a.AgentNumber && CreatorId == a.CreatorId);                      
+00187                 }
+00188                                 
+00189                 bool operator < (const CAgentNumber &a) const
+00190                 {                       
+00191                         if(AgentNumber < a.AgentNumber) return true; 
+00192                         else
+00193                         if(AgentNumber == a.AgentNumber) return (CreatorId < a.CreatorId);
+00194 
+00195                         return false;
+00196                 }
+00197 
+00198                 bool operator > (const CAgentNumber &a) const
+00199                 {                       
+00200                         if(AgentNumber > a.AgentNumber) return true; 
+00201                         else
+00202                         if(AgentNumber == a.AgentNumber) return (CreatorId > a.CreatorId);
+00203 
+00204                         return false;
+00205                 }
+00207 
+00208                 const CAgentNumber &operator ++(int)
+00209                 {
+00210                         if(AgentNumber < maxResolutionNumer)
+00211                         {
+00212                                 AgentNumber ++;
+00213                         }
+00214                         else
+00215                         {
+00216                                 throw NLAIE::CExceptionIndexError();
+00217                         }
+00218                         return *this;
+00219                 }
+00220 
+00221                 const CAgentNumber &operator = (const CAgentNumber &a)
+00222                 {
+00223                         CreatorId = a.CreatorId;                        
+00224                         DynamicId = a.DynamicId;
+00225                         AgentNumber = a.AgentNumber;
+00226                         return *this;
+00227                 }
+00228 
+00229                 const CAgentNumber &operator = (uint64 p)
+00230                 {                       
+00231                         DynamicId = (uint64)(p & 0xff);
+00232                         p >>= 8;
+00233                         CreatorId = (uint64)(p & 0xff);
+00234                         p >>= 8;
+00235                         AgentNumber = (uint64)(p);
+00236                         
+00237                         return *this;
+00238                 }
+00239 
+00240                 operator uint64 () const
+00241                 {
+00242                         uint64 p = AgentNumber;
+00243                         p <<= 8;
+00244                         p |= (uint64)CreatorId;
+00245                         p <<= 8;
+00246                         p |= (uint64)DynamicId;
+00247 
+00248                         return p;
+00249                 }
+00250 
+00252                 virtual void save(NLMISC::IStream &os)
+00253                 {                       
+00254                         uint64 p = AgentNumber;
+00255                         p <<= 8;
+00256                         p |= (uint64)CreatorId;
+00257                         p <<= 8;
+00258                         p |= (uint64)DynamicId;
+00259                         os.serial(p);                   
+00260                 }
+00261 
+00263                 virtual void load(NLMISC::IStream &is)
+00264                 {
+00265                         uint64 p;
+00266                         is.serial(p);
+00267 
+00268                         DynamicId = (uint64)(p & 0xff);
+00269                         p >>= 8;
+00270                         CreatorId = (uint64)(p & 0xff);
+00271                         p >>= 8;
+00272                         AgentNumber = (uint64)(p);                      
+00273 
+00274                 }
+00275 
+00276                 
+00278                 virtual void getDebugString(std::string &str) const;            
+00279 
+00281 
+00282                 virtual std::string     getClassName()
+00283                 {
+00284                         return std::string("<CAgentNumber>");
+00285                 }
+00286 
+00287                 virtual void serial(NLMISC::IStream     &f) throw(NLMISC::EStream)
+00288                 {
+00289                         if(f.isReading())
+00290                         {
+00291                                 load(f);
+00292                         }
+00293                         else
+00294                         {                               
+00295                                 save(f);
+00296                         }
+00297 
+00298                 }
+00300 
+00301         };      */
+00302 
+00308         struct CIdent: public CAgentNumber
+00309         {
+00310                 std::string TypeName;
+00311                 CIdent()
+00312                 {                       
+00313                 }               
+00314 
+00315                 CIdent(const std::string &typeName,uint64 id,uint8 creator = ServerId,uint8 dyn = ServerId):CAgentNumber(id,creator,dyn),TypeName(typeName)
+00316                 {                       
+00317                 }
+00318 
+00319                 CIdent(const std::string &typeName,const CAgentNumber &a):CAgentNumber(a),TypeName(typeName)
+00320                 {                       
+00321                 }
+00322 
+00323                 CIdent(const CIdent &a):CAgentNumber(a),TypeName(a.TypeName)
+00324                 {                       
+00325                 }
+00326 
+00328                 CIdent(NLMISC::IStream &is):CAgentNumber(is)
+00329                 {                       
+00330                         std::string s;
+00331                         is.serial(s);
+00332                         TypeName = s;
+00333                 }
+00334 
+00335                 virtual ~CIdent() {}
+00336 
+00337                 bool operator == (const CIdent &a) const
+00338                 {
+00339                         if(TypeName == a.TypeName) 
+00340                         {
+00341                                 return CAgentNumber::operator == (a);
+00342                         }
+00343                         return false;
+00344                 }
+00345                                 
+00346                 bool operator < (const CIdent &a) const
+00347                 {                               
+00348                         return TypeName < a.TypeName;
+00349                 }
+00350 
+00351                 bool operator > (const CIdent &a) const
+00352                 {
+00353                         return !(TypeName < a.TypeName);
+00354                 }               
+00355                 
+00356 
+00357                 const CIdent &operator = (const CIdent &a)
+00358                 {
+00359                         CAgentNumber::operator = (a);
+00360                         TypeName = a.TypeName;
+00361                         return *this;
+00362                 }
+00363 
+00365                 virtual void save(NLMISC::IStream &os)
+00366                 {       
+00367                         CAgentNumber::save(os);
+00368                         os.serial(TypeName);
+00369                 }
+00370 
+00372                 virtual void load(NLMISC::IStream &is)
+00373                 {
+00374                         CAgentNumber::load(is);
+00375                         std::string s;
+00376                         is.serial(s);
+00377                         TypeName = s;
+00378                 }
+00379 
+00380                 
+00381 
+00383                 virtual void getDebugString(std::string &str) const
+00384                 {
+00385                         CAgentNumber::getDebugString(str);
+00386                         str += NLAIC::stringGetBuild(" '%s'",TypeName.data());
+00387                 }
+00388 
+00389                 const std::string &getTypeName() const
+00390                 {
+00391                         return TypeName;
+00392                 }
+00393         };
+00394 }
+00395 #endif
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1