# 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  

msg_getvalue.cpp

Go to the documentation of this file.
00001 
00006 /* Copyright, 2000 Nevrax Ltd.
00007  *
00008  * This file is part of NEVRAX NEL.
00009  * NEVRAX NEL is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2, or (at your option)
00012  * any later version.
00013 
00014  * NEVRAX NEL is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00017  * General Public License for more details.
00018 
00019  * You should have received a copy of the GNU General Public License
00020  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00021  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00022  * MA 02111-1307, USA.
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 &params) 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 }       // NLAIAGENT
00146 
00147 #endif // NL_MSGGETVALUE_H