# 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  

ident.cpp

Go to the documentation of this file.
00001 
00006 /* Copyright, 2000 Nevrax Ltd.
00007  *
00008  * This file is part of NEVRAX NEL.
00009  * NEVRAX NEL is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2, or (at your option)
00012  * any later version.
00013 
00014  * NEVRAX NEL is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00017  * General Public License for more details.
00018 
00019  * You should have received a copy of the GNU General Public License
00020  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00021  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00022  * MA 02111-1307, USA.
00023  */
00024 #include "nel/ai/agent/agent.h"
00025 
00026 namespace NLAIAGENT
00027 {       
00028         const uint8 CAgentNumber::AgentTypeBit = 1<<7;
00029         const CAgentNumber CAgentNumber::Unknow(0,CAgentNumber::ServerId,CAgentNumber::ServerId);
00030 
00031         uint64 atoiInt64(const char *ident)
00032         {
00033                 uint64 k = 0;
00034 
00035                 while(*ident != 0)
00036                 {
00037                         if(*ident == ':') break;
00038 
00039                         switch(*(ident++))
00040                         {
00041                         case '0':
00042                                 k |= 0;
00043                                 break;
00044                         case '1':
00045                                 k |= 1;
00046                                 break;
00047                         case '2':
00048                                 k |= 2;
00049                                 break;
00050                         case '3':
00051                                 k |= 3;
00052                                 break;
00053                         case '4':
00054                                 k |= 4;
00055                                 break;
00056                         case '5':
00057                                 k |= 5;
00058                                 break;
00059                         case '6':
00060                                 k |= 6;
00061                                 break;
00062                         case '7':
00063                                 k |= 7;
00064                                 break;
00065                         case '8':
00066                                 k |= 8;
00067                                 break;
00068                         case '9':
00069                                 k |= 9;
00070                                 break;
00071                         case 'a':
00072                                 k |= 10;
00073                                 break;
00074                         case 'b':
00075                                 k |= 11;
00076                                 break;
00077                         case 'c':
00078                                 k |= 12;
00079                                 break;
00080                         case 'd':
00081                                 k |= 13;
00082                                 break;
00083                         case 'e':
00084                                 k |= 14;
00085                                 break;
00086                         case 'f':
00087                                 k |= 15;
00088                                 break;
00089 
00090                         case 'A':
00091                                 k |= 10;
00092                                 break;
00093                         case 'B':
00094                                 k |= 11;
00095                                 break;
00096                         case 'C':
00097                                 k |= 12;
00098                                 break;
00099                         case 'D':
00100                                 k |= 13;
00101                                 break;
00102                         case 'E':
00103                                 k |= 14;
00104                                 break;
00105                         case 'F':
00106                                 k |= 15;
00107                                 break;
00108 
00109                         case 0:
00110                                 return k;
00111                         case ':':
00112                                 return k;
00113                                 break;
00114                         }
00115                         if(*ident != 0 && *ident != ':') k <<= 4;
00116                 }
00117 
00118                 return k;
00119         }       
00120                 
00121 
00122         CLocWordNumRef::~CLocWordNumRef()
00123         {
00124                 NLMISC::CSynchronized<tMapRef >::CAccessor a(&_LocRefence);
00125                 tMapRef::iterator Itr = a.value().find(_Id);
00126                 if(Itr != a.value().end())
00127                 {                               
00128                         a.value().erase(Itr);
00129                 }
00130                 else throw NLAIE::CExceptionIndexHandeledError();
00131         }
00132 
00133         const NLAIC::CIdentType &CLocWordNumRef::getType() const
00134         {               
00135                 return *IdLocWordNumRef;
00136         }
00137 
00138         IRefrence *CLocWordNumRef::getRef(const CNumericIndex &id)
00139         {
00140                 NLMISC::CSynchronized<tMapRef >::CAccessor a(&_LocRefence);
00141                 tMapRef::iterator Itr = a.value().find(id);
00142                 if(Itr != a.value().end())
00143                 {                               
00144                         return (*Itr).second;
00145                 }
00146                 /*else
00147                 {
00148                         throw NLAIE::CExceptionIndexHandeledError();
00149                 }*/
00150                 return NULL;
00151         }
00152 
00153         void CLocWordNumRef::Init()
00154         {
00155                 /*NLMISC::CSynchronized<tMapRef >::CAccessor a(&_LocRefence);
00156                 a.value() = new CLocWordNumRef::tMapRef;*/
00157         }
00158 
00159         void CLocWordNumRef::clear()
00160         {                       
00161                 /*NLMISC::CSynchronized<tMapRef >::CAccessor a(&_LocRefence);
00162                 if(a.value() )
00163                 {
00164                         delete a.value();
00165                         a.value() = NULL;
00166                 }*/                     
00167         }
00168 
00169         void releaseAgentLib()
00170         {
00171                 //CLocWordNumRef::clear();
00172                 //CIndexedVarName::releaseClass();
00173         }
00174 
00175         void initAgentLib()
00176         {
00177                 CLocWordNumRef::Init();         
00178                 CIndexedVarName::initClass();
00179         }       
00180 }