#include <operator_script.h>
Inheritance diagram for NLAIAGENT::COperatorScript:
Base class member method. | |
virtual std::string | getMethodeMemberDebugString (sint32, sint32) 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 bool | haveActivity () const |
allow to know if the agent have an activity process to run. | |
virtual sint32 | isClassInheritedFrom (const NLAIAGENT::IVarName &) const |
virtual TQueue | isDeflautProccessMsg (const IVarName *, const NLAIAGENT::IVarName *, const IObjectIA &) const |
virtual TQueue | isMember (const IVarName *, const NLAIAGENT::IVarName *, const IObjectIA &) const |
virtual void | processContinuation (IMessageBase *, IMessageBase *) |
virtual IObjectIA::CProcessResult | runActivity () |
Mailer do'nt have own activity. | |
virtual void | runChildren () |
virtual bool | runChildrenStepByStep () |
Activates the child agents. | |
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 *) |
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 | |
void | activate () |
Activates the actor. | |
virtual void | addSet (const std::string &) |
Add a set for the agent. | |
virtual std::set< std::string >::const_iterator | beginSet () const |
NLAILOGIC::CFact * | buildFromVars (NLAILOGIC::IBaseAssert *, std::vector< sint32 > &, NLAILOGIC::CValueSet *) |
void | calcPriority () |
virtual void | callConstructor () |
virtual void | callFunction (std::string &, NLAIAGENT::IObjectIA *p=NULL) |
virtual void | cancel () |
virtual TQueue | canProcessMessage (const IVarName &) |
virtual bool | checkActivation () |
void | checkPause () |
bool | checkPreconditions () |
virtual bool | checkTrigMsg () |
virtual const NLAIC::IBasicType * | clone () const |
Inherited functions. | |
void | connect (IConnectIA *b) |
COperatorScript (IAgentManager *, IBasicAgent *, std::list< IObjectIA * > &, NLAISCRIPT::COperatorClass *) | |
COperatorScript (const COperatorScript &) | |
COperatorScript (IAgentManager *, bool activated=false) | |
sint32 | decRef () |
Decrement the reference of an object. | |
virtual std::set< std::string >::const_iterator | endSet () const |
void | execOnActivate () |
virtual void | failure () |
virtual int | getBaseMethodCount () const |
Get an valid context for this instance. | |
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 void | getDebugString (std::string &) const |
void | getFatherComponent (IVarName &) |
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 sint32 | getMethodIndexSize () const |
virtual const IRefrence * | getOwner () const |
To get the top level parent of this agent. | |
IConnectIA * | getParent () const |
to get the agent parents | |
TQueue | getPrivateMember (const IVarName *, const IVarName *, const IObjectIA &) const |
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 () |
const CAgentScript * | getTopLevel () const |
virtual const NLAIC::CIdentType & | getType () const |
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. | |
bool | isActivated () |
Returns true if the actor has a token. | |
virtual sint32 | isClassInheritedFrom (const IVarName &) const |
virtual bool | isEqual (const IBasicObjectIA &a) const |
Implementation of the isEqual of the IBasicObjectIA. | |
bool | isExclusive () |
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. | |
virtual void | Launch (const std::string &name, NLAIAGENT::IBasicAgent *) |
void | linkGoalArgs (NLAILOGIC::CGoal *) |
Binds the goal args to the variables of the operator (defined by the "Goal:" field in the script). | |
virtual void | load (NLMISC::IStream &is) |
void | lookForGoals () |
virtual const NLAIC::IBasicType * | newInstance () const |
virtual void | onActivate () |
Callback called at the activation of the actor. | |
virtual void | onFailure (IObjectIA *) |
virtual void | onKill (IConnectIA *a) |
Called by an agent who's destroyed te remove its references. | |
virtual void | onPause () |
These functions can be overloaded to have the actor execute something when paused or restarted. | |
virtual void | onRestart () |
virtual void | onSuccess (IObjectIA *) |
virtual void | onUnActivate () |
Callback called when the agent is unactivated. | |
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 | order (NLAIAGENT::IBaseGroupType *, NLAILOGIC::IGoal *) |
void | pause () |
Pauses the actor. | |
float | priority () const |
Priority of the operator. | |
virtual void | processFailure (NLAIAGENT::IObjectIA *) |
virtual void | processMessages () |
virtual void | processMessages (NLAIAGENT::IMessageBase *msg, NLAIAGENT::IObjectIA *o) |
virtual void | processSuccess (NLAIAGENT::IObjectIA *) |
std::list< NLAILOGIC::CFact * > * | propagate (std::list< NLAILOGIC::CFact * > &) |
std::list< NLAILOGIC::CValueSet * > * | propagate (std::list< NLAILOGIC::CValueSet * > &, NLAILOGIC::CValueSet *, std::vector< sint32 > &) |
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. | |
void | restart () |
Restarts the actor. | |
virtual const CProcessResult & | run () |
virtual IObjectIA::CProcessResult | runMethodBase (int index, IObjectIA *) |
virtual IObjectIA::CProcessResult | runMethodBase (int heritance, int index, IObjectIA *) |
virtual IMessageBase * | runTell (const IMessageBase &m) |
virtual void | save (NLMISC::IStream &os) |
virtual NLAILOGIC::CGoal * | selectGoal () |
Selects a goal among the ones the operator can process. | |
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 CProcessResult | sendMessage (IObjectIA *) |
virtual void | serial (NLMISC::IStream &f) throw (NLMISC::EStream) |
virtual void | setParent (const IWordNumRef *parent) |
to set the parent of the agents. | |
void | setPriority (float prio) |
virtual void | setState (TProcessStatement s, IObjectIA *result) |
Set the state of an agent. | |
bool | setStaticMember (const IVarName &compName, IObjectIA *change) |
virtual void | setTopLevel (CAgentScript *) |
Set the top level agent of this one. | |
void | setTypeAt (uint64 t) |
That function allow user to change the 7 bit of the type field in the sid agent number;. | |
virtual void | success () |
void | unActivate () |
Unactivates the actor. | |
NLAILOGIC::CValueSet * | unifyLiaison (const NLAILOGIC::CValueSet *, NLAILOGIC::CValueSet *, std::vector< sint32 > &) |
virtual | ~COperatorScript () |
Static Public Member Functions | |
void | initAgentScript () |
void | initClass () |
void | releaseAgentScript () |
void | releaseClass () |
Static Public Attributes | |
const NLAIC::CIdentType | IdActorScript |
const NLAIC::CIdentType * | IdAgent = NULL |
const NLAIC::CIdentType | IdAgentScript |
NLAISCRIPT::COperandSimpleListOr * | IdMsgNotifyParent = NULL |
NLAISCRIPT::COperandSimple * | IdMsgNotifyParentClass = NULL |
const NLAIC::CIdentType | IdOperatorScript |
NLAISCRIPT::COperandSimpleListOr * | msgPerf = NULL |
NLAISCRIPT::COperandSimpleListOr * | msgType = NULL |
NLAISCRIPT::CParam * | ParamFailureMsg = NULL |
NLAISCRIPT::CParam * | ParamGetValueMsg = NULL |
NLAISCRIPT::COperandSimpleListOr * | ParamIdFailureMsg = NULL |
NLAISCRIPT::COperandSimpleListOr * | ParamIdGetValueMsg = NULL |
NLAISCRIPT::COperandSimpleListOr * | ParamIdInitComponentMsg = NULL |
NLAISCRIPT::COperandSimpleListOr * | ParamIdSetValueMsg = NULL |
NLAISCRIPT::COperandSimpleListOr * | ParamIdSuccessMsg = NULL |
NLAISCRIPT::COperandSimpleListOr * | ParamIdTellComponentMsg = NULL |
NLAISCRIPT::CParam * | ParamInitComponentMsg = NULL |
NLAISCRIPT::CParam * | ParamRunParentNotify = NULL |
NLAISCRIPT::CParam * | ParamSetStatic |
NLAISCRIPT::CParam * | ParamSetValueMsg = NULL |
NLAISCRIPT::CParam * | ParamSuccessMsg = 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() |
NLAISCRIPT::CParam * | SendCompParamMessageScript = NULL |
NLAISCRIPT::CParam * | SendParamMessageScript = NULL |
CMethodCall ** | StaticMethod = NULL |
Protected Types | |
enum | c_funcs_id { fid_modeachieve, fid_modemaintain, fid_isPaused, fid_getPriority, fid_setPriority, fid_isActivable, fid_background, fid_exclusive, fid_achieve, fid_order, fid_last } |
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 CProcessResult | sendBroadCast (IObjectIA *) |
void | setNumRef (const IWordNumRef &ref) |
virtual void | switchActor (std::vector< CComponentHandle * > &, bool stay_active=false) |
virtual void | switchActor (std::vector< CActorScript * > &, bool stay_active=false) |
virtual void | switchActor (CActorScript *, bool stay_active=false) |
Protected Attributes | |
std::vector< CComponentHandle * > | _Actors |
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 |
bool | _IsActivated |
bool | _IsPaused |
std::list< IBasicAgent * > | _Launched |
IMailBox * | _Mail |
Box letter for communication service. | |
sint32 | _NbAnswers |
int | _NbComponents |
Nomber of static compoment. | |
bool | _OnActivate |
sint32 | _OnActivateIndex |
sint32 | _OnFailureIndex |
sint32 | _OnPauseIndex |
sint32 | _OnRestartIndex |
sint32 | _OnSuccessIndex |
sint32 | _OnUnActivateIndex |
CProcessResult | _RunState |
Internal state of the agent. | |
sint | _SizeChild |
CAgentScript * | _TopLevel |
std::set< std::string > | mapSet |
Private Attributes | |
std::list< NLAILOGIC::CGoal * > | _ActivatedGoals |
float | _BasePriority |
NLAILOGIC::CGoal * | _CurrentGoal |
sint32 | _CyclesBeforeUpdate |
bool | _Exclusive |
NLAILOGIC::CFactBase * | _FactBase |
bool | _IsActivable |
bool | _Maintain |
float | _Priority |
std::vector< NLAIAGENT::IObjectIA * > | _VarValues |
|
Reimplemented from NLAIAGENT::CActorScript. Definition at line 49 of file operator_script.h.
00050 { 00051 fid_modeachieve, 00052 fid_modemaintain, 00053 fid_isPaused, 00054 fid_getPriority, 00055 fid_setPriority, 00056 fid_isActivable, 00057 fid_background, 00058 fid_exclusive, 00059 fid_achieve, 00060 fid_order, 00061 fid_last 00062 }; |
|
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 43 of file operator_script.cpp. References _CurrentGoal, _CyclesBeforeUpdate, _Exclusive, _IsActivable, and _Maintain. Referenced by clone(), and newInstance().
00043 : CActorScript( manager ) 00044 { 00045 _CurrentGoal = NULL; 00046 _CyclesBeforeUpdate = 0; 00047 _IsActivable = false; 00048 _Maintain = false; 00049 _Priority = 0; 00050 _Exclusive = true; 00051 } |
|
Definition at line 18 of file operator_script.cpp. References _BasePriority, _CurrentGoal, _CyclesBeforeUpdate, _Exclusive, _IsActivable, and _Maintain.
00018 : CActorScript(a) 00019 { 00020 _CurrentGoal = a._CurrentGoal; 00021 _CyclesBeforeUpdate = a._CyclesBeforeUpdate; 00022 _IsActivable = a._IsActivable; 00023 _Maintain = a._Maintain; 00024 _Priority = 0; 00025 _Exclusive = a._Exclusive; 00026 _BasePriority = a._BasePriority; 00027 } |
|
Definition at line 29 of file operator_script.cpp. References _CurrentGoal, _CyclesBeforeUpdate, _Exclusive, _IsActivable, _Maintain, and components.
00033 : CActorScript(manager, father, components, actor_class ) 00034 { 00035 _CurrentGoal = NULL; 00036 _CyclesBeforeUpdate = 0; 00037 _IsActivable = false; 00038 _Maintain = false; 00039 _Priority = 0; 00040 _Exclusive = true; 00041 } |
|
Definition at line 53 of file operator_script.cpp.
00054 { 00055 #ifdef NL_DEBUG 00056 //const char *className = (const char *)getType(); 00057 #endif 00058 std::vector<NLAIAGENT::IObjectIA *>::iterator it_val = _VarValues.begin(); 00059 while ( it_val != _VarValues.end() ) 00060 { 00061 (*it_val)->release(); 00062 it_val++; 00063 } 00064 } |
|
Activates the actor.
Definition at line 126 of file actor_script.cpp. References NLAIAGENT::CActorScript::_OnActivateIndex, NLAIAGENT::CAgentScript::getClass(), NLAIAGENT::IConnectIA::getParent(), NLAISCRIPT::CAgentClass::isClassInheritedFrom(), NLAISCRIPT::CAgentClass::isMember(), NLAIAGENT::CActorScript::onActivate(), r, and NLAIAGENT::TQueue. Referenced by NLAIAGENT::CSeqFsmScript::onSuccess(), run(), NLAIAGENT::CActorScript::runMethodBase(), and NLAIAGENT::CActorScript::switchActor().
00127 { 00128 if ( !_IsActivated ) 00129 { 00130 CAgentScript *father = (CAgentScript *) getParent(); 00131 00132 if ( father && ( ( CAgentScript *)father)->getClass()->isClassInheritedFrom( CStringVarName("Fsm") ) != -1 ) 00133 { 00134 ( (CFsmScript *)father)->activate( this ); 00135 } 00136 00137 // Looks for the function to call at the activation of the state 00138 static CStringVarName activate_func_name("OnActivate"); 00139 TQueue r = _AgentClass->isMember( NULL, &activate_func_name, NLAISCRIPT::CParam() ); 00140 if ( !r.empty() ) 00141 _OnActivateIndex = r.top().Index; 00142 else 00143 onActivate(); 00144 _IsActivated = true; 00145 } 00146 } |
|
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 427 of file operator_script.cpp. References assert, NLAILOGIC::CValueSet::setValue(), and sint32. Referenced by propagate().
00428 { 00429 NLAILOGIC::CFact *result = new NLAILOGIC::CFact( assert); // TODO:: pas besoin du nombre dans ce constructeur puisqu'on a l'assert 00430 for (sint32 i = 0; i < (sint32) pl.size() ; i++ ) 00431 { 00432 result->setValue( i, (*vars)[ pl[i] ] ); 00433 } 00434 return result; 00435 } |
|
Definition at line 383 of file operator_script.cpp. References _BasePriority, _IsActivable, NLAIAGENT::IDigital< float >::getNumber(), NLAIAGENT::IConnectIA::getParent(), getType(), NLAIAGENT::CComponentHandle::getValue(), NLAIFUZZY::IFuzzySet::membership(), and value. Referenced by run().
00384 { 00385 int i; 00386 double pri = 1.0; 00387 for ( i = 0; i < (int) ( (NLAISCRIPT::COperatorClass *) _AgentClass)->getFuzzyVars().size(); i++) 00388 { 00389 CComponentHandle var_handle( *(const IVarName *)( ( (NLAISCRIPT::COperatorClass *) _AgentClass )->getFuzzySets() )[i],(IAgent *)getParent(), true ); 00390 CComponentHandle set_handle( *(const IVarName *)( ( (NLAISCRIPT::COperatorClass *) _AgentClass )->getFuzzyVars() )[i],(IAgent *)getParent(), true ); 00391 CComponentHandle this_var_handle( *(const IVarName *)( ( (NLAISCRIPT::COperatorClass *) _AgentClass )->getFuzzySets() )[i], this, true ); 00392 00393 NLAIFUZZY::IFuzzySet *set = (NLAIFUZZY::IFuzzySet *) set_handle.getValue(); 00394 DigitalType *var = (DigitalType *) var_handle.getValue(); 00395 00396 if ( var == NULL ) 00397 var = (DigitalType *) this_var_handle.getValue(); 00398 00399 // Min 00400 if ( set != NULL && var != NULL ) 00401 { 00402 double value = var->getNumber(); 00403 double membership = set->membership( value ); 00404 if ( membership < pri ) 00405 pri = membership; 00406 } 00407 } 00408 00409 #ifdef NL_DEBUG 00410 const char *dbg_class = (const char *) getType(); 00411 #endif 00412 00413 // float class_pri = ( (NLAISCRIPT::COperatorClass *) _AgentClass)->getPriority(); 00414 00415 if (! _IsActivable ) 00416 _Priority = 0.0; 00417 else 00418 // _Priority = (float)pri * class_pri; 00419 _Priority = (float)pri * _BasePriority; 00420 } |
|
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 } |
|
Reimplemented from NLAIAGENT::CActorScript. Definition at line 371 of file operator_script.cpp. References _CurrentGoal.
00372 { 00373 _CurrentGoal = NULL; 00374 CActorScript::cancel(); 00375 _CurrentGoal = NULL; 00376 } |
|
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 } |
|
Definition at line 299 of file operator_script.cpp. References _ActivatedGoals, _CurrentGoal, _Maintain, checkPreconditions(), getType(), linkGoalArgs(), and lookForGoals(). Referenced by run().
00300 { 00301 #ifdef NL_DEBUG 00302 const char *dbg_class_name = (const char *) getType(); 00303 #endif 00304 00305 // If not in maintain mode and the operator has already been activated, keeps it activated. 00306 if ( _IsActivated && _CurrentGoal != NULL && !_Maintain) 00307 return true; 00308 00309 if ( ( (NLAISCRIPT::COperatorClass *) _AgentClass )->getGoal() != NULL) 00310 { 00311 // if ( _CurrentGoal != NULL ) 00312 lookForGoals(); 00313 00314 // If no goal is posted corresponding to this operator's one, returns false 00315 if ( _ActivatedGoals.empty() ) 00316 return false; 00317 00318 std::list<NLAILOGIC::CGoal *>::iterator it_goal = _ActivatedGoals.begin(); 00319 while ( it_goal != _ActivatedGoals.end() ) 00320 { 00321 linkGoalArgs( *it_goal ); 00322 if ( checkPreconditions() == true ) 00323 { 00324 NLAILOGIC::CGoal *goal = *it_goal; 00325 _ActivatedGoals.clear(); 00326 _ActivatedGoals.push_back( goal ); 00327 return true; 00328 } 00329 it_goal++; 00330 } 00331 return false; 00332 } 00333 else 00334 return checkPreconditions(); 00335 } |
|
Definition at line 269 of file operator_script.cpp. References _CurrentGoal, getType(), NLAILOGIC::IGoal::isSelected(), NLAIAGENT::CActorScript::pause(), and NLAIAGENT::CActorScript::restart(). Referenced by run().
00270 { 00271 #ifdef NL_DEBUG 00272 const char *dbg_class_name = (const char *) getType(); 00273 #endif 00274 if ( (_CurrentGoal != NULL) ) 00275 { 00276 if ( !_IsPaused && !_CurrentGoal->isSelected() ) 00277 pause(); 00278 if ( _IsPaused && _CurrentGoal->isSelected() ) 00279 restart(); 00280 } 00281 } |
|
Definition at line 356 of file operator_script.cpp. References checkTrigMsg(), NLAIAGENT::IAgentManager::getAgentContext(), NLAIAGENT::CAgentScript::getAgentManager(), getType(), and NLAISCRIPT::CCodeContext::Self. Referenced by checkActivation().
00357 { 00358 #ifdef NL_DEBUG 00359 const char *dbg_class_name = (const char *) getType(); 00360 #endif 00361 // Checks for message triggers 00362 if ( ( (NLAISCRIPT::COperatorClass *) _AgentClass )->NbMsgTrigger() != 0 && !checkTrigMsg() ) 00363 return false; 00364 00365 NLAISCRIPT::CCodeContext *context = (NLAISCRIPT::CCodeContext *) getAgentManager()->getAgentContext(); 00366 context->Self = this; 00367 return ((NLAISCRIPT::COperatorClass *)_AgentClass)->isValidFonc( context ); 00368 } |
|
Definition at line 828 of file operator_script.cpp. References NLAIAGENT::IBasicAgent::getMail(), NLAIAGENT::IMailBox::getMesseageListe(), NLAIAGENT::IConnectIA::getParent(), NLAIC::IBasicType::getType(), NLAIC::IPointerGestion::incRef(), NLAIAGENT::CAgentScript::setStaticMember(), and sint32. Referenced by checkPreconditions().
00829 { 00830 IBasicAgent *father = (IBasicAgent *) getParent(); 00831 if ( father != NULL ) 00832 { 00833 IMailBox *mailbox = father->getMail(); 00834 if ( mailbox != NULL ) 00835 { 00836 std::list<const IMessageBase *>::const_iterator it_msg; 00837 const std::list<const IMessageBase *> &msg_list = mailbox->getMesseageListe(); 00838 00839 it_msg = msg_list.begin(); 00840 while ( it_msg != msg_list.end() ) 00841 { 00842 IMessageBase *msg = (NLAIAGENT::IMessageBase *)*it_msg; 00843 #ifdef NL_DEBUG 00844 const char *id = (const char *) msg->getType(); 00845 #endif 00846 00847 sint32 msg_comp_pos = ( (NLAISCRIPT::COperatorClass *) _AgentClass )->checkTriggerMsg( msg ); 00848 if ( msg_comp_pos == -1) 00849 return false; 00850 else 00851 { 00852 if(!setStaticMember( msg_comp_pos, (NLAIAGENT::IObjectIA *) msg )) 00853 msg->incRef(); 00854 return true; 00855 } 00856 it_msg++; 00857 } 00858 } 00859 } 00860 return false; 00861 } |
|
Inherited functions.
Reimplemented from NLAIAGENT::CActorScript. Definition at line 71 of file operator_script.cpp. References COperatorScript().
00072 { 00073 COperatorScript *m = new COperatorScript(*this); 00074 return m; 00075 } |
|
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 } |
|
Definition at line 236 of file operator_script.cpp. References NLAIAGENT::IAgentManager::getAgentContext(), NLAIAGENT::CAgentScript::getAgentManager(), getType(), NLAIAGENT::CActorScript::onActivate(), r, NLAIAGENT::CAgentScript::runMethodeMember(), NLAISCRIPT::CCodeContext::Self, sint, and NLAISCRIPT::CCodeContext::Stack. Referenced by run().
00237 { 00238 #ifdef NL_DEBUG 00239 const char *dbg_class_name = (const char *) getType(); 00240 #endif 00241 if ( _OnActivateIndex != -1 ) // if found, runs the script's OnActivate() function declared in the operator class 00242 { 00243 if ( getAgentManager() != NULL ) 00244 { 00245 NLAISCRIPT::CCodeContext *context = (NLAISCRIPT::CCodeContext *) getAgentManager()->getAgentContext(); 00246 #ifdef NL_DEBUG 00247 sint sp = context->Stack.CIndexStackPointer::operator int (); 00248 #endif 00249 context->Self = this; 00250 IObjectIA::CProcessResult r = runMethodeMember( _OnActivateIndex , context); 00251 if(r.Result != NULL) 00252 { 00253 throw; 00254 } 00255 00256 #ifdef NL_DEBUG 00257 if ( sp != context->Stack.CIndexStackPointer::operator int () ) 00258 { 00259 throw; 00260 } 00261 #endif 00262 _OnActivateIndex = -1; 00263 } 00264 } 00265 else 00266 onActivate(); // Otherwise runs the C++ virtual one (inherited from CActorScript) 00267 } |
|
|
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 checkPreconditions(), 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::CActorScript. Definition at line 729 of file operator_script.cpp.
00730 { 00731 return CActorScript::getBaseMethodCount() + fid_last; 00732 } |
|
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::CActorScript. Definition at line 91 of file operator_script.cpp. References NLAIC::IBasicType::clone(), NLAIAGENT::IAgentManager::getAgentContext(), NLAISCRIPT::CAgentClass::getDebugString(), NLAIAGENT::CStringType::getStr(), NLAIAGENT::IVarName::getString(), NLAIAGENT::CIdMethod::Index, NLAIAGENT::CAgentScript::isMember(), param, priority(), r, NLAIC::IPointerGestion::release(), NLAISCRIPT::CCallMethod::runOpCode(), NLAISCRIPT::CCodeContext::Self, NLAISCRIPT::CCodeContext::Stack, NLAIC::stringGetBuild(), t, and NLAIAGENT::TQueue.
00092 { 00093 if ( _AgentClass ) 00094 _AgentClass->getDebugString(t); 00095 else 00096 t += "<COperatorScript>"; 00097 t += "<"; 00098 00099 if ( _IsActivated ) 00100 t += "activated>"; 00101 else 00102 t += "idle>"; 00103 t += " <P "; 00104 std::string text; 00105 text = NLAIC::stringGetBuild("%f", priority() ); 00106 t += text; 00107 t += "\n\t"; 00108 00109 if( _AgentManager != NULL) 00110 { 00111 const NLAISCRIPT::CParam p; 00112 static CStringVarName debugStringF("GetDebugString"); 00113 00114 TQueue r = isMember(NULL,&debugStringF,p); 00115 if(r.size()) 00116 { 00117 NLAISCRIPT::CCodeContext *c = (NLAISCRIPT::CCodeContext *)_AgentManager->getAgentContext()->clone(); 00118 NLAIAGENT::CIdMethod m = r.top(); 00119 //msg->setMethodIndex(0,m.Index); 00120 c->Self = this; 00121 00122 IBaseGroupType *param = new CGroupType(); 00123 (*c).Stack ++; 00124 (*c).Stack[(int)(*c).Stack] = param; 00125 NLAISCRIPT::IMethodContext *methodContex = new NLAISCRIPT::CMethodContext(); 00126 NLAISCRIPT::CCallMethod opCall(methodContex,0,m.Index); 00127 opCall.runOpCode(*c); 00128 const NLAIAGENT::CStringType *returnMsg = (const NLAIAGENT::CStringType *)c->Stack[(int)(*c).Stack]; 00129 t += returnMsg->getStr().getString(); 00130 (*c).Stack--; 00131 c->release(); 00132 } 00133 } 00134 } |
|
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 getType(), and NLAIAGENT::CMainAgentScript::run().
00278 { 00279 return _AgentClass; 00280 } |
|
|
|
Definition at line 434 of file agent_script.h. Referenced by 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(), 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::CActorScript. Definition at line 815 of file operator_script.cpp. References sint32.
00816 { 00817 return CActorScript::getMethodIndexSize() + fid_last; 00818 } |
|
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(), calcPriority(), checkTrigMsg(), NLAIAGENT::IConnectIA::Kill(), 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 } |
|
Reimplemented from NLAIAGENT::CActorScript. Definition at line 734 of file operator_script.cpp. References fid_background, fid_exclusive, fid_getPriority, fid_isActivable, fid_isPaused, fid_modeachieve, fid_modemaintain, fid_order, fid_setPriority, NLAIAGENT::IVarName::getString(), param, and NLAIAGENT::TQueue.
00735 { 00736 00737 #ifdef NL_DEBUG 00738 const char *dbg_func_name = name->getString(); 00739 #endif 00740 00741 TQueue result; 00742 00743 static NLAIAGENT::CStringVarName modeachieve_name("SetModeAchieve"); 00744 static NLAIAGENT::CStringVarName modemaintain_name("SetModeMaintain"); 00745 static NLAIAGENT::CStringVarName ispaused_name("IsPaused"); 00746 static NLAIAGENT::CStringVarName isactivable_name("IsActivable"); 00747 static NLAIAGENT::CStringVarName priority_name("GetPriority"); 00748 static NLAIAGENT::CStringVarName set_priority_name("SetPriority"); 00749 static NLAIAGENT::CStringVarName exclusive_name("SetExclusive"); 00750 static NLAIAGENT::CStringVarName background_name("SetBackground"); 00751 static NLAIAGENT::CStringVarName order_name("Order"); 00752 00753 00754 if ( *name == modeachieve_name ) 00755 { 00756 NLAIAGENT::CObjectType *r_type = new NLAIAGENT::CObjectType( new NLAIC::CIdentType( NLAIC::CIdentType::VoidType ) ); 00757 result.push( NLAIAGENT::CIdMethod( CActorScript::getMethodIndexSize() + fid_modeachieve, 0.0,NULL, r_type ) ); 00758 } 00759 00760 if ( *name == modemaintain_name ) 00761 { 00762 NLAIAGENT::CObjectType *r_type = new NLAIAGENT::CObjectType( new NLAIC::CIdentType( NLAIC::CIdentType::VoidType ) ); 00763 result.push( NLAIAGENT::CIdMethod( CActorScript::getMethodIndexSize() + fid_modemaintain , 0.0,NULL, r_type ) ); 00764 } 00765 00766 if ( *name == ispaused_name ) 00767 { 00768 NLAIAGENT::CObjectType *r_type = new NLAIAGENT::CObjectType( new NLAIC::CIdentType( NLAIC::CIdentType::VoidType ) ); 00769 result.push( NLAIAGENT::CIdMethod( CActorScript::getMethodIndexSize() + fid_isPaused , 0.0,NULL, r_type ) ); 00770 } 00771 00772 00773 if ( *name == isactivable_name ) 00774 { 00775 NLAIAGENT::CObjectType *r_type = new NLAIAGENT::CObjectType( new NLAIC::CIdentType( NLAIC::CIdentType::VoidType ) ); 00776 result.push( NLAIAGENT::CIdMethod( CActorScript::getMethodIndexSize() + fid_isActivable , 0.0,NULL, r_type ) ); 00777 } 00778 00779 if ( *name == priority_name ) 00780 { 00781 NLAIAGENT::CObjectType *r_type = new NLAIAGENT::CObjectType( new NLAIC::CIdentType( NLAIC::CIdentType::VoidType ) ); 00782 result.push( NLAIAGENT::CIdMethod( CActorScript::getMethodIndexSize() + fid_getPriority , 0.0,NULL, r_type ) ); 00783 } 00784 00785 if ( *name == set_priority_name ) 00786 { 00787 NLAIAGENT::CObjectType *r_type = new NLAIAGENT::CObjectType( new NLAIC::CIdentType( NLAIAGENT::DigitalType::IdDigitalType ) ); 00788 result.push( NLAIAGENT::CIdMethod( CActorScript::getMethodIndexSize() + fid_setPriority , 0.0,NULL, r_type ) ); 00789 } 00790 00791 if ( *name == exclusive_name ) 00792 { 00793 NLAIAGENT::CObjectType *r_type = new NLAIAGENT::CObjectType( new NLAIC::CIdentType( NLAIC::CIdentType::VoidType ) ); 00794 result.push( NLAIAGENT::CIdMethod( CActorScript::getMethodIndexSize() + fid_exclusive , 0.0,NULL, r_type ) ); 00795 } 00796 00797 if ( *name == background_name ) 00798 { 00799 NLAIAGENT::CObjectType *r_type = new NLAIAGENT::CObjectType( new NLAIC::CIdentType( NLAIC::CIdentType::VoidType ) ); 00800 result.push( NLAIAGENT::CIdMethod( CActorScript::getMethodIndexSize() + fid_background , 0.0,NULL, r_type ) ); 00801 } 00802 00803 if ( *name == order_name ) 00804 { 00805 NLAIAGENT::CObjectType *r_type = new NLAIAGENT::CObjectType( new NLAIC::CIdentType( NLAIC::CIdentType::VoidType ) ); 00806 result.push( NLAIAGENT::CIdMethod( CActorScript::getMethodIndexSize() + fid_order , 0.0,NULL, r_type ) ); 00807 } 00808 00809 if ( result.empty() ) 00810 return CActorScript::getPrivateMember(className, name, param); 00811 else 00812 return result; 00813 } |
|
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 }
|
|
Definition at line 948 of file actor_script.cpp. References NLAIAGENT::CActorScript::_TopLevel. Referenced by NLAIAGENT::CActorScript::runMethodBase().
00949 { 00950 return _TopLevel; 00951 } |
|
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::CActorScript. Definition at line 141 of file operator_script.cpp. References NLAIAGENT::CAgentScript::getFactoryClass(), NLAISCRIPT::IClassInterpret::getType(), and IdOperatorScript. Referenced by calcPriority(), checkActivation(), checkPause(), checkPreconditions(), execOnActivate(), isExclusive(), lookForGoals(), onFailure(), onSuccess(), and run().
00142 { 00143 if ( getFactoryClass() != NULL ) 00144 return getFactoryClass()->getType(); 00145 else 00146 return IdOperatorScript; 00147 } |
|
allow to know if the agent have an activity process to run.
Reimplemented from NLAIAGENT::IAgent. Reimplemented in NLAIAGENT::CAgentManagerTimer, NLAIAGENT::CAgentWatchTimer, and NLAIAGENT::CAgentOperation. Definition at line 1617 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_AgentClass, and NLAISCRIPT::CAgentClass::getRunMethod(). Referenced by NLAIAGENT::CMainAgentScript::run().
01618 { 01619 return _AgentClass != NULL && (_AgentClass->getRunMethod() >= 0); 01620 } |
|
|
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 50 of file actor_script.cpp. References NLAIAGENT::CActorScript::ParamIdFailureMsg, and NLAIAGENT::CActorScript::ParamIdSuccessMsg. Referenced by NLAILINK::initIALib().
00051 { 00052 CActorScript::ParamIdSuccessMsg = new NLAISCRIPT::COperandSimpleListOr(2, 00053 new NLAIC::CIdentType(NLAIAGENT::CSuccessMsg::IdSuccessMsg), 00054 new NLAIC::CIdentType(NLAISCRIPT::CSuccessMsgClass::IdSuccessMsgClass) ); 00055 CActorScript::ParamSuccessMsg = new NLAISCRIPT::CParam(1,ParamIdSuccessMsg); 00056 CActorScript::ParamIdFailureMsg = new NLAISCRIPT::COperandSimpleListOr(2, 00057 new NLAIC::CIdentType(NLAIAGENT::CFailureMsg::IdFailureMsg), 00058 new NLAIC::CIdentType(NLAISCRIPT::CFailureMsgClass::IdFailureMsgClass) ); 00059 00060 CActorScript::ParamFailureMsg = new NLAISCRIPT::CParam(1,ParamIdFailureMsg); 00061 } |
|
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 } |
|
Returns true if the actor has a token.
Definition at line 120 of file actor_script.cpp.
00121 { 00122 return _IsActivated; 00123 } |
|
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::CActorScript. Definition at line 136 of file operator_script.cpp.
00137 { 00138 return true; 00139 } |
|
Definition at line 820 of file operator_script.cpp. References _Exclusive, and getType().
00821 { 00822 #ifdef NL_DEBUG 00823 const char *dbg_exclusive = (const char *) getType(); 00824 #endif 00825 return _Exclusive; 00826 } |
|
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 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 } |
|
Definition at line 609 of file actor_script.cpp. References NLAIAGENT::CActorScript::_Launched, NLAIAGENT::CActorScript::_NbAnswers, NLAIAGENT::CActorScript::_TopLevel, NLAIAGENT::CAgentScript::addDynamicAgent(), and NLAIAGENT::IObjectIA::isClassInheritedFrom(). Referenced by NLAIAGENT::CActorScript::runMethodBase().
00610 { 00611 00612 CStringType stringName( name.c_str() ); 00613 addDynamicAgent( stringName , child ); 00614 _NbAnswers++; 00615 00616 if ( child->isClassInheritedFrom( CStringVarName("Actor") ) != -1 ) 00617 { 00618 if ( _TopLevel ) 00619 ((CActorScript *)child)->setTopLevel( _TopLevel ); 00620 else 00621 ((CActorScript *)child)->setTopLevel( this ); 00622 00623 ((CActorScript *)child)->activate(); 00624 } 00625 00626 _Launched.push_back( (NLAIAGENT::IAgent *) child ); 00627 } |
|
Binds the goal args to the variables of the operator (defined by the "Goal:" field in the script).
Definition at line 546 of file operator_script.cpp. References NLAILOGIC::CGoal::getArgs(), and NLAIAGENT::CAgentScript::setStaticMember(). Referenced by checkActivation(), and run().
00547 { 00548 std::vector<NLAIAGENT::IObjectIA *>::const_iterator it_arg = g->getArgs().begin(); 00549 std::vector<sint32>::iterator it_pos = ( (NLAISCRIPT::COperatorClass *) _AgentClass )->getGoalVarPos().begin(); 00550 while ( it_arg != g->getArgs().end() ) 00551 { 00552 if(!setStaticMember( *it_pos, *it_arg )) 00553 (*it_arg)->incRef(); 00554 it_arg++; 00555 it_pos++; 00556 } 00557 } |
|
Load the class from a stream. Reimplemented from NLAIAGENT::CActorScript. Definition at line 155 of file operator_script.cpp.
00156 {
00157 CAgentScript::load(is);
00158 // TODO
00159 }
|
|
Definition at line 338 of file operator_script.cpp. References _ActivatedGoals, NLAIAGENT::CAgentScript::getGoalStack(), NLAIAGENT::IConnectIA::getParent(), and getType(). Referenced by checkActivation().
00339 { 00340 #ifdef NL_DEBUG 00341 const char *dbg_class_name = (const char *) getType(); 00342 #endif 00343 _ActivatedGoals.clear(); 00344 CAgentScript *father = (CAgentScript *) getParent(); 00345 const std::vector<NLAILOGIC::CGoal *> *goals = father->getGoalStack(); 00346 00347 int i; 00348 for ( i = 0; i < (int) goals->size(); i++ ) 00349 { 00350 if ( (*( (*goals)[i])) == *( (NLAISCRIPT::COperatorClass *) _AgentClass )->getGoal() ) 00351 _ActivatedGoals.push_back( (*goals)[i] ); 00352 } 00353 } |
|
This function allow a new instance, that mean that the class is a class factory. Reimplemented from NLAIAGENT::CActorScript. Definition at line 77 of file operator_script.cpp. References NLAISCRIPT::CAgentClass::buildNewInstance(), and COperatorScript().
00078 { 00079 COperatorScript *instance; 00080 if ( _AgentClass ) 00081 { 00082 instance = (COperatorScript *) _AgentClass->buildNewInstance(); 00083 } 00084 else 00085 { 00086 instance = new COperatorScript(NULL); 00087 } 00088 return instance; 00089 } |
|
Callback called at the activation of the actor.
Reimplemented in NLAILOGIC::CGoalPath. Definition at line 345 of file actor_script.cpp. Referenced by NLAIAGENT::CActorScript::activate(), execOnActivate(), and NLAIAGENT::CActorScript::runMethodBase().
00346 {
00347 // Default behaviour: do nothing
00348 }
|
|
Reimplemented from NLAIAGENT::CActorScript. Definition at line 573 of file operator_script.cpp. References _CurrentGoal, getType(), NLAILOGIC::CGoal::operatorFailure(), and NLAIAGENT::CActorScript::unActivate().
00574 { 00575 00576 #ifdef NL_DEBUG 00577 const char *dbg_class = (const char *) getType(); 00578 #endif 00579 00580 if(_CurrentGoal == NULL) 00581 return; 00582 // Tells the goal the operator failed 00583 _CurrentGoal->operatorFailure( this ); 00584 _CurrentGoal = NULL; 00585 unActivate(); 00586 } |
|
Called by an agent who's destroyed te remove its references.
Reimplemented from NLAIAGENT::CAgentScript. Definition at line 66 of file operator_script.cpp.
00067 { 00068 CActorScript::onKill(a); 00069 } |
|
These functions can be overloaded to have the actor execute something when paused or restarted.
Definition at line 237 of file actor_script.cpp. Referenced by NLAIAGENT::CActorScript::pause().
00238 {
00239 // Default: doesn't do anything.
00240 }
|
|
Definition at line 288 of file actor_script.cpp. Referenced by NLAIAGENT::CActorScript::restart().
00289 { 00290 } |
|
Dependencies failure and success notification These functions are called by other operators or goals who failed or succeeded Reimplemented from NLAIAGENT::CActorScript. Definition at line 560 of file operator_script.cpp. References _CurrentGoal, getType(), NLAILOGIC::CGoal::operatorSuccess(), and NLAIAGENT::CActorScript::unActivate().
00561 { 00562 #ifdef NL_DEBUG 00563 const char *dbg_class = (const char *) getType(); 00564 #endif 00565 if(_CurrentGoal == NULL) 00566 return; 00567 _CurrentGoal->operatorSuccess( this ); 00568 _CurrentGoal = NULL; 00569 unActivate(); 00570 } |
|
Callback called when the agent is unactivated.
Reimplemented in NLAILOGIC::CGoalPath. Definition at line 351 of file actor_script.cpp. Referenced by NLAIAGENT::CActorScript::runMethodBase(), and NLAIAGENT::CActorScript::unActivate().
00352 {
00353 // default behaviour: do nothing
00354 }
|
|
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().
|
|
|
Pauses the actor.
Definition at line 191 of file actor_script.cpp. References NLAIAGENT::CActorScript::_IsPaused, NLAIAGENT::CActorScript::_Launched, NLAIAGENT::CActorScript::_OnPauseIndex, NLAIAGENT::IAgentManager::getAgentContext(), NLAIAGENT::CAgentScript::getAgentManager(), NLAIC::IBasicType::getType(), NLAISCRIPT::CAgentClass::isMember(), NLAIAGENT::CActorScript::onPause(), r, NLAIAGENT::CAgentScript::runMethodeMember(), NLAISCRIPT::CCodeContext::Self, and NLAIAGENT::TQueue. Referenced by checkPause(), and NLAIAGENT::CActorScript::runMethodBase().
00192 { 00193 if ( _IsActivated ) 00194 { 00195 00196 if ( !_IsPaused ) 00197 { 00198 // Looks for the function to call when the actor is paused 00199 static CStringVarName activate_func_name("OnPause"); 00200 TQueue r = _AgentClass->isMember( NULL, &activate_func_name, NLAISCRIPT::CParam() ); 00201 if ( !r.empty() ) 00202 { 00203 if ( getAgentManager() != NULL ) 00204 { 00205 _OnPauseIndex = r.top().Index; 00206 NLAISCRIPT::CCodeContext *context = (NLAISCRIPT::CCodeContext *) getAgentManager()->getAgentContext(); 00207 context->Self = this; 00208 runMethodeMember( _OnPauseIndex ,context); 00209 _OnPauseIndex = -1; 00210 } 00211 } 00212 else 00213 onPause(); 00214 _IsPaused = true; 00215 } 00216 00217 // Calls the launched actors Pause callbacks 00218 std::list<IBasicAgent *>::iterator it_l = _Launched.begin(); 00219 while ( it_l != _Launched.end() ) 00220 { 00221 CActorScript *launched = (CActorScript *) *it_l; 00222 launched->pause(); 00223 it_l++; 00224 } 00225 00226 int i; 00227 for ( i = 0; i < _NbComponents; i++ ) 00228 { 00229 if ( ((const NLAIC::CTypeOfObject &)_Components[i]->getType()) & NLAIC::CTypeOfObject::tActor ) 00230 { 00231 ( (CActorScript *) _Components[i] )->pause(); 00232 } 00233 } 00234 } 00235 } |
|
Priority of the operator.
Reimplemented from NLAIAGENT::CActorScript. Definition at line 422 of file operator_script.cpp. Referenced by getDebugString(), and runMethodBase().
00423 { 00424 return _Priority; 00425 } |
|
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 } |
|
Definition at line 1004 of file actor_script.cpp. References NLAIAGENT::CActorScript::failure(), NLAIAGENT::CActorScript::getType(), and param. Referenced by NLAIAGENT::CActorScript::runMethodBase().
|
|
The processMessages method, process the loop/Run message. Reimplemented from NLAIAGENT::CAgentScript. Definition at line 395 of file actor_script.cpp. References NLAIAGENT::CAgentScript::processMessages(). Referenced by NLAIAGENT::CActorScript::run().
00396 {
00397 //if ( _IsActivated )
00398 CAgentScript::processMessages();
00399 }
|
|
Reimplemented from NLAIAGENT::CAgentScript. Definition at line 880 of file operator_script.cpp. References NLAIC::IBasicType::getType().
00881 { 00882 #ifdef NL_DEBUG 00883 const char *txt = (const char *)msg->getType(); 00884 #endif 00885 CAgentScript::processMessages(msg,o); 00886 } |
|
Own success and failure functions These function telle other operators and goals that might be waiting for the execution of this one. Definition at line 953 of file actor_script.cpp. References NLAIAGENT::CActorScript::getType(), param, and NLAIAGENT::CActorScript::success(). Referenced by NLAIAGENT::CActorScript::runMethodBase(), and NLAIAGENT::CActorScript::runTell().
|
|
Definition at line 473 of file operator_script.cpp. References buildFromVars(), NLAISCRIPT::COperatorClass::getAssertPos(), NLAISCRIPT::COperatorClass::getConcs(), NLAISCRIPT::COperatorClass::getConds(), NLAISCRIPT::COperatorClass::getPosVarsConcs(), NLAISCRIPT::COperatorClass::getPosVarsConds(), propagate(), r, sint32, and size.
00474 { 00475 std::list<NLAILOGIC::CFact *> *conflicts = new std::list<NLAILOGIC::CFact *>; 00476 std::list< NLAILOGIC::CValueSet *> liaisons; 00477 NLAILOGIC::CValueSet *empty = new NLAILOGIC::CValueSet( ( (NLAISCRIPT::COperatorClass *)_AgentClass)->getVars().size() ); 00478 liaisons.push_back( empty ); 00479 00480 NLAISCRIPT::COperatorClass *op_class = (NLAISCRIPT::COperatorClass *) _AgentClass; 00481 00482 std::list<NLAILOGIC::CFact *>::iterator it_f = facts.begin(); 00483 while ( it_f != facts.end() ) 00484 { 00485 std::vector<sint32> pos_asserts; 00486 op_class->getAssertPos( (*it_f)->getAssert() , op_class->getConds(), pos_asserts); 00487 for (sint32 i = 0; i < (sint32) pos_asserts.size(); i++ ) 00488 { 00489 std::list<NLAILOGIC::CValueSet *> *links = propagate( liaisons, *it_f, op_class->getPosVarsConds()[ pos_asserts[i] ] ); 00490 if ( links ) 00491 { 00492 while ( links->size() ) 00493 { 00494 for (sint32 i = 0; i < (sint32) op_class->getConcs().size(); i++ ) 00495 { 00496 NLAILOGIC::CFact *r = buildFromVars( op_class->getConcs()[i], op_class->getPosVarsConcs()[i], links->front() ); 00497 std::string buf; 00498 r->getDebugString( buf ); 00499 // Tests if the fact is already in the conflicts list 00500 bool found = false; 00501 std::list<NLAILOGIC::CFact *>::iterator it_c = conflicts->begin(); 00502 while ( ! found && it_c != conflicts->end() ) 00503 { 00504 found = (**it_c) == *r; 00505 it_c++; 00506 } 00507 if ( !found ) 00508 { 00509 std::string buf; 00510 r->getDebugString( buf ); 00511 conflicts->push_back( r ); 00512 } 00513 } 00514 links->front()->release(); 00515 links->pop_front(); 00516 } 00517 delete links; 00518 } 00519 } 00520 it_f++; 00521 } 00522 00523 while ( liaisons.size() ) 00524 { 00525 liaisons.front()->release(); 00526 liaisons.pop_front(); 00527 } 00528 return conflicts; 00529 } |
|
Definition at line 438 of file operator_script.cpp. References NLAILOGIC::CValueSet::undefined(), and unifyLiaison(). Referenced by propagate().
00439 { 00440 std::list<NLAILOGIC::CValueSet *> *conflits = new std::list<NLAILOGIC::CValueSet *>; 00441 std::list<NLAILOGIC::CValueSet *> buf_liaisons; 00442 // Pour chaque liaison... 00443 std::list< NLAILOGIC::CValueSet *>::iterator it_l = liaisons.begin(); 00444 00445 while ( it_l != liaisons.end() ) 00446 { 00447 NLAILOGIC::CValueSet *l = *it_l; 00448 00449 NLAILOGIC::CValueSet *result = unifyLiaison( l, fact, pos_vals ); 00450 if ( result ) 00451 { 00452 if ( result->undefined() == 0 ) 00453 { 00454 conflits->push_back( result ); 00455 } 00456 else 00457 buf_liaisons.push_back( result ); 00458 } 00459 it_l++; 00460 } 00461 00462 while ( buf_liaisons.size() ) 00463 { 00464 liaisons.push_back( buf_liaisons.front() ); 00465 buf_liaisons.pop_front(); 00466 } 00467 00468 return conflits; 00469 } |
|
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 63 of file actor_script.cpp. Referenced by NLAILINK::releaseIALib().
00064 { 00065 CActorScript::ParamSuccessMsg->release(); 00066 CActorScript::ParamFailureMsg->release(); 00067 } |
|
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 } |
|
Restarts the actor.
Definition at line 243 of file actor_script.cpp. References NLAIAGENT::CActorScript::_IsPaused, NLAIAGENT::CActorScript::_Launched, NLAIAGENT::CActorScript::_OnRestartIndex, NLAIAGENT::IAgentManager::getAgentContext(), NLAIAGENT::CAgentScript::getAgentManager(), NLAIC::IBasicType::getType(), NLAISCRIPT::CAgentClass::isMember(), NLAIAGENT::CActorScript::onRestart(), r, NLAIAGENT::CAgentScript::runMethodeMember(), NLAISCRIPT::CCodeContext::Self, and NLAIAGENT::TQueue. Referenced by checkPause(), and NLAIAGENT::CActorScript::runMethodBase().
00244 { 00245 if ( _IsActivated ) 00246 { 00247 if ( _IsPaused ) 00248 { 00249 // Looks for the function to call when the actor is restarted 00250 static CStringVarName activate_func_name("OnRestart"); 00251 TQueue r = _AgentClass->isMember( NULL, &activate_func_name, NLAISCRIPT::CParam() ); 00252 if ( !r.empty() ) 00253 { 00254 if ( getAgentManager() != NULL ) 00255 { 00256 _OnRestartIndex = r.top().Index; 00257 NLAISCRIPT::CCodeContext *context = (NLAISCRIPT::CCodeContext *) getAgentManager()->getAgentContext(); 00258 context->Self = this; 00259 runMethodeMember( _OnRestartIndex ,context); 00260 _OnRestartIndex = -1; 00261 } 00262 } 00263 else 00264 onRestart(); 00265 _IsPaused = false; 00266 } 00267 00268 // Calls the launched actors Restart callbacks 00269 std::list<IBasicAgent *>::iterator it_l = _Launched.begin(); 00270 while ( it_l != _Launched.end() ) 00271 { 00272 CActorScript *launched = (CActorScript *) *it_l; 00273 launched->restart(); 00274 it_l++; 00275 } 00276 00277 int i; 00278 for ( i = 0; i < _NbComponents; i++ ) 00279 { 00280 if ( ((const NLAIC::CTypeOfObject &)_Components[i]->getType()) & NLAIC::CTypeOfObject::tActor ) 00281 { 00282 ( (CActorScript *) _Components[i] )->restart(); 00283 } 00284 } 00285 } 00286 } |
|
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::CActorScript. Definition at line 162 of file operator_script.cpp. References _CurrentGoal, _CyclesBeforeUpdate, _IsActivable, NLAIAGENT::CActorScript::activate(), NLAILOGIC::CGoal::addSuccessor(), calcPriority(), checkActivation(), checkPause(), execOnActivate(), getType(), NLAILOGIC::IGoal::isSelected(), linkGoalArgs(), selectGoal(), and NLAIAGENT::CActorScript::unActivate().
00163 { 00164 00165 #ifdef NL_DEBUG 00166 const char *dbg_class_name = (const char *) getType(); 00167 std::string dbg_goal; 00168 #endif 00169 00170 // Checks the goal and preconditions after a certain number of cycles (defined in the script using the UdpateEvery keyword) 00171 if ( _CyclesBeforeUpdate == 0 ) 00172 { 00173 _IsActivable = checkActivation(); 00174 _CyclesBeforeUpdate = ( (NLAISCRIPT::COperatorClass *) _AgentClass )->getUpdateEvery(); 00175 calcPriority(); 00176 } 00177 else 00178 _CyclesBeforeUpdate--; 00179 00180 if ( _IsActivable ) // If the goal exists and the preconditions are validated 00181 { 00182 if ( ! _IsActivated ) // If the operator wasn't activated before, initialises the current goal and runs the OnActivate() function 00183 { 00184 // Registers to the goal and gets the args 00185 if ( _CurrentGoal == NULL && ( (NLAISCRIPT::COperatorClass *) _AgentClass )->getGoal() != NULL ) 00186 { 00187 _CurrentGoal = selectGoal(); // Select a goal among possible ones 00188 #ifdef NL_DEBUG 00189 { 00190 // static sint untrucMerdic = 0; 00191 // nlinfo("_CurrentGoal = 0x%4x, at untrucMerdic = %d",_CurrentGoal, untrucMerdic ++); 00192 } 00193 #endif 00194 _CurrentGoal->addSuccessor( (IBasicAgent *) this ); // Adds the operator to the list of operators launched for this goal 00195 linkGoalArgs( _CurrentGoal ); // Instanciates the goal's args values into the operator's components 00196 } 00197 00198 if ( ( _CurrentGoal != NULL && _CurrentGoal->isSelected() ) || ( (NLAISCRIPT::COperatorClass *) _AgentClass )->getGoal() == NULL) 00199 { 00200 activate(); 00201 execOnActivate(); // Execs onActivate() function in the script if defined, otherwise the C++ one inherited from CActorScript. 00202 } 00203 } 00204 else 00205 checkPause(); // Check if the agent must be paused / restarted 00206 00207 // If the operator is activated and not paused, runs it (including its children), 00208 // otherwise just process messages 00209 if ( _IsActivated ) 00210 { 00211 if( !_IsPaused ) 00212 return CAgentScript::run(); 00213 else 00214 { 00215 CActorScript::processMessages(); 00216 return IObjectIA::ProcessRun; 00217 } 00218 } 00219 else 00220 CActorScript::processMessages(); 00221 } 00222 else 00223 { 00224 if ( _IsActivated == true ) // If the operator is curently activated, unactivates it 00225 { 00226 unActivate(); 00227 _CurrentGoal = NULL; 00228 } 00229 CActorScript::processMessages(); 00230 return IObjectIA::ProcessRun; 00231 } 00232 return IObjectIA::ProcessRun; 00233 } |
|
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::IAgent. Reimplemented in NLAIAGENT::CAgentManagerTimer, NLAIAGENT::CAgentWatchTimer, NLAIAGENT::CAgentClockTimer, and NLAIAGENT::CAgentOperation. Definition at line 1607 of file agent_script.cpp. References NLAIAGENT::CAgentScript::_AgentClass, NLAIAGENT::CAgentScript::_AgentManager, NLAIAGENT::IAgentManager::getAgentContext(), NLAISCRIPT::CAgentClass::getRunMethod(), NLAIAGENT::CAgentScript::runMethodeMember(), and NLAISCRIPT::CCodeContext::Self. Referenced by NLAIAGENT::CMainAgentScript::run().
01608 { 01609 01610 NLAISCRIPT::CCodeContext *context = (NLAISCRIPT::CCodeContext *)_AgentManager->getAgentContext(); 01611 context->Self = this; 01612 if(_AgentClass->getRunMethod() >= 0) runMethodeMember(_AgentClass->getRunMethod(), context); 01613 01614 return ProcessRun; 01615 } |
|
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 from NLAIAGENT::CActorScript. Definition at line 659 of file operator_script.cpp. References _Exclusive, _IsActivable, _Maintain, fid_background, fid_exclusive, fid_getPriority, fid_isActivable, fid_isPaused, fid_modeachieve, fid_modemaintain, fid_order, fid_setPriority, index, order(), params, priority(), and r.
00660 { 00661 int i = index - CActorScript::getMethodIndexSize(); 00662 00663 00664 IObjectIA::CProcessResult r; 00665 std::vector<CStringType *> handles; 00666 00667 00668 switch( i ) 00669 { 00670 case fid_modemaintain: 00671 _Maintain = true; 00672 r.ResultState = NLAIAGENT::processIdle; 00673 r.Result = NULL; 00674 return r; 00675 00676 case fid_modeachieve: 00677 _Maintain = false; 00678 r.ResultState = NLAIAGENT::processIdle; 00679 r.Result = NULL; 00680 return r; 00681 00682 case fid_isActivable: 00683 r.ResultState = NLAIAGENT::processIdle; 00684 r.Result = new NLAILOGIC::CBoolType( _IsActivable ); 00685 return r; 00686 00687 case fid_isPaused: 00688 r.ResultState = NLAIAGENT::processIdle; 00689 r.Result = new NLAILOGIC::CBoolType( _IsPaused ); 00690 return r; 00691 00692 case fid_getPriority: 00693 r.ResultState = NLAIAGENT::processIdle; 00694 r.Result = new NLAIAGENT::DigitalType( priority() ); 00695 return r; 00696 00697 case fid_setPriority: 00698 _Priority = ((NLAIAGENT::DigitalType *)((NLAIAGENT::IBaseGroupType *) params)->get())->getValue(); 00699 r.ResultState = NLAIAGENT::processIdle; 00700 r.Result = NULL; 00701 return r; 00702 00703 case fid_background: 00704 _Exclusive = false; 00705 r.ResultState = NLAIAGENT::processIdle; 00706 r.Result = NULL; 00707 return r; 00708 00709 case fid_exclusive: 00710 _Exclusive = true; 00711 r.ResultState = NLAIAGENT::processIdle; 00712 r.Result = NULL; 00713 return r; 00714 00715 case fid_order: 00716 { 00717 NLAIAGENT::IBaseGroupType *receivers = (NLAIAGENT::IBaseGroupType *) ((NLAIAGENT::IBaseGroupType *)params)->getFront(); 00718 ((NLAIAGENT::IBaseGroupType *)params)->popFront(); 00719 NLAILOGIC::IGoal *goal = (NLAILOGIC::IGoal *) ((NLAIAGENT::IBaseGroupType *)params)->getFront(); 00720 ((NLAIAGENT::IBaseGroupType *)params)->popFront(); 00721 order( receivers, goal ); 00722 return r; 00723 } 00724 00725 } 00726 return CActorScript::runMethodBase(index, params); 00727 } |
|
Reimplemented from NLAIAGENT::CActorScript. Definition at line 588 of file operator_script.cpp. References _Exclusive, _IsActivable, _Maintain, fid_achieve, fid_background, fid_exclusive, fid_getPriority, fid_isActivable, fid_isPaused, fid_modeachieve, fid_modemaintain, fid_order, fid_setPriority, NLAIAGENT::getValue(), index, order(), params, priority(), r, and setPriority().
00589 { 00590 IObjectIA::CProcessResult r; 00591 00592 switch ( index ) 00593 { 00594 case fid_modeachieve: 00595 _Maintain = false; 00596 r.ResultState = NLAIAGENT::processIdle; 00597 r.Result = NULL; 00598 return r; 00599 00600 case fid_modemaintain: 00601 _Maintain = true; 00602 r.ResultState = NLAIAGENT::processIdle; 00603 r.Result = NULL; 00604 return r; 00605 00606 case fid_isActivable: 00607 r.ResultState = NLAIAGENT::processIdle; 00608 r.Result = new NLAILOGIC::CBoolType( _IsActivable ); 00609 return r; 00610 00611 case fid_isPaused: 00612 r.ResultState = NLAIAGENT::processIdle; 00613 r.Result = new NLAILOGIC::CBoolType( _IsPaused ); 00614 return r; 00615 00616 case fid_getPriority: 00617 r.ResultState = NLAIAGENT::processIdle; 00618 r.Result = new NLAIAGENT::DigitalType( priority() ); 00619 return r; 00620 00621 case fid_setPriority: 00622 { 00623 setPriority(((NLAIAGENT::DigitalType *)((NLAIAGENT::IBaseGroupType *) params)->get())->getValue()); 00624 r.ResultState = NLAIAGENT::processIdle; 00625 r.Result = NULL; 00626 return r; 00627 } 00628 00629 case fid_background: 00630 _Exclusive = false; 00631 r.ResultState = NLAIAGENT::processIdle; 00632 r.Result = NULL; 00633 return r; 00634 00635 case fid_exclusive: 00636 _Exclusive = true; 00637 r.ResultState = NLAIAGENT::processIdle; 00638 r.Result = NULL; 00639 return r; 00640 00641 case fid_achieve: 00642 r.ResultState = NLAIAGENT::processIdle; 00643 r.Result = NULL; 00644 return r; 00645 00646 case fid_order: 00647 { 00648 NLAIAGENT::IBaseGroupType *receivers = (NLAIAGENT::IBaseGroupType *) ((NLAIAGENT::IBaseGroupType *)params)->getFront(); 00649 ((NLAIAGENT::IBaseGroupType *)params)->popFront(); 00650 NLAILOGIC::IGoal *goal = (NLAILOGIC::IGoal *) ((NLAIAGENT::IBaseGroupType *)params)->getFront(); 00651 ((NLAIAGENT::IBaseGroupType *)params)->popFront(); 00652 order( receivers, goal ); 00653 return r; 00654 } 00655 } 00656 return r; 00657 } |
|
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 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 from NLAIAGENT::IBasicAgent. Definition at line 1020 of file actor_script.cpp. References NLAIAGENT::IMessageBase::getMessageGroup(), and NLAIAGENT::CActorScript::processSuccess().
01021 { 01022 processSuccess( (NLAIAGENT::IObjectIA *) m.getMessageGroup() ); 01023 return new NLAIAGENT::CSuccessMsg(); 01024 } |
|
|
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::CActorScript. Definition at line 149 of file operator_script.cpp.
00150 {
00151 CAgentScript::save(os);
00152 // TODO
00153 }
|
|
Selects a goal among the ones the operator can process.
Definition at line 285 of file operator_script.cpp. References _ActivatedGoals. Referenced by run().
00286 { 00287 if ( !_ActivatedGoals.empty() ) 00288 { 00289 // TODO: instantiate each goal's variables and compute priority. 00290 // then select the highest priority goal. 00291 return _ActivatedGoals.front(); 00292 } 00293 00294 else 00295 return NULL; 00296 } |
|
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::CAgentScript. Definition at line 390 of file actor_script.cpp. References NLAIAGENT::CAgentScript::sendMessage().
00391 {
00392 return CAgentScript::sendMessage(m);
00393 }
|
|
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 } |
|
Definition at line 888 of file operator_script.cpp. References _BasePriority. Referenced by NLAISCRIPT::COperatorClass::buildNewInstance(), and runMethodBase().
00889 { 00890 _BasePriority = prio; 00891 } |
|
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 checkTrigMsg(), 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 from NLAIAGENT::CAgentScript. Reimplemented in NLAIAGENT::CFsmScript. Definition at line 932 of file actor_script.cpp. References NLAIAGENT::CActorScript::_TopLevel, NLAIAGENT::IObjectIA::isClassInheritedFrom(), and NLAIAGENT::CAgentScript::setTopLevel().
00933 { 00934 _TopLevel = tl; 00935 00936 for (int i = 0; i < _NbComponents; i++ ) 00937 { 00938 if ( _Components[i]->isClassInheritedFrom( NLAIAGENT::CStringVarName("Actor") ) != -1 ) 00939 { 00940 if ( _TopLevel ) 00941 ( (CActorScript *)_Components[i] )->setTopLevel( _TopLevel ); 00942 else 00943 ( (CActorScript *)_Components[i] )->setTopLevel( this ); 00944 } 00945 } 00946 } |
|
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 } |
|
|
Transfers activity to another actor. The second arg bool must be set to true for this agent to stay active, false otherwise. Definition at line 323 of file actor_script.cpp. References NLAIAGENT::CActorScript::activate(), nlwarning, and NLAIAGENT::CActorScript::unActivate().
00324 { 00325 std::vector<CComponentHandle *>::iterator it_handle = handles.begin(); 00326 while ( it_handle != handles.end() ) 00327 { 00328 CActorScript *actor = (CActorScript *)( *it_handle )->getValue(); 00329 if ( actor != NULL ) 00330 actor->activate(); 00331 else 00332 { 00333 const char *sw_name = (*it_handle)->getCompName()->getString(); 00334 nlwarning("SWITCH: component %s not found.", sw_name); 00335 } 00336 it_handle++; 00337 } 00338 // TODO: Envoi de message "activate" 00339 if ( !stay_active ) 00340 unActivate(); 00341 } |
|
Transfers activity to another actor. The second arg bool must be set to true for this agent to stay active, false otherwise. Definition at line 306 of file actor_script.cpp. References NLAIAGENT::CActorScript::unActivate().
00307 { 00308 std::vector<CActorScript *>::iterator it_act = actors.begin(); 00309 while ( it_act != actors.end() ) 00310 { 00311 ( *it_act )->activate(); 00312 it_act++; 00313 } 00314 00315 // TODO: Envoi de message "activate" 00316 if ( !stay_active ) 00317 unActivate(); 00318 } |
|
Transfers activity to another actor. The second arg bool must be set to true for this agent to stay active, false otherwise. Definition at line 295 of file actor_script.cpp. References NLAIAGENT::CActorScript::activate(), and NLAIAGENT::CActorScript::unActivate(). Referenced by NLAIAGENT::CActorScript::runMethodBase().
00296 { 00297 receiver->activate(); 00298 00299 if ( !stay_active && ( receiver != this ) ) 00300 unActivate(); 00301 } |
|
|
Definition at line 533 of file operator_script.cpp. References NLAILOGIC::CValueSet::unify(). Referenced by propagate().
00534 { 00535 NLAILOGIC::CValueSet *result; 00536 00537 if ( (result = fp->unify( vals, pos_vals )) ) 00538 return result; 00539 else 00540 { 00541 return NULL; 00542 } 00543 } |
|
Definition at line 69 of file operator_script.h. Referenced by checkActivation(), lookForGoals(), and selectGoal(). |
|
Definition at line 92 of file actor_script.h. |
|
|
|
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 74 of file operator_script.h. Referenced by calcPriority(), COperatorScript(), and setPriority(). |
|
|
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(). |
|
Definition at line 67 of file operator_script.h. Referenced by cancel(), checkActivation(), checkPause(), COperatorScript(), onFailure(), onSuccess(), and run(). |
|
Definition at line 68 of file operator_script.h. Referenced by COperatorScript(), and run(). |
|
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 71 of file operator_script.h. Referenced by COperatorScript(), isExclusive(), and runMethodBase(). |
|
Definition at line 66 of file operator_script.h. |
|
Definition at line 179 of file agent_script.h. Referenced by NLAIAGENT::CAgentScript::CAgentScript(), and NLAIAGENT::CAgentScript::runChildrenStepByStep(). |
|
Definition at line 70 of file operator_script.h. Referenced by calcPriority(), COperatorScript(), run(), and runMethodBase(). |
|
Definition at line 76 of file actor_script.h. Referenced by NLAIAGENT::CActorScript::CActorScript(). |
|
Definition at line 78 of file actor_script.h. Referenced by NLAIAGENT::CActorScript::CActorScript(), NLAIAGENT::CActorScript::pause(), NLAIAGENT::CActorScript::restart(), and NLAIAGENT::CActorScript::unActivate(). |
|
Definition at line 94 of file actor_script.h. Referenced by NLAIAGENT::CActorScript::Launch(), NLAIAGENT::CActorScript::pause(), NLAIAGENT::CActorScript::restart(), NLAIAGENT::CActorScript::runMethodBase(), NLAIAGENT::CActorScript::unActivate(), and NLAIAGENT::CActorScript::~CActorScript(). |
|
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(). |
|
Definition at line 72 of file operator_script.h. Referenced by checkActivation(), COperatorScript(), and runMethodBase(). |
|
Definition at line 88 of file actor_script.h. Referenced by NLAIAGENT::CActorScript::CActorScript(), NLAIAGENT::CActorScript::Launch(), and NLAIAGENT::CActorScript::runMethodBase(). |
|
|
Definition at line 77 of file actor_script.h. |
|
Definition at line 81 of file actor_script.h. Referenced by NLAIAGENT::CActorScript::activate(), NLAIAGENT::CActorScript::CActorScript(), NLAIAGENT::CActorScript::run(), and NLAIAGENT::CActorScript::unActivate(). |
|
Definition at line 86 of file actor_script.h. Referenced by NLAIAGENT::CActorScript::failure(). |
|
Definition at line 83 of file actor_script.h. Referenced by NLAIAGENT::CActorScript::pause(). |
|
Definition at line 84 of file actor_script.h. Referenced by NLAIAGENT::CActorScript::restart(). |
|
Definition at line 85 of file actor_script.h. Referenced by NLAIAGENT::CActorScript::success(). |
|
Definition at line 82 of file actor_script.h. Referenced by NLAIAGENT::CActorScript::CActorScript(), and NLAIAGENT::CActorScript::unActivate(). |
|
Definition at line 73 of file operator_script.h. |
|
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 96 of file actor_script.h. Referenced by NLAIAGENT::CActorScript::CActorScript(), NLAIAGENT::CActorScript::getTopLevel(), NLAIAGENT::CActorScript::Launch(), and NLAIAGENT::CActorScript::setTopLevel(). |
|
Definition at line 65 of file operator_script.h. |
|
Referenced by NLAIAGENT::CActorScript::getType(). |
|
Definition at line 77 of file static_def_init.cpp. Referenced by NLAIAGENT::IAgent::getType(). |
|
Referenced by NLAIAGENT::CAgentScript::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(). |
|
Referenced by getType(). |
|
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 48 of file actor_script.cpp. Referenced by NLAIAGENT::CActorScript::getPrivateMember(). |
|
Definition at line 71 of file agent_script.cpp. Referenced by NLAIAGENT::CAgentScript::initAgentScript(). |
|
Definition at line 47 of file actor_script.cpp. Referenced by NLAIAGENT::CActorScript::initClass(). |
|
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 45 of file actor_script.cpp. Referenced by NLAIAGENT::CActorScript::initClass(). |
|
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 46 of file actor_script.cpp. Referenced by NLAIAGENT::CActorScript::getPrivateMember(). |
|
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 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. |