#include <agent_timer.h>
Inheritance diagram for NLAIAGENT::CAgentManagerTimer:
IAgentManager member method. | |
virtual const IObjectIA * | getAgentContext () const |
Get an valid context for this instance. | |
virtual int | getBaseMethodCount () const |
Get an valid context for this instance. | |
[NOHEADER] | |
virtual const NLAILOGIC::CFactBase * | getFactBase () |
Get the fact base of the agent, if not exist it return NULL. | |
virtual void | removeGoal (NLAILOGIC::CGoal *) |
remove a goal, it hapend when it neaded by user, when the priorty is down or when the goal is satisfay. | |
virtual IObjectIA::CProcessResult | runCancelGoalMsg (IBaseGroupType *) |
Cancel a goal, it call by message manager when a cancel goal message is occure. | |
virtual IObjectIA::CProcessResult | runFactMsg (IBaseGroupType *) |
Add a fact on the fact base, it occur when a fact message hapend. | |
virtual IObjectIA::CProcessResult | runGoalMsg (IBaseGroupType *) |
Run all goal message, it call by message manager when a goal message is occure. | |
virtual void | setTopLevel (NLAIAGENT::CAgentScript *) |
Set the top level agent of this one. | |
Base class member method. | |
virtual std::string | getMethodeMemberDebugString (sint32, sint32) const |
virtual sint32 | getMethodIndexSize () const |
virtual TQueue | getPrivateMember (const IVarName *, const NLAIAGENT::IVarName *, const IObjectIA &) const |
virtual const IObjectIA * | getStaticMember (sint32) const |
virtual sint32 | getStaticMemberIndex (const IVarName &) const |
virtual sint32 | getStaticMemberSize () const |
virtual sint32 | isClassInheritedFrom (const NLAIAGENT::IVarName &) const |
virtual TQueue | isDeflautProccessMsg (const IVarName *, const NLAIAGENT::IVarName *, const IObjectIA &) const |
virtual bool | isEqual (const IBasicObjectIA &a) const |
Implementation of the isEqual of the IBasicObjectIA. | |
virtual TQueue | isMember (const IVarName *, const NLAIAGENT::IVarName *, const IObjectIA &) const |
virtual void | onKill (IConnectIA *A) |
Called by an agent who's destroyed te remove its references. | |
virtual void | processContinuation (IMessageBase *, IMessageBase *) |
virtual void | processMessages (IMessageBase *, IObjectIA *) |
virtual void | processMessages () |
virtual const IObjectIA::CProcessResult & | run () |
virtual void | runChildren () |
virtual bool | runChildrenStepByStep () |
Activates the child agents. | |
virtual IObjectIA::CProcessResult | runMethodBase (int index, IObjectIA *) |
virtual IObjectIA::CProcessResult | runMethodBase (int heritance, int index, IObjectIA *) |
virtual IObjectIA::CProcessResult | runMethodeMember (sint32 index, IObjectIA *) |
virtual IObjectIA::CProcessResult | runMethodeMember (sint32 heritance, sint32 index, IObjectIA *) |
virtual const CProcessResult & | runStep () |
virtual CProcessResult | sendMessage (const IVarName &, IObjectIA *) |
virtual CProcessResult | sendMessage (IObjectIA *) |
CProcessResult | sendMessageToDynmaicChild (const IVarName &, IObjectIA *) |
IObjectIA::CProcessResult | sendMethod (IObjectIA *) |
IObjectIA::CProcessResult | sendMethodCompoment (IObjectIA *) |
virtual bool | setStaticMember (sint32, IObjectIA *) |
Public Types | |
enum | TMethodNumDef { TSend, TSendComponent, TGetChildTag, TAddChildTag, TRemoveChild, TFather, TSelf, TGetName, TIsInherited, TGetClassName, TRunTellComponent, TRunAskComponent, TRunAskParentNotify, TRunTellParentNotify, TRunAskDebugString, TSetStatic, TGetValue, TSetValue, TDeflautProccessMsg, TInitComponent, TIsEUU, TAddSet, TLastM } |
This enum define ident for hard coded method that we have to import its under the script. More... | |
enum | TTypeCheck { CheckAll, CheckCount, DoNotCheck } |
Public Member Functions | |
virtual void | addSet (const std::string &) |
Add a set for the agent. | |
virtual std::set< std::string >::const_iterator | beginSet () const |
CAgentManagerTimer (IAgentManager *, IBasicAgent *, std::list< IObjectIA * > &, NLAISCRIPT::CAgentClass *) | |
CAgentManagerTimer (IAgentManager *) | |
CAgentManagerTimer (const CAgentManagerTimer &) | |
virtual void | callConstructor () |
virtual void | callFunction (std::string &, NLAIAGENT::IObjectIA *p=NULL) |
virtual TQueue | canProcessMessage (const IVarName &) |
void | connect (IConnectIA *b) |
sint32 | decRef () |
Decrement the reference of an object. | |
virtual std::set< std::string >::const_iterator | endSet () const |
virtual sint | getChildCoun () const |
const NLAISCRIPT::CAgentClass * | getClass () const |
virtual const NLAIAGENT::IVarName * | getClassName () const |
Returns the name of the class in the registry. | |
virtual const std::vector< NLAILOGIC::CGoal * > * | getGoalStack () |
virtual const CIdent | getIdentType () const |
virtual const std::string | getInfo () |
IMailBox * | getMail () const |
Get the mail box letter. | |
virtual const IRefrence * | getOwner () const |
To get the top level parent of this agent. | |
IConnectIA * | getParent () const |
to get the agent parents | |
const sint32 & | getRef () const |
get the refence count. | |
virtual const CProcessResult & | getState () const |
Get the curent state of the agent. | |
const IObjectIA * | getStaticMember (const IVarName &compName) const |
virtual NLAILOGIC::CGoal * | getTopGoal () |
virtual bool | haveActivity () const |
allow to know if the agent have an activity process to run. | |
void | incRef () |
Inc a reference. We use this when we have to conserve a pointer memeory for exemple in a list. | |
virtual void | init (IObjectIA *) |
virtual bool | isa (const std::string &) const |
Test the set of the agent. | |
virtual sint32 | isClassInheritedFrom (const IVarName &) const |
virtual bool | isLocal () |
If the result is true the object is loclal else its a representation of an object on the server. By the method return true. | |
virtual void | Kill () |
Call this function to destroy an agent including its referneces in other agents and its childs. | |
operator const IWordNumRef & () const | |
to get a word num ref of the agents. | |
operator const IWordNumRef * () const | |
to get a word num ref pointer of the agents. | |
bool | operator== (const IBasicObjectIA &classType) const |
virtual void | release () |
Release allow to release the pointer. The last release when the _Ref is nul delete the object. | |
void | removeConnection (IConnectIA *Agent) |
To release a connection. | |
virtual IObjectIA::CProcessResult | runActivity () |
Mailer do'nt have own activity. | |
virtual IObjectIA::CProcessResult | sendMessage (IMessageBase *msg, IBasicAgent &receiver) |
Send message to an receiver agent. | |
virtual IObjectIA::CProcessResult | sendMessage (IMessageBase *msg) |
Send a message to the agent. | |
virtual void | serial (NLMISC::IStream &f) throw (NLMISC::EStream) |
virtual void | setParent (const IWordNumRef *parent) |
to set the parent of the agents. | |
virtual void | setState (TProcessStatement s, IObjectIA *result) |
Set the state of an agent. | |
bool | setStaticMember (const IVarName &compName, IObjectIA *change) |
void | setTypeAt (uint64 t) |
That function allow user to change the 7 bit of the type field in the sid agent number;. | |
virtual | ~CAgentManagerTimer () |
NLAIC::IBasicInterface base class method. | |
virtual const NLAIC::IBasicType * | clone () const |
virtual void | getDebugString (std::string &t) const |
virtual const NLAIC::CIdentType & | getType () const |
virtual void | load (NLMISC::IStream &is) |
virtual const NLAIC::IBasicType * | newInstance () const |
virtual void | save (NLMISC::IStream &os) |
Static Public Member Functions | |
void | initAgentScript () |
void | initClass () |
void | releaseAgentScript () |
void | releaseClass () |
Static Public Attributes | |
const int | ClockTick = 40 |
const NLAIC::CIdentType * | IdAgent = NULL |
const NLAIC::CIdentType | IdAgentScript |
const NLAIC::CIdentType * | IdAgentTimer = NULL |
NLAISCRIPT::COperandSimpleListOr * | IdMsgNotifyParent = NULL |
NLAISCRIPT::COperandSimple * | IdMsgNotifyParentClass = NULL |
bool | IsRunning = false |
NLAISCRIPT::COperandSimpleListOr * | msgPerf = NULL |
NLAISCRIPT::COperandSimpleListOr * | msgType = NULL |
NLAISCRIPT::CParam * | ParamGetValueMsg = NULL |
NLAISCRIPT::COperandSimpleListOr * | ParamIdGetValueMsg = NULL |
NLAISCRIPT::COperandSimpleListOr * | ParamIdInitComponentMsg = NULL |
NLAISCRIPT::COperandSimpleListOr * | ParamIdSetValueMsg = NULL |
NLAISCRIPT::COperandSimpleListOr * | ParamIdTellComponentMsg = NULL |
NLAISCRIPT::CParam * | ParamInitComponentMsg = NULL |
NLAISCRIPT::CParam * | ParamRunParentNotify = NULL |
NLAISCRIPT::CParam * | ParamSetStatic |
NLAISCRIPT::CParam * | ParamSetValueMsg = NULL |
NLAISCRIPT::CParam * | ParamTellComponentMsg = NULL |
TProcessStatement | ProcessBuzzy = processBuzzy |
TProcessStatement | ProcessEnd = processEnd |
TProcessStatement | ProcessError = processError |
TProcessStatement | ProcessIdle = processIdle |
TProcessStatement | ProcessLocked = processLocked |
CProcessResult | ProcessNotComplit = IObjectIA::CProcessResult(processNotComplete) |
CProcessResult | ProcessRun = IObjectIA::CProcessResult() |
CRunTimer * | RunTimer = NULL |
NLAISCRIPT::CParam * | SendCompParamMessageScript = NULL |
NLAISCRIPT::CParam * | SendParamMessageScript = NULL |
CMethodCall ** | StaticMethod = NULL |
NLMISC::CSynchronized< CAgentScript * > * | TimerManager = NULL |
NLMISC::IThread * | TimerManagerRun = NULL |
Protected Member Functions | |
void | connectLoadStream (NLMISC::IStream &is) |
void | createComponents (std::list< IObjectIA * > &) |
void | refLoadStream (NLMISC::IStream &is) |
the loader of the class. | |
virtual IObjectIA * | run (const IMessageBase &m) |
virtual IMessageBase * | runAchieve (const IMessageBase &m) |
virtual IMessageBase * | runAsk (const IMessageBase &m) |
virtual IMessageBase * | runBreak (const IMessageBase &m) |
virtual IMessageBase * | runError (const IMessageBase &m) |
virtual IMessageBase * | runEven (const IMessageBase &m) |
virtual IMessageBase * | runExec (const IMessageBase &m) |
virtual IMessageBase * | runKill (const IMessageBase &m) |
virtual IMessageBase * | runService (const IMessageBase &m) |
virtual IMessageBase * | runTell (const IMessageBase &m) |
virtual CProcessResult | sendBroadCast (IObjectIA *) |
void | setNumRef (const IWordNumRef &ref) |
Protected Attributes | |
NLAISCRIPT::CAgentClass * | _AgentClass |
The creator of this instance. This useful for find scripted method entry point. | |
TBasicList | _AgentList |
IAgentManager * | _AgentManager |
The manager where the agent is run this manager have the agent script context. | |
IObjectIA ** | _Components |
Table of static compoments. | |
TListIBasic | _Connected |
TListIBasic | _Connection |
TSetDefNameAgent | _DynamicAgentName |
Map for store agent added in the dynamic child container. | |
sint | _iComponents |
IMailBox * | _Mail |
Box letter for communication service. | |
int | _NbComponents |
Nomber of static compoment. | |
CProcessResult | _RunState |
Internal state of the agent. | |
sint | _SizeChild |
std::set< std::string > | mapSet |
Private Attributes | |
uint | _Time |
|
This enum define ident for hard coded method that we have to import its under the script.
Definition at line 69 of file agent_script.h.
00069 { 00070 TSend, 00071 TSendComponent, 00072 TGetChildTag, 00073 TAddChildTag, 00074 TRemoveChild, 00075 TFather, 00076 TSelf, 00077 TGetName, 00078 TIsInherited, 00079 TGetClassName, 00080 TRunTellComponent, 00081 TRunAskComponent, 00082 TRunAskParentNotify, 00083 TRunTellParentNotify, 00084 TRunAskDebugString, 00085 TSetStatic, 00086 TGetValue, 00087 TSetValue, 00088 // TGetValueReturn, /// Processes the "Tell(GetValueMsg)" msg resulting from a "Ask(GetValueMsg)" message sent. 00089 TDeflautProccessMsg, 00090 TInitComponent, 00091 TIsEUU, 00092 TAddSet, 00093 TLastM 00094 }; |
|
Definition at line 96 of file agent_script.h.
00096 { 00097 CheckAll, 00098 CheckCount, 00099 DoNotCheck 00100 }; |
|
Definition at line 36 of file agent_timer.cpp. References t. Referenced by clone(), initClass(), and newInstance().
00036 :CAgentScript(t), _Time(t._Time) 00037 { 00038 00039 } |
|
Definition at line 41 of file agent_timer.cpp.
00041 :CAgentScript(m), _Time(0) 00042 { 00043 } |
|
Definition at line 45 of file agent_timer.cpp. References v.
00045 :CAgentScript(m,a,v,c), _Time(0) 00046 { 00047 } |
|
Definition at line 49 of file agent_timer.cpp.
00050 { 00051 } |
|
Add a child to the agent. Child is added in a std::list<IBasicAgent *>. The method return the range of the child in the list. Implements NLAIAGENT::IBasicAgent. Reimplemented in NLAIAGENT::CLocalAgentMail. Definition at line 67 of file basic_agent.cpp. References NLAIAGENT::IAgentComposite::_AgentList, NLAIAGENT::IAgentComposite::_SizeChild, NLAIAGENT::IMailBox::addMailBox(), NLAIAGENT::IBasicAgent::getMail(), and NLAIC::IPointerGestion::incRef(). Referenced by NLAIAGENT::CAgentScript::addDynamicAgent(), NLAIAGENT::IAgentComposite::IAgentComposite(), and NLAIAGENT::IAgentComposite::load().
00068 { 00069 p->incRef(); 00070 _AgentList.push_front((IBasicAgent *)p); 00071 // Donne au fils accès à la boite aux lettres du père 00072 p->getMail()->addMailBox( this->getMail() ); 00073 _SizeChild ++; 00074 00075 return _AgentList.begin(); 00076 } |
|
that is a surchage of the method member virtual IObjectIA::CProcessResult addDynamicAgent(NLAIAGENT::IBaseGroupType *g); Reimplemented in NLAIAGENT::CMainAgentScript. Definition at line 811 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_DynamicAgentName, NLAIAGENT::IAgentComposite::addChild(), NLAIAGENT::CStringType::getDebugString(), NLAIC::IBasicType::getType(), r, NLAIAGENT::IConnectIA::setParent(), NLAIAGENT::IMessageBase::setPerformatif(), NLAIAGENT::IMessageBase::setSender(), t, type, and uint.
00812 { 00813 #ifdef NL_DEBUG 00814 std::string dbg_name; 00815 const char *type; 00816 name.getDebugString( dbg_name ); 00817 type = (const char *)agent->getType(); 00818 const char *tname = dbg_name.c_str(); 00819 #endif 00820 IObjectIA::CProcessResult r; 00821 r.ResultState = IObjectIA::ProcessIdle; 00822 00823 agent->setParent( (const IWordNumRef *) *this ); 00824 CNotifyParentScript *m = new CNotifyParentScript(this); 00825 m->setSender(this); 00826 m->setPerformatif(IMessageBase::PTell); 00827 ((IObjectIA *) agent )->sendMessage(m); 00828 uint b = NLAIC::CTypeOfObject::tInterpret | NLAIC::CTypeOfObject::tAgent; 00829 const NLAIC::CTypeOfObject &t = agent->getType(); 00830 if((t.getValue() & b) == b) 00831 { 00832 ((CAgentScript *) agent )->setAgentManager(this); 00833 } 00834 _DynamicAgentName.insert(CKeyAgent(name,addChild( agent ))); 00835 00836 r.Result = NULL; 00837 return r; 00838 } |
|
Add an agent to the dynamic agent child. Method have an IBaseGroupType argument, this argument must store an CStringType first and an IObjectIA pointer memory next. The CStringType is the name of the agent. The IObjectIA pointer memory is the agent. Not that in generally this method is called by the script Reimplemented in NLAIAGENT::CMainAgentScript. Definition at line 761 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_DynamicAgentName, NLAIAGENT::IAgentComposite::addChild(), NLAIC::IBasicType::clone(), NLAIAGENT::IBaseGroupType::getIterator(), NLAIC::IBasicType::getType(), NLAIAGENT::CConstIteratorContener::isInEnd(), r, s, NLAIAGENT::IConnectIA::setParent(), NLAIAGENT::IMessageBase::setPerformatif(), NLAIAGENT::IMessageBase::setSender(), sint, t, type, and uint. Referenced by NLAIAGENT::CActorScript::Launch(), and NLAIAGENT::CAgentScript::runMethodBase().
00762 { 00763 CIteratorContener i = g->getIterator(); 00764 CStringType &s = (CStringType &)*i++; 00765 IBasicAgent *a = (IBasicAgent *)i++; 00766 IBasicAgent *o = a; 00767 sint n = 1; 00768 00769 #ifdef NL_DEBUG 00770 std::string name; 00771 const char *type; 00772 s.getDebugString(name); 00773 00774 type = (const char *)a->getType(); 00775 const char *tname = name.c_str(); 00776 #endif 00777 if(!i.isInEnd()) 00778 { 00779 n = (sint)((NLAIAGENT::INombreDefine *)i++)->getNumber(); 00780 } 00781 00782 IObjectIA::CProcessResult r; 00783 r.ResultState = IObjectIA::ProcessIdle; 00784 00785 while(n --) 00786 { 00787 o->setParent( (const IWordNumRef *) *this ); 00788 CNotifyParentScript *m = new CNotifyParentScript(this); 00789 //this->incRef(); 00790 m->setSender(this); 00791 m->setPerformatif(IMessageBase::PTell); 00792 ((IObjectIA *)o)->sendMessage(m); 00793 00794 uint b = NLAIC::CTypeOfObject::tInterpret | NLAIC::CTypeOfObject::tAgent; 00795 const NLAIC::CTypeOfObject &t = o->getType(); 00796 00797 if((t.getValue() & b) == b) 00798 { 00799 ((CAgentScript *)o)->setAgentManager(this); 00800 } 00801 00802 _DynamicAgentName.insert(CKeyAgent(s,addChild(o))); 00803 if(n) o = (IBasicAgent *)a->clone(); 00804 } 00805 00806 r.Result = NULL; 00807 00808 return r; 00809 } |
|
Definition at line 595 of file baseai.cpp. References NLAIAGENT::IConnectIA::_Connected. Referenced by NLAIAGENT::IConnectIA::connect(), and NLAIAGENT::IConnectIA::connectLoadStream().
00596 { 00597 _Connected.insert(a); 00598 } |
|
Definition at line 572 of file baseai.cpp. References NLAIAGENT::IConnectIA::_Connection. Referenced by NLAIAGENT::IConnectIA::connect(), and NLAIAGENT::IConnectIA::connectLoadStream().
00573 { 00574 _Connection.insert(a); 00575 } |
|
Method for adding operator.
Definition at line 1667 of file agent_script.cpp.
01668 {
01669 // _Operators.push_back(op);
01670 }
|
|
Add a set for the agent.
Definition at line 756 of file agent_script.cpp. References NLAIAGENT::CAgentScript::mapSet, and s. Referenced by NLAIAGENT::CAgentScript::runMethodBase().
00757 { 00758 mapSet.insert(s); 00759 } |
|
Definition at line 362 of file agent_script.h. References NLAIAGENT::CAgentScript::mapSet.
00363 { 00364 return mapSet.begin(); 00365 } |
|
Definition at line 2420 of file agent_script.cpp. References NLAISCRIPT::CCodeContext::Code, NLAISCRIPT::CAgentClass::findMethod(), NLAISCRIPT::CAgentClass::getBrancheCode(), NLAIAGENT::CAgentScript::getClass(), NLAIAGENT::CAgentScript::getType(), NLAISCRIPT::CCodeBrancheRun::run(), NLAISCRIPT::CCodeContext::Self, sint32, and uint32.
02421 { 02422 NLAIAGENT::CStringVarName constructor_func_name("Constructor"); 02423 sint32 id_func = getClass()->findMethod( constructor_func_name, NLAISCRIPT::CParam() ); 02424 02425 #ifdef NL_DEBUG 02426 02427 const char * ttt = (const char *) getType(); 02428 #endif 02429 if ( id_func != -1 ) 02430 { 02431 NLAISCRIPT::CStackPointer stack; 02432 NLAISCRIPT::CStackPointer heap; 02433 NLAISCRIPT::CCodeContext codeContext(stack, heap, NULL, this, NLAISCRIPT::CCallPrint::inputOutput); 02434 codeContext.Self = this; 02435 NLAISCRIPT::CCodeBrancheRun *o = (NLAISCRIPT::CCodeBrancheRun *) getClass()->getBrancheCode( id_func ).getCode(); 02436 codeContext.Code = o; 02437 int ip; 02438 if(codeContext.Code != NULL) ip = (uint32)*codeContext.Code; 02439 else ip =0; 02440 02441 *codeContext.Code = 0; 02442 02443 (void)o->run(codeContext); 02444 02445 *codeContext.Code = ip; 02446 02447 } 02448 } |
|
Definition at line 2450 of file agent_script.cpp. References NLAISCRIPT::CCodeContext::Code, NLAISCRIPT::CAgentClass::findMethod(), NLAISCRIPT::CAgentClass::getBrancheCode(), NLAIAGENT::CAgentScript::getClass(), NLAIAGENT::CAgentScript::getType(), NLAISCRIPT::CCodeBrancheRun::run(), NLAISCRIPT::CCodeContext::Self, sint32, and uint32.
02451 { 02452 NLAIAGENT::CStringVarName func_name( f_name.c_str() ); 02453 sint32 id_func = getClass()->findMethod( func_name, NLAISCRIPT::CParam() ); 02454 02455 #ifdef NL_DEBUG 02456 const char * ttt = (const char *) getType(); 02457 #endif 02458 if ( id_func != -1 ) 02459 { 02460 NLAISCRIPT::CStackPointer stack; 02461 NLAISCRIPT::CStackPointer heap; 02462 NLAISCRIPT::CCodeContext codeContext(stack, heap, NULL, this, NLAISCRIPT::CCallPrint::inputOutput); 02463 codeContext.Self = this; 02464 NLAISCRIPT::CCodeBrancheRun *o = (NLAISCRIPT::CCodeBrancheRun *) getClass()->getBrancheCode( id_func ).getCode(); 02465 codeContext.Code = o; 02466 int ip; 02467 if(codeContext.Code != NULL) ip = (uint32)*codeContext.Code; 02468 else ip =0; 02469 02470 *codeContext.Code = 0; 02471 02472 (void)o->run(codeContext); 02473 02474 *codeContext.Code = ip; 02475 02476 } 02477 } |
|
The method canProcessMessage(const IVarName &msgName) allow us to know if agent can preocess given by msgName. TQueue contain the liste of method (same as a run(msg)) that coud process the msg. Reimplemented in NLAIAGENT::CLocalAgentMail. Definition at line 350 of file baseai.cpp. References NLAIAGENT::TQueue. Referenced by NLAIAGENT::CLocalAgentMail::canProcessMessage().
00351 { 00352 return TQueue(); 00353 } |
|
This function allow a pointer copy, that mean that the new class have the sam attributs caracteristics as the owne. Reimplemented from NLAIAGENT::CAgentScript. Definition at line 59 of file agent_timer.cpp. References CAgentManagerTimer().
00060 { 00061 return new CAgentManagerTimer(*this); 00062 } |
|
When agent want to make connection he have to call this method to connect to an agent. When it call the B object is added in the connection list. Definition at line 555 of file baseai.cpp. References NLAIAGENT::IConnectIA::addInConnectedList(), and NLAIAGENT::IConnectIA::addInConnectionList(). Referenced by NLAIAGENT::CAgentWatchTimer::addAttrib(), NLAIAGENT::IAgentInput::addInputConnection(), NLAIAGENT::CLocalMailBox::addMailBox(), NLAIAGENT::CAgentWatchTimer::CAgentWatchTimer(), NLAIAGENT::CLocalAgentMail::CLocalAgentMail(), NLAIAGENT::CAgentOperation::connectOnChange(), and NLAIAGENT::IConnectIA::setParent().
00556 { 00557 b->addInConnectedList(this); 00558 addInConnectionList(b); 00559 } |
|
Definition at line 521 of file baseai.cpp. References NLAIAGENT::IConnectIA::addInConnectedList(), NLAIAGENT::IConnectIA::addInConnectionList(), num, NLMISC::IStream::serial(), and sint32. Referenced by NLAIAGENT::IConnectIA::IConnectIA(), and NLAIAGENT::IConnectIA::load().
00522 { 00523 IRefrence::refLoadStream(is); 00524 NLAIC::CIdentTypeAlloc id; 00525 sint32 i; 00526 is.serial( i ); 00527 00528 if(i) 00529 { 00530 while(i --) 00531 { 00532 is >> id; 00533 IWordNumRef *num = (IWordNumRef *)id.allocClass(); 00534 num->load(is); 00535 addInConnectionList((IConnectIA *)((const IRefrence *)*num)); 00536 delete num; 00537 } 00538 } 00539 00540 00541 is.serial(i); 00542 if(i) 00543 { 00544 while(i--) 00545 { 00546 is >> id; 00547 IWordNumRef *num = (IWordNumRef *)id.allocClass(); 00548 num->load(is); 00549 addInConnectedList((IConnectIA *)((const IRefrence *)*num)); 00550 delete num; 00551 } 00552 } 00553 } |
|
Definition at line 78 of file basic_agent.cpp. References NLAIAGENT::IAgentComposite::_AgentList, NLAIAGENT::IAgentComposite::_SizeChild, and NLAIC::IBasicType::clone().
00079 { 00080 _AgentList.push_front((IBasicAgent *)p.clone()); 00081 _SizeChild ++; 00082 } |
|
Definition at line 2391 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_Components, NLAIAGENT::CAgentScript::_NbComponents, components, t, and uint. Referenced by NLAIAGENT::CAgentScript::CAgentScript().
02392 { 02393 _NbComponents = components.size(); 02394 if ( _NbComponents ) 02395 { 02396 _Components = new IObjectIA *[ _NbComponents ]; 02397 std::list<IObjectIA *>::iterator it_c = components.begin(); 02398 int id_c = 0; 02399 while ( it_c != components.end() ) 02400 { 02401 IObjectIA *o = (IObjectIA *)*it_c; 02402 _Components[id_c] = o; 02403 02404 uint b = NLAIC::CTypeOfObject::tInterpret | NLAIC::CTypeOfObject::tAgent; 02405 const NLAIC::CTypeOfObject &t = o->getType(); 02406 02407 if((t.getValue() & b) == b) 02408 { 02409 ((CAgentScript *)o)->setParent( (const IWordNumRef *) *this); 02410 } 02411 02412 it_c++; 02413 id_c++; 02414 } 02415 } 02416 else 02417 _Components = NULL; 02418 } |
|
Decrement the reference of an object.
Definition at line 93 of file abstract_interface.h. References NLAIC::IPointerGestion::_Ref, and sint32. Referenced by NLAIC::IPointerGestion::release(), and NLAIAGENT::CAgentTimerHandle::~CAgentTimerHandle().
00094 {
00095 return --_Ref;
00096 }
|
|
Definition at line 367 of file agent_script.h. References NLAIAGENT::CAgentScript::mapSet.
00368 { 00369 return mapSet.end(); 00370 } |
|
Get an valid context for this instance.
Implements NLAIAGENT::IAgentManager. Reimplemented in NLAIAGENT::CMainAgentScript. Definition at line 296 of file agent_script.h. References NLAIAGENT::IAgentManager::getAgentContext(), and NLAIAGENT::CAgentScript::getAgentManager().
00297 { 00298 return getAgentManager()->getAgentContext(); 00299 } |
|
Get the manager of the instance.
Definition at line 271 of file agent_script.h. References NLAIAGENT::CAgentScript::_AgentManager. Referenced by NLAIAGENT::COperatorScript::checkPreconditions(), NLAIAGENT::COperatorScript::execOnActivate(), NLAIAGENT::CActorScript::failure(), NLAIAGENT::CAgentScript::getAgentContext(), NLAIAGENT::CActorScript::pause(), NLAIAGENT::CActorScript::restart(), NLAIAGENT::CActorScript::run(), NLAIAGENT::CActorScript::success(), and NLAIAGENT::CActorScript::unActivate().
00272 { 00273 return _AgentManager; 00274 } |
|
Get an valid context for this instance.
Reimplemented from NLAIAGENT::IAgentManager. Reimplemented in NLAIAGENT::CActorScript, NLAIAGENT::CAgentWatchTimer, NLAIAGENT::CMainAgentScript, NLAIAGENT::CAgentOperation, NLAIAGENT::CFsmScript, NLAILOGIC::CGoalPath, and NLAIAGENT::COperatorScript. Definition at line 2107 of file agent_script.cpp. Referenced by NLAIAGENT::CAgentWatchTimer::getBaseMethodCount(), NLAIAGENT::CActorScript::getBaseMethodCount(), NLAIAGENT::CAgentScript::getMethodeMemberDebugString(), NLAIAGENT::CAgentScript::processMessages(), and NLAIAGENT::CAgentScript::runMethodeMember().
02108 {
02109 return IAgentManager::getBaseMethodCount() + CAgentScript::TLastM;
02110 }
|
|
Definition at line 358 of file agent.h. References NLAIAGENT::IAgentComposite::_SizeChild, and sint.
00359 { 00360 return _SizeChild; 00361 } |
|
get the mail boxe for scripted message.
Definition at line 512 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_AgentClass, NLAISCRIPT::CAgentClass::getChildMessageIndex(), and sint32.
00513 { 00514 return _AgentClass->getChildMessageIndex( msg, child_index ); 00515 } |
|
Definition at line 421 of file agent_script.h. References NLAIAGENT::CAgentScript::_AgentClass. Referenced by NLAIAGENT::CActorScript::activate(), NLAIAGENT::CAgentScript::callConstructor(), NLAIAGENT::CAgentScript::callFunction(), and NLAIAGENT::CActorScript::unActivate().
00422 { 00423 return _AgentClass; 00424 } |
|
Implements NLMISC::IClassable. Reimplemented in NLAIC::CIdentType. Definition at line 116 of file abstract_interface.h. Referenced by NLAISCRIPT::CAgentClass::isClassInheritedFrom().
00117 { 00118 return std::string("<unnamed>"); 00119 } |
|
Returns the name of the class in the registry.
Definition at line 79 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_AgentClass, and NLAISCRIPT::IClassInterpret::getClassName(). Referenced by NLAIAGENT::CAgentScript::runMethodBase().
00080 { 00081 const NLAIAGENT::IVarName *classname; 00082 if ( _AgentClass != NULL ) 00083 { 00084 classname = _AgentClass->getClassName(); 00085 } 00086 else 00087 classname = new CStringVarName("<unknown>"); // Memory leak ? 00088 00089 return classname; 00090 } |
|
This is a Debug function, text is an character pointer to receive the debug text output, the debug text containe all think sensible to interset user. Reimplemented from NLAIAGENT::CAgentScript. Definition at line 68 of file agent_timer.cpp. References NLAIC::stringGetBuild(), and t.
00069 { 00070 t += NLAIC::stringGetBuild("CAgentManagerTimer <%d>",_Time); 00071 } |
|
Get agent from the dynamic agent child. Method have an IBaseGroupType argument where he must store an CStringType representative of the name of the agent. Definition at line 884 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_DynamicAgentName, NLAIAGENT::IBaseGroupType::get(), r, s, sint, size, and x. Referenced by NLAIAGENT::CAgentScript::runMethodBase().
00885 { 00886 CStringType *s = (CStringType *)g->get(); 00887 IObjectIA::CProcessResult r; 00888 r.ResultState = IObjectIA::ProcessIdle; 00889 std::pair<TSetDefNameAgent::iterator,TSetDefNameAgent::iterator> p = _DynamicAgentName.equal_range(CKeyAgent(*s)); 00890 00891 if(p.first != p.second) 00892 { 00893 sint size = _DynamicAgentName.count(CKeyAgent(*s)); 00894 sint n = 0; 00895 CVectorGroupManager *x; 00896 x = new CVectorGroupManager(size); 00897 while(p.first != p.second) 00898 { 00899 (*p.first->Itr)->incRef(); 00900 x->set(n++, *p.first->Itr); 00901 p.first++; 00902 } 00903 00904 r.Result = x; 00905 return r; 00906 00907 } 00908 r.Result = new CVectorGroupManager(); 00909 return r; 00910 } |
|
Get the instance name of the agent in its manager Definition at line 1155 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_DynamicAgentName, NLAIAGENT::IBaseGroupType::get(), NLAIAGENT::CKeyAgent::Itr, NLAIAGENT::CKeyAgent::Name, r, and s.
01156 { 01157 01158 IObjectIA::CProcessResult r; 01159 const IObjectIA *o = ((CLocalAgentMail *)g->get())->getHost(); 01160 TSetDefNameAgent::iterator i = _DynamicAgentName.begin(); 01161 01162 while(i != _DynamicAgentName.end()) 01163 { 01164 CKeyAgent key = *i; 01165 if( o == *key.Itr ) 01166 { 01167 CStringType *s = new CStringType(key.Name); 01168 r.Result = s; 01169 return r; 01170 } 01171 i ++; 01172 } 01173 r.Result = new CStringType(CStringVarName("Unknown")); 01174 return r; 01175 } |
|
Get the fact base of the agent, if not exist it return NULL.
Definition at line 386 of file agent_script.h.
00387 {
00388 return NULL;
00389 }
|
|
Get the creator of this instance.
Definition at line 277 of file agent_script.h. References NLAIAGENT::CAgentScript::_AgentClass. Referenced by NLAIAGENT::COperatorScript::getType(), and NLAIAGENT::CMainAgentScript::run().
00278 { 00279 return _AgentClass; 00280 } |
|
Definition at line 434 of file agent_script.h. Referenced by NLAIAGENT::COperatorScript::lookForGoals().
00435 {
00436 return NULL;
00437 }
|
|
Definition at line 480 of file baseai.cpp. References NLAIAGENT::IRefrence::_NumRef, NLAIAGENT::CNumericIndex::getId(), and NLAIAGENT::IWordNumRef::getNumIdent().
00481 {
00482 return CIdent(0,_NumRef->getNumIdent().getId());
00483 }
|
|
Definition at line 292 of file abstract_interface.h. References NLAIC::IBasicType::getDebugString(), and s.
00293 { 00294 std::string s; 00295 getDebugString(s); 00296 return s; 00297 } |
|
Get the mail box letter.
Definition at line 332 of file agents.cpp. References NLAIAGENT::IBasicAgent::_Mail. Referenced by NLAIAGENT::IAgentComposite::addChild(), NLAIAGENT::COperatorScript::checkTrigMsg(), NLAIAGENT::IAgent::processMessages(), NLAIAGENT::CAgentScript::processMessages(), NLAIAGENT::IAgentComposite::removeChild(), NLAIAGENT::CMainAgentScript::run(), NLAIAGENT::IAgent::run(), NLAIAGENT::IAgent::runStep(), and NLAIAGENT::IBasicAgent::sendMessage().
00333 { 00334 return _Mail; 00335 } |
|
get the closure correspondent of the method indexed by index.
Definition at line 574 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_AgentClass, NLAISCRIPT::CAgentClass::getBrancheCode(), NLAISCRIPT::CAgentClass::getMethodIndexSize(), NLAISCRIPT::IClassInterpret::getType(), NLAIAGENT::CAgentScript::getType(), index, and sint32.
00575 { 00576 if ( _AgentClass != NULL ) 00577 { 00578 #ifdef NL_DEBUG 00579 const char *dbg_class_name = (const char *) getType(); 00580 const char *dbg_base_class_name = (const char *) _AgentClass->getType(); 00581 00582 if ( index >= _AgentClass->getMethodIndexSize()) 00583 { 00584 throw NLAIE::CExceptionIndexError(); 00585 } 00586 #endif 00587 return (NLAISCRIPT::IOpCode *)_AgentClass->getBrancheCode(index).getCode(); 00588 } 00589 else 00590 return NULL; 00591 } |
|
get the closure correspondent of the method indexed by index in the base class inheritance.
Definition at line 558 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_AgentClass, NLAISCRIPT::CAgentClass::getBrancheCode(), NLAISCRIPT::CAgentClass::getMethodIndexSize(), index, sint32, and NLAISCRIPT::CAgentClass::sizeVTable(). Referenced by NLAIAGENT::CAgentScript::processMessages(), and NLAIAGENT::CAgentScript::runMethodeMember().
00559 { 00560 #ifdef NL_DEBUG 00561 if ( index >= _AgentClass->getMethodIndexSize()) 00562 { 00563 throw NLAIE::CExceptionIndexError(); 00564 } 00565 00566 if ( inheritance >= _AgentClass->sizeVTable()) 00567 { 00568 throw NLAIE::CExceptionIndexError(); 00569 } 00570 #endif 00571 return (NLAISCRIPT::IOpCode *)_AgentClass->getBrancheCode(inheritance,index).getCode(); 00572 } |
|
The methode getMethodeMemberDebugString(sint32 heritance, sint32 index) return a string that define the name and the argument of the method Reimplemented from NLAIAGENT::IObjectIA. Definition at line 2012 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_AgentClass, NLAIAGENT::CAgentScript::getBaseMethodCount(), NLAISCRIPT::CAgentClass::getBrancheCode(), NLAIAGENT::IBasicAgent::getMethodIndexSize(), sint32, NLAIAGENT::CAgentScript::TAddChildTag, NLAIAGENT::CAgentScript::TFather, NLAIAGENT::CAgentScript::TGetChildTag, NLAIAGENT::CAgentScript::TGetName, NLAIAGENT::CAgentScript::TGetValue, NLAIAGENT::CAgentScript::TInitComponent, NLAIAGENT::CAgentScript::TRunAskComponent, NLAIAGENT::CAgentScript::TRunAskParentNotify, NLAIAGENT::CAgentScript::TRunTellComponent, NLAIAGENT::CAgentScript::TRunTellParentNotify, NLAIAGENT::CAgentScript::TSelf, NLAIAGENT::CAgentScript::TSend, NLAIAGENT::CAgentScript::TSendComponent, NLAIAGENT::CAgentScript::TSetStatic, and NLAIAGENT::CAgentScript::TSetValue.
02013 { 02014 int i = id - getBaseMethodCount(); 02015 if(i >= 0) 02016 { 02017 std::string name; 02018 if(h) 02019 { 02020 _AgentClass->getBrancheCode(h,i).getName().getDebugString(name); 02021 _AgentClass->getBrancheCode(h,i).getParam().getDebugString(name); 02022 } 02023 else 02024 { 02025 _AgentClass->getBrancheCode(i).getName().getDebugString(name); 02026 _AgentClass->getBrancheCode(i).getParam().getDebugString(name); 02027 } 02028 return name; 02029 } 02030 02031 switch(id - IAgent::getMethodIndexSize()) 02032 { 02033 case TSend: 02034 { 02035 return std::string("CAgentScript::sendMessage(IMessage)"); 02036 } 02037 02038 case TSendComponent: 02039 { 02040 return std::string("CAgentScript::sendMessage(String,IMessage)"); 02041 } 02042 02043 case TGetChildTag: 02044 { 02045 return std::string("CAgentScript::getDynamicAgent(String)"); 02046 } 02047 02048 case TAddChildTag: 02049 { 02050 return std::string("CAgentScript::addDynamicAgent(String,IAgent)"); 02051 } 02052 case TFather: 02053 { 02054 return std::string("CAgentScript::Father()"); 02055 } 02056 02057 case TSelf: 02058 { 02059 return std::string("CAgentScript::Self()"); 02060 } 02061 case TGetName: 02062 { 02063 return std::string("CAgentScript::GetAgentName()"); 02064 } 02065 02066 case TRunAskParentNotify: 02067 { 02068 return std::string("CAgentScript::runAskParentNotify(CNotifyParent)"); 02069 } 02070 02071 case TRunTellParentNotify: 02072 { 02073 return std::string("CAgentScript::runTellarentNotify(CNotifyParent)"); 02074 } 02075 02076 case TRunAskComponent: 02077 case TRunTellComponent: 02078 { 02079 return std::string("CAgentScript::runTell/AskCompoment(MsgTellCompoment)"); 02080 } 02081 case TSetStatic: 02082 { 02083 return std::string("CAgentScript::updateStaticMember(String, IObjectIA *)"); 02084 } 02085 02086 case TGetValue: 02087 { 02088 return std::string("CAgentScript::runAskGetValue(MsgGetValue)"); 02089 } 02090 02091 case TSetValue: 02092 { 02093 return std::string("CAgentScript::runTellSetValue(MsgGetValue)"); 02094 } 02095 02096 case TInitComponent: 02097 { 02098 return std::string("CAgentScript::runInitComponent(MsgGetValue)"); 02099 } 02100 02101 02102 default: 02103 return IAgentManager::getMethodeMemberDebugString(h,id); 02104 } 02105 } |
|
getMethodIndexSize define the nomber of method define in the class. Reimplemented from NLAIAGENT::IBasicAgent. Reimplemented in NLAIAGENT::CActorScript, NLAIAGENT::CAgentWatchTimer, NLAIAGENT::CAgentOperation, NLAIAGENT::CFsmScript, NLAILOGIC::CGoalPath, and NLAIAGENT::COperatorScript. Definition at line 632 of file agent_script.cpp. References NLAIAGENT::IBasicAgent::getMethodIndexSize(), and sint32. Referenced by NLAIAGENT::CAgentWatchTimer::getMethodIndexSize(), NLAIAGENT::CActorScript::getMethodIndexSize(), NLAIAGENT::CAgentWatchTimer::runMethodBase(), and NLAIAGENT::CActorScript::runMethodBase().
00633 { 00634 /*if(_AgentClass) 00635 { 00636 return _AgentClass->getMethodIndexSize(); 00637 } 00638 else*/ 00639 { 00640 return IAgent::getMethodIndexSize() + TLastM; 00641 } 00642 } |
|
To get the top level parent of this agent.
Definition at line 402 of file baseai.cpp. References NLAIAGENT::IRefrence::getParent().
|
|
to get the agent parents
Reimplemented from NLAIAGENT::IRefrence. Definition at line 511 of file baseai.cpp. Referenced by NLAIAGENT::CActorScript::activate(), NLAIAGENT::COperatorScript::calcPriority(), NLAIAGENT::COperatorScript::checkTrigMsg(), NLAIAGENT::IConnectIA::Kill(), NLAIAGENT::COperatorScript::lookForGoals(), NLAIAGENT::CLocalMailBox::newInstance(), NLAIAGENT::IAgent::newInstance(), NLAIAGENT::CActor::newInstance(), NLAIAGENT::IConnectIA::onKill(), NLAIAGENT::IBasicAgent::runAsk(), NLAIAGENT::CAgentScript::runAskDebugString(), NLAIAGENT::CAgentScript::runAskParentNotify(), NLAIAGENT::CAgentScript::runMethodBase(), NLAIAGENT::CActorScript::runMethodBase(), NLAIAGENT::IBasicAgent::runMethodeMember(), NLAIAGENT::CAgentScript::runTellParentNotify(), NLAIAGENT::IConnectIA::setParent(), and NLAIAGENT::CActorScript::unActivate().
00512 { 00513 return (IConnectIA *)IRefrence::getParent(); 00514 } |
|
Definition at line 2228 of file agent_script.cpp. References NLAIAGENT::IVarName::getString(), NLAIAGENT::isTemplateMember(), param, and NLAIAGENT::TQueue. Referenced by NLAIAGENT::CActorScript::getPrivateMember(), and NLAIAGENT::CAgentScript::isMember().
02229 { 02230 02231 #ifdef NL_DEBUG 02232 const char *dgb_meth_name = methodName->getString(); 02233 #endif 02234 return isTemplateMember(CAgentScript::StaticMethod,CAgentScript::TLastM,IAgent::getMethodIndexSize(),className,methodName,param); 02235 } |
|
get the refence count.
Definition at line 99 of file abstract_interface.h. References NLAIC::IPointerGestion::_Ref, and sint32. Referenced by NLAIAGENT::CAgentTimerHandle::~CAgentTimerHandle().
00100 {
00101 return _Ref;
00102 }
|
|
Get the curent state of the agent.
Implements NLAIAGENT::IConnectIA. Definition at line 309 of file agents.cpp. References NLAIAGENT::IBasicAgent::_RunState. Referenced by NLAIAGENT::CMainAgentScript::run(), NLAIAGENT::IAgent::run(), NLAIAGENT::CAgentClockTimer::runActivity(), NLAIAGENT::CAgentWatchTimer::runActivity(), NLAIAGENT::IAgent::runChildren(), NLAIAGENT::IAgent::runChildrenStepByStep(), and NLAIAGENT::IAgent::runStep().
00310 { 00311 return _RunState; 00312 } |
|
to get the pointer of a given components referened by an string. Definition at line 261 of file baseai.h. References NLAIAGENT::IObjectIA::getStaticMember(), and NLAIAGENT::IObjectIA::getStaticMemberIndex().
00262 { 00263 return getStaticMember(getStaticMemberIndex(compName)); 00264 } |
|
to get the pointer of a given components referened by an index. Reimplemented from NLAIAGENT::IObjectIA. Definition at line 547 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_Components, NLAIAGENT::CAgentScript::_NbComponents, index, and sint32. Referenced by NLAIAGENT::CAgentScript::sendMessage().
00548 { 00549 #ifdef NL_DEBUG 00550 if ( index >= _NbComponents ) 00551 { 00552 throw NLAIE::CExceptionIndexError(); 00553 } 00554 #endif 00555 return _Components[ index ]; 00556 } |
|
to get the index of a given components name. Reimplemented from NLAIAGENT::IObjectIA. Definition at line 2319 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_AgentClass, NLAISCRIPT::CAgentClass::getInheritedStaticMemberIndex(), and sint32. Referenced by NLAIAGENT::CAgentScript::runInitComponent(), NLAIAGENT::CAgentScript::runTellSetValue(), and NLAIAGENT::CAgentScript::sendMessage().
02320 { 02321 return _AgentClass->getInheritedStaticMemberIndex(name); 02322 } |
|
Static member is the component that the agent is create and die with. getStaticMemberSize to get the size of the static member components Reimplemented from NLAIAGENT::IObjectIA. Definition at line 542 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_NbComponents, and sint32.
00543 { 00544 return _NbComponents;//_AgentClass->getStaticMemberSize(); 00545 } |
|
Definition at line 429 of file agent_script.h.
00430 {
00431 return NULL;
00432 }
|
|
getType return a unique string how represente the class, it can be the name of the class. This function is used for the sytem regstry class (see the definition of the template class Gen::CRegistry). Reimplemented from NLAIAGENT::CAgentScript. Definition at line 73 of file agent_timer.cpp. References IdAgentTimer.
00074 { 00075 return *IdAgentTimer; 00076 } |
|
allow to know if the agent have an activity process to run.
Reimplemented from NLAIAGENT::CAgentScript. Definition at line 68 of file agent_timer.h.
00069 { 00070 return true; 00071 } |
|
|
Init method alows to init the attribut of an object. the maparmetre is in more time a list of IObjectIA. Reimplemented in NLAIFUZZY::CSimpleFuzzyCond, NLAIFUZZY::CFuzzyRule, NLAIFUZZY::CFuzzyRuleSet, NLAIFUZZY::CFuzzyInterval, NLAIFUZZY::CRightFuzzySet, NLAIFUZZY::CTriangleFuzzySet, NLAIFUZZY::CTrapezeFuzzySet, NLAIFUZZY::CLeftFuzzySet, NLAIFUZZY::CFuzzyVar, NLAILOGIC::CFirstOrderAssert, NLAILOGIC::CRule, and NLAILOGIC::CFactPattern. Definition at line 116 of file baseai.cpp. Referenced by NLAIFUZZY::IFuzzySet::runMethodeMember(), and NLAISCRIPT::CLdbNewOpCode::runOpCode().
00117 { 00118 00119 } |
|
Definition at line 92 of file agent_script.cpp. References _ADD_SET_, _ADDCHILD_, _FATHER_, _GETCHILD_, _GETNAME_, _ISA_, _REMOVECHILD_, _RUNASK_, _RUNTEL_, _SELF_, _SEND_, _SETSTATIC_, NLAILINK::buildScript(), NLAIAGENT::CAgentScript::IdMsgNotifyParent, NLAISCRIPT::CMsgNotifyParentClass::IdMsgNotifyParentClass, NLAIAGENT::CAgentScript::IdMsgNotifyParentClass, NLAIC::IPointerGestion::incRef(), NLAIAGENT::CAgentScript::msgPerf, NLAIAGENT::CAgentScript::msgType, NLAIAGENT::CAgentScript::ParamGetValueMsg, NLAIAGENT::CAgentScript::ParamIdGetValueMsg, NLAIAGENT::CAgentScript::ParamIdInitComponentMsg, NLAIAGENT::CAgentScript::ParamIdSetValueMsg, NLAIAGENT::CAgentScript::ParamInitComponentMsg, NLAIAGENT::CAgentScript::ParamRunParentNotify, NLAIAGENT::CAgentScript::ParamSetValueMsg, NLAIAGENT::CAgentScript::ParamTellComponentMsg, NLAIAGENT::CAgentScript::SendCompParamMessageScript, and NLAIAGENT::CAgentScript::SendParamMessageScript. Referenced by NLAILINK::initIALib().
00093 { 00094 00095 std::string msgStr; 00096 std::string scriptName("MsgAgentScript"); 00097 msgStr = std::string("From Message : Define MsgTellComponent\n{"); 00098 msgStr += std::string("Component:\n"); 00099 msgStr += std::string("\tString<'CompomentName'>;\n"); 00100 msgStr += std::string("\tMessage<'MsgType'>;\n"); 00101 msgStr += std::string("End\n"); 00102 00103 00104 msgStr += std::string("Constructor(String i; Message msg)\n"); 00105 msgStr += std::string("\tCompomentName = i;\n"); 00106 msgStr += std::string("\tMsgType = msg;\n"); 00107 msgStr += std::string("End\n"); 00108 msgStr += std::string("}\n"); 00109 //NLAILINK::buildScript(msgStr,scriptName); 00110 00111 msgStr += std::string("From Message : Define MsgInitCompoment\n{"); 00112 msgStr += std::string("Component:\n"); 00113 msgStr += std::string("End\n}\n"); 00114 00115 msgStr += std::string("From Message : Define MsgDebugString\n{"); 00116 msgStr += std::string("Component:\n"); 00117 msgStr += std::string("End\n}\n"); 00118 00119 00120 NLAILINK::buildScript(msgStr,scriptName); 00121 00122 static NLAIC::CIdentType idMsgTellComponentType ("MsgTellComponent"); 00123 static NLAIC::CIdentType idMsgInitComponentType ("MsgInitCompoment"); 00124 static NLAIC::CIdentType idMsgDebugString ("MsgDebugString"); 00125 00126 msgType = new NLAISCRIPT::COperandSimpleListOr(3, 00127 new NLAIC::CIdentType(CMessageList::IdMessage), 00128 new NLAIC::CIdentType(CMessageVector::IdMessageVector), 00129 new NLAIC::CIdentType(NLAISCRIPT::CMessageClass::IdMessageClass)); 00130 00131 msgPerf = new NLAISCRIPT::COperandSimpleListOr(7, 00132 new NLAIC::CIdentType(CPExec::IdPExec), 00133 new NLAIC::CIdentType(CPAchieve::IdPAchieve), 00134 new NLAIC::CIdentType(CPAsk::IdPAsk), 00135 new NLAIC::CIdentType(CPBreak::IdPBreak), 00136 new NLAIC::CIdentType(CPTell::IdPTell), 00137 new NLAIC::CIdentType(CPKill::IdPKill), 00138 new NLAIC::CIdentType(CPError::IdPError)); 00139 00140 00141 SendParamMessageScript = new NLAISCRIPT::CParam(2,msgPerf, msgType); 00142 00143 msgPerf->incRef(); 00144 msgType->incRef(); 00145 00146 SendCompParamMessageScript = new NLAISCRIPT::CParam(3,new NLAISCRIPT::COperandSimple(new NLAIC::CIdentType(CStringType::IdStringType)), 00147 msgPerf, msgType); 00148 00149 IdMsgNotifyParentClass = new NLAISCRIPT::COperandSimple(new NLAIC::CIdentType(NLAISCRIPT::CMsgNotifyParentClass::IdMsgNotifyParentClass)); 00150 00151 IdMsgNotifyParent = new NLAISCRIPT::COperandSimpleListOr(2, 00152 new NLAIC::CIdentType(NLAISCRIPT::CMsgNotifyParentClass::IdMsgNotifyParentClass), 00153 new NLAIC::CIdentType(CNotifyParentScript::IdNotifyParentScript)); 00154 00155 ParamRunParentNotify = new NLAISCRIPT::CParam(1,IdMsgNotifyParent); 00156 00157 NLAISCRIPT::COperandSimple *idMsgTellComponent = new NLAISCRIPT::COperandSimple(new NLAIC::CIdentType(idMsgTellComponentType)); 00158 NLAISCRIPT::CParam *ParamTellComponentMsg = new NLAISCRIPT::CParam(1,idMsgTellComponent); 00159 00160 NLAISCRIPT::COperandSimple *idOpMsgDebugString = new NLAISCRIPT::COperandSimple(new NLAIC::CIdentType(idMsgDebugString)); 00161 NLAISCRIPT::CParam *ParamMsgDebugString = new NLAISCRIPT::CParam(1,idOpMsgDebugString); 00162 00163 CAgentScript::ParamIdGetValueMsg = new NLAISCRIPT::COperandSimpleListOr(2, 00164 new NLAIC::CIdentType(NLAIAGENT::CGetValueMsg::IdGetValueMsg), 00165 new NLAIC::CIdentType(NLAISCRIPT::CGetValueMsgClass::IdGetValueMsgClass) ); 00166 00167 CAgentScript::ParamGetValueMsg = new NLAISCRIPT::CParam(1,ParamIdGetValueMsg); 00168 00169 CAgentScript::ParamIdSetValueMsg = new NLAISCRIPT::COperandSimpleListOr(2, 00170 new NLAIC::CIdentType(NLAIAGENT::CSetValueMsg::IdSetValueMsg), 00171 new NLAIC::CIdentType(NLAISCRIPT::CSetValueMsgClass::IdSetValueMsgClass) ); 00172 00173 CAgentScript::ParamSetValueMsg = new NLAISCRIPT::CParam(1,ParamIdSetValueMsg); 00174 00176 CAgentScript::ParamIdInitComponentMsg = new NLAISCRIPT::COperandSimpleListOr(2, 00177 new NLAIC::CIdentType(idMsgInitComponentType), 00178 new NLAIC::CIdentType(idMsgInitComponentType) ); 00179 00180 CAgentScript::ParamInitComponentMsg = new NLAISCRIPT::CParam(1,ParamIdInitComponentMsg); 00182 00183 StaticMethod = new CAgentScript::CMethodCall *[CAgentScript::TLastM]; 00184 00185 StaticMethod[CAgentScript::TRunAskParentNotify] = new CAgentScript::CMethodCall( _RUNASK_, 00186 CAgentScript::TRunAskParentNotify, ParamRunParentNotify, 00187 CAgentScript::CheckAll, 00188 1, 00189 new NLAISCRIPT::CObjectUnknown(IdMsgNotifyParentClass)); 00190 00191 IdMsgNotifyParentClass->incRef(); 00192 ParamRunParentNotify->incRef(); 00193 StaticMethod[CAgentScript::TRunTellParentNotify] = new CAgentScript::CMethodCall( _RUNTEL_, 00194 CAgentScript::TRunTellParentNotify, ParamRunParentNotify, 00195 CAgentScript::CheckAll, 00196 1, 00197 new NLAISCRIPT::CObjectUnknown(IdMsgNotifyParentClass)); 00198 00199 idMsgTellComponent->incRef(); 00200 StaticMethod[CAgentScript::TRunTellComponent] = new CAgentScript::CMethodCall( _RUNTEL_, 00201 CAgentScript::TRunTellComponent, ParamTellComponentMsg, 00202 CAgentScript::CheckAll, 00203 1, 00204 new NLAISCRIPT::CObjectUnknown(idMsgTellComponent)); 00205 00206 idOpMsgDebugString->incRef(); 00207 StaticMethod[CAgentScript::TRunAskDebugString] = new CAgentScript::CMethodCall( _RUNASK_, 00208 CAgentScript::TRunAskDebugString, ParamMsgDebugString, 00209 CAgentScript::CheckAll, 00210 1, 00211 new NLAISCRIPT::CObjectUnknown(idOpMsgDebugString)); 00212 00213 /*idOpMsgDebugString->incRef(); 00214 ParamMsgDebugString->incRef(); 00215 StaticMethod[CAgentScript::TRunAskDebugString] = new CAgentScript::CMethodCall( _RUNTEL_, 00216 CAgentScript::TRunTellComponent, ParamMsgDebugString, 00217 CAgentScript::CheckAll, 00218 1, 00219 new NLAISCRIPT::CObjectUnknown(idOpMsgDebugString));*/ 00220 00221 ParamTellComponentMsg->incRef(); 00222 idMsgTellComponent->incRef(); 00223 StaticMethod[CAgentScript::TRunAskComponent] = new CAgentScript::CMethodCall( _RUNASK_, 00224 CAgentScript::TRunAskComponent, ParamTellComponentMsg, 00225 CAgentScript::CheckAll, 00226 1, 00227 new NLAISCRIPT::CObjectUnknown(idMsgTellComponent)); 00228 00229 StaticMethod[CAgentScript::TSend] = new CAgentScript::CMethodCall( _SEND_, 00230 CAgentScript::TSend, SendParamMessageScript, 00231 CAgentScript::CheckAll, 00232 2, 00233 new NLAISCRIPT::CObjectUnknown(new NLAISCRIPT::COperandVoid)); 00234 00235 StaticMethod[CAgentScript::TSendComponent] = new CAgentScript::CMethodCall( _SEND_, 00236 CAgentScript::TSendComponent, 00237 SendCompParamMessageScript,CAgentScript::CheckAll, 00238 3, 00239 new NLAISCRIPT::CObjectUnknown(new NLAISCRIPT::COperandVoid)); 00240 00241 StaticMethod[CAgentScript::TGetChildTag] = new CAgentScript::CMethodCall( _GETCHILD_, 00242 CAgentScript::TGetChildTag, 00243 NULL, 00244 CAgentScript::CheckCount, 00245 1, 00246 new NLAISCRIPT::CObjectUnknown(new 00247 NLAISCRIPT::COperandSimple( 00248 new NLAIC::CIdentType(CVectorGroupManager::IdVectorGroupManager)))); 00249 00250 StaticMethod[CAgentScript::TAddChildTag] = new CAgentScript::CMethodCall( _ADDCHILD_, 00251 CAgentScript::TAddChildTag, 00252 NULL,CAgentScript::DoNotCheck, 00253 2, 00254 new NLAISCRIPT::CObjectUnknown( 00255 new NLAISCRIPT::COperandSimple( 00256 new NLAIC::CIdentType(DigitalType::IdDigitalType)))); 00257 00258 StaticMethod[CAgentScript::TFather] = new CAgentScript::CMethodCall( _FATHER_, 00259 CAgentScript::TFather, 00260 NULL,CAgentScript::CheckCount, 00261 0, 00262 new NLAISCRIPT::CObjectUnknown( 00263 new NLAISCRIPT::COperandSimple( 00264 //check if correct 00265 new NLAIC::CIdentType(*IAgent::IdAgent)))); 00266 00267 00268 StaticMethod[CAgentScript::TSelf] = new CAgentScript::CMethodCall( _SELF_, 00269 CAgentScript::TSelf, 00270 NULL,CAgentScript::CheckCount, 00271 0, 00272 new NLAISCRIPT::CObjectUnknown( new NLAISCRIPT::COperandSimple( 00273 new NLAIC::CIdentType(CAgentScript::IdAgentScript)))); 00274 00275 StaticMethod[CAgentScript::TGetName] = new CAgentScript::CMethodCall( _GETNAME_, 00276 CAgentScript::TGetName, 00277 NULL,CAgentScript::CheckCount, 00278 0, 00279 new NLAISCRIPT::CObjectUnknown( 00280 new NLAISCRIPT::COperandSimple( 00281 new NLAIC::CIdentType(CStringType::IdStringType)))); 00282 00283 StaticMethod[CAgentScript::TGetClassName] = new CAgentScript::CMethodCall( "GetClassName", 00284 CAgentScript::TGetClassName, 00285 NULL,CAgentScript::CheckCount, 00286 0, 00287 new NLAISCRIPT::CObjectUnknown( 00288 new NLAISCRIPT::COperandSimple( 00289 new NLAIC::CIdentType(CStringType::IdStringType)))); 00290 00291 StaticMethod[CAgentScript::TIsInherited] = new CAgentScript::CMethodCall( "IsInherited", 00292 CAgentScript::TIsInherited, 00293 NULL,CAgentScript::CheckCount, 00294 1, 00295 new NLAISCRIPT::CObjectUnknown( 00296 new NLAISCRIPT::COperandSimple( 00297 new NLAIC::CIdentType(NLAILOGIC::CBoolType::IdBoolType)))); 00298 00299 StaticMethod[CAgentScript::TRemoveChild] = new CAgentScript::CMethodCall( _REMOVECHILD_, 00300 CAgentScript::TRemoveChild, 00301 NULL,CAgentScript::CheckCount, 00302 0, 00303 new NLAISCRIPT::CObjectUnknown( 00304 new NLAISCRIPT::COperandSimple( 00305 new NLAIC::CIdentType(DigitalType::IdDigitalType)))); 00306 00307 StaticMethod[CAgentScript::TSetStatic] = new CAgentScript::CMethodCall( _SETSTATIC_, 00308 CAgentScript::TSetStatic, NULL, 00309 CAgentScript::CheckCount, 00310 2, 00311 new NLAISCRIPT::CObjectUnknown(new NLAISCRIPT::COperandVoid)) ; 00312 00313 00314 StaticMethod[CAgentScript::TGetValue] = new CAgentScript::CMethodCall( _RUNASK_, 00315 CAgentScript::TGetValue, ParamGetValueMsg, 00316 CAgentScript::CheckAll, 00317 1, 00318 new NLAISCRIPT::CObjectUnknown(new NLAISCRIPT::COperandVoid)) ; 00319 00320 StaticMethod[CAgentScript::TSetValue] = new CAgentScript::CMethodCall( _RUNTEL_, 00321 CAgentScript::TSetValue, ParamSetValueMsg, 00322 CAgentScript::CheckAll, 00323 1, 00324 new NLAISCRIPT::CObjectUnknown(new NLAISCRIPT::COperandVoid)) ; 00325 00326 ParamIdInitComponentMsg->incRef(); 00327 StaticMethod[CAgentScript::TInitComponent] = new CAgentScript::CMethodCall( _RUNTEL_, 00328 CAgentScript::TInitComponent, ParamInitComponentMsg, 00329 CAgentScript::CheckAll, 00330 1, 00331 new NLAISCRIPT::CObjectUnknown(ParamIdInitComponentMsg)) ; 00332 00333 NLAISCRIPT::CParam *ParamString = new NLAISCRIPT::CParam(1,new NLAISCRIPT::COperandSimple(new NLAIC::CIdentType(CStringType::IdStringType))); 00334 StaticMethod[CAgentScript::TIsEUU] = new CAgentScript::CMethodCall( _ISA_, 00335 CAgentScript::TIsEUU, 00336 ParamString,CAgentScript::CheckAll, 00337 0, new NLAISCRIPT::CObjectUnknown( new NLAISCRIPT::COperandSimple( 00338 new NLAIC::CIdentType(NLAIAGENT::UInt32Type::IdUInt32Type)))); 00339 ParamString->incRef(); 00340 StaticMethod[CAgentScript::TAddSet] = new CAgentScript::CMethodCall(_ADD_SET_, 00341 CAgentScript::TAddSet, 00342 ParamString,CAgentScript::CheckAll, 00343 0, new NLAISCRIPT::CObjectUnknown(new NLAISCRIPT::COperandVoid)); 00344 00345 00346 StaticMethod[CAgentScript::TDeflautProccessMsg] = new CAgentScript::CMethodCall("DeflautProccessMsg", 00347 CAgentScript::TDeflautProccessMsg, NULL, 00348 CAgentScript::CheckCount, 00349 1, 00350 new NLAISCRIPT::CObjectUnknown(new NLAISCRIPT::COperandVoid)); 00351 00352 } |
|
Definition at line 93 of file agent_timer.cpp. References CAgentManagerTimer(). Referenced by NLAILINK::initIALib().
00094 { 00095 if(!CAgentManagerTimer::IsRunning) 00096 { 00097 CAgentManagerTimer *h = new CAgentManagerTimer(NULL); 00098 CAgentManagerTimer::IdAgentTimer = new NLAIC::CIdentType ("AgentStaticManagerTimer", NLAIC::CSelfClassFactory((const NLAIC::IBasicInterface &)*h), 00099 NLAIC::CTypeOfObject(NLAIC::CTypeOfObject::tAgent), 00100 NLAIC::CTypeOfOperator(NLAIC::CTypeOfOperator::opNone)); 00101 00102 CAgentManagerTimer::TimerManager = new NLMISC::CSynchronized<CAgentScript *>( "CAgentManagerTimer::TimerManager" ); 00103 { 00104 NLMISC::CSynchronized<CAgentScript *>::CAccessor accessor(CAgentManagerTimer::TimerManager); 00105 accessor.value() = h; 00106 } 00107 /*CAgentManagerTimer::RunTimer = new CAgentManagerTimer::CRunTimer(); 00108 CAgentManagerTimer::TimerManagerRun = NLMISC::IThread::create(CAgentManagerTimer::RunTimer); 00109 CAgentManagerTimer::TimerManagerRun->start(); 00110 CAgentManagerTimer::IsRunning = true;*/ 00111 CAgentManagerTimer::IsRunning = false; 00112 } 00113 } |
|
Test the set of the agent.
Definition at line 741 of file agent_script.cpp. References NLAIAGENT::CAgentScript::getType(), NLAIAGENT::CAgentScript::isClassInheritedFrom(), NLAIAGENT::CAgentScript::mapSet, and s. Referenced by NLAIAGENT::CAgentScript::runMethodBase().
00742 { 00743 std::set<std::string>::iterator it = mapSet.find(s); 00744 if(it != mapSet.end()) return true; 00745 else 00746 if(isClassInheritedFrom(CStringVarName(s.c_str())) >= 0) 00747 return true; 00748 else 00749 if(s == (const char *) getType()) 00750 return true; 00751 00752 return false; 00753 } |
|
isClassInheritedFrom(className) allow us to known if this class have a base class with the name className. If true the method return the range of the base class, this range is an arbitrary reference id define by the programmer or bay the scrypt. the false return is define by -1. Reimplemented in NLAIAGENT::IVector, NLAIAGENT::CLocalAgentMail, NLAIAGENT::INombreDefine, NLAIAGENT::IBaseGroupType, and NLAIAGENT::CMessageScript. Definition at line 246 of file baseai.cpp. References sint32. Referenced by NLAISCRIPT::CCompilateur::getValidateHierarchyBase(), NLAIAGENT::CLocalAgentMail::isClassInheritedFrom(), NLAIAGENT::CActorScript::Launch(), NLAIAGENT::CFsmScript::setTopLevel(), and NLAIAGENT::CActorScript::setTopLevel().
00247 {
00248 return -1;
00249 }
|
|
Definition at line 2314 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_AgentClass, NLAISCRIPT::CAgentClass::isClassInheritedFrom(), and sint32. Referenced by NLAIAGENT::CAgentScript::isa(), and NLAIAGENT::CAgentScript::runMethodBase().
02315 { 02316 return _AgentClass->isClassInheritedFrom( name ); 02317 } |
|
Definition at line 2292 of file agent_script.cpp. References NLAIAGENT::IVarName::getString(), param, r, sint, NLAIAGENT::CAgentScript::TDeflautProccessMsg, and NLAIAGENT::TQueue. Referenced by NLAIAGENT::CAgentScript::isMember().
02293 { 02294 const char *name = methodName->getString(); 02295 if(name[0] == 'R' && name[1] == 'u' && name[2] == 'n') 02296 { 02297 static CStringVarName runMsgName[7] = {"RunTell", "RunAchieve", "RunAsk", "RunExec", "RunBreak", "RunKill", "RunError"}; 02298 sint i; 02299 for(i = 0; i < 7; i ++) 02300 { 02301 if(*methodName == runMsgName[i]) 02302 { 02303 TQueue r; 02304 CObjectType *c = new CObjectType(new NLAIC::CIdentType(NLAIC::CIdentType::VoidType)); 02305 r.push(CIdMethod(TDeflautProccessMsg + IAgent::getMethodIndexSize(),0.0,NULL,c)); 02306 return r; 02307 } 02308 } 02309 } 02310 02311 return TQueue(); 02312 } |
|
Implementation of the isEqual of the IBasicObjectIA.
Reimplemented from NLAIAGENT::IAgent. Reimplemented in NLAIAGENT::CActorScript, NLAIAGENT::CAgentOperation, NLAIAGENT::CFsmScript, NLAIAGENT::CSeqFsmScript, and NLAIAGENT::COperatorScript. Definition at line 720 of file agent_script.cpp.
00721 { 00722 return false; 00723 } |
|
If the result is true the object is loclal else its a representation of an object on the server. By the method return true.
Definition at line 356 of file baseai.cpp.
00357 { 00358 return true; 00359 } |
|
The method isMember(nameSubClass,methodName,param) return the best method correspondent to the search. remember we use the overloadind method. NameSubClass: if this pointer is not NULL then NameSubClass is the name of the base class were the method are defined. methodName: is the name of the class. param: is an IObjectIA where it defined the parametre of the method. lot of method use a IObjectIA vector object with an NLAIC::CIdentType as the the template argm. Reimplemented from NLAIAGENT::IObjectIA. Reimplemented in NLAIAGENT::CLocalAgentMail, and NLAIAGENT::CProxyAgentMail. Definition at line 452 of file agents.cpp. References NLAIAGENT::_GetNumId, NLAIAGENT::_RunAsk, NLAIAGENT::_RunTel, NLAISCRIPT::CParam::eval(), and NLAIAGENT::TQueue. Referenced by NLAIAGENT::CAgentScript::isMember(), NLAIAGENT::CLocalAgentMail::isMember(), and NLAIAGENT::CActor::isMember().
00453 { 00454 if(className == NULL) 00455 { 00456 TQueue a; 00457 for(int i = 0; i < _LastM; i++) 00458 { 00459 if(*methodName == IBasicAgent::_Method[i].MethodName) 00460 { 00461 CObjectType *c; 00462 if(i == _RunTel || i == _RunAsk) 00463 { 00464 static NLAISCRIPT::CParam paramMsg(1,new NLAISCRIPT::COperandSimple (new NLAIC::CIdentType(NLAISCRIPT::CMsgNotifyParentClass::IdMsgNotifyParentClass))); 00465 00466 if(paramMsg.eval((NLAISCRIPT::CParam &)p) < 0.0) continue; 00467 c = new CObjectType(new NLAIC::CIdentType(NLAISCRIPT::CMessageClass::IdMessageClass)); 00468 } 00469 else 00470 if (i == _GetNumId) 00471 { 00472 c = new CObjectType(new NLAIC::CIdentType(CStringType::IdStringType)); 00473 } 00474 else 00475 { 00476 c = new CObjectType(new NLAIC::CIdentType(CLocalAgentMail::LocalAgentMail)); 00477 } 00478 a.push(CIdMethod(IBasicAgent::_Method[i].Index + IObjectIA::getMethodIndexSize(),0.0,NULL,c)); 00479 break; 00480 } 00481 } 00482 00483 if(a.size()) return a; 00484 else return IConnectIA::isMember(className,methodName,p); 00485 } 00486 return IConnectIA::isMember(className,methodName,p); 00487 } |
|
Definition at line 2237 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_AgentClass, NLAIAGENT::CAgentScript::getPrivateMember(), NLAISCRIPT::CAgentClass::getPrivateMember(), NLAIAGENT::CAgentScript::isDeflautProccessMsg(), NLAIAGENT::IBasicAgent::isMember(), param, r, and NLAIAGENT::TQueue. Referenced by NLAIAGENT::COperatorScript::getDebugString(), NLAIAGENT::CAgentScript::getDebugString(), NLAIAGENT::CAgentWatchTimer::isMember(), and NLAIAGENT::CAgentScript::sendMessage().
02238 { 02239 02240 02241 if(className == NULL) 02242 { 02243 02244 TQueue r; 02245 if(_AgentClass != NULL) 02246 r = _AgentClass->getPrivateMember(className,methodName,param); 02247 02248 if(r.size()) 02249 return r; 02250 else 02251 { 02252 r = getPrivateMember(className,methodName,param); 02253 if(r.size()) return r; 02254 else 02255 { 02256 r = IAgent::isMember(className,methodName,param); 02257 if(r.size()) 02258 return r; 02259 else 02260 return isDeflautProccessMsg(className,methodName,param); 02261 } 02262 } 02263 02264 } 02265 else 02266 if(*className == CStringVarName("Agent")) 02267 { 02268 TQueue r; 02269 r = getPrivateMember(className,methodName,param); 02270 if(r.size()) 02271 return r; 02272 else 02273 { 02274 r = _AgentClass->getPrivateMember(className,methodName,param); 02275 02276 if ( r.size() ) 02277 return r; 02278 else 02279 { 02280 r = IAgent::isMember(className,methodName,param); 02281 if(r.size()) 02282 return r; 02283 else 02284 return isDeflautProccessMsg(className,methodName,param); 02285 } 02286 } 02287 02288 } 02289 return TQueue(); 02290 } |
|
Call this function to destroy an agent including its referneces in other agents and its childs.
Reimplemented from NLAIAGENT::IConnectIA. Definition at line 57 of file agents.cpp. References NLAIAGENT::IConnectIA::onKill(), NLAIC::IPointerGestion::release(), and sint. Referenced by NLAIAGENT::CAgentScript::~CAgentScript(), NLAIAGENT::CMainAgentScript::~CMainAgentScript(), NLAIAGENT::IAgent::~IAgent(), and NLAIAGENT::IMainAgent::~IMainAgent().
00058 { 00059 //sint n = _SizeChild; 00060 00061 #ifdef NL_DEBUG 00062 if(_SizeChild != (sint)_AgentList.size()) 00063 { 00064 sint i = (sint)_AgentList.size(); 00065 throw; 00066 } 00067 00068 #endif 00069 sint n = _SizeChild ; 00070 while ( /*_AgentList.begin() != _AgentList.end()*/ n--) 00071 { 00072 IConnectIA *c = _AgentList.front(); 00073 _AgentList.pop_front(); 00074 c->onKill(this); 00075 c->release(); 00076 } 00077 _SizeChild = 0; 00078 IAgentComposite::Kill(); 00079 } |
|
Load the class from a stream. Reimplemented from NLAIAGENT::CAgentScript. Definition at line 53 of file agent_timer.cpp.
00054 { 00055 } |
|
This function allow a new instance, that mean that the class is a class factory. Reimplemented from NLAIAGENT::CAgentScript. Definition at line 63 of file agent_timer.cpp. References CAgentManagerTimer().
00064 { 00065 return new CAgentManagerTimer(NULL); 00066 } |
|
Called by an agent who's destroyed te remove its references.
Reimplemented from NLAIAGENT::IAgent. Reimplemented in NLAIAGENT::CAgentWatchTimer, NLAIAGENT::CAgentOperation, and NLAIAGENT::COperatorScript. Definition at line 725 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_DynamicAgentName, and NLAIAGENT::IAgent::onKill(). Referenced by NLAIAGENT::CAgentWatchTimer::onKill().
00726 { 00727 TSetDefNameAgent::iterator iter = _DynamicAgentName.begin(); 00728 while( iter != _DynamicAgentName.end() ) 00729 { 00730 if((*(*iter).Itr) == a) 00731 { 00732 _DynamicAgentName.erase(iter); 00733 break; 00734 } 00735 iter++; 00736 } 00737 IAgent::onKill(a); 00738 } |
|
to get a word num ref of the agents.
Definition at line 380 of file baseai.cpp. References NLAIAGENT::IRefrence::_NumRef.
00381 {
00382 return *_NumRef;
00383 }
|
|
to get a word num ref pointer of the agents.
Definition at line 385 of file baseai.cpp. References NLAIAGENT::IRefrence::_NumRef.
00386 {
00387 return _NumRef;
00388 }
|
|
Lot of algo use this function to determine the equality between 2 class, in particular the extraction from stl list. the == operator call the bool isEqual(const IBasicObjectIA &a) const member method to determine the equality between tow class. Definition at line 134 of file baseai.cpp. References NLAIC::IBasicType::getType(), and NLAIAGENT::IBasicObjectIA::isEqual().
|
|
Definition at line 1461 of file agent_script.cpp. References NLAIC::IBasicType::clone(), NLAIAGENT::IMessageBase::getContinuation(), NLAIAGENT::IMessageBase::getPerformatif(), NLAIAGENT::IMessageBase::getSender(), NLAIAGENT::IMessageBase::setMethodIndex(), NLAIAGENT::IMessageBase::setPerformatif(), NLAIAGENT::IMessageBase::setReceiver(), and NLAIAGENT::IMessageBase::setSender(). Referenced by NLAIAGENT::CAgentScript::processMessages().
01462 { 01463 switch(msg->getPerformatif()) 01464 { 01465 case IMessageBase::PExec: 01466 if(msg->getContinuation() != NULL) 01467 { 01468 IMessageBase *o = (IMessageBase *)returnMsg->clone(); 01469 o->setMethodIndex(-1,-1); 01470 //this->incRef(); 01471 o->setSender(this); 01472 //((IObjectIA *)msg->getContinuation())->incRef(); 01473 o->setReceiver((IObjectIA *)msg->getContinuation()); 01474 ((IObjectIA *)msg->getContinuation())->sendMessage(o); 01475 } 01476 break; 01477 case IMessageBase::PAchieve: 01478 if(msg->getContinuation() != NULL) 01479 { 01480 IMessageBase *o = (IMessageBase *)returnMsg->clone(); 01481 o->setMethodIndex(-1,-1); 01482 //this->incRef(); 01483 o->setSender(this); 01484 //((IObjectIA *)msg->getContinuation())->incRef(); 01485 o->setReceiver((IObjectIA *)msg->getContinuation()); 01486 ((IObjectIA *)msg->getContinuation())->sendMessage(o); 01487 } 01488 break; 01489 case IMessageBase::PAsk: 01490 { 01491 IMessageBase *o = (IMessageBase *)returnMsg->clone(); 01492 o->setMethodIndex(-1,-1); 01493 //this->incRef(); 01494 o->setSender(this); 01495 o->setPerformatif(IMessageBase::PTell); 01496 //if(returnMsg->getSender() != NULL) ((IObjectIA *)returnMsg->getSender())->incRef(); 01497 o->setReceiver((IObjectIA *)returnMsg->getSender()); 01498 ((IObjectIA *)msg->getSender())->sendMessage(o); 01499 01500 01501 if(msg->getContinuation() != NULL) 01502 { 01503 IMessageBase *o = (IMessageBase *)returnMsg->clone(); 01504 o->setMethodIndex(-1,-1); 01505 //this->incRef(); 01506 o->setSender(this); 01507 //if(msg->getContinuation() != NULL) ((IObjectIA *)msg->getContinuation())->incRef(); 01508 o->setReceiver((IObjectIA *)msg->getContinuation()); 01509 o->setPerformatif(IMessageBase::PTell); 01510 ((IObjectIA *)msg->getContinuation())->sendMessage(o); 01511 } 01512 } 01513 break; 01514 case IMessageBase::PTell: 01515 if(msg->getContinuation() != NULL) 01516 { 01517 IMessageBase *o = (IMessageBase *)returnMsg->clone(); 01518 o->setMethodIndex(-1,-1); 01519 //this->incRef(); 01520 o->setSender(this); 01521 //if(msg->getContinuation() != NULL) ((IObjectIA *)msg->getContinuation())->incRef(); 01522 o->setReceiver((IObjectIA *)msg->getContinuation()); 01523 ((IObjectIA *)msg->getContinuation())->sendMessage(o); 01524 } 01525 break; 01526 case IMessageBase::PBreak: 01527 if(msg->getContinuation() != NULL) 01528 { 01529 IMessageBase *o = (IMessageBase *)returnMsg->clone(); 01530 o->setMethodIndex(-1,-1); 01531 //this->incRef(); 01532 o->setSender(this); 01533 //if(msg->getContinuation() != NULL) ((IObjectIA *)msg->getContinuation())->incRef(); 01534 o->setReceiver((IObjectIA *)msg->getContinuation()); 01535 ((IObjectIA *)msg->getContinuation())->sendMessage(o); 01536 } 01537 break; 01538 case IMessageBase::PKill: 01539 if(msg->getContinuation() != NULL) 01540 { 01541 IMessageBase *o = (IMessageBase *)returnMsg->clone(); 01542 o->setMethodIndex(-1,-1); 01543 //this->incRef(); 01544 o->setSender(this); 01545 //if(msg->getContinuation() != NULL) ((IObjectIA *)msg->getContinuation())->incRef(); 01546 o->setReceiver((IObjectIA *)msg->getContinuation()); 01547 ((IObjectIA *)msg->getContinuation())->sendMessage(o); 01548 } 01549 break; 01550 default: break; 01551 } 01552 } |
|
Reimplemented in NLAIAGENT::COperatorScript. Definition at line 1412 of file agent_script.cpp. References NLAISCRIPT::CCodeContext::ContextDebug, NLAIAGENT::CAgentScript::getBaseMethodCount(), NLAIAGENT::IMessageBase::getHeritanceIndex(), NLAIAGENT::IBasicAgent::getMail(), NLAIAGENT::CAgentScript::getMethode(), NLAIAGENT::IMessageBase::getMethodIndex(), NLAIC::IBasicType::getType(), NLAIC::IPointerGestion::incRef(), param, NLAIAGENT::IMailBox::popMessage(), NLAIAGENT::CAgentScript::processContinuation(), NLAIC::IPointerGestion::release(), NLAISCRIPT::CCallMethod::runOpCode(), NLAISCRIPT::CCodeContext::Self, and NLAISCRIPT::CCodeContext::Stack.
01413 { 01414 #ifdef NL_DEBUG 01415 const char *txt = (const char *)msg->getType(); 01416 bool dbugB = false; 01417 #endif 01418 NLAISCRIPT::CCodeContext &context = (NLAISCRIPT::CCodeContext &)*c; 01419 IBaseGroupType *param = new CGroupType(); 01420 msg->incRef(); 01421 param->push(msg); 01422 context.Stack ++; 01423 context.Stack[(int)context.Stack] = param; 01424 01425 int indexM = msg->getMethodIndex() - getBaseMethodCount(); 01426 if(indexM >= 0) 01427 { 01428 IObjectIA *code = getMethode(indexM); 01429 if(code == NULL) 01430 { 01431 getMail()->popMessage(); 01432 return; 01433 } 01434 } 01435 01436 NLAISCRIPT::IMethodContext *methodContex; 01437 01438 if (context.ContextDebug.Active) 01439 { 01440 /*context.ContextDebug.Param.push_back(&listBidon); 01441 listBidon.incRef();*/ 01442 methodContex = new NLAISCRIPT::CMethodContextDebug(); 01443 } 01444 else 01445 { 01446 methodContex = new NLAISCRIPT::CMethodContext(); 01447 } 01448 const IObjectIA *self = context.Self; 01449 context.Self = this; 01450 NLAISCRIPT::CCallMethod opCall(methodContex,msg->getHeritanceIndex(),msg->getMethodIndex()); 01451 opCall.runOpCode(context); 01452 context.Self = self; 01453 IMessageBase *returnMsg = (IMessageBase *)context.Stack[(int)context.Stack]; 01454 returnMsg->incRef(); 01455 context.Stack--; 01456 processContinuation(msg, returnMsg); 01457 01458 returnMsg->release(); 01459 } |
|
The processMessages method, process the loop/Run message. Reimplemented from NLAIAGENT::IAgent. Reimplemented in NLAIAGENT::CActorScript. Definition at line 1554 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_AgentManager, NLAIAGENT::IAgentManager::getAgentContext(), NLAIAGENT::IBasicAgent::getMail(), NLAIAGENT::IMailBox::getMessage(), NLAIAGENT::IMailBox::getMessageCount(), NLAIAGENT::IMessageBase::getMethodIndex(), NLAIAGENT::IBasicAgent::getMethodIndexSize(), NLAIC::IBasicType::getType(), NLAIAGENT::CAgentScript::getType(), NLAIAGENT::IMailBox::popMessage(), NLAIC::IPointerGestion::release(), and sint. Referenced by NLAIAGENT::CActorScript::processMessages(), and NLAIAGENT::CMainAgentScript::run().
01555 { 01556 IObjectIA *c = NULL; 01557 if( _AgentManager != NULL) 01558 c = (IObjectIA *)_AgentManager->getAgentContext(); 01559 else 01560 c = NULL; 01561 01562 IMailBox *mail = getMail(); 01563 01564 01565 //const IMailBox::TListMessage &l = mail->getMesseageListe(); 01566 sint n = mail->getMessageCount(); 01567 01568 while(/*l.begin() != l.end()*/n--) 01569 { 01570 IMessageBase &msg = (IMessageBase &)mail->getMessage(); 01571 #ifdef NL_DEBUG 01572 const char *dbg_this = (const char *) getType(); 01573 const char *dbg_msg = (const char *) msg.getType(); 01574 #endif 01575 01576 if(msg.getMethodIndex() >= 0 && c != NULL) 01577 { 01578 sint indexM = msg.getMethodIndex() - IAgent::getMethodIndexSize(); 01579 IObjectIA *o; 01580 if(indexM != CAgentScript::TDeflautProccessMsg) processMessages(&msg,c); 01581 else 01582 { 01583 o = IBasicAgent::run( msg ); 01584 if(o != NULL) o->release(); 01585 } 01586 if ( mail->getMessageCount() != 0 ) 01587 mail->popMessage(); 01588 } 01589 else 01590 { 01591 try 01592 { 01593 IObjectIA *o = IBasicAgent::run( msg ); 01594 if (o != NULL) 01595 o->release(); 01596 mail->popMessage(); 01597 } 01598 catch(NLAIE::CExceptionNotImplemented &e) 01599 { 01600 mail->popMessage(); 01601 throw NLAIE::CExceptionNotImplemented(e.what()); 01602 } 01603 } 01604 } 01605 } |
|
the loader of the class.
Definition at line 433 of file baseai.cpp. References NLAIAGENT::IRefrence::_NumRef, NLAIC::IBasicInterface::load(), NLAIC::IPointerGestion::release(), and NLMISC::IStream::serial(). Referenced by NLAIAGENT::IRefrence::IRefrence(), and NLAIAGENT::IRefrence::load().
00434 { 00435 IObjectIA::load(is); 00436 _NumRef->release(); 00437 NLAIC::CIdentTypeAlloc id; 00438 is >> id; 00439 _NumRef = (IWordNumRef *)id.allocClass(); 00440 _NumRef->load(is); 00441 bool k; 00442 is.serial( k ); 00443 if ( k ) 00444 { 00445 if(_Parent) _Parent->release(); 00446 is >> id; 00447 _Parent = (IWordNumRef *)id.allocClass(); 00448 _Parent->load(is); 00449 } 00450 else 00451 { 00452 _Parent = NULL; 00453 } 00454 } |
|
|
Definition at line 355 of file agent_script.cpp. References sint. Referenced by NLAILINK::releaseIALib().
00356 { 00357 //SendParamMessageScript->release(); 00358 //IdMsgNotifyParentClass->release(); 00360 // Temp, to be transfered in CGDAgentScript (Goal Driven Agent) 00361 // IdGoalMsgClass->release(); 00362 // IdGoalMsg->release(); 00363 //ParamGoalMsg->release(); 00364 //ParamCancelGoalMsg->release(); 00366 00367 //ParamRunParentNotify->release(); 00368 //SendCompParamMessageScript->release(); 00369 sint i; 00370 for(i = 0; i < CAgentScript::TLastM; i++) 00371 { 00372 delete StaticMethod[i]; 00373 } 00374 delete StaticMethod; 00375 } |
|
Definition at line 115 of file agent_timer.cpp. Referenced by NLAILINK::releaseIALib().
00116 { 00117 { 00118 NLMISC::CSynchronized<CAgentScript *>::CAccessor accessor(CAgentManagerTimer::TimerManager); 00119 accessor.value()->release(); 00120 } 00121 delete CAgentManagerTimer::TimerManager; 00122 delete CAgentManagerTimer::IdAgentTimer; 00123 CAgentManagerTimer::IdAgentTimer = NULL; 00124 CAgentManagerTimer::TimerManager = NULL; 00125 00126 if(CAgentManagerTimer::TimerManagerRun) 00127 { 00128 CAgentManagerTimer::TimerManagerRun->terminate(); 00129 delete CAgentManagerTimer::TimerManagerRun; 00130 delete CAgentManagerTimer::RunTimer; 00131 CAgentManagerTimer::IsRunning = false; 00132 } 00133 00134 } |
|
Removing operator from th agent.
Definition at line 1672 of file agent_script.cpp.
01673 { 01674 /* std::vector<NLAILOGIC::IBaseOperator *>::iterator it_o = _Operators.begin(); 01675 while ( it_o != _Operators.end() ) 01676 { 01677 if ( op == *it_o ) 01678 { 01679 _Operators.erase( it_o ); 01680 return; 01681 } 01682 it_o++; 01683 } 01684 char buf[2048]; 01685 op->getDebugString(buf); 01686 throw NLAIE::CExceptionObjectNotFoundError(buf); 01687 */ 01688 } |
|
Remove a child from the std::list<IBasicAgent *> child list. Implements NLAIAGENT::IBasicAgent. Reimplemented in NLAIAGENT::CLocalAgentMail. Definition at line 84 of file basic_agent.cpp. References NLAIAGENT::IAgentComposite::_AgentList, and NLAIAGENT::IAgentComposite::_SizeChild.
00085 { 00086 _AgentList.erase(iter); 00087 _SizeChild --; 00088 } |
|
Remove a child from the std::list<IBasicAgent *> child list. Implements NLAIAGENT::IBasicAgent. Reimplemented in NLAIAGENT::CLocalAgentMail. Definition at line 108 of file basic_agent.cpp. References NLAIAGENT::IAgentComposite::_AgentList, NLAIAGENT::IAgentComposite::_SizeChild, NLAIAGENT::IBasicAgent::getMail(), NLAIC::IPointerGestion::release(), and NLAIAGENT::IMailBox::removeMailBox().
00109 { 00110 std::list<IBasicAgent *>::iterator i = _AgentList.begin(); 00111 while(i != _AgentList.end()) 00112 { 00113 IBasicAgent *c = *i; 00114 if(c == p) 00115 { 00116 _AgentList.erase(i); 00117 p->getMail()->removeMailBox( this->getMail() ); 00118 c->release(); 00119 _SizeChild --; 00120 // Supprime chez l'ancien fils la boite au lettre du père 00121 break; 00122 } 00123 i++; 00124 } 00125 } |
|
Definition at line 90 of file basic_agent.cpp. References NLAIAGENT::IAgentComposite::_AgentList, NLAIAGENT::IAgentComposite::_SizeChild, NLAIAGENT::IBasicAgent::getMail(), and NLAIAGENT::IMailBox::removeMailBox(). Referenced by NLAIAGENT::CAgentScript::removeDynamic(), NLAIAGENT::IAgent::runChildren(), and NLAIAGENT::IAgent::runChildrenStepByStep().
00091 { 00092 std::list<IBasicAgent *>::iterator i = _AgentList.begin(); 00093 while(i != _AgentList.end()) 00094 { 00095 if(*((*i)) == p) 00096 { 00097 (*i)->release(); 00098 _AgentList.erase(i); 00099 // Supprime chez l'ancien fils la boite au lettre du père 00100 p.getMail()->removeMailBox( this->getMail() ); 00101 _SizeChild --; 00102 return; 00103 } 00104 i++; 00105 } 00106 } |
|
To release a connection.
Definition at line 561 of file baseai.cpp. References NLAIAGENT::IConnectIA::removeInConnectedList(), and NLAIAGENT::IConnectIA::removeInConnectionList(). Referenced by NLAIAGENT::CAgentWatchTimer::detach(), NLAIAGENT::IAgent::onKill(), NLAIAGENT::IAgentInput::releaseInputConnexion(), and NLAIAGENT::CLocalMailBox::removeMailBox().
00562 { 00563 Agent->removeInConnectedList(this); 00564 removeInConnectionList(Agent); 00565 } |
|
that is a surchage of the method member virtual IObjectIA::CProcessResult addDynamicAgent(NLAIAGENT::IBaseGroupType *g); Definition at line 840 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_DynamicAgentName, NLAIAGENT::IBaseGroupType::getFront(), r, NLAIAGENT::IAgentComposite::removeChild(), and s.
00841 { 00842 CStringType *s = (CStringType *)g->getFront(); 00843 IObjectIA::CProcessResult r; 00844 r.ResultState = IObjectIA::ProcessIdle; 00845 std::pair<TSetDefNameAgent::iterator,TSetDefNameAgent::iterator> p = _DynamicAgentName.equal_range(CKeyAgent(*s)); 00846 00847 if(p.first != p.second) 00848 { 00849 while(p.first != p.second) 00850 { 00851 TSetDefNameAgent::iterator iTmp = p.first; 00852 p.first ++; 00853 00854 NLAIAGENT::IBasicAgent *o = *iTmp->Itr; 00855 _DynamicAgentName.erase(iTmp); 00856 removeChild(o); 00857 } 00858 r.Result = new DigitalType(1.0); 00859 return r; 00860 } 00861 r.Result = &DigitalType::NullOperator; 00862 r.Result->incRef(); 00863 return r; 00864 } |
|
remove an agent from the manager. The rgument g must store an CStringType. This string is the name of the agent to remove. The methode return the state of the operation, an digital at 1.0 if the remove is done an digital at 0.0 is the method did'nt find the agent. Definition at line 867 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_DynamicAgentName, and NLAIAGENT::IAgentComposite::removeChild(). Referenced by NLAIAGENT::CAgentScript::runMethodBase(), and NLAIAGENT::CActorScript::unActivate().
00868 { 00869 00870 TSetDefNameAgent::iterator p = _DynamicAgentName.begin(); 00871 00872 while(p != _DynamicAgentName.end()) 00873 { 00874 if((*(*p).Itr) == ag) 00875 { 00876 _DynamicAgentName.erase(p); 00877 removeChild(ag); 00878 break; 00879 } 00880 p ++; 00881 } 00882 } |
|
remove a goal, it hapend when it neaded by user, when the priorty is down or when the goal is satisfay.
Definition at line 410 of file agent_script.h. Referenced by NLAILOGIC::CGoal::operatorSuccess().
00411 { 00412 } |
|
Definition at line 600 of file baseai.cpp. References NLAIAGENT::IConnectIA::_Connected, and NLAIAGENT::IConnectIA::TListIBasicItr. Referenced by NLAIAGENT::IConnectIA::Kill(), and NLAIAGENT::IConnectIA::removeConnection().
00601 { 00602 TListIBasicItr i = _Connected.find(a); 00603 if(i != _Connected.end()) 00604 _Connected.erase(i); 00605 /*TListIBasicItr i = _Connected.begin(); 00606 while(i != _Connected.end()) 00607 { 00608 const IConnectIA *o = *i; 00609 if(o == a) 00610 { 00611 _Connected.erase(i); 00612 return; 00613 } 00614 i++; 00615 }*/ 00616 } |
|
Definition at line 577 of file baseai.cpp. References NLAIAGENT::IConnectIA::_Connection, and NLAIAGENT::IConnectIA::TListIBasicItr. Referenced by NLAIAGENT::IConnectIA::Kill(), and NLAIAGENT::IConnectIA::removeConnection().
00578 { 00579 00580 TListIBasicItr i = _Connection.find(a); 00581 if(i != _Connection.end()) 00582 _Connection.erase(i); 00583 /*TListIBasicItr i = _Connection.begin(); 00584 while(i != _Connection.end()) 00585 { 00586 if(*i == a) 00587 { 00588 _Connection.erase(i); 00589 return; 00590 } 00591 i++; 00592 }*/ 00593 } |
|
Run message is the message processing. Reimplemented in NLAIAGENT::CMsgWaiter. Definition at line 365 of file agents.cpp. References NLAIAGENT::IMessageBase::getContinuation(), NLAIAGENT::IMessageBase::getPerformatif(), NLAIAGENT::IMessageBase::getSender(), NLAIC::IBasicType::getType(), NLAIC::IPointerGestion::incRef(), NLAIC::IPointerGestion::release(), NLAIAGENT::IBasicAgent::runAchieve(), NLAIAGENT::IBasicAgent::runAsk(), NLAIAGENT::IBasicAgent::runBreak(), NLAIAGENT::IBasicAgent::runError(), NLAIAGENT::IBasicAgent::runEven(), NLAIAGENT::IBasicAgent::runExec(), NLAIAGENT::IBasicAgent::runKill(), NLAIAGENT::IBasicAgent::runTell(), NLAIAGENT::IMessageBase::setPerformatif(), and NLAIC::stringGetBuild(). Referenced by NLAIAGENT::CSeqFsmScript::runChildren(), and NLAIAGENT::IAgent::runChildren().
00366 { 00367 IMessageBase *returnMsg = NULL; 00368 switch(msg.getPerformatif()) 00369 { 00370 case IMessageBase::PUndefine: 00371 { 00372 std::string text; 00373 text = NLAIC::stringGetBuild("Function IObjectIA *IBasicAgent::run('%s') proccess an IMessageBase::PUndefine performatif",(const char *)msg.getType()); 00374 throw NLAIE::CExceptionNotImplemented(text.c_str()); 00375 } 00376 break; 00377 case IMessageBase::PExec: 00378 00379 returnMsg = runExec(msg); 00380 if(msg.getContinuation() != NULL) 00381 { 00382 returnMsg->incRef(); 00383 ((IObjectIA *)msg.getContinuation())->sendMessage(returnMsg); 00384 } 00385 break; 00386 case IMessageBase::PAchieve: 00387 returnMsg = runAchieve(msg); 00388 if(msg.getContinuation() != NULL) 00389 { 00390 returnMsg->incRef(); 00391 ((IObjectIA *)msg.getContinuation())->sendMessage(returnMsg); 00392 } 00393 break; 00394 case IMessageBase::PAsk: 00395 returnMsg = runAsk(msg); 00396 returnMsg->setPerformatif(IMessageBase::PTell); 00397 returnMsg->incRef(); 00398 ((IObjectIA *)msg.getSender())->sendMessage(returnMsg); 00399 if(msg.getContinuation() != NULL) 00400 { 00401 returnMsg->incRef(); 00402 ((IObjectIA *)msg.getContinuation())->sendMessage(returnMsg); 00403 } 00404 break; 00405 case IMessageBase::PTell: 00406 returnMsg = runTell(msg); 00407 00408 break; 00409 case IMessageBase::PBreak: 00410 returnMsg = runBreak(msg); 00411 break; 00412 case IMessageBase::PKill: 00413 returnMsg = runKill(msg); 00414 break; 00415 case IMessageBase::PError: 00416 returnMsg = runError(msg); 00417 break; 00418 00419 case IMessageBase::PEven: 00420 returnMsg = runEven(msg); 00421 break; 00422 default: break; 00423 } 00424 00425 if(returnMsg) returnMsg->release(); 00426 return NULL; 00427 } |
|
The work of an agent. Typically agent process child message, process its message and run its activity. Reimplemented from NLAIAGENT::IAgent. Reimplemented in NLAIAGENT::CActorScript, NLAIAGENT::CMainAgentScript, NLAIAGENT::CAgentOperation, NLAIAGENT::CFsmScript, and NLAIAGENT::COperatorScript. Definition at line 1628 of file agent_script.cpp. References NLMISC::CTime::getPerformanceTime(), NLAIAGENT::CAgentScript::getType(), r, and NLMISC::TTicks. Referenced by NLAIAGENT::CActorScript::run().
01629 { 01630 01631 #ifdef NL_DEBUG 01632 const char *dbg_class_name = (const char *) getType(); 01633 //const NLAIAGENT::IRefrence *dbg_mail_parent = _ScriptMail->getParent(); 01634 #endif 01635 01636 #ifdef PROFILE 01637 NLMISC::TTicks time = NLMISC::CTime::getPerformanceTime(); 01638 #endif 01639 01640 const IObjectIA::CProcessResult &r = IAgentManager::run(); 01641 01642 #ifdef PROFILE 01643 time = NLMISC::CTime::getPerformanceTime() - time; 01644 //if(time) 01645 { 01646 TimeRun = time; 01647 NbRun = 1; 01648 } 01649 #endif 01650 01651 return r; 01652 01653 } |
|
runAchieve ist to processing reltative to PAchieve Performatif. its call from the IObjectIA *run(const IMessageBase &m) method. Definition at line 127 of file agent.h. References NLAIC::IBasicType::getDebugString(), and NLAIC::IBasicType::getType(). Referenced by NLAIAGENT::IBasicAgent::run().
00128 { 00129 std::string debugString; 00130 std::string text; 00131 getDebugString(debugString); 00132 text = "IMessageBase *runAchieve("; 00133 text += (const char *)m.getType(); 00134 text += " note implementaited for the '"; 00135 text += (const char *)getType(); 00136 text += "' interface for the instence '"; 00137 text += (const char *)getType(); 00138 text += "' '"; 00139 text += debugString; 00140 text += "'"; 00141 00142 throw NLAIE::CExceptionNotImplemented(text.c_str()); 00143 return NULL; 00144 } |
|
Mailer do'nt have own activity.
Reimplemented from NLAIAGENT::CAgentScript. Definition at line 78 of file agent_timer.cpp.
00079 { 00080 _Time ++; 00081 return IObjectIA::CProcessResult(); 00082 } |
|
runAsk is to processing reltative to PAsk Performatif. its call from the IObjectIA *run(const IMessageBase &m) method. Definition at line 546 of file agents.cpp. References NLAIC::IBasicType::getDebugString(), NLAIAGENT::IConnectIA::getParent(), NLAIC::IBasicType::getType(), and NLAIC::stringGetBuild(). Referenced by NLAIAGENT::IBasicAgent::run().
00547 { 00548 if(NLAISCRIPT::CMsgNotifyParentClass::IdMsgNotifyParentClass == m.getType()) 00549 { 00550 if(getParent() != NULL) 00551 { 00552 CNotifyParentScript *msg = new CNotifyParentScript(); 00553 return msg; 00554 } 00555 else 00556 { 00557 CNotifyParentScript *msg = new CNotifyParentScript((IBasicAgent *)getParent()); 00558 return msg; 00559 } 00560 } 00561 else 00562 { 00563 std::string debugString; 00564 std::string text; 00565 getDebugString(debugString); 00566 text += NLAIC::stringGetBuild("runAsk(%s) note implementaited for the '%s' interface for the instence '%s'",(const char *)m.getType(),(const char *)getType(),debugString.c_str()); 00567 throw NLAIE::CExceptionNotImplemented(text.c_str()); 00568 return NULL; 00569 } 00570 } |
|
This function process the message ask debug string for the runTell. Definition at line 923 of file agent_script.cpp. References NLAIC::CIdentType::allocClass(), NLAIAGENT::IBaseGroupType::get(), NLAIAGENT::CAgentScript::getDebugString(), NLAIAGENT::IConnectIA::getParent(), NLAIAGENT::IMessageBase::getSender(), NLAIC::IBasicType::getType(), NLAIAGENT::CAgentScript::getType(), NLAIAGENT::IListBasicManager::push(), r, NLAIAGENT::IMessageBase::setPerformatif(), and NLAIAGENT::IMessageBase::setSender(). Referenced by NLAIAGENT::CAgentScript::runMethodBase().
00924 { 00925 00926 #ifdef NL_DEBUG 00927 const char *text = (const char *)getType(); 00928 const char *textP = (const char *)getParent()->getType(); 00929 #endif 00930 static NLAIC::CIdentType idMsgDebugString ("MsgDebugString"); 00931 00932 NLAIAGENT::IMessageBase &mOriginal = (NLAIAGENT::IMessageBase &)*g->get(); 00933 00934 IMessageBase *m = (IMessageBase *)idMsgDebugString.allocClass(); 00935 m->setPerformatif(IMessageBase::PTell); 00936 m->setSender(this); 00937 00938 std::string str; 00939 getDebugString(str); 00940 00941 m->push(new CStringType(str)); 00942 00943 if(mOriginal.getSender() != NULL) 00944 ((IObjectIA *)mOriginal.getSender())->sendMessage((IObjectIA *)m); 00945 00946 IObjectIA::CProcessResult r; 00947 00948 //m->incRef(); 00949 r.Result = m; 00950 return r; 00951 } |
|
|
This function process the message CNotifyParentScript for the runAsk. Definition at line 912 of file agent_script.cpp. References NLAIAGENT::IConnectIA::getParent(), r, NLAIAGENT::IMessageBase::setPerformatif(), and NLAIAGENT::IMessageBase::setSender(). Referenced by NLAIAGENT::CAgentScript::runMethodBase().
|
|
runBreak is to processing reltative to PBreak Performatif. its call from the IObjectIA *run(const IMessageBase &m) method. Definition at line 159 of file agent.h. References NLAIC::IBasicType::getDebugString(), and NLAIC::IBasicType::getType(). Referenced by NLAIAGENT::IBasicAgent::run().
00160 { 00161 std::string debugString; 00162 std::string text; 00163 getDebugString(debugString); 00164 text = "IMessageBase *runBreak("; 00165 text += (const char *)m.getType(); 00166 text += " note implementaited for the '"; 00167 text += (const char *)getType(); 00168 text += "' interface for the instence '"; 00169 text += (const char *)getType(); 00170 text += "' '"; 00171 text += debugString; 00172 text += "'"; 00173 00174 throw NLAIE::CExceptionNotImplemented(text.c_str()); 00175 return NULL; 00176 } |
|
Cancel a goal, it call by message manager when a cancel goal message is occure.
Definition at line 398 of file agent_script.h.
00399 {
00400 return IObjectIA::CProcessResult();
00401 }
|
|
Run all child. Reimplemented from NLAIAGENT::IAgent. Reimplemented in NLAIAGENT::CFsmScript, and NLAIAGENT::CSeqFsmScript. Definition at line 1377 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_Components, NLAIAGENT::CAgentScript::_NbComponents, NLAIAGENT::CAgentScript::getType(), NLAIAGENT::IObjectIA::run(), and NLAIAGENT::IAgent::runChildren(). Referenced by NLAIAGENT::CMainAgentScript::run().
01378 { 01379 #ifdef NL_DEBUG 01380 const char *classBase = (const char *)getType(); 01381 #endif 01382 // Activation des agents de la partie statique 01383 int i = _NbComponents; 01384 01385 IObjectIA **com = _Components; 01386 01387 while(i --) 01388 (*com ++)->run(); 01389 01390 // Activation des fils 01391 IAgent::runChildren(); 01392 } |
|
Activates the child agents.
Reimplemented from NLAIAGENT::IAgent. Definition at line 1394 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_Components, NLAIAGENT::CAgentScript::_iComponents, NLAIAGENT::CAgentScript::_NbComponents, NLAIAGENT::IObjectIA::run(), and NLAIAGENT::IAgent::runChildrenStepByStep().
01395 { 01396 if(_iComponents == _NbComponents) 01397 { 01398 if(IAgent::runChildrenStepByStep()) 01399 { 01400 _iComponents = 0; 01401 return true; 01402 } 01403 else return false; 01404 } 01405 01406 IObjectIA *o = _Components[_iComponents ++]; 01407 o->run(); 01408 01409 return false; 01410 } |
|
runError is to processing reltative to PError Performatif. its call from the IObjectIA *run(const IMessageBase &m) method. Definition at line 206 of file agent.h. References NLAIC::IBasicType::getDebugString(), and NLAIC::IBasicType::getType(). Referenced by NLAIAGENT::IBasicAgent::run().
00207 { 00208 std::string debugString; 00209 std::string text; 00210 getDebugString(debugString); 00211 text = "IMessageBase *runError("; 00212 text += (const char *)m.getType(); 00213 text += " note implementaited for the '"; 00214 text += (const char *)getType(); 00215 text += "' interface for the instence '"; 00216 text += (const char *)getType(); 00217 text += "' '"; 00218 text += debugString; 00219 text += "'"; 00220 00221 throw NLAIE::CExceptionNotImplemented(text.c_str()); 00222 return NULL; 00223 } |
|
RunExec is to processing reltative to PExec Performatif. its call from the IObjectIA *run(const IMessageBase &m) method. Definition at line 105 of file agent.h. References NLAIC::IBasicType::getDebugString(), and NLAIC::IBasicType::getType(). Referenced by NLAIAGENT::IBasicAgent::run().
00106 { 00107 std::string debugString; 00108 std::string text; 00109 getDebugString(debugString); 00110 text = "IMessageBase *runEven("; 00111 text += (const char *)m.getType(); 00112 text += " note implementaited for the '"; 00113 text += (const char *)getType(); 00114 text += "' interface for the instence '"; 00115 text += (const char *)getType(); 00116 text += "' '"; 00117 text += debugString; 00118 text += "'"; 00119 00120 throw NLAIE::CExceptionNotImplemented(text.c_str()); 00121 return NULL; 00122 } |
|
RunExec is to processing reltative to PExec Performatif. its call from the IObjectIA *run(const IMessageBase &m) method. Reimplemented in NLAIAGENT::CMainAgentScript. Definition at line 83 of file agent.h. References NLAIC::IBasicType::getDebugString(), and NLAIC::IBasicType::getType(). Referenced by NLAIAGENT::IBasicAgent::run().
00084 { 00085 std::string debugString; 00086 std::string text; 00087 getDebugString(debugString); 00088 text = "IMessageBase *runExec("; 00089 text += (const char *)m.getType(); 00090 text += " note implementaited for the '"; 00091 text += (const char *)getType(); 00092 text += "' interface for the instence '"; 00093 text += (const char *)getType(); 00094 text += "' '"; 00095 text += debugString; 00096 text += "'"; 00097 00098 throw NLAIE::CExceptionNotImplemented(text.c_str()); 00099 return NULL; 00100 } |
|
Add a fact on the fact base, it occur when a fact message hapend.
Definition at line 404 of file agent_script.h.
00405 {
00406 return IObjectIA::CProcessResult();
00407 }
|
|
Run all goal message, it call by message manager when a goal message is occure.
Definition at line 392 of file agent_script.h.
00393 {
00394 return IObjectIA::CProcessResult();
00395 }
|
|
that is a surchage of the method member virtual IObjectIA::CProcessResult addDynamicAgent(NLAIAGENT::IBaseGroupType *g); Definition at line 1103 of file agent_script.cpp. References NLAIAGENT::IBaseGroupType::get(), and r.
01104 { 01105 const char * class_name = ((NLAIAGENT::CStringVarName *)g->get())->getString(); 01106 NLAIC::CIdentType id_class( class_name ); 01107 01108 01109 01110 /* 01111 NLAIAGENT::IMessageBase &msg_result = (NLAIAGENT::IMessageBase &)*g->get(); 01112 msg_result.incRef(); 01113 01114 01115 // Cleans previous components 01116 if ( _Components != NULL ) 01117 { 01118 for ( int i = 0; i < _NbComponents; i++ ) 01119 _Components[i]->release(); 01120 } 01121 01122 // Creates a new component array 01123 _NbComponents = (sint32) msg_result.size() / 3; 01124 _Components = new IObjectIA *[ _NbComponents ]; 01125 01126 int test = 0; 01127 01128 for ( int i = 0; i < msg_result.size() ; i += 3 ) 01129 { 01130 CStringType *comp_name = (CStringType *) msg_result[ (sint32) i ]; 01131 CStringType *comp_type = (CStringType *) msg_result[ (sint32) (i + 1) ]; 01132 IObjectIA *comp_val = (IObjectIA *) msg_result[ (sint32) (i + 2) ]; 01133 01134 sint32 index = getStaticMemberIndex( comp_name->getStr() ); //_AgentClass->getInheritedStaticMemberIndex( comp_name->getStr() ); 01135 if ( index != -1 ) 01136 { 01137 // Sets the component to the new value 01138 setStaticMember( index, comp_val ); 01139 } 01140 else 01141 { 01142 setStaticMember( (sint32) (i / 3) , comp_val ); 01143 } 01144 test++; 01145 } 01146 */ 01147 IObjectIA::CProcessResult r; 01148 r.Result = NULL; 01149 return r; 01150 } |
|
that is a surchage of the method member virtual IObjectIA::CProcessResult addDynamicAgent(NLAIAGENT::IBaseGroupType *g); Definition at line 1060 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_Components, NLAIAGENT::CAgentScript::_NbComponents, NLAIAGENT::IBaseGroupType::get(), NLAIAGENT::CAgentScript::getStaticMemberIndex(), NLAIAGENT::CStringType::getStr(), NLAIC::IPointerGestion::incRef(), index, r, NLAIC::IPointerGestion::release(), NLAIAGENT::CAgentScript::setStaticMember(), sint32, and NLAIAGENT::IListBasicManager::size(). Referenced by NLAIAGENT::CAgentScript::runMethodBase().
01061 { 01062 NLAIAGENT::IMessageBase &msg_result = (NLAIAGENT::IMessageBase &)*g->get(); 01063 msg_result.incRef(); 01064 01065 01066 // Cleans previous components 01067 if ( _Components != NULL ) 01068 { 01069 for ( int i = 0; i < _NbComponents; i++ ) 01070 _Components[i]->release(); 01071 } 01072 01073 // Creates a new component array 01074 _NbComponents = (sint32) msg_result.size() / 3; 01075 _Components = new IObjectIA *[ _NbComponents ]; 01076 01077 int test = 0; 01078 01079 for ( int i = 0; i < msg_result.size() ; i += 3 ) 01080 { 01081 CStringType *comp_name = (CStringType *) msg_result[ (sint32) i ]; 01082 IObjectIA *comp_val = (IObjectIA *) msg_result[ (sint32) (i + 2) ]; 01083 01084 sint32 index = getStaticMemberIndex( comp_name->getStr() ); //_AgentClass->getInheritedStaticMemberIndex( comp_name->getStr() ); 01085 if ( index != -1 ) 01086 { 01087 // Sets the component to the new value 01088 setStaticMember( index, comp_val ); 01089 } 01090 else 01091 { 01092 setStaticMember( (sint32) (i / 3) , comp_val ); 01093 } 01094 test++; 01095 } 01096 01097 IObjectIA::CProcessResult r; 01098 msg_result.incRef(); 01099 r.Result = &msg_result; 01100 return r; 01101 } |
|
runKill is to processing reltative to PKill Performatif. its call from the IObjectIA *run(const IMessageBase &m) method. Reimplemented in NLAIAGENT::CAgentWatchTimer. Definition at line 184 of file agent.h. References NLAIC::IBasicType::getDebugString(), and NLAIC::IBasicType::getType(). Referenced by NLAIAGENT::IBasicAgent::run().
00185 { 00186 std::string debugString; 00187 std::string text; 00188 getDebugString(debugString); 00189 text = "IMessageBase *runKill("; 00190 text += (const char *)m.getType(); 00191 text += " note implementaited for the '"; 00192 text += (const char *)getType(); 00193 text += "' interface for the instence '"; 00194 text += (const char *)getType(); 00195 text += "' '"; 00196 text += debugString; 00197 text += "'"; 00198 00199 throw NLAIE::CExceptionNotImplemented(text.c_str()); 00200 return NULL; 00201 } |
|
Reimplemented in NLAIAGENT::CActorScript, NLAIAGENT::CAgentWatchTimer, NLAIAGENT::CAgentOperation, NLAIAGENT::CFsmScript, NLAIAGENT::CSeqFsmScript, NLAILOGIC::CGoalPath, and NLAIAGENT::COperatorScript. Definition at line 1849 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_AgentClass, NLAIAGENT::CAgentScript::_DynamicAgentName, NLAIAGENT::CAgentScript::addDynamicAgent(), NLAIAGENT::CAgentScript::addSet(), NLAIAGENT::CAgentScript::getClassName(), NLAIAGENT::CAgentScript::getDynamicAgent(), NLAISCRIPT::CAgentClass::getInheritedStaticMemberIndex(), NLAIAGENT::IBasicAgent::getMethodIndexSize(), NLAIAGENT::IConnectIA::getParent(), NLAIAGENT::CStringType::getStr(), NLAIC::IPointerGestion::incRef(), index, NLAIAGENT::CAgentScript::isa(), NLAIAGENT::CAgentScript::isClassInheritedFrom(), NLAIAGENT::CKeyAgent::Itr, NLAIAGENT::CKeyAgent::Name, param, r, NLAIAGENT::IObjectIA::CProcessResult::Result, NLAIAGENT::CAgentScript::runAskDebugString(), NLAIAGENT::CAgentScript::runAskGetValue(), NLAIAGENT::CAgentScript::runAskParentNotify(), NLAIAGENT::CAgentScript::runInitComponent(), NLAIAGENT::IBasicAgent::runMethodeMember(), NLAIAGENT::CAgentScript::runTellComponent(), NLAIAGENT::CAgentScript::runTellParentNotify(), NLAIAGENT::CAgentScript::runTellSetValue(), s, NLAIAGENT::CAgentScript::sendMethod(), NLAIAGENT::CAgentScript::sendMethodCompoment(), NLAIAGENT::CAgentScript::TAddChildTag, NLAIAGENT::CAgentScript::TAddSet, NLAIAGENT::CAgentScript::TFather, NLAIAGENT::CAgentScript::TGetChildTag, NLAIAGENT::CAgentScript::TGetClassName, NLAIAGENT::CAgentScript::TGetName, NLAIAGENT::CAgentScript::TGetValue, NLAIAGENT::CAgentScript::TInitComponent, NLAIAGENT::CAgentScript::TIsEUU, NLAIAGENT::CAgentScript::TIsInherited, NLAIAGENT::CAgentScript::TRunAskComponent, NLAIAGENT::CAgentScript::TRunAskDebugString, NLAIAGENT::CAgentScript::TRunAskParentNotify, NLAIAGENT::CAgentScript::TRunTellComponent, NLAIAGENT::CAgentScript::TRunTellParentNotify, NLAIAGENT::CAgentScript::TSelf, NLAIAGENT::CAgentScript::TSend, NLAIAGENT::CAgentScript::TSendComponent, NLAIAGENT::CAgentScript::TSetStatic, NLAIAGENT::CAgentScript::TSetValue, NLAISCRIPT::CAgentClass::updateStaticMember(), and value.
01850 { 01851 switch(index - IAgent::getMethodIndexSize()) 01852 { 01853 case TSend: 01854 { 01855 return sendMethod(o); 01856 } 01857 01858 case TSendComponent: 01859 { 01860 return sendMethodCompoment(o); 01861 } 01862 01863 case TGetChildTag: 01864 { 01865 return getDynamicAgent((IBaseGroupType *)o); 01866 } 01867 01868 case TAddChildTag: 01869 { 01870 return addDynamicAgent((IBaseGroupType *)o); 01871 } 01872 case TFather: 01873 { 01874 IObjectIA::CProcessResult a; 01875 a.Result = (IObjectIA *)getParent(); 01876 //if(a.Result != NULL) 01877 a.Result->incRef(); 01878 return a; 01879 } 01880 01881 case TSelf: 01882 { 01883 IObjectIA::CProcessResult a; 01884 a.Result = new CLocalAgentMail(this); 01885 return a; 01886 } 01887 case TGetName: 01888 { 01889 IObjectIA::CProcessResult r; 01890 const CAgentScript *p = (CAgentScript *)getParent(); 01891 TSetDefNameAgent::iterator i = p->_DynamicAgentName.begin(); 01892 01893 while(i != p->_DynamicAgentName.end()) 01894 { 01895 CKeyAgent key = *i; 01896 if( this == *key.Itr ) 01897 { 01898 CStringType *s = new CStringType(key.Name); 01899 r.Result = s; 01900 return r; 01901 } 01902 i ++; 01903 } 01904 r.Result = new CStringType(CStringVarName("Unknown")); 01905 return r; 01906 } 01907 01908 case TGetClassName: 01909 { 01910 IObjectIA::CProcessResult r; 01911 const NLAIAGENT::IVarName *classname = getClassName(); 01912 r.Result = new CStringType( *classname ); 01913 01914 r.Result->incRef(); 01915 return r; 01916 } 01917 01918 case TIsInherited: 01919 { 01920 IObjectIA::CProcessResult r; 01921 if ( _AgentClass != NULL ) 01922 { 01923 CGroupType *param = (CGroupType *) o; 01924 CStringType *comp_name = (CStringType *)((IBaseGroupType *)param)->popFront(); 01925 if ( isClassInheritedFrom( comp_name->getStr() ) != -1 ) 01926 r.Result = new NLAILOGIC::CBoolType( true ); 01927 else 01928 r.Result = new NLAILOGIC::CBoolType( false ); 01929 01930 } 01931 else 01932 r.Result = new NLAILOGIC::CBoolType( false ); 01933 01934 r.Result->incRef(); 01935 return r; 01936 } 01937 01938 case TRunAskParentNotify: 01939 { 01940 return runAskParentNotify((IBaseGroupType *)o); 01941 } 01942 01943 case TRunTellParentNotify: 01944 { 01945 return runTellParentNotify((IBaseGroupType *)o); 01946 } 01947 01948 case TRunAskDebugString: 01949 { 01950 return runAskDebugString((IBaseGroupType *)o); 01951 } 01952 01953 case TRunAskComponent: 01954 case TRunTellComponent: 01955 { 01956 return runTellComponent((IBaseGroupType *)o); 01957 } 01958 case TSetStatic: 01959 { 01960 CGroupType *param = (CGroupType *) o; 01961 CStringType *comp_name = (CStringType *)((IBaseGroupType *)param)->popFront(); 01962 IObjectIA *value = (IObjectIA *)((IBaseGroupType *)param)->popFront(); 01963 int index = _AgentClass->getInheritedStaticMemberIndex( comp_name->getStr() ); 01964 _AgentClass->updateStaticMember(index, value); 01965 IObjectIA::CProcessResult a; 01966 a.Result = NULL; 01967 return a; 01968 } 01969 01970 case TGetValue: 01971 { 01972 return runAskGetValue( (IBaseGroupType *) o ); 01973 } 01974 01975 case TSetValue: 01976 { 01977 return runTellSetValue( (IBaseGroupType *) o ); 01978 } 01979 01980 case TInitComponent: 01981 { 01982 return runInitComponent( (IBaseGroupType *) o ); 01983 } 01984 01985 case TIsEUU: 01986 { 01987 CGroupType *param = (CGroupType *) o; 01988 std::string s(((NLAIAGENT::CStringType *)param->get())->getStr().getString()); 01989 NLAIAGENT::IObjectIA::CProcessResult r; 01990 01991 if(isa(s)) 01992 r.Result = new NLAIAGENT::DigitalType(1.0); 01993 else 01994 r.Result = new NLAIAGENT::DigitalType(0.0); 01995 return r; 01996 } 01997 01998 case TAddSet: 01999 { 02000 CGroupType *param = (CGroupType *) o; 02001 std::string s(((NLAIAGENT::CStringType *)param->get())->getStr().getString()); 02002 addSet(s); 02003 02004 return NLAIAGENT::IObjectIA::CProcessResult(); 02005 } 02006 02007 default: 02008 return IAgent::runMethodeMember(index,o); 02009 } 02010 } |
|
Reimplemented in NLAIAGENT::CActorScript, NLAIAGENT::CAgentWatchTimer, NLAIAGENT::CAgentOperation, NLAIAGENT::CSeqFsmScript, NLAILOGIC::CGoalPath, and NLAIAGENT::COperatorScript. Definition at line 1698 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_AgentClass, NLAIAGENT::CAgentScript::_DynamicAgentName, NLAIAGENT::CAgentScript::addDynamicAgent(), NLAIAGENT::CAgentScript::getClassName(), NLAISCRIPT::CAgentClass::getComponentIndex(), NLAIAGENT::CAgentScript::getDynamicAgent(), NLAIAGENT::IBasicAgent::getMethodIndexSize(), NLAIAGENT::IConnectIA::getParent(), NLAIAGENT::CStringType::getStr(), NLAIC::IPointerGestion::incRef(), index, NLAIAGENT::CAgentScript::isClassInheritedFrom(), NLAIAGENT::CKeyAgent::Itr, NLAIAGENT::CKeyAgent::Name, param, r, NLAIAGENT::CAgentScript::removeDynamic(), NLAIAGENT::IObjectIA::CProcessResult::Result, NLAIAGENT::CAgentScript::runAskDebugString(), NLAIAGENT::CAgentScript::runAskGetValue(), NLAIAGENT::CAgentScript::runAskParentNotify(), NLAIAGENT::CAgentScript::runInitComponent(), NLAIAGENT::IBasicAgent::runMethodeMember(), NLAIAGENT::CAgentScript::runTellComponent(), NLAIAGENT::CAgentScript::runTellParentNotify(), NLAIAGENT::CAgentScript::runTellSetValue(), s, NLAIAGENT::CAgentScript::sendMethod(), NLAIAGENT::CAgentScript::sendMethodCompoment(), NLAIAGENT::CAgentScript::TAddChildTag, NLAIAGENT::CAgentScript::TFather, NLAIAGENT::CAgentScript::TGetChildTag, NLAIAGENT::CAgentScript::TGetClassName, NLAIAGENT::CAgentScript::TGetName, NLAIAGENT::CAgentScript::TGetValue, NLAIAGENT::CAgentScript::TInitComponent, NLAIAGENT::CAgentScript::TIsInherited, NLAIAGENT::CAgentScript::TRemoveChild, NLAIAGENT::CAgentScript::TRunAskComponent, NLAIAGENT::CAgentScript::TRunAskDebugString, NLAIAGENT::CAgentScript::TRunAskParentNotify, NLAIAGENT::CAgentScript::TRunTellComponent, NLAIAGENT::CAgentScript::TRunTellParentNotify, NLAIAGENT::CAgentScript::TSelf, NLAIAGENT::CAgentScript::TSend, NLAIAGENT::CAgentScript::TSendComponent, NLAIAGENT::CAgentScript::TSetStatic, NLAIAGENT::CAgentScript::TSetValue, NLAISCRIPT::CAgentClass::updateStaticMember(), and value. Referenced by NLAIAGENT::CAgentWatchTimer::runMethodBase(), NLAIAGENT::CActorScript::runMethodBase(), and NLAIAGENT::CAgentScript::runMethodeMember().
01699 { 01700 switch(index - IAgent::getMethodIndexSize()) 01701 { 01702 case TSend: 01703 { 01704 return sendMethod(o); 01705 } 01706 01707 case TSendComponent: 01708 { 01709 return sendMethodCompoment(o); 01710 } 01711 01712 case TGetChildTag: 01713 { 01714 return getDynamicAgent((IBaseGroupType *)o); 01715 } 01716 01717 case TAddChildTag: 01718 { 01719 return addDynamicAgent((IBaseGroupType *)o); 01720 } 01721 01722 case TFather: 01723 { 01724 IObjectIA::CProcessResult a; 01725 a.Result = (IObjectIA *)getParent(); 01726 a.Result->incRef(); 01727 return a; 01728 } 01729 01730 case TSelf: 01731 { 01732 IObjectIA::CProcessResult a; 01733 a.Result = new CLocalAgentMail(this); 01734 return a; 01735 } 01736 01737 case TGetName: 01738 { 01739 IObjectIA::CProcessResult r; 01740 const CAgentScript *p = (CAgentScript *)getParent(); 01741 TSetDefNameAgent::iterator i = p->_DynamicAgentName.begin(); 01742 01743 while(i != p->_DynamicAgentName.end()) 01744 { 01745 CKeyAgent key = *i; 01746 if( this == *key.Itr ) 01747 { 01748 CStringType *s = new CStringType(key.Name); 01749 r.Result = s; 01750 return r; 01751 } 01752 i ++; 01753 } 01754 r.Result = new CStringType(CStringVarName("Unknown")); 01755 01756 return r; 01757 } 01758 01759 case TGetClassName: 01760 { 01761 IObjectIA::CProcessResult r; 01762 if ( _AgentClass != NULL ) 01763 { 01764 const NLAIAGENT::IVarName *classname = getClassName(); 01765 r.Result = new CStringType( *classname ); 01766 } 01767 else 01768 r.Result = new CStringType( CStringVarName("<unknown>")); 01769 return r; 01770 } 01771 01772 case TIsInherited: 01773 { 01774 IObjectIA::CProcessResult r; 01775 if ( _AgentClass != NULL ) 01776 { 01777 CGroupType *param = (CGroupType *) o; 01778 CStringType *comp_name = (CStringType *)((IBaseGroupType *)param)->popFront(); 01779 if ( isClassInheritedFrom( comp_name->getStr() ) != -1 ) 01780 r.Result = new NLAILOGIC::CBoolType( true ); 01781 else 01782 r.Result = new NLAILOGIC::CBoolType( false ); 01783 } 01784 else 01785 r.Result = new NLAILOGIC::CBoolType( false ); 01786 01787 return r; 01788 } 01789 01790 case TRemoveChild: 01791 { 01792 return removeDynamic((IBaseGroupType *)o); 01793 } 01794 01795 case TRunAskParentNotify: 01796 { 01797 return runAskParentNotify((IBaseGroupType *)o); 01798 } 01799 01800 case TRunTellParentNotify: 01801 { 01802 return runTellParentNotify((IBaseGroupType *)o); 01803 } 01804 01805 case TRunAskDebugString: 01806 { 01807 return runAskDebugString((IBaseGroupType *)o); 01808 } 01809 01810 case TRunAskComponent: 01811 case TRunTellComponent: 01812 { 01813 return runTellComponent((IBaseGroupType *)o); 01814 } 01815 01816 01817 case TSetStatic: 01818 { 01819 CGroupType *param = (CGroupType *) o; 01820 CStringType *comp_name = (CStringType *)((IBaseGroupType *)param)->popFront(); 01821 IObjectIA *value = (IObjectIA *)((IBaseGroupType *)param)->popFront(); 01822 int index = _AgentClass->getComponentIndex( comp_name->getStr() ); 01823 _AgentClass->updateStaticMember(index, value); 01824 return IObjectIA::CProcessResult(); 01825 } 01826 01827 case TGetValue: 01828 { 01829 return runAskGetValue( (IBaseGroupType *) o ); 01830 } 01831 01832 case TSetValue: 01833 { 01834 return runTellSetValue( (IBaseGroupType *) o ); 01835 } 01836 01837 case TInitComponent: 01838 { 01839 return runInitComponent( (IBaseGroupType *) o ); 01840 } 01841 01842 01843 default: 01844 return IAgent::runMethodeMember(index,o); 01845 01846 } 01847 } |
|
The methode runMethodeMember(sint32 index,IObjectIA *param) allow us to run a own member method. index: is the method id return by the isMember(const IVarName *,const IVarName *,const IObjectIA &) const method. param: is the parametre for the method. Reimplemented from NLAIAGENT::IBasicAgent. Reimplemented in NLAIAGENT::CAgentWatchTimer. Definition at line 2172 of file agent_script.cpp. References NLAISCRIPT::CCodeContext::Code, NLAISCRIPT::CCodeContext::ContextDebug, NLAIAGENT::CAgentScript::getBaseMethodCount(), NLAIAGENT::CAgentScript::getMethode(), NLAIC::IBasicType::getType(), index, NLAISCRIPT::CCodeContext::Param, r, NLAIAGENT::CAgentScript::runMethodBase(), NLAIAGENT::IBasicAgent::runMethodeMember(), sint32, NLAISCRIPT::CCodeContext::Stack, and uint32.
02173 { 02174 if(c->getType() != NLAISCRIPT::CCodeContext::IdCodeContext) 02175 { 02176 return IAgent::runMethodeMember(index, c); 02177 } 02178 02179 NLAISCRIPT::IOpCode *opPtr = NULL; 02180 NLAISCRIPT::CCodeContext &context = (NLAISCRIPT::CCodeContext &)*c; 02181 02182 int i = index - getBaseMethodCount(); 02183 if(i < 0) 02184 { 02185 /*if (context.ContextDebug.Active) 02186 { 02187 context.ContextDebug.Param.push_back(&listBidon); 02188 listBidon.incRef(); 02189 }*/ 02190 02191 IObjectIA::CProcessResult r = runMethodBase(index,(IObjectIA *)context.Param.back()); 02192 if(r.Result != NULL) 02193 { 02194 context.Stack++; 02195 context.Stack[(int)context.Stack] = r.Result; 02196 } 02197 r.Result = NULL; 02198 return r; 02199 } 02200 else 02201 { 02202 opPtr = getMethode(i); 02203 } 02204 IObjectIA::CProcessResult r; 02205 if(opPtr != NULL) 02206 { 02207 NLAISCRIPT::CCodeBrancheRun *opTmp = context.Code; 02208 int ip; 02209 if(context.Code != NULL) ip = (uint32)*context.Code; 02210 else ip =0; 02211 context.Code = (NLAISCRIPT::CCodeBrancheRun *)opPtr; 02212 *context.Code = 0; 02213 02214 r = ((NLAISCRIPT::ICodeBranche *)opPtr)->run(context); 02215 02216 // If we are in Debug Mode 02217 if (context.ContextDebug.Active) 02218 { 02219 context.ContextDebug.callStackPop(); 02220 } 02221 02222 *context.Code = ip; 02223 context.Code = opTmp; 02224 } 02225 return r; 02226 } |
|
The methode runMethodeMember(sint32 heritance, sint32 index, IObjectIA *param) allow us to run a member method. heritance: is the id returned by the methodisClassInheritedFrom(const IVarName &). index: is the method id return by the isMember(const IVarName *,const IVarName *,const IObjectIA &) const method. param: is the parametre for the method. Reimplemented from NLAIAGENT::IBasicAgent. Definition at line 2112 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_AgentClass, NLAISCRIPT::CCodeContext::Code, NLAISCRIPT::CCodeContext::ContextDebug, NLAIAGENT::CAgentScript::getBaseMethodCount(), NLAISCRIPT::CAgentClass::getBrancheCode(), NLAIAGENT::CAgentScript::getMethode(), NLAIC::IBasicType::getType(), index, NLAISCRIPT::CCodeContext::Param, r, NLAIAGENT::CAgentScript::runMethodBase(), NLAIAGENT::IBasicAgent::runMethodeMember(), sint32, NLAISCRIPT::CCodeContext::Stack, and uint32. Referenced by NLAIAGENT::COperatorScript::execOnActivate(), NLAIAGENT::CActorScript::failure(), NLAIAGENT::CActorScript::pause(), NLAIAGENT::CActorScript::restart(), NLAIAGENT::CMainAgentScript::run(), NLAIAGENT::CActorScript::run(), NLAIAGENT::CAgentScript::runActivity(), NLAIAGENT::CActorScript::success(), and NLAIAGENT::CActorScript::unActivate().
02113 { 02114 02115 if(c->getType() != NLAISCRIPT::CCodeContext::IdCodeContext) 02116 { 02117 return IAgent::runMethodeMember(inheritance,index, c); 02118 } 02119 02120 NLAISCRIPT::IOpCode *opPtr = NULL; 02121 NLAISCRIPT::CCodeContext &context = (NLAISCRIPT::CCodeContext &)*c; 02122 02123 int i = index - getBaseMethodCount(); 02124 if(i < 0) 02125 { 02126 /*if (context.ContextDebug.Active) 02127 { 02128 context.ContextDebug.Param.push_back(&listBidon); 02129 listBidon.incRef(); 02130 }*/ 02131 02132 IObjectIA::CProcessResult r = runMethodBase(index,(IObjectIA *)context.Param.back()); 02133 if(r.Result != NULL) 02134 { 02135 context.Stack++; 02136 context.Stack[(int)context.Stack] = r.Result; 02137 } 02138 r.Result = NULL; 02139 return r; 02140 } 02141 else 02142 { 02143 opPtr = getMethode(inheritance,i); 02144 } 02145 02146 IObjectIA::CProcessResult r; 02147 if(opPtr != NULL) 02148 { 02149 #ifdef NL_DEBUG 02150 std::string nameDbg; 02151 _AgentClass->getBrancheCode(inheritance,i).getName().getDebugString(nameDbg); 02152 _AgentClass->getBrancheCode(inheritance,i).getParam().getDebugString(nameDbg); 02153 #endif 02154 NLAISCRIPT::IOpCode &op = *opPtr; 02155 NLAISCRIPT::CCodeBrancheRun *opTmp = context.Code; 02156 int ip = (uint32)*context.Code; 02157 context.Code = (NLAISCRIPT::CCodeBrancheRun *)&op; 02158 *context.Code = 0; 02159 02160 r = ((NLAISCRIPT::ICodeBranche *)opPtr)->run(context); 02161 // If we are in Debug Mode 02162 if (context.ContextDebug.Active) 02163 { 02164 context.ContextDebug.callStackPop(); 02165 } 02166 *context.Code = ip; 02167 context.Code = opTmp; 02168 } 02169 return r; 02170 } |
|
runService is to processing reltative to PService Performatif. its call from the IObjectIA *run(const IMessageBase &m) method. Definition at line 228 of file agent.h. References NLAIC::IBasicType::getDebugString(), and NLAIC::IBasicType::getType().
00229 { 00230 std::string debugString; 00231 std::string text; 00232 getDebugString(debugString); 00233 text = "IMessageBase *runService("; 00234 text += (const char *)m.getType(); 00235 text += " note implementaited for the '"; 00236 text += (const char *)getType(); 00237 text += "' interface for the instence '"; 00238 text += (const char *)getType(); 00239 text += "' '"; 00240 text += debugString; 00241 text += "'"; 00242 00243 throw NLAIE::CExceptionNotImplemented(text.c_str()); 00244 return NULL; 00245 } |
|
Some where Run method define the process of the agen. Reimplemented from NLAIAGENT::IAgent. Definition at line 1655 of file agent_script.cpp. References NLAIAGENT::CAgentScript::getType().
01656 { 01657 01658 #ifdef NL_DEBUG 01659 const char *dbg_class_name = (const char *) getType(); 01660 //const NLAIAGENT::IRefrence *dbg_mail_parent = _ScriptMail->getParent(); 01661 #endif 01662 01663 return IAgentManager::runStep(); 01664 01665 } |
|
runTell is to processing reltative to PTell Performatif. its call from the IObjectIA *run(const IMessageBase &m) method. Reimplemented in NLAIAGENT::CActorScript, NLAIAGENT::CAgentWatchTimer, and NLAIAGENT::CAgentOperation. Definition at line 572 of file agents.cpp. References NLAIC::IBasicType::clone(), and NLAIC::IBasicType::getType(). Referenced by NLAIAGENT::IBasicAgent::run(), and NLAIAGENT::CAgentWatchTimer::runTell().
00573 { 00574 if(NLAISCRIPT::CMsgNotifyParentClass::IdMsgNotifyParentClass == m.getType()) 00575 { 00576 /*const INombreDefine *n = (const INombreDefine *)m.getFront(); 00577 if(n->getNumber() != 0.0) 00578 { 00579 const CLocalAgentMail *parent = (const CLocalAgentMail *)m.get(); 00580 }*/ 00581 return (IMessageBase *)m.clone(); 00582 } 00583 else 00584 { 00585 /* std::string debugString; 00586 std::string text; 00587 getDebugString(debugString); 00588 text += NLAIC::stringGetBuild("runTell(%s) note implementaited for the '%s' interface for the instence '%s'",(const char *)m.getType(),(const char *)getType(),debugString.c_str()); 00589 throw NLAIE::CExceptionNotImplemented(text.c_str()); */ 00590 return NULL; 00591 } 00592 } |
|
|
This function process the message CNotifyParentScript for the runTell. Definition at line 953 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_Components, NLAIAGENT::CAgentScript::_NbComponents, NLAIAGENT::CNotifyParentScript::clone(), NLAIAGENT::IConnectIA::getParent(), NLAIC::IBasicType::getType(), NLAIAGENT::CAgentScript::getType(), r, NLAIC::IPointerGestion::release(), NLAIAGENT::IMessageBase::setPerformatif(), NLAIAGENT::IMessageBase::setSender(), sint, t, and uint. Referenced by NLAIAGENT::CAgentScript::runMethodBase().
00954 { 00955 sint i; 00956 00957 #ifdef NL_DEBUG 00958 const char *text = (const char *)getType(); 00959 const char *textP = (const char *)getParent()->getType(); 00960 #endif 00961 CNotifyParentScript *m = new CNotifyParentScript(this); 00962 m->setPerformatif(IMessageBase::PTell); 00963 m->setSender(this); 00964 00965 for(i = 0; i < _NbComponents; i++) 00966 { 00967 if(_Components[i] != NULL) 00968 { 00969 CNotifyParentScript *msg = (CNotifyParentScript *)m->clone(); 00970 try 00971 { 00972 uint b = NLAIC::CTypeOfObject::tInterpret | NLAIC::CTypeOfObject::tAgent; 00973 const NLAIC::CTypeOfObject &t = _Components[i]->getType(); 00974 00975 if((t.getValue() & b) == b) 00976 _Components[i]->sendMessage(msg); 00977 } 00978 catch(NLAIE::IException &) 00979 { 00980 msg->release(); 00981 } 00982 } 00983 } 00984 IObjectIA::CProcessResult r; 00985 r.Result = m; 00986 return r; 00987 } |
|
that is a surchage of the method member virtual IObjectIA::CProcessResult addDynamicAgent(NLAIAGENT::IBaseGroupType *g); Definition at line 1032 of file agent_script.cpp. References NLAIAGENT::IBaseGroupType::get(), NLAIAGENT::CAgentScript::getStaticMemberIndex(), NLAIAGENT::CStringType::getStr(), NLAIC::IPointerGestion::incRef(), index, r, NLAIAGENT::CAgentScript::setStaticMember(), sint32, and NLAIAGENT::IListBasicManager::size(). Referenced by NLAIAGENT::CAgentScript::runMethodBase().
01033 { 01034 NLAIAGENT::IMessageBase &msg_result = (NLAIAGENT::IMessageBase &)*g->get(); 01035 msg_result.incRef(); 01036 01037 while ( msg_result.size() ) 01038 { 01039 CStringType *comp_name = (CStringType *) msg_result[ (sint32) 0 ]; 01040 IObjectIA *comp_val = (IObjectIA *) msg_result[ (sint32) 1 ]; 01041 01042 sint32 index = getStaticMemberIndex( comp_name->getStr() ); 01043 if ( index != -1 ) 01044 { 01045 // Sets the component to the new value 01046 setStaticMember( index, comp_val ); 01047 } 01048 else 01049 { 01050 // Component not found: creates it 01051 01052 } 01053 } 01054 IObjectIA::CProcessResult r; 01055 msg_result.incRef(); 01056 r.Result = &msg_result; 01057 return r; 01058 } |
|
programmer have to call this method to load or save internal attribut. Reimplemented from NLAIAGENT::CAgentScript. Definition at line 56 of file agent_timer.cpp.
00057 { 00058 } |
|
Definition at line 1197 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_DynamicAgentName, NLAIC::IPointerGestion::incRef(), and NLAIAGENT::IObjectIA::sendMessage().
01198 { 01199 TSetDefNameAgent::iterator i = _DynamicAgentName.begin(); 01200 01201 if(i != _DynamicAgentName.end()) 01202 { 01203 ((IObjectIA *)(*(*(i)).Itr))->sendMessage(m); 01204 i ++; 01205 01206 while(i != _DynamicAgentName.end()) 01207 { 01208 m->incRef(); 01209 IObjectIA *o = ((IObjectIA *)(*(*(i)).Itr)); 01210 o->sendMessage(m); 01211 i++; 01212 } 01213 } 01214 01215 return IObjectIA::CProcessResult(); 01216 } |
|
Send message to an receiver agent.
Definition at line 326 of file agents.cpp. References NLAIAGENT::IMailBox::addMessage(), and NLAIAGENT::IBasicAgent::getMail().
00327 {
00328 receiver.getMail()->addMessage( msg );
00329 return IObjectIA::ProcessRun;
00330 }
|
|
Send a message to the agent.
Implements NLAIAGENT::IConnectIA. Definition at line 320 of file agents.cpp. References NLAIAGENT::IBasicAgent::_Mail, and NLAIAGENT::IMailBox::addMessage(). Referenced by NLAILOGIC::IGoal::failure(), NLAIAGENT::CAgentScript::sendMessage(), and NLAILOGIC::IGoal::success().
00321 { 00322 _Mail->addMessage(msg); 00323 return IObjectIA::ProcessRun; 00324 } |
|
This method allow to send a message to an compoment given by an string IVarName. Reimplemented from NLAIAGENT::IObjectIA. Definition at line 1250 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_AgentClass, NLAIAGENT::CAgentScript::getStaticMember(), NLAIAGENT::CAgentScript::getStaticMemberIndex(), NLAIAGENT::IVarName::getString(), NLAIC::IBasicType::getType(), NLAIAGENT::processError, NLAIC::IPointerGestion::release(), NLAIAGENT::IObjectIA::sendMessage(), and NLAIAGENT::CAgentScript::sendMessageToDynmaicChild().
01251 { 01252 #ifdef NL_DEBUG 01253 const char *txt = (const char *)msg->getType(); 01254 const char *compNameDb = (const char *)compName.getString(); 01255 //nlinfo("MSG %s %4x", txt, this); 01256 #endif 01257 if(_AgentClass != NULL) 01258 { 01259 int i = getStaticMemberIndex(compName); 01260 if(i >= 0) 01261 { 01262 IObjectIA *comp = (IObjectIA *)getStaticMember(i); 01263 if(comp != NULL) 01264 { 01265 comp->sendMessage(msg); 01266 } 01267 else 01268 { 01269 if(sendMessageToDynmaicChild(compName,msg).ResultState == processError) msg->release(); 01270 } 01271 } 01272 else 01273 { 01274 if(sendMessageToDynmaicChild(compName,msg).ResultState == processError) msg->release(); 01275 } 01276 } 01277 else 01278 { 01279 if(sendMessageToDynmaicChild(compName,msg).ResultState == processError) msg->release(); 01280 } 01281 return IObjectIA::CProcessResult(); 01282 } |
|
sendMessage allow agent to send a message to an ather agent. The message is a IMessageBase. Reimplemented from NLAIAGENT::IConnectIA. Reimplemented in NLAIAGENT::CActorScript, and NLAIAGENT::CMainAgentScript. Definition at line 1284 of file agent_script.cpp. References NLAIAGENT::IMessageBase::getMethodIndex(), NLMISC::CTime::getPerformanceTime(), NLAIAGENT::IMessageBase::getPerformatif(), NLAIAGENT::CAgentScript::getType(), NLAIC::IBasicType::getType(), NLAIAGENT::CIdMethod::Index, NLAIAGENT::CAgentScript::isMember(), r, NLAIAGENT::IBasicAgent::sendMessage(), NLAIAGENT::IMessageBase::setMethodIndex(), NLAIAGENT::IMessageBase::setReceiver(), t, NLAIAGENT::TQueue, and uint. Referenced by NLAIAGENT::CAgentScript::runTellComponent(), NLAIAGENT::CAgentTimerHandle::sendMessage(), NLAIAGENT::CActorScript::sendMessage(), NLAIAGENT::CAgentScript::sendMessageToDynmaicChild(), NLAIAGENT::CAgentScript::sendMethod(), and NLAIAGENT::CAgentScript::sendMethodCompoment().
01285 { 01286 #ifdef NL_DEBUG 01287 const char *txt = (const char *)m->getType(); 01288 const char *classBase = (const char *)getType(); 01289 //nlinfo("MSG %s %4x", txt, m); 01290 #endif 01291 IMessageBase *msg = (IMessageBase *)m; 01292 //this->incRef(); 01293 msg->setReceiver(this); 01294 if(msg->getMethodIndex() < 0) 01295 { 01296 uint b = NLAIC::CTypeOfObject::tInterpret | NLAIC::CTypeOfObject::tMessage; 01297 const NLAIC::CTypeOfObject &t = m->getType(); 01298 01299 if((t.getValue() & b) == b) 01300 { 01301 //char runMsg[1024]; 01302 //strcpy(runMsg,_RUN_); 01303 static CStringVarName sRunTell("RunTell"); 01304 static CStringVarName sRunAchieve("RunAchieve"); 01305 static CStringVarName sRunAsk("RunAsk"); 01306 static CStringVarName sRunExec("RunExec"); 01307 static CStringVarName sRunBreak("RunBreak"); 01308 static CStringVarName sRunKill("RunKill"); 01309 static CStringVarName sRunError("RunError"); 01310 01311 CStringVarName *runMsg = NULL;//sRunTell; 01312 01313 switch(msg->getPerformatif()) 01314 { 01315 case IMessageBase::PExec: 01316 //strcat(runMsg,"Exec"); 01317 runMsg = &sRunExec; 01318 break; 01319 case IMessageBase::PAchieve: 01320 //strcat(runMsg,"Achieve"); 01321 runMsg = &sRunAchieve; 01322 break; 01323 case IMessageBase::PAsk: 01324 //strcat(runMsg,"Ask"); 01325 runMsg = &sRunAsk; 01326 break; 01327 case IMessageBase::PTell: 01328 //strcat(runMsg,"Tell"); 01329 runMsg = &sRunTell; 01330 break; 01331 case IMessageBase::PBreak: 01332 runMsg = &sRunBreak; 01333 break; 01334 case IMessageBase::PKill: 01335 runMsg = &sRunKill; 01336 break; 01337 case IMessageBase::PError: 01338 runMsg = &sRunError; 01339 break; 01340 01341 default: 01342 throw; 01343 break; 01344 } 01345 01346 CStringVarName &tmp_name = *runMsg; 01347 01348 NLAISCRIPT::COperandSimple *t = new NLAISCRIPT::COperandSimple(new NLAIC::CIdentType(m->getType())); 01349 NLAISCRIPT::CParam p(1,t); 01350 01351 TQueue r = isMember(NULL,&tmp_name,p); 01352 if(r.size()) 01353 { 01354 NLAIAGENT::CIdMethod m = r.top(); 01355 msg->setMethodIndex(0,m.Index); 01356 } 01357 } 01358 } 01359 01360 IObjectIA::CProcessResult r = IAgent::sendMessage(msg); 01361 01362 01363 01364 #ifdef PROFILE 01365 time = NLMISC::CTime::getPerformanceTime() - time; 01366 //if(time) 01367 { 01368 TimeSend += time; 01369 NbSend ++; 01370 } 01371 #endif 01372 01373 return r; 01374 //return IObjectIA::CProcessResult(); 01375 } |
|
Definition at line 1218 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_DynamicAgentName, NLAIC::IBasicType::clone(), NLAIC::IBasicType::getDebugString(), NLAIC::IBasicType::getType(), NLAIAGENT::processError, r, and NLAIAGENT::CAgentScript::sendMessage(). Referenced by NLAIAGENT::CAgentScript::sendMessage().
01219 { 01220 //TSetDefNameAgent::iterator p = _DynamicAgentName.find(CKeyAgent(CStringType(compName))); 01221 std::pair<TSetDefNameAgent::iterator,TSetDefNameAgent::iterator> p = _DynamicAgentName.equal_range(CKeyAgent(CStringType(compName))); 01222 01223 #ifdef NL_DEBUG 01224 const char *txt = (const char *)msg->getType(); 01225 std::string txtName; 01226 compName.getDebugString(txtName); 01227 #endif 01228 01229 IObjectIA::CProcessResult r; 01230 01231 if(p.first != p.second) 01232 { 01233 while(p.first != p.second) 01234 { 01235 CAgentScript *o = (CAgentScript *)*((*(p.first)).Itr); 01236 o->sendMessage(msg); 01237 p.first ++; 01238 if(p.first != p.second) msg = (IObjectIA *)msg->clone(); 01239 } 01240 } 01241 else 01242 { 01243 r.ResultState = processError; 01244 r.Result = NULL; 01245 } 01246 01247 return r; 01248 } |
|
Definition at line 1177 of file agent_script.cpp. References NLAIAGENT::INombreDefine::getNumber(), param, NLAIC::IPointerGestion::release(), NLAIAGENT::CAgentScript::sendMessage(), NLAIAGENT::IMessageBase::setPerformatif(), and sint. Referenced by NLAIAGENT::CAgentScript::runMethodBase().
01178 { 01179 INombreDefine *p = (INombreDefine *)((IBaseGroupType *)param)->popFront(); 01180 IMessageBase *msg = (IMessageBase *)((IBaseGroupType *)param)->popFront(); 01181 msg->setPerformatif((IMessageBase::TPerformatif)(sint)p->getNumber()); 01182 p->release(); 01183 return sendMessage(msg); 01184 } |
|
Definition at line 1186 of file agent_script.cpp. References NLAIAGENT::INombreDefine::getNumber(), NLAIAGENT::CStringType::getStr(), NLAIC::IPointerGestion::incRef(), param, NLAIAGENT::CAgentScript::sendMessage(), NLAIAGENT::IMessageBase::setPerformatif(), and sint. Referenced by NLAIAGENT::CAgentScript::runMethodBase().
01187 { 01188 NLAIAGENT::CIteratorContener It = ((IBaseGroupType *)param)->getIterator(); 01189 const CStringType *n = (const CStringType *)It++; 01190 INombreDefine *p = (INombreDefine *)((IBaseGroupType *)It++); 01191 IMessageBase *msg = (IMessageBase *)((IBaseGroupType *)It++); 01192 msg->setPerformatif((IMessageBase::TPerformatif)(sint)p->getNumber()); 01193 msg->incRef(); 01194 return sendMessage(n->getStr(),msg); 01195 } |
|
Reimplemented from NLAIC::IPointerGestion. Definition at line 328 of file abstract_interface.h. References NLAIC::IBasicInterface::load(), and NLAIC::IBasicInterface::save().
|
|
Set the manager for this instance.
Definition at line 496 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_AgentManager, NLAIAGENT::CAgentScript::_Components, NLAIAGENT::CAgentScript::_NbComponents, NLAIC::IBasicType::getType(), t, and uint.
00497 { 00498 //if(_AgentManager != NULL) _AgentManager->release(); 00499 _AgentManager = manager; 00500 for ( int i = 0; i < _NbComponents; i++ ) 00501 { 00502 00503 uint b = NLAIC::CTypeOfObject::tInterpret | NLAIC::CTypeOfObject::tAgent; 00504 const NLAIC::CTypeOfObject &t = (const NLAIC::CTypeOfObject &)_Components[i]->getType(); 00505 if( (t.getValue() & b ) == b) 00506 { 00507 ((CAgentScript *)_Components[i])->setAgentManager(_AgentManager); 00508 } 00509 } 00510 } |
|
Definition at line 461 of file baseai.cpp. References NLAIAGENT::IRefrence::_NumRef, NLAIAGENT::IWordNumRef::getNumIdent(), and NLAIC::IPointerGestion::release().
00462 { 00463 if(_NumRef != NULL) _NumRef->release(); 00464 _NumRef = new CLocWordNumRef(ref.getNumIdent(),this); 00465 } |
|
to set the parent of the agents.
Reimplemented from NLAIAGENT::IRefrence. Definition at line 661 of file baseai.cpp. References NLAIAGENT::IConnectIA::connect(), and NLAIAGENT::IConnectIA::getParent(). Referenced by NLAIAGENT::CAgentScript::addDynamicAgent(), NLAIAGENT::IAgentComposite::deleteListe(), NLAIAGENT::IBasicAgent::IBasicAgent(), NLAIAGENT::IConnectIA::onKill(), NLAIAGENT::CProxyAgentMail::sendMessage(), NLAIAGENT::CLocalAgentMail::sendMessage(), and NLAIAGENT::IBasicAgent::~IBasicAgent().
00662 { 00663 IRefrence::setParent(parent); 00664 IConnectIA *p = (IConnectIA *)getParent(); 00665 00666 if(p != NULL) connect(p); 00667 } |
|
Set the state of an agent.
Implements NLAIAGENT::IConnectIA. Definition at line 314 of file agents.cpp. References NLAIAGENT::IBasicAgent::_RunState. Referenced by NLAIAGENT::CAgentWatchTimer::runActivity(), NLAIAGENT::CAgentWatchTimer::runKill(), and NLAIAGENT::CAgentWatchTimer::runTell().
|
|
to cahnge a given components given by an index. Definition at line 268 of file baseai.h. References NLAIAGENT::IObjectIA::getStaticMemberIndex(). Referenced by NLAISCRIPT::CAffHeapMemberiOpCode::runOpCode(), NLAISCRIPT::CAffMemberiOpCode::runOpCode(), and NLAIAGENT::CLocalAgentMail::setStaticMember().
00269 { 00270 return setStaticMember(getStaticMemberIndex(compName),change); 00271 } |
|
to cahnge a given components given by a string. Reimplemented from NLAIAGENT::IObjectIA. Definition at line 517 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_Components, NLAIAGENT::CAgentScript::_NbComponents, index, NLAIC::IPointerGestion::release(), sint32, t, and uint. Referenced by NLAIAGENT::COperatorScript::checkTrigMsg(), NLAIAGENT::COperatorScript::linkGoalArgs(), NLAIAGENT::CAgentScript::runInitComponent(), and NLAIAGENT::CAgentScript::runTellSetValue().
00518 { 00519 #ifdef NL_DEBUG 00520 if ( index >= _NbComponents ) 00521 { 00522 throw NLAIE::CExceptionIndexError(); 00523 } 00524 #endif 00525 IObjectIA *old_comp = _Components[ index ]; 00526 _Components[ index ] = op; 00527 00528 uint b = NLAIC::CTypeOfObject::tInterpret | NLAIC::CTypeOfObject::tAgent; 00529 const NLAIC::CTypeOfObject &t = op->getType(); 00530 if((t.getValue() & b) == b) 00531 { 00532 ((CAgentScript *)op)->setParent( (const IWordNumRef *) *this); 00533 } 00534 if(op != old_comp) 00535 { 00536 old_comp->release(); 00537 return false; 00538 } 00539 return true; 00540 } |
|
Set the top level agent of this one.
Reimplemented in NLAIAGENT::CActorScript, and NLAIAGENT::CFsmScript. Definition at line 415 of file agent_script.h. Referenced by NLAIAGENT::CFsmScript::setTopLevel(), and NLAIAGENT::CActorScript::setTopLevel().
00416 { 00417 } |
|
That function allow user to change the 7 bit of the type field in the sid agent number;.
Definition at line 485 of file baseai.cpp. References NLAIAGENT::IRefrence::_NumRef, NLAIAGENT::CNumericIndex::getId(), NLAIAGENT::IWordNumRef::getNumIdent(), t, and uint64. Referenced by NLAIAGENT::IRefrence::IRefrence().
00486 { 00487 ((CAgentNumber &)(_NumRef->getNumIdent().getId())).setTypeAt(t); 00488 } |
|
|
|
The manager where the agent is run this manager have the agent script context.
Definition at line 170 of file agent_script.h. Referenced by NLAIAGENT::CAgentScript::CAgentScript(), NLAIAGENT::CAgentScript::getAgentManager(), NLAIAGENT::CAgentScript::getDebugString(), NLAIAGENT::CAgentScript::processMessages(), NLAIAGENT::CAgentScript::runActivity(), and NLAIAGENT::CAgentScript::setAgentManager(). |
|
|
Definition at line 427 of file baseai.h. Referenced by NLAIAGENT::IConnectIA::addInConnectedList(), NLAIAGENT::IConnectIA::Kill(), NLAIAGENT::IConnectIA::removeInConnectedList(), and NLAIAGENT::IConnectIA::save(). |
|
Reimplemented in NLAIAGENT::CAgentOperation. Definition at line 426 of file baseai.h. Referenced by NLAIAGENT::IConnectIA::addInConnectionList(), NLAIAGENT::IConnectIA::Kill(), NLAIAGENT::IConnectIA::removeInConnectionList(), and NLAIAGENT::IConnectIA::save(). |
|
Map for store agent added in the dynamic child container.
Definition at line 173 of file agent_script.h. Referenced by NLAIAGENT::CAgentScript::addDynamicAgent(), NLAIAGENT::CAgentScript::getDynamicAgent(), NLAIAGENT::CAgentScript::getDynamicName(), NLAIAGENT::CAgentScript::onKill(), NLAIAGENT::CAgentScript::removeDynamic(), NLAIAGENT::CAgentScript::runMethodBase(), NLAIAGENT::CAgentScript::sendBroadCast(), and NLAIAGENT::CAgentScript::sendMessageToDynmaicChild(). |
|
Definition at line 179 of file agent_script.h. Referenced by NLAIAGENT::CAgentScript::CAgentScript(), and NLAIAGENT::CAgentScript::runChildrenStepByStep(). |
|
Box letter for communication service.
Definition at line 63 of file agent.h. Referenced by NLAIAGENT::IBasicAgent::getMail(), NLAIAGENT::IBasicAgent::IBasicAgent(), NLAIAGENT::IBasicAgent::load(), NLAIAGENT::IBasicAgent::onKill(), NLAIAGENT::IBasicAgent::save(), NLAIAGENT::IBasicAgent::sendMessage(), and NLAIAGENT::IBasicAgent::~IBasicAgent(). |
|
|
Internal state of the agent.
Definition at line 61 of file agent.h. Referenced by NLAIAGENT::IBasicAgent::getState(), and NLAIAGENT::IBasicAgent::setState(). |
|
|
Definition at line 59 of file agent_timer.h. |
|
Definition at line 91 of file agent_timer.cpp. |
|
Definition at line 77 of file static_def_init.cpp. Referenced by NLAIAGENT::IAgent::getType(). |
|
Referenced by NLAIAGENT::CAgentScript::getType(). |
|
Definition at line 85 of file agent_timer.cpp. Referenced by getType(). |
|
Definition at line 67 of file agent_script.cpp. Referenced by NLAIAGENT::CAgentScript::initAgentScript(). |
|
Definition at line 66 of file agent_script.cpp. Referenced by NLAIAGENT::CAgentScript::initAgentScript(). |
|
Definition at line 89 of file agent_timer.cpp. |
|
Definition at line 181 of file agent_script.h. Referenced by NLAIAGENT::CAgentScript::addSet(), NLAIAGENT::CAgentScript::beginSet(), NLAIAGENT::CAgentScript::CAgentScript(), NLAIAGENT::CAgentScript::endSet(), and NLAIAGENT::CAgentScript::isa(). |
|
Definition at line 63 of file agent_script.cpp. Referenced by NLAIAGENT::CAgentScript::initAgentScript(). |
|
Definition at line 62 of file agent_script.cpp. Referenced by NLAIAGENT::CAgentScript::initAgentScript(). |
|
Definition at line 71 of file agent_script.cpp. Referenced by NLAIAGENT::CAgentScript::initAgentScript(). |
|
Definition at line 70 of file agent_script.cpp. Referenced by NLAIAGENT::CAgentScript::initAgentScript(). |
|
Definition at line 76 of file agent_script.cpp. Referenced by NLAIAGENT::CAgentScript::initAgentScript(). |
|
Definition at line 72 of file agent_script.cpp. Referenced by NLAIAGENT::CAgentScript::initAgentScript(). |
|
Definition at line 74 of file agent_script.cpp. |
|
Definition at line 77 of file agent_script.cpp. Referenced by NLAIAGENT::CAgentScript::initAgentScript(). |
|
Definition at line 68 of file agent_script.cpp. Referenced by NLAIAGENT::CAgentScript::initAgentScript(). |
|
Definition at line 140 of file agent_script.h. |
|
Definition at line 73 of file agent_script.cpp. Referenced by NLAIAGENT::CAgentScript::initAgentScript(). |
|
Definition at line 75 of file agent_script.cpp. Referenced by NLAIAGENT::CAgentScript::initAgentScript(). |
|
Define the an buzzy state for an agent all time in this state. Definition at line 147 of file baseai.cpp. |
|
Define the an end state for an agent all time in this state. Definition at line 148 of file baseai.cpp. |
|
Define the an error state for an agent all time in this state. Definition at line 149 of file baseai.cpp. |
|
Define the an idle state for an agent all time in this state. Definition at line 145 of file baseai.cpp. |
|
Define the an locked state for an agent all time in this state. Definition at line 146 of file baseai.cpp. |
|
Definition at line 144 of file baseai.cpp. |
|
Definition at line 143 of file baseai.cpp. |
|
Definition at line 88 of file agent_timer.cpp. |
|
Definition at line 65 of file agent_script.cpp. Referenced by NLAIAGENT::CAgentScript::initAgentScript(). |
|
Definition at line 64 of file agent_script.cpp. Referenced by NLAIAGENT::CAgentScript::initAgentScript(). |
|
Reimplemented in NLAIAGENT::CAgentWatchTimer, and NLAIAGENT::CAgentOperation. Definition at line 69 of file agent_script.cpp. |
|
Definition at line 86 of file agent_timer.cpp. |
|
Definition at line 87 of file agent_timer.cpp. |