# 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 {       
00044         class DigitalType : public INombre<float>
00045         {
00046 
00047         public:
00048                 static DigitalType NullOperator;
00049 
00050                 static const NLAIC::CIdentType IdDigitalType;
00051 
00052         public:
00054                 DigitalType(float value):INombre<float>(value)
00055                 {                       
00056                 }
00057 
00059                 DigitalType():INombre<float>()
00060                 {                       
00061                 }
00062                 
00063                 DigitalType(const DigitalType &a):INombre<float>(a)
00064                 {                       
00065                 }
00066 
00068                 DigitalType(NLMISC::IStream &is):INombre<float>(is)
00069                 {
00070                 }
00071                 
00073 
00074                 virtual const NLAIC::IBasicType *clone() const
00075                 {
00076                         NLAIC::IBasicInterface *m = new DigitalType(*this);                     
00077                         return m;
00078                 }
00079                 
00080                 virtual const NLAIC::IBasicType *newInstance() const
00081                 {
00082                         return clone();
00083                 }
00084 
00085                 virtual const NLAIC::CIdentType &getType() const;               
00086                 
00087 
00088                 virtual void getDebugString(char *text) const
00089                 {
00090                         sprintf(text,"<float> %f",getValue());
00091                 }               
00092 
00093                 virtual const CProcessResult &run();
00095         };
00096 
00105         class BorneDigitalType: public IBornNombre<float>
00106         {                       
00107 
00108         public:
00109                 static const NLAIC::CIdentType IdBorneDigitalType;
00110 
00111         public:
00112 
00116                 BorneDigitalType(float sup,float inf,float value): IBornNombre<float>(value,sup,inf)
00117                 {
00118                 }
00122                 BorneDigitalType(float sup,float inf):IBornNombre<float>(sup,inf)
00123                 {
00124                 }               
00125 
00126                 BorneDigitalType(const BorneDigitalType &a): IBornNombre<float>(a)
00127                 {
00128                 }                               
00129 
00131                 BorneDigitalType(NLMISC::IStream &is):IBornNombre<float>(is)
00132                 {
00133                 }
00134 
00136 
00137                 virtual const NLAIC::IBasicType *clone() const
00138                 {
00139                         NLAIC::IBasicInterface *m = new BorneDigitalType(*this);                        
00140                         return m;
00141                 }               
00142 
00143                 virtual const NLAIC::IBasicType *newInstance() const
00144                 {
00145                         return clone();
00146                 }
00147 
00148                 virtual const NLAIC::CIdentType &getType() const;                               
00149 
00150                 virtual const CProcessResult &run();
00151                 
00152                 virtual void getDebugString(char *text) const
00153                 {
00154                         sprintf(text,"_Value<%f> [_inf<%f> _sup<%f>]",getValue(),getInf(),getSup());
00155                 }
00157 
00158         protected:              
00159         };
00160 
00171         class DDigitalType : public INombre<double>
00172         {
00173 
00174         public:
00175                 static const NLAIC::CIdentType IdDDigitalType;
00176 
00177         public:
00179                 DDigitalType(double value):INombre<double>(value)
00180                 {                       
00181                 }
00182 
00184                 DDigitalType():INombre<double>()
00185                 {                       
00186                 }
00187                 
00188                 DDigitalType(const DDigitalType &a):INombre<double>(a)
00189                 {                       
00190                 }
00191 
00193                 DDigitalType(NLMISC::IStream &is):INombre<double>(is)
00194                 {
00195                 }
00196                 
00198 
00199                 virtual const NLAIC::IBasicType *clone() const
00200                 {
00201                         NLAIC::IBasicInterface *m = new DDigitalType(*this);                    
00202                         return m;
00203                 }
00204                 
00205                 virtual const NLAIC::IBasicType *newInstance() const
00206                 {
00207                         return clone();
00208                 }
00209 
00210                 virtual const NLAIC::CIdentType &getType() const;               
00211                 
00212 
00213                 virtual void getDebugString(char *text) const
00214                 {
00215                         sprintf(text,"%.5e",getValue());
00216                 }               
00217 
00218                 virtual const CProcessResult &run();
00220         };
00221 
00231         class BorneDDigitalType: public IBornNombre<double>
00232         {                       
00233 
00234         public:
00235                 static const NLAIC::CIdentType IdBorneDDigitalType;
00236 
00237         public:
00238 
00242                 BorneDDigitalType(double sup,double inf,double value): IBornNombre<double>(value,sup,inf)
00243                 {
00244                 }
00248                 BorneDDigitalType(double sup,double inf):IBornNombre<double>(sup,inf)
00249                 {
00250                 }               
00251 
00252                 BorneDDigitalType(const BorneDDigitalType &a): IBornNombre<double>(a)
00253                 {
00254                 }                               
00255 
00257                 BorneDDigitalType(NLMISC::IStream &is):IBornNombre<double>(is)
00258                 {
00259                 }
00260 
00262 
00263                 virtual const NLAIC::IBasicType *clone() const
00264                 {
00265                         NLAIC::IBasicInterface *m = new BorneDDigitalType(*this);                       
00266                         return m;
00267                 }               
00268 
00269                 virtual const NLAIC::IBasicType *newInstance() const
00270                 {
00271                         return clone();
00272                 }
00273 
00274                 virtual const NLAIC::CIdentType &getType() const;                               
00275 
00276                 virtual const CProcessResult &run();
00277                 
00278                 virtual void getDebugString(char *text) const
00279                 {
00280                         sprintf(text,"_Value<%e> [_inf<%e> _sup<%e>]",getValue(),getInf(),getSup());
00281                 }
00283 
00284         protected:              
00285         };
00286 
00287 
00297         class IntegerType: public INombre<sint32>
00298         {
00299         public:
00300 
00301                 static const NLAIC::CIdentType IdIntegerType;
00302 
00303         public:
00304                 IntegerType(sint32 value):INombre<sint32>(value)
00305                 {                       
00306                 }
00307 
00308                 IntegerType():INombre<sint32>()
00309                 {                       
00310                 }
00311 
00312                 IntegerType(const IntegerType &a):INombre<sint32>(a)
00313                 {                       
00314                 }
00315 
00316                 IntegerType(NLMISC::IStream &is):INombre<sint32>(is)
00317                 {
00318                 }
00319                 
00320 
00321                 virtual const NLAIC::IBasicType *clone() const
00322                 {
00323                         NLAIC::IBasicInterface *m = new IntegerType(*this);                     
00324                         return m;
00325                 }
00326                 
00327                 virtual const NLAIC::IBasicType *newInstance() const
00328                 {
00329                         return clone();
00330                 }
00331 
00332                 virtual const NLAIC::CIdentType &getType() const;               
00333                 
00334 
00335                 virtual void getDebugString(char *text) const
00336                 {
00337                         sprintf(text,"%d",getValue());
00338                 }               
00339 
00340                 virtual const CProcessResult &run();
00341         };
00342 
00352         class ShortIntegerType: public INombre<sint16>
00353         {
00354         public:
00355 
00356                 static const NLAIC::CIdentType IdShortIntegerType;
00357 
00358         public:
00359                 ShortIntegerType(sint16 value):INombre<sint16>(value)
00360                 {                       
00361                 }
00362 
00363                 ShortIntegerType():INombre<sint16>()
00364                 {                       
00365                 }
00366 
00367                 ShortIntegerType(const ShortIntegerType &a):INombre<sint16>(a)
00368                 {                       
00369                 }
00370 
00371                 ShortIntegerType(NLMISC::IStream &is):INombre<sint16>(is)
00372                 {
00373                 }
00374                 
00375 
00376                 virtual const NLAIC::IBasicType *clone() const
00377                 {
00378                         NLAIC::IBasicInterface *m = new ShortIntegerType(*this);                        
00379                         return m;
00380                 }
00381                 
00382                 virtual const NLAIC::IBasicType *newInstance() const
00383                 {
00384                         return clone();
00385                 }
00386 
00387                 virtual const NLAIC::CIdentType &getType() const;               
00388                 
00389 
00390                 virtual void getDebugString(char *text) const
00391                 {
00392                         sprintf(text,"%d",getValue());
00393                 }               
00394 
00395                 virtual const CProcessResult &run();
00396         };
00397 
00407         class CharType: public INombre<sint8>
00408         {
00409         public:
00410 
00411                 static const NLAIC::CIdentType IdCharType;
00412 
00413         public:
00414                 CharType(sint8 value):INombre<sint8>(value)
00415                 {                       
00416                 }
00417 
00418                 CharType():INombre<sint8>()
00419                 {                       
00420                 }
00421 
00422                 CharType(const CharType &a):INombre<sint8>(a)
00423                 {                       
00424                 }
00425 
00426                 CharType(NLMISC::IStream &is):INombre<sint8>(is)
00427                 {
00428                 }
00429                 
00430                 virtual const NLAIC::IBasicType *clone() const
00431                 {
00432                         NLAIC::IBasicInterface *m = new CharType(*this);                        
00433                         return m;
00434                 }
00435                 
00436                 virtual const NLAIC::IBasicType *newInstance() const
00437                 {
00438                         return clone();
00439                 }
00440 
00441                 virtual const NLAIC::CIdentType &getType() const;               
00442                 
00443 
00444                 virtual void getDebugString(char *text) const
00445                 {
00446                         sprintf(text,"%c",getValue());
00447                 }               
00448 
00449                 virtual const CProcessResult &run();
00450         };
00451 }
00452 
00453 
00454 #endif