# 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_digital.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 #ifndef NL_AGENT_DIGITAL_H
00027 #define NL_AGENT_DIGITAL_H
00028 
00029 #include "nel/ai/agent/agent.h"
00030 #include "nel/ai/agent/agent_object.h"
00031 #include "nel/ai/agent/agent_nombre.h"
00032 
00033 namespace NLAIAGENT
00034 {       
00035         
00045         class DigitalType : public IDigital<float>
00046         {
00047 
00048         public:
00049                 static DigitalType NullOperator;
00050 
00051                 static const NLAIC::CIdentType IdDigitalType;
00052 
00053         public:
00055                 DigitalType(float value):IDigital<float>(value)
00056                 {                       
00057                 }
00058 
00060                 DigitalType():IDigital<float>()
00061                 {                       
00062                 }
00063                 
00064                 DigitalType(const DigitalType &a):IDigital<float>(a)
00065                 {                       
00066                 }
00067 
00069                 DigitalType(NLMISC::IStream &is):IDigital<float>(is)
00070                 {
00071                 }
00072 
00073                 virtual IObjetOp &neg()
00074                 {
00075                         _Value = -_Value;
00076                         chekBorn();
00077                         return *this;
00078                 }
00079                 
00081 
00082                 virtual const NLAIC::IBasicType *clone() const
00083                 {
00084                         NLAIC::IBasicInterface *m = new DigitalType(*this);                     
00085                         return m;
00086                 }
00087                 
00088                 virtual const NLAIC::IBasicType *newInstance() const
00089                 {
00090                         return clone();
00091                 }
00092 
00093                 virtual const NLAIC::CIdentType &getType() const;               
00094                         
00095                 virtual void getDebugString(std::string &text) const
00096                 {                       
00097                         text += NLAIC::stringGetBuild("%f",getValue());
00098                 }               
00099 
00100                 virtual const CProcessResult &run();
00102         };
00103 
00104 
00113         class BorneDigitalType: public IBornNombre<float>
00114         {                       
00115 
00116         public:
00117                 static const NLAIC::CIdentType IdBorneDigitalType;
00118 
00119         public:
00120 
00124                 BorneDigitalType(float sup,float inf,float value): IBornNombre<float>(value,sup,inf)
00125                 {
00126                 }
00130                 BorneDigitalType(float sup,float inf):IBornNombre<float>(sup,inf)
00131                 {
00132                 }               
00133 
00134                 BorneDigitalType(const BorneDigitalType &a): IBornNombre<float>(a)
00135                 {
00136                 }                               
00137 
00139                 BorneDigitalType(NLMISC::IStream &is):IBornNombre<float>(is)
00140                 {
00141                 }
00142 
00143                 virtual IObjetOp &neg()
00144                 {
00145                         _Value = -_Value;
00146                         chekBorn();
00147                         return *this;
00148                 }
00149 
00151 
00152                 virtual const NLAIC::IBasicType *clone() const
00153                 {
00154                         NLAIC::IBasicInterface *m = new BorneDigitalType(*this);                        
00155                         return m;
00156                 }               
00157 
00158                 virtual const NLAIC::IBasicType *newInstance() const
00159                 {
00160                         return clone();
00161                 }
00162 
00163                 virtual const NLAIC::CIdentType &getType() const;                               
00164 
00165                 virtual const CProcessResult &run();
00166                 
00167                 virtual void getDebugString(std::string &text) const
00168                 {
00169                         text += NLAIC::stringGetBuild("%f [_inf<%f> _sup<%f>]",getValue(),getInf(),getSup());
00170                 }
00172 
00173         protected:              
00174         };
00175 
00186         class DDigitalType : public IDigital<double>
00187         {
00188 
00189         public:
00190                 static const NLAIC::CIdentType IdDDigitalType;
00191 
00192         public:
00194                 DDigitalType(double value):IDigital<double>(value)
00195                 {                       
00196                 }
00197 
00199                 DDigitalType():IDigital<double>()
00200                 {                       
00201                 }
00202                 
00203                 DDigitalType(const DDigitalType &a):IDigital<double>(a)
00204                 {                       
00205                 }
00206 
00208                 DDigitalType(NLMISC::IStream &is):IDigital<double>(is)
00209                 {
00210                 }
00211 
00212                 virtual IObjetOp &neg()
00213                 {
00214                         _Value = -_Value;
00215                         chekBorn();
00216                         return *this;
00217                 }
00218                 
00220 
00221                 virtual const NLAIC::IBasicType *clone() const
00222                 {
00223                         NLAIC::IBasicInterface *m = new DDigitalType(*this);                    
00224                         return m;
00225                 }
00226                 
00227                 virtual const NLAIC::IBasicType *newInstance() const
00228                 {
00229                         return clone();
00230                 }
00231 
00232                 virtual const NLAIC::CIdentType &getType() const;               
00233                 
00234 
00235                 virtual void getDebugString(std::string &text) const
00236                 {
00237                         text += NLAIC::stringGetBuild("%.5f",getValue());
00238                 }               
00239 
00240                 virtual const CProcessResult &run();
00242         };
00243 
00253         class BorneDDigitalType: public IBornNombre<double>
00254         {
00255 
00256         public:
00257                 static const NLAIC::CIdentType IdBorneDDigitalType;
00258 
00259         public:
00260 
00264                 BorneDDigitalType(double sup,double inf,double value): IBornNombre<double>(value,sup,inf)
00265                 {
00266                 }
00270                 BorneDDigitalType(double sup,double inf):IBornNombre<double>(sup,inf)
00271                 {
00272                 }               
00273 
00274                 BorneDDigitalType(const BorneDDigitalType &a): IBornNombre<double>(a)
00275                 {
00276                 }               
00277 
00279                 BorneDDigitalType(NLMISC::IStream &is):IBornNombre<double>(is)
00280                 {
00281                 }
00282 
00283 
00284                 virtual IObjetOp &neg()
00285                 {
00286                         _Value = -_Value;
00287                         chekBorn();
00288                         return *this;
00289                 }
00290 
00292 
00293                 virtual const NLAIC::IBasicType *clone() const
00294                 {
00295                         NLAIC::IBasicInterface *m = new BorneDDigitalType(*this);                       
00296                         return m;
00297                 }               
00298 
00299                 virtual const NLAIC::IBasicType *newInstance() const
00300                 {
00301                         return clone();
00302                 }
00303 
00304                 virtual const NLAIC::CIdentType &getType() const;                               
00305 
00306                 virtual const CProcessResult &run();
00307                 
00308                 virtual void getDebugString(std::string &text) const
00309                 {
00310                         text += NLAIC::stringGetBuild("%e [_inf<%e> _sup<%e>]",getValue(),getInf(),getSup());
00311                 }
00313 
00314         protected:              
00315         };
00316 
00317 
00327         class IntegerType: public IDigital<sint32>
00328         {
00329         public:
00330 
00331                 static const NLAIC::CIdentType IdIntegerType;
00332 
00333         public:
00334                 IntegerType(sint32 value):IDigital<sint32>(value)
00335                 {                       
00336                 }
00337 
00338                 IntegerType():IDigital<sint32>()
00339                 {                       
00340                 }
00341 
00342                 IntegerType(const IntegerType &a):IDigital<sint32>(a)
00343                 {                       
00344                 }
00345 
00346                 IntegerType(NLMISC::IStream &is):IDigital<sint32>(is)
00347                 {
00348                 }
00349 
00350                 virtual IObjetOp &neg()
00351                 {
00352                         _Value = -_Value;
00353                         chekBorn();
00354                         return *this;
00355                 }
00356                 
00357 
00358                 virtual const NLAIC::IBasicType *clone() const
00359                 {
00360                         NLAIC::IBasicInterface *m = new IntegerType(*this);                     
00361                         return m;
00362                 }
00363                 
00364                 virtual const NLAIC::IBasicType *newInstance() const
00365                 {
00366                         return clone();
00367                 }
00368 
00369                 virtual const NLAIC::CIdentType &getType() const;               
00370                 
00371 
00372                 virtual void getDebugString(std::string &text) const
00373                 {
00374 
00375                         text += NLAIC::stringGetBuild("%d",getValue());
00376                 }               
00377 
00378                 virtual const CProcessResult &run();
00379         };
00380 
00390         class ShortIntegerType: public IDigital<sint16>
00391         {
00392         public:
00393 
00394                 static const NLAIC::CIdentType IdShortIntegerType;
00395 
00396         public:
00397                 ShortIntegerType(sint16 value):IDigital<sint16>(value)
00398                 {                       
00399                 }
00400 
00401                 ShortIntegerType():IDigital<sint16>()
00402                 {                       
00403                 }
00404 
00405                 ShortIntegerType(const ShortIntegerType &a):IDigital<sint16>(a)
00406                 {                       
00407                 }
00408 
00409                 ShortIntegerType(NLMISC::IStream &is):IDigital<sint16>(is)
00410                 {
00411                 }
00412 
00413                 virtual IObjetOp &neg()
00414                 {
00415                         _Value = -_Value;
00416                         chekBorn();
00417                         return *this;
00418                 }
00419                 
00420 
00421                 virtual const NLAIC::IBasicType *clone() const
00422                 {
00423                         NLAIC::IBasicInterface *m = new ShortIntegerType(*this);                        
00424                         return m;
00425                 }
00426                 
00427                 virtual const NLAIC::IBasicType *newInstance() const
00428                 {
00429                         return clone();
00430                 }
00431 
00432                 virtual const NLAIC::CIdentType &getType() const;               
00433                 
00434 
00435                 virtual void getDebugString(std::string &text) const
00436                 {
00437                         text += NLAIC::stringGetBuild("%d",getValue());
00438                 }               
00439 
00440                 virtual const CProcessResult &run();
00441         };
00442 
00452         class CharType: public IDigital<sint8>
00453         {
00454         public:
00455 
00456                 static const NLAIC::CIdentType IdCharType;
00457 
00458         public:
00459                 CharType(sint8 value):IDigital<sint8>(value)
00460                 {                       
00461                 }
00462 
00463                 CharType():IDigital<sint8>()
00464                 {                       
00465                 }
00466 
00467                 CharType(const CharType &a):IDigital<sint8>(a)
00468                 {                       
00469                 }
00470 
00471                 CharType(NLMISC::IStream &is):IDigital<sint8>(is)
00472                 {
00473                 }
00474 
00475                 virtual IObjetOp &neg()
00476                 {
00477                         _Value = -_Value;
00478                         chekBorn();
00479                         return *this;
00480                 }
00481                 
00482                 virtual const NLAIC::IBasicType *clone() const
00483                 {
00484                         NLAIC::IBasicInterface *m = new CharType(*this);                        
00485                         return m;
00486                 }
00487                 
00488                 virtual const NLAIC::IBasicType *newInstance() const
00489                 {
00490                         return clone();
00491                 }
00492 
00493                 virtual const NLAIC::CIdentType &getType() const;               
00494                 
00495 
00496                 virtual void getDebugString(std::string &text) const
00497                 {
00498                         text += NLAIC::stringGetBuild("%d",getValue());
00499                 }               
00500 
00501                 virtual const CProcessResult &run();
00502         };
00503 
00504         
00514         class UInt8Type: public IDigital<uint8>
00515         {
00516         public:
00517 
00518                 static const NLAIC::CIdentType IdUInt8Type;
00519 
00520         public:
00521                 UInt8Type(sint8 value):IDigital<uint8>(value)
00522                 {                       
00523                 }
00524 
00525                 UInt8Type():IDigital<uint8>()
00526                 {                       
00527                 }
00528 
00529                 UInt8Type(const UInt8Type &a):IDigital<uint8>(a)
00530                 {                       
00531                 }
00532 
00533                 UInt8Type(NLMISC::IStream &is):IDigital<uint8>(is)
00534                 {
00535                 }
00536 
00537                 
00538                 virtual const NLAIC::IBasicType *clone() const
00539                 {
00540                         NLAIC::IBasicInterface *m = new UInt8Type(*this);                       
00541                         return m;
00542                 }
00543                 
00544                 virtual const NLAIC::IBasicType *newInstance() const
00545                 {
00546                         return clone();
00547                 }
00548 
00549                 virtual const NLAIC::CIdentType &getType() const;               
00550                 
00551 
00552                 virtual void getDebugString(std::string &text) const
00553                 {
00554                         text += NLAIC::stringGetBuild("%d",getValue());
00555                 }               
00556 
00557                 virtual const CProcessResult &run();
00558 
00559                 virtual IObjetOp &neg()
00560                 {
00561                         chekBorn();
00562                         return *this;
00563                 }
00564         };
00565 
00575         class UInt16Type: public IDigital<uint16>
00576         {
00577         public:
00578 
00579                 static const NLAIC::CIdentType IdUInt16Type;
00580 
00581         public:
00582                 UInt16Type(uint16 value):IDigital<uint16>(value)
00583                 {                       
00584                 }
00585 
00586                 UInt16Type():IDigital<uint16>()
00587                 {                       
00588                 }
00589 
00590                 UInt16Type(const UInt16Type &a):IDigital<uint16>(a)
00591                 {                       
00592                 }
00593 
00594                 UInt16Type(NLMISC::IStream &is):IDigital<uint16>(is)
00595                 {
00596                 }
00597                 
00598                 virtual const NLAIC::IBasicType *clone() const
00599                 {
00600                         NLAIC::IBasicInterface *m = new UInt16Type(*this);                      
00601                         return m;
00602                 }
00603                 
00604                 virtual const NLAIC::IBasicType *newInstance() const
00605                 {
00606                         return clone();
00607                 }
00608 
00609                 virtual const NLAIC::CIdentType &getType() const;               
00610                 
00611 
00612                 virtual void getDebugString(std::string &text) const
00613                 {
00614                         text += NLAIC::stringGetBuild("%d",getValue());
00615                 }               
00616 
00617                 virtual const CProcessResult &run();
00618 
00619                 virtual IObjetOp &neg()
00620                 {
00621                         chekBorn();
00622                         return *this;
00623                 }
00624 
00625         };
00626 
00634         class UInt32Type: public IDigital<uint32>
00635         {
00636         public:
00637 
00638                 static const NLAIC::CIdentType IdUInt32Type;
00639 
00640         public:
00641                 UInt32Type(uint32 value):IDigital<uint32>(value)
00642                 {                       
00643                 }
00644 
00645                 UInt32Type():IDigital<uint32>()
00646                 {                       
00647                 }
00648 
00649                 UInt32Type(const UInt32Type &a):IDigital<uint32>(a)
00650                 {                       
00651                 }
00652 
00653                 UInt32Type(NLMISC::IStream &is):IDigital<uint32>(is)
00654                 {
00655                 }
00656                 
00657                 virtual const NLAIC::IBasicType *clone() const
00658                 {
00659                         NLAIC::IBasicInterface *m = new UInt32Type(*this);                      
00660                         return m;
00661                 }
00662                 
00663                 virtual const NLAIC::IBasicType *newInstance() const
00664                 {
00665                         return clone();
00666                 }
00667 
00668                 virtual const NLAIC::CIdentType &getType() const;               
00669                 
00670 
00671                 virtual void getDebugString(std::string &text) const
00672                 {
00673                         text += NLAIC::stringGetBuild("%d",getValue());
00674                 }               
00675 
00676                 virtual const CProcessResult &run();
00677 
00678                 virtual IObjetOp &neg()
00679                 {
00680                         chekBorn();
00681                         return *this;
00682                 }
00683 
00684         };
00685 
00693         class UInt64Type: public INombre<uint64>
00694         {
00695         public:
00696 
00697                 static const NLAIC::CIdentType IdUInt64Type;
00698 
00699         public:
00700                 UInt64Type(uint64 value):INombre<uint64>(value)
00701                 {                       
00702                 }
00703 
00704                 UInt64Type():INombre<uint64>()
00705                 {                       
00706                 }
00707 
00708                 UInt64Type(const UInt64Type &a):INombre<uint64>(a)
00709                 {                       
00710                 }
00711 
00712                 UInt64Type(NLMISC::IStream &is):INombre<uint64>(is)
00713                 {
00714                 }
00715                 
00716                 virtual const NLAIC::IBasicType *clone() const
00717                 {
00718                         NLAIC::IBasicInterface *m = new UInt64Type(*this);
00719                         return m;
00720                 }
00721                 
00722                 virtual const NLAIC::IBasicType *newInstance() const
00723                 {
00724                         return clone();
00725                 }
00726 
00727                 virtual const NLAIC::CIdentType &getType() const;               
00728                 
00729 
00730                 virtual void getDebugString(std::string &text) const
00731                 {
00732                         text += NLAIC::stringGetBuild("%d",getValue());
00733                 }               
00734 
00735                 virtual const CProcessResult &run();
00736 
00737                 virtual double getNumber() const;               
00738 
00739                 virtual IObjetOp &neg()
00740                 {
00741                         chekBorn();
00742                         return *this;
00743                 }
00744 
00745         };
00746 
00747 }
00748 #endif