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/agent__3dvector_8cpp-source.html | 460 ++++++++++++++++++++++ 1 file changed, 460 insertions(+) create mode 100644 docs/doxygen/nel/agent__3dvector_8cpp-source.html (limited to 'docs/doxygen/nel/agent__3dvector_8cpp-source.html') diff --git a/docs/doxygen/nel/agent__3dvector_8cpp-source.html b/docs/doxygen/nel/agent__3dvector_8cpp-source.html new file mode 100644 index 00000000..f9d0e25f --- /dev/null +++ b/docs/doxygen/nel/agent__3dvector_8cpp-source.html @@ -0,0 +1,460 @@ + + + + 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  
+

agent_3dvector.cpp

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 #include "nel/ai/agent/agent_digital.h"
+00028 #include "nel/ai/script/interpret_methodes.h"
+00029 #include "nel/ai/script/type_def.h"
+00030 #include "nel/ai/agent/object_type.h"
+00031 #include "nel/ai/agent/agent_method_def.h"
+00032 #include "nel/ai/agent/agent_3dvector.h"
+00033 
+00034 // Add some code in the namespace "NLAIAGENT".
+00035 namespace NLAIAGENT
+00036 {
+00037 
+00038         /****************************************************
+00039          * 
+00040          */
+00041         sint32 IVector::getMethodIndexSize() const
+00042         {
+00043                 return getMethodIndexSize() + 10;
+00044         }
+00045 
+00046         /****************************************************
+00047          * 
+00048          */
+00049         tQueue IVector::isMember(const IVarName *baseClass,const IVarName *methodName,const IObjectIA &p) const
+00050         {               
+00051                 //Type IVarName voir agent_string.h.
+00052                 static const CStringVarName methodX("x");
+00053                 static const CStringVarName methodY("y");
+00054                 static const CStringVarName methodZ("z");
+00055                 static const CStringVarName methodSquareLength("SquareLength");
+00056                 static const CStringVarName methodLength("Length");
+00057                 static const CStringVarName methodUnit("Unit");
+00058                 static const CStringVarName selfName((const char *)getType());
+00059                 static const CStringVarName constructor(_CONSTRUCTOR_);
+00060 
+00061                 //NLAISCRIPT::CParam est le type reel de p voir nel/ai/script/interpret_methodes.h pour la declaration de la class.
+00062                 const NLAISCRIPT::CParam &param = (const NLAISCRIPT::CParam &)p;
+00063                         
+00064                 if(baseClass == NULL || (*baseClass) == selfName)
+00065                 {
+00066                         if((*methodName) == methodX)
+00067                         {
+00068                                 if(!param.size())
+00069                                 {
+00070                                         tQueue a;
+00071                                         //Type du retour de la method x(), c'est un Float dont de type DDigitalType c'est à dire DDigitalType::IDDigitalType;
+00072                                         //CObjectType est un IObjectIA qui permet d'encapsuler un NLAIC::CIdentType c'est à dire un type.
+00073                                         NLAIAGENT::CObjectType *t = new NLAIAGENT::CObjectType(new NLAIC::CIdentType(DDigitalType::IdDDigitalType));
+00074                                         t->incRef();
+00075                                         //CIdMethod est dans basicai.h elle va être documenter.
+00076                                         a.push(CIdMethod(IObjetOp::getMethodIndexSize() + 1,0.0,NULL,t));
+00077                                         return a;
+00078                                 }
+00079                                 else
+00080                                 {
+00081                                         NLAISCRIPT::CParam xParam;
+00082                                         xParam.push(NLAISCRIPT::COperandSimple(new NLAIC::CIdentType(DDigitalType::IdDDigitalType)));
+00083                                         if(param == xParam)
+00084                                         {               
+00085                                                 tQueue a;
+00086                                                 //Type du retour de la method x(), c'est un void dont de type VoidType c'est à dire NLAIC::CIdentType::VoidType;
+00087                                                 //CObjectType est un IObjectIA qui permet d'encapsuler un NLAIC::CIdentType c'est à dire un type.
+00088                                                 //la variable NLAIC::CIdentType::VoidType est un static dans la class NLAIC::CIdentType.
+00089                                                 NLAIAGENT::CObjectType *t = new NLAIAGENT::CObjectType(new NLAIC::CIdentType(NLAIC::CIdentType::VoidType));
+00090                                                 t->incRef();
+00091                                                 //CIdMethod est dans basicai.h elle va être documenter.
+00092                                                 a.push(CIdMethod(IObjetOp::getMethodIndexSize() + 2,0.0,NULL,t));
+00093                                                 return a;
+00094                                         }
+00095                                 }
+00096                         }
+00097                         else if((*methodName) == methodY)
+00098                         {
+00099                                 if(!param.size())
+00100                                 {
+00101                                         tQueue a;
+00102                                         //Type du retour de la method y(), c'est un Float dont de type DDigitalType c'est à dire DDigitalType::IdDDigitalType;
+00103                                         //CObjectType est un IObjectIA qui permet d'encapsuler un NLAIC::CIdentType c'est à dire un type.
+00104                                         NLAIAGENT::CObjectType *t = new NLAIAGENT::CObjectType(new NLAIC::CIdentType(DDigitalType::IdDDigitalType));
+00105                                         t->incRef();
+00106                                         //CIdMethod est dans basicai.h elle va être documenter.
+00107                                         a.push(CIdMethod(IObjetOp::getMethodIndexSize() + 3,0.0,NULL,t));
+00108                                         return a;
+00109                                 }
+00110                                 else
+00111                                 {
+00112                                         NLAISCRIPT::CParam xParam;
+00113                                         xParam.push(NLAISCRIPT::COperandSimple(new NLAIC::CIdentType(DDigitalType::IdDDigitalType)));
+00114                                         if(param == xParam)
+00115                                         {               
+00116                                                 tQueue a;
+00117                                                 //Type du retour de la method y(), c'est un void dont de type VoidType c'est à dire CIdentType::VoidType;
+00118                                                 //CObjectType est un IObjectIA qui permet d'encapsuler un NLAIC::CIdentType c'est à dire un type.
+00119                                                 //la variable NLAIC::CIdentType::VoidType est un static dans la class NLAIC::CIdentType.
+00120                                                 NLAIAGENT::CObjectType *t = new NLAIAGENT::CObjectType(new NLAIC::CIdentType(NLAIC::CIdentType::VoidType));                                             
+00121                                                 //CIdMethod est dans basicai.h elle va être documenter.
+00122                                                 a.push(CIdMethod(IObjetOp::getMethodIndexSize() + 4,0.0,NULL,t));
+00123                                                 return a;
+00124                                         }
+00125                                 }
+00126                         }
+00127                         if((*methodName) == methodZ)
+00128                         {
+00129                                 if(!param.size())
+00130                                 {
+00131                                         tQueue a;
+00132                                         //Type du retour de la method x(), c'est un Float dont de type DDigitalType c'est à dire DDigitalType::IdDDigitalType;
+00133                                         //CObjectType est un IObjectIA qui permet d'encapsuler un NLAIC::CIdentType c'est à dire un type.
+00134                                         NLAIAGENT::CObjectType *t = new NLAIAGENT::CObjectType(new NLAIC::CIdentType(DDigitalType::IdDDigitalType));                                    
+00135                                         //CIdMethod est dans basicai.h elle va être documenter.
+00136                                         a.push(CIdMethod(IObjetOp::getMethodIndexSize() + 5,0.0,NULL,t));
+00137                                         return a;
+00138                                 }
+00139                                 else
+00140                                 {
+00141                                         NLAISCRIPT::CParam xParam;
+00142                                         xParam.push(NLAISCRIPT::COperandSimple(new NLAIC::CIdentType(DDigitalType::IdDDigitalType)));
+00143                                         if(param == xParam)
+00144                                         {               
+00145                                                 tQueue a;
+00146                                                 //Type du retour de la method x(), c'est un void dont de type VoidType c'est à dire NLAIC::CIdentType::VoidType;
+00147                                                 //CObjectType est un IObjectIA qui permet d'encapsuler un NLAIC::CIdentType c'est à dire un type.
+00148                                                 //la variable NLAIC::CIdentType::VoidType est un static dans la class NLAIC::CIdentType.
+00149                                                 NLAIAGENT::CObjectType *t = new NLAIAGENT::CObjectType(new NLAIC::CIdentType(NLAIC::CIdentType::VoidType));                                             
+00150                                                 //CIdMethod est dans basicai.h elle va être documenter.
+00151                                                 a.push(CIdMethod(IObjetOp::getMethodIndexSize() + 6,0.0,NULL,t));
+00152                                                 return a;
+00153                                         }
+00154                                 }
+00155                         }
+00156                         else if((*methodName) == methodSquareLength)
+00157                         {
+00158                                 if(!param.size())
+00159                                 {
+00160                                         tQueue a;
+00161                                         //Return a void type (no value return)
+00162                                         NLAIAGENT::CObjectType *t = new NLAIAGENT::CObjectType(new NLAIC::CIdentType(DDigitalType::IdDDigitalType));                                    
+00163                                         a.push(CIdMethod(IObjetOp::getMethodIndexSize() + 7,0.0,NULL,t));
+00164                                         return a;
+00165                                 }
+00166                         }
+00167                         else if((*methodName) == methodLength)
+00168                         {
+00169                                 if(!param.size())
+00170                                 {
+00171                                         tQueue a;
+00172                                         //Return a digital type
+00173                                         NLAIAGENT::CObjectType *t = new NLAIAGENT::CObjectType(new NLAIC::CIdentType(DDigitalType::IdDDigitalType));                                    
+00174                                         a.push(CIdMethod(IObjetOp::getMethodIndexSize() + 8,0.0,NULL,t));
+00175                                         return a;
+00176                                 }
+00177                         }
+00178                         else if((*methodName) == methodUnit)
+00179                         {
+00180                                 if(!param.size())
+00181                                 {
+00182                                         tQueue a;
+00183                                         //Return a void type
+00184                                         NLAIAGENT::CObjectType *t = new NLAIAGENT::CObjectType(new NLAIC::CIdentType(NLAIC::CIdentType::VoidType));                                     
+00185                                         a.push(CIdMethod(IObjetOp::getMethodIndexSize() + 9,0.0,NULL,t));
+00186                                         return a;
+00187                                 }
+00188                         }
+00189                         else if((*methodName) == constructor)
+00190                         {
+00191                                 NLAISCRIPT::CParam constructParam;
+00192                                 constructParam.push(NLAISCRIPT::COperandSimpleListOr(2,new NLAIC::CIdentType(DDigitalType::IdDDigitalType),new NLAIC::CIdentType(DDigitalType::IdDDigitalType)));
+00193                                 constructParam.push(NLAISCRIPT::COperandSimpleListOr(2,new NLAIC::CIdentType(DDigitalType::IdDDigitalType),new NLAIC::CIdentType(DDigitalType::IdDDigitalType)));
+00194                                 constructParam.push(NLAISCRIPT::COperandSimpleListOr(2,new NLAIC::CIdentType(DDigitalType::IdDDigitalType),new NLAIC::CIdentType(DDigitalType::IdDDigitalType)));
+00195                                 if(constructParam.eval(param) >= 0.0 )
+00196                                 {               
+00197                                         tQueue a;
+00198                                         //Type du retour du constructeur , c'est un void dont de type VoidType c'est à dire CIdentType::VoidType;
+00199                                         //CObjectType est un IObjectIA qui permet d'encapsuler un NLAIC::CIdentType c'est à dire un type.
+00200                                         //la variable NLAIC::CIdentType::VoidType est un static dans la class NLAIC::CIdentType.
+00201                                         NLAIAGENT::CObjectType *t = new NLAIAGENT::CObjectType(new NLAIC::CIdentType(NLAIC::CIdentType::VoidType));                                     
+00202                                         //CIdMethod est dans basicai.h elle va être documentee.
+00203                                         a.push(CIdMethod(IObjetOp::getMethodIndexSize() + 0,0.0,NULL,t));
+00204                                         return a;
+00205                                 }
+00206                         }
+00207                 }
+00208                 return IObjetOp::isMember(baseClass,methodName,p);
+00209         }
+00210 
+00211         /****************************************************
+00212          * 
+00213          */
+00214         sint32 IVector::isClassInheritedFrom(const IVarName &baseClass) const
+00215         {
+00216 
+00218                 //Cette class n'a aucun heritage.
+00219                 const CStringVarName selfName((const char *)getType());
+00220                 //ça c'est si jamais quelqu'un ecrit un truc du type Vector.x() où Vector est le non de cette class dans le script.
+00221                 if((baseClass) == selfName) return 0;           
+00222                 else return -1;
+00224 /*
+00225                 //Cette class n'a aucun heritage.
+00226                 const CStringVarName selfName((const char *)getType());
+00227                 //ça c'est si jamais quelqu'un ecrit un truc du type Vector.x() où Vector est le non de cette class dans le script.
+00228                 if((baseClass) == selfName) return 0 + IObjetOp::getInheritedSize();
+00229                 else return IObjetOp::isClassInheritedFrom(baseClass);
+00230 */
+00231         }
+00232 
+00233         /****************************************************
+00234          * 
+00235          */
+00236         IObjectIA::CProcessResult IVector::runMethodeMember(sint32 baseClassTag, sint32 methodTag, IObjectIA *p)
+00237         {
+00239                 if(baseClassTag == 0)
+00240                 {
+00241                         return runMethodeMember(methodTag,p);
+00242                 }
+00244 /*              if(baseClassTag == (0+IObjetOp::getInheritedSize()) )
+00245                 {
+00246                         return runMethodeMember(methodTag,p);
+00247                 }
+00248 */
+00249                 return IObjectIA::runMethodeMember(baseClassTag,methodTag,p);
+00250 
+00251         }
+00252 
+00253         /****************************************************
+00254          * 
+00255          */
+00256         IObjectIA::CProcessResult IVector::runMethodeMember(sint32 methodTag,IObjectIA *p)
+00257         {
+00258                 IBaseGroupType &param = (IBaseGroupType &)*p;
+00259 
+00260                 switch(methodTag - IObjetOp::getMethodIndexSize())
+00261                 {
+00262                 case 0:
+00263                         {
+00264                                 CIteratorContener i = param.getIterator();
+00265                                 const INombreDefine *o = (const INombreDefine *)i++;
+00266                                 x(o->getNumber());
+00267                                 o = (const INombreDefine *)i++;                         
+00268                                 y(o->getNumber());
+00269                                 o = (const INombreDefine *)i++;                         
+00270                                 z(o->getNumber());
+00271                                 IObjectIA::CProcessResult a;
+00272                                 a.ResultState = processIdle;
+00273                                 a.Result = NULL;
+00274                                 return a;
+00275                         }
+00276 
+00277                 case 1:
+00278                         {                               
+00279                                 DDigitalType *r = new DDigitalType(x());
+00280                                 r->incRef();
+00281                                 IObjectIA::CProcessResult a;
+00282                                 a.ResultState = processIdle;
+00283                                 a.Result = r;
+00284                                 return a;
+00285                         }                                               
+00286 
+00287                 case 2:
+00288                         {
+00289                                 
+00290                                 x(((const INombreDefine *)param.get())->getNumber());
+00291                                 IObjectIA::CProcessResult a;
+00292                                 a.ResultState = processIdle;
+00293                                 a.Result = NULL;
+00294                                 return a;
+00295                         }                       
+00296 
+00297                 case 3:
+00298                         {                               
+00299                                 DDigitalType *r = new DDigitalType(y());
+00300                                 r->incRef();
+00301                                 IObjectIA::CProcessResult a;
+00302                                 a.ResultState = processIdle;
+00303                                 a.Result = r;
+00304                                 return a;
+00305                         }                                               
+00306 
+00307                 case 4:
+00308                         {
+00309                                 y(((const INombreDefine *)param.get())->getNumber());
+00310                                 IObjectIA::CProcessResult a;
+00311                                 a.ResultState = processIdle;
+00312                                 a.Result = NULL;
+00313                                 return a;
+00314                         }                       
+00315 
+00316                 case 5:
+00317                         {                               
+00318                                 DDigitalType *r = new DDigitalType(z());
+00319                                 r->incRef();
+00320                                 IObjectIA::CProcessResult a;
+00321                                 a.ResultState = processIdle;
+00322                                 a.Result = r;
+00323                                 return a;
+00324                         }                                               
+00325 
+00326                 case 6:
+00327                         {
+00328                                 z(((const INombreDefine *)param.get())->getNumber());
+00329                                 IObjectIA::CProcessResult a;
+00330                                 a.ResultState = processIdle;
+00331                                 a.Result = NULL;
+00332                                 return a;
+00333                         }
+00334                 
+00335                 case 7:
+00336                         {
+00337                                 DDigitalType *r = new DDigitalType(squareLength());
+00338                                 r->incRef();
+00339                                 IObjectIA::CProcessResult a;
+00340                                 a.ResultState = processIdle;
+00341                                 a.Result = r;
+00342                                 return a;
+00343                         }
+00344 
+00345                 case 8:
+00346                         {
+00347                                 DDigitalType *r = new DDigitalType(length());
+00348                                 r->incRef();
+00349                                 IObjectIA::CProcessResult a;
+00350                                 a.ResultState = processIdle;
+00351                                 a.Result = r;
+00352                                 return a;
+00353                         }
+00354 
+00355                 case 9:
+00356                         {
+00357                                 unit();
+00358                                 IObjectIA::CProcessResult a;
+00359                                 a.ResultState = processIdle;
+00360                                 a.Result = NULL;
+00361                                 return a;
+00362                         }
+00363 
+00364                 default:
+00365                         return IObjetOp::runMethodeMember(methodTag,p);
+00366                         break;
+00367                 }
+00368         }
+00369 
+00370         /****************************************************
+00371          * 
+00372          */
+00373         const IObjectIA::CProcessResult &VectorType::run()
+00374         {
+00375                 return IObjectIA::ProcessRun;
+00376         }
+00377 
+00378         /****************************************************
+00379          * 
+00380          */
+00381         const NLAIC::CIdentType &VectorType::getType() const
+00382         {               
+00383                 return IdVectorType;
+00384         }
+00385 
+00386 }// Enf of the namespace "NLAIAGENT" //
+00387 
+00388 using namespace NLAIAGENT;
+00389 const NLAIC::CIdentType VectorType::IdVectorType("Vector3D",NLAIC::CSelfClassFactory(VectorType(0, 0, 0)), 
+00390                                                                                                                         NLAIC::CTypeOfObject(NLAIC::CTypeOfObject::tObject),
+00391                                                                                                                         NLAIC::CTypeOfOperator(NLAIC::CTypeOfOperator::opAdd | 
+00392                                                                                                                         NLAIC::CTypeOfOperator::opSub | 
+00393                                                                                                                         NLAIC::CTypeOfOperator::opEq | 
+00394                                                                                                                         NLAIC::CTypeOfOperator::opDiff));
+00395 
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1