Home | nevrax.com |
|
interpret_object.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_INTERPRET_OBJECT_H 00027 #define NL_INTERPRET_OBJECT_H 00028 00029 #include "nel/ai/agent/agent.h" 00030 #include "nel/ai/script/interpret_methodes.h" 00031 00032 namespace NLAISCRIPT 00033 { 00044 struct CComponent 00045 { 00047 NLAIAGENT::IVarName *RegisterName; 00049 NLAIAGENT::IVarName *ObjectName; 00051 NLAIAGENT::IObjectIA *StaticValue; 00052 00059 bool Local; 00060 bool Static; 00061 CComponent() 00062 { 00063 RegisterName = NULL; // name of the type of component in the registry 00064 ObjectName = NULL; // name of the member component in the class 00065 Local = false; // true if the object is not accessible from a remote machine 00066 Static = false; // true if the component is static (defined and stored in the class) 00067 StaticValue = NULL; // static value of the component, NULL if non static 00068 } 00072 virtual void save(NLMISC::IStream &); 00076 virtual void load(NLMISC::IStream &); 00077 }; 00078 00090 class IClassInterpret: public NLAIAGENT::IObjectIA 00091 { 00092 private: 00094 NLAIAGENT::IVarName *_Name; 00095 00096 protected: 00098 NLAIC::CIdentType *_IdType; 00099 00100 IClassInterpret(const NLAIAGENT::IVarName &,const IClassInterpret &); 00101 00102 public: 00104 virtual CComponent *getComponent(const NLAIAGENT::IVarName &) const = 0; 00105 00107 virtual CComponent *getComponent(sint32 i) const = 0; 00108 00109 public: 00110 00111 IClassInterpret(); 00112 IClassInterpret(NLAIC::CIdentType *idType); 00113 virtual ~IClassInterpret(); 00114 virtual const NLAIC::CIdentType &getType() const; 00115 void setType(NLAIC::CIdentType *idType); 00116 void setType(const NLAIAGENT::IVarName &, const IClassInterpret &); 00117 00119 virtual NLAIAGENT::IObjectIA *buildNewInstance() const = 0; 00120 00122 virtual sint32 registerComponent(const NLAIAGENT::IVarName &) = 0; 00123 00125 virtual sint32 getStaticMemberSize() const = 0; 00126 00128 00129 virtual sint32 addBrancheCode(const NLAIAGENT::IVarName &,const CParam &) = 0; 00130 virtual CMethodeName &getBrancheCode() const = 0; 00132 virtual CMethodeName &getBrancheCode(sint32) const= 0; 00134 virtual CMethodeName &getBrancheCode(sint32 h, sint32 m) const= 0; 00136 00138 virtual sint32 getRunMethod() const = 0; 00140 virtual void setRunMethod(sint32 index) = 0; 00141 00143 virtual void buildVTable() = 0; 00145 virtual const IClassInterpret *getInheritance(sint32 n) const = 0; 00147 virtual sint32 sizeVTable() const= 0; 00148 00150 virtual const NLAIAGENT::IVarName *getClassName() const; 00151 virtual void setClassName(const NLAIAGENT::IVarName &); 00152 00154 virtual void setInheritanceName(const NLAIAGENT::IVarName &name) = 0; 00155 00157 virtual const NLAIAGENT::IVarName *getInheritanceName() const = 0; 00158 00160 virtual const IClassInterpret *getBaseClass() const = 0; 00161 virtual const IClassInterpret *getComputeBaseClass() = 0; 00163 virtual const char *getComponentName(sint32 = 0) const = 0; 00164 00165 virtual NLAIAGENT::tQueue getPrivateMember(const NLAIAGENT::IVarName *,const NLAIAGENT::IVarName *,const NLAIAGENT::IObjectIA ¶m) const = 0; 00166 00167 const NLAIAGENT::IVarName *getName() const 00168 { 00169 return _Name; 00170 } 00171 00172 virtual NLAIC::CTypeOfObject getTypeClass() const 00173 { 00174 return NLAIC::CTypeOfObject::tInterpret; 00175 } 00176 00177 virtual void initStatics() 00178 { 00179 } 00180 }; 00181 00182 00183 00195 class CClassInterpretFactory: public NLAIC::IClassFactory 00196 { 00197 private: 00198 IClassInterpret *_Inst; 00199 public: 00200 CClassInterpretFactory(IClassInterpret *a); 00201 CClassInterpretFactory(const IClassInterpret &a); 00202 00204 00205 void setClass(const NLAIC::IBasicInterface &); 00206 virtual void getDebugString(std::string &) const; 00207 const NLAIC::IBasicType *clone() const; 00208 const NLAIC::IBasicType *newInstance() const; 00209 virtual const NLAIC::CIdentType &getType() const; 00210 const NLAIC::IBasicInterface *createInstance() const; 00211 const NLAIC::IBasicInterface *getClass() const; 00213 00214 virtual ~CClassInterpretFactory(); 00215 }; 00216 00217 00228 class CExceptionHaveNoType: public NLAIE::IException 00229 { 00230 public: 00231 00232 CExceptionHaveNoType(const CExceptionHaveNoType &e):NLAIE::IException(e) 00233 { 00234 } 00235 00236 CExceptionHaveNoType(const std::string &text):NLAIE::IException(text) 00237 { 00238 } 00239 00240 virtual const NLAIE::IException *clone() const 00241 { 00242 return new CExceptionHaveNoType(*this); 00243 } 00244 00245 virtual ~CExceptionHaveNoType() 00246 { 00247 } 00248 }; 00249 } 00250 #endif |