Home | nevrax.com |
|
object_load.hGo 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_OBJECT_LOAD_H 00027 #define NL_OBJECT_LOAD_H 00028 00029 namespace NLAISCRIPT 00030 { 00040 class ILoadObject: public NLAIC::IBasicInterface 00041 { 00042 public: 00043 ILoadObject() 00044 { 00045 00046 } 00047 00049 00050 00051 virtual const NLAIAGENT::IObjectIA *getObject(CCodeContext &context) const = 0; 00053 virtual const NLAIAGENT::IBaseGroupType *getParam(CCodeContext &context) const = 0; 00055 00056 virtual void getDebugString(std::string &) const{} 00057 virtual ~ILoadObject() 00058 { 00059 } 00060 }; 00061 00071 class CLoadSelfObject: public ILoadObject 00072 { 00073 public: 00074 static const NLAIC::CIdentType IdLoadSelfObject; 00075 private: 00076 std::list<sint32> _I; 00077 public: 00078 CLoadSelfObject() 00079 { 00080 } 00081 00082 CLoadSelfObject(const std::list<sint32> &i):_I(i) 00083 { 00084 } 00085 00086 00088 virtual const NLAIAGENT::IObjectIA *getObject(CCodeContext &context) const; 00090 virtual const NLAIAGENT::IBaseGroupType *getParam(CCodeContext &context) const; 00091 00092 00094 00095 virtual const NLAIC::CIdentType &getType() const 00096 { 00097 return IdLoadSelfObject; 00098 } 00099 00100 virtual const NLAIC::IBasicType *clone() const 00101 { 00102 NLAIC::IBasicType *x= new CLoadSelfObject(_I); 00103 return x; 00104 } 00105 00106 virtual const NLAIC::IBasicType *newInstance() const 00107 { 00108 NLAIC::IBasicType *x= new CLoadSelfObject(); 00109 return x; 00110 } 00111 00112 virtual void save(NLMISC::IStream &os) 00113 { 00114 std::list<sint32> &i = (std::list<sint32> &) _I; 00115 os.serialCont(i); 00116 } 00117 virtual void load(NLMISC::IStream &is) 00118 { 00119 is.serialCont(_I); 00120 } 00122 }; 00123 00124 class CLoadStackObject: public ILoadObject 00125 { 00126 public: 00127 static const NLAIC::CIdentType IdLoadSelfObject; 00128 private: 00129 std::list<sint32> _I; 00130 00131 public: 00132 CLoadStackObject(){} 00133 CLoadStackObject(const std::list<sint32> &i):_I(i) 00134 { 00135 } 00136 00138 virtual const NLAIAGENT::IObjectIA *getObject(CCodeContext &context) const; 00140 virtual const NLAIAGENT::IBaseGroupType *getParam(CCodeContext &context) const; 00141 00143 00144 virtual const NLAIC::CIdentType &getType() const 00145 { 00146 return IdLoadSelfObject; 00147 } 00148 00149 virtual const NLAIC::IBasicType *clone() const 00150 { 00151 NLAIC::IBasicType *x= new CLoadStackObject(_I); 00152 return x; 00153 } 00154 00155 virtual const NLAIC::IBasicType *newInstance() const 00156 { 00157 NLAIC::IBasicType *x= new CLoadStackObject(); 00158 return x; 00159 } 00160 00161 virtual void save(NLMISC::IStream &os) 00162 { 00163 std::list<sint32> &i = (std::list<sint32> &) _I; 00164 os.serialCont(i); 00165 } 00166 virtual void load(NLMISC::IStream &is) 00167 { 00168 is.serialCont(_I); 00169 } 00171 }; 00172 00173 class CLoadHeapObject: public ILoadObject 00174 { 00175 public: 00176 static const NLAIC::CIdentType IdLoadHeapObject; 00177 private: 00178 std::list<sint32> _I; 00179 sint32 _N; 00180 public: 00181 CLoadHeapObject(){} 00182 CLoadHeapObject(const std::list<sint32> &i,int n):_I(i),_N(n) 00183 { 00184 } 00185 00187 virtual const NLAIAGENT::IObjectIA *getObject(CCodeContext &context) const; 00189 virtual const NLAIAGENT::IBaseGroupType *getParam(CCodeContext &context) const; 00190 00192 00193 virtual const NLAIC::CIdentType &getType() const 00194 { 00195 return IdLoadHeapObject; 00196 } 00197 00198 virtual const NLAIC::IBasicType *clone() const 00199 { 00200 NLAIC::IBasicType *x= new CLoadHeapObject(_I,_N); 00201 return x; 00202 } 00203 00204 virtual const NLAIC::IBasicType *newInstance() const 00205 { 00206 NLAIC::IBasicType *x= new CLoadHeapObject(); 00207 return x; 00208 } 00209 00210 virtual void save(NLMISC::IStream &os) 00211 { 00212 std::list<sint32> &i = (std::list<sint32> &) _I; 00213 os.serialCont(i); 00214 sint32 n = _N; 00215 os.serial(n); 00216 } 00217 virtual void load(NLMISC::IStream &is) 00218 { 00219 is.serialCont(_I); 00220 is.serial(_N); 00221 } 00223 }; 00224 } 00225 00226 #endif |