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_nombre_h-source.html | 438 ++++++++++++++++++++++++++++ 1 file changed, 438 insertions(+) create mode 100644 docs/doxygen/nel/agent_nombre_h-source.html (limited to 'docs/doxygen/nel/agent_nombre_h-source.html') diff --git a/docs/doxygen/nel/agent_nombre_h-source.html b/docs/doxygen/nel/agent_nombre_h-source.html new file mode 100644 index 00000000..bc093633 --- /dev/null +++ b/docs/doxygen/nel/agent_nombre_h-source.html @@ -0,0 +1,438 @@ + + + + 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_nombre.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 #ifndef NL_AGENT_NOMBRE_H
+00026 #define NL_AGENT_NOMBRE_H
+00027 
+00028 //#include "nel/ai/agent/agent_object.h"
+00029 #include "nel/ai/logic/boolval.h"
+00030 #include "nel/misc/vector.h"
+00031 
+00032 namespace NLAIAGENT
+00033 {       
+00034 
+00041         class INombreDefine: public IObjetOp
+00042         {
+00043 
+00044         public:
+00045 
+00047                 enum  TMethodNumDef {
+00048                         TConst, 
+00049                         TLastM 
+00050                 };
+00051 
+00053                 struct CMethodCall
+00054                 {
+00055                         CMethodCall(const char *name, int i): MethodName (name)
+00056                         {                               
+00057                                 Index = i;
+00058                         }
+00060                         CStringVarName MethodName;
+00062                         sint32 Index;
+00063                 };
+00065                 static CMethodCall StaticMethod[];
+00066 
+00067         public:
+00068                 INombreDefine()
+00069                 {
+00070                 }
+00071 
+00072                 INombreDefine(const INombreDefine &value):IObjetOp(value)
+00073                 {
+00074                 }
+00075 
+00077 
+00078                 virtual sint32 getMethodIndexSize() const;
+00079                 virtual sint32 isClassInheritedFrom(const IVarName &) const;
+00080                 virtual tQueue isMember(const IVarName *,const IVarName *,const IObjectIA &) const;             
+00082 
+00083 
+00085                 virtual double getNumber() const = 0;
+00086                 virtual ~INombreDefine()
+00087                 {
+00088                 }
+00089 
+00090         };
+00091 
+00100         template <class tNombre> 
+00101         class INombre: public INombreDefine
+00102         {       
+00103 
+00104         protected:
+00105                 tNombre _Value;
+00106 
+00107         public:
+00108                 INombre(tNombre value):_Value(value)
+00109                 {
+00110                 }
+00111                 INombre(const INombre &value):INombreDefine(value),_Value((tNombre)value._Value)
+00112                 {
+00113                 }
+00114                 INombre()
+00115                 {                       
+00116                 }
+00117                 INombre(NLMISC::IStream &is)
+00118                 {
+00119                         load(is);
+00120                 }
+00121 
+00122                 virtual ~INombre()
+00123                 {
+00124                 }
+00125 
+00126                 virtual double getNumber() const
+00127                 {
+00128                         return (double)_Value;
+00129                 }
+00130 
+00132 
+00133                 virtual CProcessResult runMethodeMember(sint32, sint32, IObjectIA *)
+00134                 {
+00135                         return IObjectIA::CProcessResult();
+00136                 }
+00137                 virtual CProcessResult runMethodeMember(sint32 index,IObjectIA *p)
+00138                 {
+00139                         IBaseGroupType *param = (IBaseGroupType *)p;
+00140 
+00141                         switch(index - IObjetOp::getMethodIndexSize())
+00142                         {
+00143                         case INombreDefine::TConst:
+00144                                 {                                       
+00145                                         INombre *o = (INombre *)param->get();
+00146                                         _Value = (tNombre )((INombreDefine *)param->get())->getNumber();
+00147                                         return IObjectIA::CProcessResult();             
+00148                                 }
+00149                         }
+00150 
+00151                         return IObjectIA::CProcessResult();
+00152                 }
+00154 
+00155                 virtual void save(NLMISC::IStream &os)
+00156                 {       
+00157                         tNombre v = _Value;
+00158                         // TODO
+00159                         os.serial( v );
+00160                 }
+00161 
+00162                 virtual void load(NLMISC::IStream &is)
+00163                 {                               
+00164                         // TODO
+00165                         is.serial( _Value );                    
+00166 
+00167                 }               
+00168 
+00169                 virtual bool isEqual(const IBasicObjectIA &a) const
+00170                 {                       
+00171                         return !(*(IObjectIA *)this == (IObjetOp &)a);
+00172                 }
+00173 
+00174                 virtual bool isTrue() const
+00175                 {
+00176                         return _Value != (tNombre)0;
+00177                 }
+00178 
+00179                 tNombre getValue() const
+00180                 {
+00181                         return _Value;
+00182                 }
+00183                 void setValue(tNombre value) 
+00184                 {
+00185                         _Value = value;
+00186                 }               
+00187 
+00188                 virtual IObjectIA &operator = (const IObjectIA &a)
+00189                 {                       
+00190                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00191                         _Value = v;
+00192                         chekBorn();
+00193                         return *this;
+00194                 }
+00195 
+00196                 virtual IObjetOp &operator += (const IObjetOp &a)
+00197                 {
+00198                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00199                         addValue(v);
+00200                         return *this;
+00201                 }
+00202 
+00203                 virtual IObjetOp &operator -= (const IObjetOp &a)
+00204                 {
+00205                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00206                         subValue(v);
+00207                         return *this;
+00208                 }
+00209 
+00210                 virtual IObjetOp &neg()
+00211                 {
+00212                         _Value = -_Value;
+00213                         chekBorn();
+00214                         return *this;
+00215                 }
+00216 
+00217                 virtual IObjetOp &operator *= (const IObjetOp &a)
+00218                 {
+00219                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00220                         mulValue(v);
+00221                         return *this;
+00222                 }
+00223 
+00224                 virtual IObjetOp &operator /= (const IObjetOp &a)
+00225                 {
+00226                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00227                         divValue(v);
+00228                         return *this;
+00229                 }
+00230 
+00231                 virtual IObjetOp *operator + (const IObjetOp &a)  const
+00232                 {
+00233                         IObjetOp *o = (IObjetOp *)clone();                      
+00234                         *o += a;
+00235                         return o;
+00236                 }
+00237 
+00238                 virtual IObjetOp *operator - (const IObjetOp &a)  const
+00239                 {
+00240                         IObjetOp *o = (IObjetOp *)clone();                      
+00241                         *o -= a;
+00242                         return o;
+00243                 }
+00244 
+00245                 virtual const IObjetOp *operator * (const IObjetOp &a)  const
+00246                 {
+00247                         IObjetOp *o = (IObjetOp *)clone();                      
+00248                         *o *= a;
+00249                         return o;
+00250                 }
+00251 
+00252                 virtual const IObjetOp *operator / (const IObjetOp &a)  const
+00253                 {
+00254                         IObjetOp *o = (IObjetOp *)clone();                      
+00255                         *o /= a;
+00256                         return o;
+00257                 }
+00258 
+00259 
+00260                 virtual IObjetOp *operator < (IObjetOp &a) const
+00261                 {
+00262                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00263                         NLAILOGIC::CBoolType *x = new NLAILOGIC::CBoolType(_Value < v);                 
+00264                         return x;
+00265                 }
+00266 
+00267                 virtual IObjetOp *operator > (IObjetOp &a) const
+00268                 {
+00269                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00270                         NLAILOGIC::CBoolType *x = new NLAILOGIC::CBoolType(_Value > v);                 
+00271                         return x;
+00272                 }
+00273 
+00274                 virtual IObjetOp *operator <= (IObjetOp &a) const
+00275                 {
+00276                         tNombre v = (tNombre)((const INombre &)a).getValue();
+00277                         NLAILOGIC::CBoolType *x = new NLAILOGIC::CBoolType(_Value <= v);                        
+00278                         return x;
+00279                 }
+00280 
+00281                 virtual IObjetOp *operator >= (IObjetOp &a) const
+00282                 {
+00283                         tNombre v = (tNombre)((const INombre &)a).getValue();
+00284                         NLAILOGIC::CBoolType *x = new NLAILOGIC::CBoolType(_Value >= v);                        
+00285                         return x;
+00286                 }
+00287 
+00288                 virtual IObjetOp *operator ! () const
+00289                 {                       
+00290                         NLAILOGIC::CBoolType *x = new NLAILOGIC::CBoolType(_Value == (tNombre)0);                       
+00291                         return x;
+00292                 }
+00293 
+00294                 virtual IObjetOp *operator != (IObjetOp &a) const
+00295                 {
+00296                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00297                         NLAILOGIC::CBoolType *x = new NLAILOGIC::CBoolType(_Value != v);
+00298                         return x;
+00299                 }
+00300 
+00301                 virtual IObjetOp *operator == (IObjetOp &a) const
+00302                 {
+00303                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00304                         NLAILOGIC::CBoolType *x = new NLAILOGIC::CBoolType(_Value == v);
+00305                         return x;
+00306                 }
+00307 
+00308                 
+00309         protected:
+00310 
+00311                 virtual void chekBorn(){}
+00312                 
+00313                 void addValue(tNombre value)
+00314                 {
+00315                         _Value += value;
+00316                         chekBorn();
+00317                 }
+00318 
+00319                 void subValue(tNombre value)
+00320                 {
+00321                         _Value -= value;
+00322                         chekBorn();
+00323                 }
+00324 
+00325                 void mulValue(tNombre value)
+00326                 {
+00327                         _Value *= value;
+00328                         chekBorn();
+00329                 }
+00330 
+00331                 void divValue(tNombre value)
+00332                 {
+00333                         _Value /= value;
+00334                         chekBorn();
+00335                 }
+00336         };
+00337 
+00338         template <class tNombre> 
+00339         class  IBornNombre: public INombre<tNombre>
+00340         {
+00341         private:
+00342                 tNombre _inf,_sup;
+00343         public:
+00344                 IBornNombre(tNombre value,tNombre inf,tNombre sup):INombre<tNombre>(value),_inf((tNombre)inf),_sup((tNombre)sup)
+00345                 {
+00346                 }
+00347                 IBornNombre(const IBornNombre &value):INombre<tNombre>(value),_inf((tNombre)value._inf),_sup((tNombre)value._sup)
+00348                 {
+00349                 }
+00350                 IBornNombre(tNombre inf,tNombre sup):_inf((tNombre)inf),_sup((tNombre)sup)
+00351                 {                       
+00352                 }
+00353                 IBornNombre(NLMISC::IStream &is):INombre<tNombre>(is)
+00354                 {                       
+00355                 }
+00356                 virtual ~IBornNombre()
+00357                 {
+00358                 }
+00359 
+00360                 virtual void save(NLMISC::IStream &)
+00361                 {
+00362 /*                      INombre<tNombre>::save(os);
+00363                         os.serial( _sup );
+00364                         os.serial(_inf );*/
+00365                 }
+00366 
+00367                 virtual void load(NLMISC::IStream &)
+00368                 {
+00369                         // TODO
+00370 /*                      INombre<tNombre>::load(is);
+00371                         is.serial( _sup );
+00372                         is.serial( _inf );*/
+00373                 }
+00374 
+00375                 tNombre getSup() const
+00376                 {
+00377                         return _sup;
+00378                 }
+00379                 tNombre getInf() const
+00380                 {
+00381                         return _inf;
+00382                 }
+00383         protected:
+00384 
+00385                 void chekBorn()
+00386                 {
+00387                         if(_Value > _sup) _Value = _sup;
+00388                         if(_Value < _inf) _Value = _inf;
+00389                 }                                       
+00390         };
+00391 }
+00392 
+00393 #endif
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1