Home | nevrax.com |
|
interpret_methodes.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 #ifndef NL_INTERPRET_METHODE_H 00026 #define NL_INTERPRET_METHODE_H 00027 00028 #include "nel/ai/script/virtual_op_code.h" 00029 #include "nel/ai/agent/agent.h" 00030 00031 namespace NLAISCRIPT 00032 { 00033 class IOpType; 00034 00046 class CParam : public NLAIAGENT::IObjectIA 00047 { 00048 private: 00049 typedef std::vector<IOpType *> tParam; 00050 private: 00052 tParam _Param; 00053 NLAIAGENT::IBaseGroupType *_ParamInfo; 00054 00055 public: 00056 static const NLAIC::CIdentType IdParam; 00057 00058 CParam(); 00059 00060 CParam(const CParam &); 00061 00062 /* 00063 This constructor allow to define an inline for defining method arg. 00064 for use that you must give the nomber of IOpType* that define the maethod argument. 00065 \code 00066 exemple: 00067 CParam(3,new COperandVoid(),new COperandSimple(new NLAIC::CIdentType(NLAIAGENT::IntegerType::IdIntegerType)), 00068 new COperandSimple(new NLAIC::CIdentType(NLAIAGENT::IntegerType::IdIntegerType))); 00069 \endcode 00070 */ 00071 CParam(int count, ...); 00072 00073 virtual ~CParam(); 00075 bool operator == (const CParam &p) const; 00076 00084 double eval(const CParam &p) const; 00086 void operator = (const CParam &p); 00088 const IOpType *operator[] (sint32 i) const; 00090 void push(const NLAIAGENT::IBaseGroupType &); 00092 void push(const IOpType &); 00094 void push(IOpType *i); 00095 00097 const IOpType &get() const; 00099 void pop(); 00101 void clear(); 00103 sint32 size() const; 00104 00106 00107 virtual const NLAIC::CIdentType &getType() const; 00108 virtual const NLAIC::IBasicType *clone() const; 00109 virtual const NLAIC::IBasicType *newInstance() const; 00110 virtual void getDebugString(std::string &) const; 00111 virtual bool isEqual(const NLAIAGENT::IBasicObjectIA &) const; 00112 void load(NLMISC::IStream &); 00113 void save(NLMISC::IStream &); 00114 virtual const NLAIAGENT::IObjectIA::CProcessResult &run(); 00116 00117 const NLAIAGENT::IBaseGroupType *getInfo() const 00118 { 00119 return _ParamInfo; 00120 } 00121 00122 void setInfo(NLAIAGENT::IBaseGroupType *); 00123 00124 void getString(std::string &txt) const; 00125 }; 00126 00136 class CMethodeName : public NLAIAGENT::IObjectIA 00137 { 00138 private: 00140 NLAIAGENT::IVarName *_MethodeName; 00142 IOpCode *_Code; 00144 CParam _Param; 00146 IOpType *_TypeOfMethode; 00147 00148 public: 00149 static const NLAIC::CIdentType IdMethodeName; 00150 00151 CMethodeName(const NLAIAGENT::IVarName &name); 00152 CMethodeName(const CMethodeName &); 00153 CMethodeName(); 00154 virtual ~CMethodeName(); 00155 void setName(const NLAIAGENT::IVarName &name); 00156 const NLAIAGENT::IVarName &getName() const; 00157 void setParam(const CParam &p); 00158 void setTypeOfMethode(IOpType *); 00159 CParam &getParam(); 00160 void setCode(IOpCode *c); 00161 IOpCode *getCode(); 00162 const IOpType *getTypeOfMethode() const; 00163 00165 00166 void load(NLMISC::IStream &); 00167 void save(NLMISC::IStream &); 00168 virtual const NLAIC::CIdentType &getType() const; 00169 virtual const NLAIC::IBasicType *clone() const; 00170 const NLAIC::IBasicType *newInstance() const; 00171 virtual void getDebugString(std::string &) const; 00172 virtual bool isEqual(const NLAIAGENT::IBasicObjectIA &) const; 00173 virtual const NLAIAGENT::IObjectIA::CProcessResult &run(); 00175 }; 00176 } 00177 #endif |