00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef NL_MSGGETVALUE_H
00027 #define NL_MSGGETVALUE_H
00028
00029 #include "nel/ai/agent/msg_getvalue.h"
00030 #include "nel/ai/agent/agent_digital.h"
00031 #include "nel/ai/agent/object_type.h"
00032 #include "nel/ai/script/codage.h"
00033 #include "nel/ai/script/object_unknown.h"
00034 #include "nel/ai/script/interpret_message_getvalue.h"
00035
00036 namespace NLAIAGENT
00037 {
00038 CGetValueMsg::CGetValueMsg( std::list<IObjectIA *> &l, NLAISCRIPT::CMessageClass *b):CMessageScript(l,b)
00039 {
00040 set(0, new DigitalType(0) );
00041 }
00042
00043 CGetValueMsg::CGetValueMsg(NLAISCRIPT::CMessageClass *b) : CMessageScript(b)
00044 {
00045 CVectorGroupType *x = new CVectorGroupType(1);
00046 setMessageGroup(x);
00047 setGroup(CMessageGroup::msgScriptingGroup);
00048 set(0, new DigitalType(0) );
00049 }
00050
00051 CGetValueMsg::CGetValueMsg(IBasicAgent *agent):
00052 CMessageScript((NLAISCRIPT::CMessageClass *)NLAISCRIPT::CGetValueMsgClass::IdGetValueMsgClass.getFactory()->getClass())
00053 {
00054 CVectorGroupType *x = new CVectorGroupType(1);
00055 setMessageGroup(x);
00056 setGroup(CMessageGroup::msgScriptingGroup);
00057 set(0, new DigitalType(0) );
00058 }
00059
00060 CGetValueMsg::CGetValueMsg(const CGetValueMsg &m): CMessageScript(m)
00061 {
00062 }
00063
00064 CGetValueMsg::~CGetValueMsg()
00065 {
00066
00067 }
00068
00069 const NLAIC::IBasicType *CGetValueMsg::clone() const
00070 {
00071 const NLAIC::IBasicType *x;
00072 x = new CGetValueMsg(*this);
00073 return x;
00074 }
00075
00076 const NLAIC::CIdentType &CGetValueMsg::getType() const
00077 {
00078 if ( getCreatorClass() )
00079 return getCreatorClass()->getType();
00080 else
00081 return NLAISCRIPT::CGetValueMsgClass::IdGetValueMsgClass;
00082 }
00083
00084 void CGetValueMsg::getDebugString(std::string &t) const
00085 {
00086 const CStringType *c = (const CStringType *)getFront();
00087 std::string txt;
00088 c->getDebugString(txt);
00089 t += NLAIC::stringGetBuild("CGetValueMsg<%s>",txt.c_str());
00090 }
00091
00092
00093 tQueue CGetValueMsg::isMember(const IVarName *className,const IVarName *funcName,const IObjectIA ¶ms) const
00094 {
00095
00096 tQueue r;
00097
00098 if(className == NULL)
00099 {
00100 if( (*funcName) == CStringVarName( "Constructor" ) )
00101 {
00102
00103 r.push( CIdMethod( IMessageBase::getMethodIndexSize(), 0.0, NULL, new NLAISCRIPT::CObjectUnknown(new NLAISCRIPT::COperandVoid) ) );
00104 }
00105 }
00106
00107 if ( r.empty() )
00108 return CMessageScript::isMember(className, funcName, params);
00109 else
00110 return r;
00111 }
00112
00113 NLAIAGENT::IObjectIA::CProcessResult CGetValueMsg::runMethodeMember(sint32, sint32, NLAIAGENT::IObjectIA *)
00114 {
00115 return IObjectIA::CProcessResult();
00116 }
00117
00118 IObjectIA::CProcessResult CGetValueMsg::runMethodeMember(sint32 index, IObjectIA *context)
00119 {
00120 IBaseGroupType *arg = (IBaseGroupType *) ( (NLAISCRIPT::CCodeContext *)context )->Param.back();
00121
00122 switch( index - IMessageBase::getMethodIndexSize() )
00123 {
00124 case 0:
00125 {
00126 IObjectIA *param = (IObjectIA *) arg->get();
00127 arg->popFront();
00128 #ifdef NL_DEBUG
00129 std::string buffer;
00130 param->getDebugString( buffer );
00131 #endif
00132 set(0, param);
00133 }
00134 break;
00135 }
00136 return IObjectIA::CProcessResult();
00137 }
00138
00139 sint32 CGetValueMsg::getBaseMethodCount() const
00140 {
00141 return CMessageScript::getBaseMethodCount() + 1;
00142 }
00143
00144
00145 }
00146
00147 #endif // NL_MSGGETVALUE_H