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_8h-source.html | 459 ++++++++++++++++++++++++++ 1 file changed, 459 insertions(+) create mode 100644 docs/doxygen/nel/agent__nombre_8h-source.html (limited to 'docs/doxygen/nel/agent__nombre_8h-source.html') diff --git a/docs/doxygen/nel/agent__nombre_8h-source.html b/docs/doxygen/nel/agent__nombre_8h-source.html new file mode 100644 index 00000000..ad61e9bd --- /dev/null +++ b/docs/doxygen/nel/agent__nombre_8h-source.html @@ -0,0 +1,459 @@ + + + + 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 
+00086                 virtual double getNumber() const = 0;
+00087                 virtual ~INombreDefine()
+00088                 {
+00089                 }
+00090 
+00091         };
+00092 
+00101         template <class tNombre> 
+00102         class INombre: public INombreDefine
+00103         {       
+00104 
+00105         protected:
+00106                 tNombre _Value;
+00107 
+00108         public:
+00109                 INombre(tNombre value):_Value(value)
+00110                 {
+00111                 }
+00112                 INombre(const INombre &value):INombreDefine(value),_Value((tNombre)value._Value)
+00113                 {
+00114                 }
+00115                 INombre()
+00116                 {                       
+00117                 }
+00118                 INombre(NLMISC::IStream &is)
+00119                 {
+00120                         load(is);
+00121                 }
+00122 
+00123                 virtual ~INombre()
+00124                 {
+00125                 }               
+00126 
+00128 
+00129                 virtual CProcessResult runMethodeMember(sint32, sint32, IObjectIA *)
+00130                 {
+00131                         return IObjectIA::CProcessResult();
+00132                 }
+00133                 virtual CProcessResult runMethodeMember(sint32 index,IObjectIA *p)
+00134                 {
+00135                         IBaseGroupType *param = (IBaseGroupType *)p;
+00136 
+00137                         switch(index - IObjetOp::getMethodIndexSize())
+00138                         {
+00139                         case INombreDefine::TConst:
+00140                                 {                                       
+00141                                         _Value = (tNombre )((INombreDefine *)param->get())->getNumber();
+00142                                         return IObjectIA::CProcessResult();             
+00143                                 }
+00144                         }
+00145 
+00146                         return IObjectIA::CProcessResult();
+00147                 }
+00149 
+00150                 virtual void save(NLMISC::IStream &os)
+00151                 {       
+00152                         tNombre v = _Value;
+00153                         // TODO
+00154                         os.serial( v );
+00155                 }
+00156 
+00157                 virtual void load(NLMISC::IStream &is)
+00158                 {                               
+00159                         // TODO
+00160                         is.serial( _Value );                    
+00161 
+00162                 }               
+00163 
+00164                 virtual bool isEqual(const IBasicObjectIA &a) const
+00165                 {                       
+00166                         return !(*(IObjectIA *)this == (IObjetOp &)a);
+00167                 }
+00168 
+00169                 virtual bool isTrue() const
+00170                 {
+00171                         return _Value != (tNombre)0;
+00172                 }
+00173 
+00174                 tNombre getValue() const
+00175                 {
+00176                         return _Value;
+00177                 }
+00178 
+00179                 void setValue(tNombre value) 
+00180                 {
+00181                         _Value = value;
+00182                 }               
+00183 
+00184                 virtual IObjectIA &operator = (const IObjectIA &a)
+00185                 {                       
+00186                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00187                         _Value = v;
+00188                         chekBorn();
+00189                         return *this;
+00190                 }
+00191 
+00192                 virtual IObjetOp &operator += (const IObjetOp &a)
+00193                 {
+00194                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00195                         addValue(v);
+00196                         return *this;
+00197                 }
+00198 
+00199                 virtual IObjetOp &operator -= (const IObjetOp &a)
+00200                 {
+00201                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00202                         subValue(v);
+00203                         return *this;
+00204                 }
+00205 
+00206                 virtual IObjetOp &neg() = 0;            
+00207 
+00208                 virtual IObjetOp &operator *= (const IObjetOp &a)
+00209                 {
+00210                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00211                         mulValue(v);
+00212                         return *this;
+00213                 }
+00214 
+00215                 virtual IObjetOp &operator /= (const IObjetOp &a)
+00216                 {
+00217                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00218                         divValue(v);
+00219                         return *this;
+00220                 }
+00221 
+00222                 virtual IObjetOp *operator + (const IObjetOp &a)
+00223                 {
+00224                         IObjetOp *o = (IObjetOp *)clone();                      
+00225                         *o += a;
+00226                         return o;
+00227                 }
+00228 
+00229                 virtual IObjetOp *operator - (const IObjetOp &a)
+00230                 {
+00231                         IObjetOp *o = (IObjetOp *)clone();                      
+00232                         *o -= a;
+00233                         return o;
+00234                 }
+00235 
+00236                 virtual IObjetOp *operator * (const IObjetOp &a)
+00237                 {
+00238                         IObjetOp *o = (IObjetOp *)clone();                      
+00239                         *o *= a;
+00240                         return o;
+00241                 }
+00242 
+00243                 virtual IObjetOp *operator / (const IObjetOp &a)
+00244                 {
+00245                         IObjetOp *o = (IObjetOp *)clone();                      
+00246                         *o /= a;
+00247                         return o;
+00248                 }
+00249 
+00250 
+00251                 virtual IObjetOp *operator < (IObjetOp &a) const
+00252                 {
+00253                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00254                         NLAILOGIC::CBoolType *x = new NLAILOGIC::CBoolType(_Value < v);                 
+00255                         return x;
+00256                 }
+00257 
+00258                 virtual IObjetOp *operator > (IObjetOp &a) const
+00259                 {
+00260                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00261                         NLAILOGIC::CBoolType *x = new NLAILOGIC::CBoolType(_Value > v);                 
+00262                         return x;
+00263                 }
+00264 
+00265                 virtual IObjetOp *operator <= (IObjetOp &a) const
+00266                 {
+00267                         tNombre v = (tNombre)((const INombre &)a).getNumber();
+00268                         NLAILOGIC::CBoolType *x = new NLAILOGIC::CBoolType(_Value <= v);                        
+00269                         return x;
+00270                 }
+00271 
+00272                 virtual IObjetOp *operator >= (IObjetOp &a) const
+00273                 {
+00274                         tNombre v = (tNombre)((const INombre &)a).getNumber();
+00275                         NLAILOGIC::CBoolType *x = new NLAILOGIC::CBoolType(_Value >= v);                        
+00276                         return x;
+00277                 }
+00278 
+00279                 virtual IObjetOp *operator ! () const
+00280                 {                       
+00281                         NLAILOGIC::CBoolType *x = new NLAILOGIC::CBoolType(_Value == (tNombre)0);                       
+00282                         return x;
+00283                 }
+00284 
+00285                 virtual IObjetOp *operator != (IObjetOp &a) const
+00286                 {
+00287                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00288                         NLAILOGIC::CBoolType *x = new NLAILOGIC::CBoolType(_Value != v);
+00289                         return x;
+00290                 }
+00291 
+00292                 virtual IObjetOp *operator == (IObjetOp &a) const
+00293                 {
+00294                         tNombre v = (tNombre)((const INombreDefine &)a).getNumber();
+00295                         NLAILOGIC::CBoolType *x = new NLAILOGIC::CBoolType(_Value == v);
+00296                         return x;
+00297                 }
+00298 
+00299                 
+00300         protected:
+00301 
+00302                 virtual void chekBorn(){}
+00303                 
+00304                 void addValue(tNombre value)
+00305                 {
+00306                         _Value += value;
+00307                         chekBorn();
+00308                 }
+00309 
+00310                 void subValue(tNombre value)
+00311                 {
+00312                         _Value -= value;
+00313                         chekBorn();
+00314                 }
+00315 
+00316                 void mulValue(tNombre value)
+00317                 {
+00318                         _Value *= value;
+00319                         chekBorn();
+00320                 }
+00321 
+00322                 void divValue(tNombre value)
+00323                 {
+00324                         _Value /= value;
+00325                         chekBorn();
+00326                 }
+00327         };
+00328 
+00329         template <class tNombre> 
+00330         class IDigital : public INombre<tNombre>
+00331         {
+00332 
+00333         public :
+00334                 IDigital(tNombre value):INombre<tNombre>(value)
+00335                 {
+00336                 }
+00337 
+00338                 IDigital(const IDigital &value):INombre<tNombre>(value)
+00339                 {
+00340                 }
+00341                 
+00342                 IDigital()
+00343                 {                       
+00344                 }
+00345                 
+00346                 IDigital(NLMISC::IStream &is):INombre<tNombre>(is)
+00347                 {
+00348                 }
+00349                 
+00350                 virtual ~IDigital()
+00351                 {
+00352                 }
+00353 
+00354                 virtual double getNumber() const
+00355                 {
+00356                         return (double)_Value;
+00357                 }
+00358         };
+00359 
+00360         template <class tNombre> 
+00361         class  IBornNombre: public IDigital<tNombre>
+00362         {
+00363         private:
+00364                 tNombre _inf,_sup;
+00365         public:
+00366                 IBornNombre(tNombre value,tNombre inf,tNombre sup):IDigital<tNombre>(value),_inf((tNombre)inf),_sup((tNombre)sup)
+00367                 {
+00368                 }
+00369                 IBornNombre(const IBornNombre &value):IDigital<tNombre>(value),_inf((tNombre)value._inf),_sup((tNombre)value._sup)
+00370                 {
+00371                 }
+00372                 IBornNombre(tNombre inf,tNombre sup):_inf((tNombre)inf),_sup((tNombre)sup)
+00373                 {                       
+00374                 }
+00375                 IBornNombre(NLMISC::IStream &is):IDigital<tNombre>(is)
+00376                 {                       
+00377                 }
+00378                 virtual ~IBornNombre()
+00379                 {
+00380                 }
+00381 
+00382                 virtual void save(NLMISC::IStream &)
+00383                 {
+00384 /*                      IDigital<tNombre>::save(os);
+00385                         os.serial( _sup );
+00386                         os.serial(_inf );*/
+00387                 }
+00388 
+00389                 virtual void load(NLMISC::IStream &)
+00390                 {
+00391                         // TODO
+00392 /*                      IDigital<tNombre>::load(is);
+00393                         is.serial( _sup );
+00394                         is.serial( _inf );*/
+00395                 }
+00396 
+00397                 tNombre getSup() const
+00398                 {
+00399                         return _sup;
+00400                 }
+00401                 tNombre getInf() const
+00402                 {
+00403                         return _inf;
+00404                 }
+00405         protected:
+00406 
+00407                 void chekBorn()
+00408                 {
+00409                         if(_Value > _sup) _Value = _sup;
+00410                         if(_Value < _inf) _Value = _inf;
+00411                 }                                       
+00412         };
+00413 }
+00414 
+00415 #endif
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1