# 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  

opcode_ldb.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_OPCODE_LDB_H
00026 #define NL_OPCODE_LDB_H
00027 
00028 namespace NLAISCRIPT
00029 {                       
00030         class CLdbOpCode : public IOpRunCode
00031         {
00032         public:
00033                 static const NLAIC::CIdentType IdLdbOpCode;
00034 
00035         private:
00036                 NLAIAGENT::IObjectIA *_B;
00037         public:
00038                 CLdbOpCode(const NLAIAGENT::IObjectIA &b);              
00039 
00040                 NLAIAGENT::TProcessStatement runOpCode(CCodeContext &context);
00041 
00042                 void getDebugResult(std::string &,CCodeContext &context) const;
00043 
00044                 const NLAIC::IBasicType *clone() const
00045                 {
00046                         NLAIC::IBasicType *x = new CLdbOpCode(*_B);
00047                         return x;
00048                 }
00049 
00050                 const NLAIC::IBasicType *newInstance() const 
00051                 {
00052                         return clone();
00053                 }
00054 
00055                 const NLAIC::CIdentType &getType() const
00056                 {
00057                         return IdLdbOpCode;
00058                 }
00059 
00060                 void getDebugString(std::string &) const{ }
00061 
00062                 void save(NLMISC::IStream &os)
00063                 {
00064                         os.serial( (NLAIC::CIdentType &) _B->getType() );
00065                         _B->save(os);           
00066                 }
00067 
00068                 void load(NLMISC::IStream &is) 
00069                 {
00070                         _B->release();
00071                         NLAIC::CIdentTypeAlloc id;
00072                         is.serial( id );
00073                         _B = (NLAIAGENT::IObjectIA *)id.allocClass();
00074                         _B->load(is);
00075                 }                               
00076                 
00077                 virtual ~CLdbOpCode()
00078                 {
00079                         _B->release();
00080                 }
00081         };
00082 
00083         class CLdbMemberOpCode : public IOpRunCode
00084         {
00085         public:
00086                 static const NLAIC::CIdentType IdLdbMemberOpCode;
00087         private:
00088                 int _B;
00089         public:
00090                 CLdbMemberOpCode(int b):
00091                 _B(b)
00092                 {
00093                 }
00094                 
00095 
00096                 NLAIAGENT::TProcessStatement runOpCode(CCodeContext &context);          
00097 
00098                 void getDebugResult(std::string &str,CCodeContext &context) const;              
00099 
00100                 const NLAIC::IBasicType *clone() const
00101                 {
00102                         NLAIC::IBasicType *x = new CLdbMemberOpCode(_B);
00103                         return x;
00104                 }
00105 
00106                 const NLAIC::IBasicType *newInstance() const 
00107                 {
00108                         return clone();
00109                 }
00110 
00111                 const NLAIC::CIdentType &getType() const
00112                 {
00113                         return IdLdbMemberOpCode;
00114                 }               
00115 
00116                 void getDebugString(std::string &) const{ }
00117 
00118                 void save(NLMISC::IStream &os)
00119                 {
00120                         sint32 b = (sint32) _B;
00121                         os.serial( b );
00122                 }
00123 
00124                 void load(NLMISC::IStream &is) 
00125                 {                       
00126                         sint32 b;
00127                         is.serial(b);                   
00128                         _B = (int) b;
00129                 }                               
00130                 
00131                 virtual ~CLdbMemberOpCode()
00132                 {                       
00133                 }
00134         };
00135 
00136         class CLdbStackMemberiOpCode : public IOpRunCode
00137         {
00138         public:
00139                 static const NLAIC::CIdentType IdLdbStackMemberiOpCode;
00140         private:                
00141                  std::list<sint32> _I;
00142         public:
00143                 CLdbStackMemberiOpCode(std::list<sint32> b):
00144                 _I(b)
00145                 {
00146                 }
00147 
00148                 NLAIAGENT::TProcessStatement runOpCode(CCodeContext &context);          
00149 
00150                 void getDebugResult(std::string &str,CCodeContext &context) const;              
00151 
00152                 const NLAIC::IBasicType *clone() const
00153                 {
00154                         NLAIC::IBasicType *x = new CLdbStackMemberiOpCode(_I);
00155                         return x;
00156                 }
00157 
00158                 const NLAIC::IBasicType *newInstance() const 
00159                 {
00160                         return clone();
00161                 }
00162 
00163                 const NLAIC::CIdentType &getType() const
00164                 {
00165                         return IdLdbStackMemberiOpCode;
00166                 }
00167 
00168                 void getDebugString(std::string &) const{ }
00169 
00170                 void save(NLMISC::IStream &os)
00171                 {                       
00172                         std::list<sint32> &i = (std::list<sint32> &)_I;
00173                         os.serialCont(i);
00174                 }
00175 
00176                 void load(NLMISC::IStream &is) 
00177                 {                               
00178                         is.serialCont(_I);
00179                 }
00180                 
00181                 virtual ~CLdbStackMemberiOpCode()
00182                 {                       
00183                 }
00184         };
00185 
00186         class CLdbHeapMemberiOpCode : public IOpRunCode
00187         {
00188         public:
00189                 static const NLAIC::CIdentType IdLdbHeapMemberiOpCode;
00190         private:
00191                 std::list<sint32> _I;
00192                 sint32 _N;
00193         public:
00194                 CLdbHeapMemberiOpCode(const std::list<sint32> &b,sint32 n):
00195                 _I(b),_N(n)
00196                 {
00197                 }
00198 
00199                 NLAIAGENT::TProcessStatement runOpCode(CCodeContext &context);
00200 
00201                 void getDebugResult(std::string &str,CCodeContext &context) const;              
00202 
00203                 const NLAIC::IBasicType *clone() const
00204                 {
00205                         NLAIC::IBasicType *x = new CLdbHeapMemberiOpCode(_I,_N);
00206                         return x;
00207                 }
00208 
00209                 const NLAIC::IBasicType *newInstance() const 
00210                 {
00211                         return clone();
00212                 }
00213 
00214                 const NLAIC::CIdentType &getType() const
00215                 {
00216                         return IdLdbHeapMemberiOpCode;
00217                 }
00218 
00219                 void getDebugString(std::string &) const{ }
00220 
00221                 void save(NLMISC::IStream &os)
00222                 {                       
00223                         std::list<sint32> &i = (std::list<sint32> &) _I;
00224                         os.serialCont(i);
00225                         sint32 n = _N;
00226                         os.serial(n);
00227                 }
00228 
00229                 void load(NLMISC::IStream &is) 
00230                 {                               
00231                         is.serialCont(_I);
00232                         is.serial(_N);
00233                 }
00234                 
00235                 virtual ~CLdbHeapMemberiOpCode()
00236                 {                       
00237                 }
00238         };
00239 
00240         class CLdbMemberiOpCode : public IOpRunCode
00241         {
00242         public:
00243                 static const NLAIC::CIdentType IdLdbMemberiOpCode;
00244         private:
00245                 std::list<sint32> _I;
00246         public:
00247                 CLdbMemberiOpCode(std::list<sint32> b):
00248                 _I(b)
00249                 {
00250                 }
00251 
00252                 NLAIAGENT::TProcessStatement runOpCode(CCodeContext &context);          
00253 
00254                 void getDebugResult(std::string &str,CCodeContext &context) const;              
00255 
00256                 const NLAIC::IBasicType *clone() const
00257                 {
00258                         NLAIC::IBasicType *x = new CLdbMemberiOpCode(_I);
00259                         return x;
00260                 }
00261 
00262                 const NLAIC::IBasicType *newInstance() const 
00263                 {
00264                         return clone();
00265                 }
00266 
00267                 const NLAIC::CIdentType &getType() const
00268                 {
00269                         return IdLdbMemberiOpCode;
00270                 }
00271 
00272                 void getDebugString(std::string &) const{ }
00273 
00274                 void save(NLMISC::IStream &os)
00275                 {                       
00276                         std::list<sint32> &i = (std::list<sint32> &)_I;
00277                         os.serialCont(i);
00278                 }
00279 
00280                 void load(NLMISC::IStream &is) 
00281                 {       
00282                         is.serialCont(_I);
00283                 }
00284                 
00285                 virtual ~CLdbMemberiOpCode()
00286                 {                       
00287                 }
00288         };
00289 
00290         class CLdbRefOpCode : public IOpRunCode
00291         {
00292         public:
00293                 static const NLAIC::CIdentType IdLdbRefOpCode;
00294         private:
00295                 int _B;
00296         public:
00297                 CLdbRefOpCode(int b):
00298                 _B(b)
00299                 {                       
00300                 }
00301                 
00302                 NLAIAGENT::TProcessStatement runOpCode(CCodeContext &context);          
00303 
00304                 void getDebugResult(std::string &str,CCodeContext &context) const;
00305 
00306                 const NLAIC::IBasicType *clone() const
00307                 {
00308                         NLAIC::IBasicType *x = new CLdbRefOpCode(_B);
00309                         return x;
00310 
00311                 }
00312 
00313                 const NLAIC::IBasicType *newInstance() const 
00314                 {
00315                         return clone();
00316                 }
00317 
00318                 const NLAIC::CIdentType &getType() const
00319                 {
00320                         return IdLdbRefOpCode;
00321                 }               
00322 
00323                 void save(NLMISC::IStream &os)
00324                 {
00325                         sint32 b = (sint32) _B;
00326                         os.serial( b );
00327                 }
00328 
00329                 void load(NLMISC::IStream &is) 
00330                 {                               
00331                         sint32 b;
00332                         is.serial( b );
00333                         _B = (int) b;
00334                 }               
00335 
00336                 virtual ~CLdbRefOpCode()
00337                 {                       
00338                 }
00339                 
00340         };
00341 }
00342 
00343 #endif