diff options
Diffstat (limited to 'docs/doxygen/nel/goal_8cpp-source.html')
-rw-r--r-- | docs/doxygen/nel/goal_8cpp-source.html | 973 |
1 files changed, 973 insertions, 0 deletions
diff --git a/docs/doxygen/nel/goal_8cpp-source.html b/docs/doxygen/nel/goal_8cpp-source.html new file mode 100644 index 00000000..23284ace --- /dev/null +++ b/docs/doxygen/nel/goal_8cpp-source.html @@ -0,0 +1,973 @@ +<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + <TITLE>nevrax.org : docs</TITLE> + <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css"> + <link href="doxygen.css" rel="stylesheet" type="text/css"> +</HEAD> +<BODY MARGINHEIGHT="0" MARGINWIDTH="0"> + +<!-- uplinks --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </TD> + </TR> +</TABLE> + +<!-- banner Nevrax --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%> + <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR> +</TABLE> + +<!-- main table --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + + <!------ Begin Box ------> + <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black> + <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF> + <TABLE cellspacing=0 cellpadding=1 border=0> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr> + </TABLE> + </TD></TR></TABLE></TD></TR></TABLE> + <!------ End Box ------> + + </TD> + <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + +<!-- title --> +<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td> +<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A> +</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""> +</td></tr></table> + + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>Documentation</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<!-- Generated by Doxygen 1.2.14 --> +<center> +<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> </center> +<hr><h1>goal.cpp</h1><a href="goal_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="preprocessor">#include "<a class="code" href="goal_8h.html">nel/ai/logic/goal.h</a>"</font> +00002 <font class="preprocessor">#include "<a class="code" href="var_8h.html">nel/ai/logic/var.h</a>"</font> +00003 <font class="preprocessor">#include "<a class="code" href="object__type_8h.html">nel/ai/agent/object_type.h</a>"</font> +00004 <font class="preprocessor">#include "<a class="code" href="operator__script_8h.html">nel/ai/logic/operator_script.h</a>"</font> +00005 <font class="preprocessor">#include "<a class="code" href="msg__action_8h.html">nel/ai/agent/msg_action.h</a>"</font> +00006 +00007 <font class="keyword">namespace </font>NLAILOGIC +00008 { +00009 +00010 +<a name="l00011"></a><a class="code" href="classNLAILOGIC_1_1IGoal.html#a0">00011</a> IGoal::IGoal() : IBaseBoolType() +00012 { +00013 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n0">_Name</a> = NULL; +00014 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n7">_Sender</a> = NULL; +00015 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n8">_Receiver</a> = NULL; +00016 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n5">_Selected</a> = <font class="keyword">false</font>; +00017 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n4">_Mode</a> = <a class="code" href="classNLAILOGIC_1_1IGoal.html#s5s0">achieveOnce</a>; +00018 } +00019 +<a name="l00020"></a><a class="code" href="classNLAILOGIC_1_1IGoal.html#a1">00020</a> IGoal::IGoal(<font class="keyword">const</font> <a class="code" href="classNLAIAGENT_1_1IVarName.html">NLAIAGENT::IVarName</a> &name, TTypeOfGoal mode) : IBaseBoolType() +00021 { +00022 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n0">_Name</a> = (<a class="code" href="classNLAIAGENT_1_1IVarName.html">NLAIAGENT::IVarName</a> *) name.<a class="code" href="classNLAIC_1_1IBasicType.html#a3">clone</a>(); +00023 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n7">_Sender</a> = NULL; +00024 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n8">_Receiver</a> = NULL; +00025 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n4">_Mode</a> = mode; +00026 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n5">_Selected</a> = <font class="keyword">false</font>; +00027 } +00028 +<a name="l00029"></a><a class="code" href="classNLAILOGIC_1_1IGoal.html#a2">00029</a> IGoal::IGoal(<font class="keyword">const</font> <a class="code" href="classNLAIAGENT_1_1IVarName.html">NLAIAGENT::IVarName</a> &name, <a class="code" href="classstd_1_1list.html">std::list<const NLAIAGENT::IObjectIA *></a> &args, TTypeOfGoal mode) +00030 { +00031 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n0">_Name</a> = (<a class="code" href="classNLAIAGENT_1_1IVarName.html">NLAIAGENT::IVarName</a> *) name.<a class="code" href="classNLAIC_1_1IBasicType.html#a3">clone</a>(); +00032 <font class="keywordflow">while</font> ( !args.empty() ) +00033 { +00034 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>.push_back( (<a class="code" href="classNLAIAGENT_1_1IObjectIA.html">NLAIAGENT::IObjectIA</a> *) args.front()->clone() ); +00035 args.pop_front(); +00036 } +00037 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n7">_Sender</a> = NULL; +00038 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n8">_Receiver</a> = NULL; +00039 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n4">_Mode</a> = mode; +00040 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n5">_Selected</a> = <font class="keyword">false</font>; +00041 } +00042 +<a name="l00043"></a><a class="code" href="classNLAILOGIC_1_1IGoal.html#a3">00043</a> IGoal::IGoal(<font class="keyword">const</font> IGoal &c) : IBaseBoolType() +00044 { +00045 <font class="keywordflow">if</font> ( c._Name ) +00046 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n0">_Name</a> = (<a class="code" href="classNLAIAGENT_1_1IVarName.html">NLAIAGENT::IVarName</a> *) c._Name-><a class="code" href="classNLAIC_1_1IBasicType.html#a3">clone</a>(); +00047 <font class="keywordflow">else</font> +00048 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n0">_Name</a> = NULL; +00049 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n7">_Sender</a> =c._Sender; +00050 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n8">_Receiver</a> = c._Receiver; +00051 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n4">_Mode</a> = c._Mode; +00052 +00053 <font class="keywordflow">for</font> ( <font class="keywordtype">int</font> i = 0; i < (int) c._Args.size(); i++ ) +00054 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>.push_back( (<a class="code" href="classNLAIAGENT_1_1IObjectIA.html">NLAIAGENT::IObjectIA</a> *) c._Args[i]->clone() ); +00055 +00056 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n5">_Selected</a> = c._Selected; +00057 } +00058 +<a name="l00059"></a><a class="code" href="classNLAILOGIC_1_1IGoal.html#a4">00059</a> IGoal::~IGoal() +00060 { +00061 <font class="keywordflow">if</font> ( _Name ) +00062 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n0">_Name</a>-><a class="code" href="classNLAIC_1_1IPointerGestion.html#a3">release</a>(); +00063 +00064 <font class="keywordtype">int</font> i; +00065 <font class="keywordflow">for</font> ( i = 0; i < (int) <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>.size(); i++ ) +00066 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>[i]->release(); +00067 +00068 std::vector<NLAIAGENT::IBasicAgent *>::iterator it_s = <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.begin(); +00069 <font class="keywordflow">while</font> ( it_s != <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.end() ) +00070 { +00071 (*it_s ++)->release(); +00072 } +00073 } +00074 +00075 +<a name="l00076"></a><a class="code" href="classNLAILOGIC_1_1IGoal.html#a19">00076</a> <font class="keywordtype">void</font> IGoal::setSender(<a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>) +00077 { +00078 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n7">_Sender</a> = s; +00079 } +00080 +<a name="l00081"></a><a class="code" href="classNLAILOGIC_1_1IGoal.html#a20">00081</a> <font class="keywordtype">void</font> IGoal::setReceiver(<a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>) +00082 { +00083 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n8">_Receiver</a> = r; +00084 } +00085 +<a name="l00086"></a><a class="code" href="classNLAILOGIC_1_1IGoal.html#a21">00086</a> <a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *IGoal::getSender() +00087 { +00088 <font class="keywordflow">return</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#n7">_Sender</a>; +00089 } +00090 +<a name="l00091"></a><a class="code" href="classNLAILOGIC_1_1IGoal.html#a22">00091</a> <a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *IGoal::getReceiver() +00092 { +00093 <font class="keywordflow">return</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#n8">_Receiver</a>; +00094 } +00095 +<a name="l00096"></a><a class="code" href="classNLAILOGIC_1_1IGoal.html#a11">00096</a> <font class="keywordtype">void</font> IGoal::failure() +00097 { +00098 <font class="keywordflow">if</font> ( <a class="code" href="classNLAILOGIC_1_1IGoal.html#n7">_Sender</a> != NULL ) +00099 { +00100 <a class="code" href="classNLAIAGENT_1_1IMessageBase.html">NLAIAGENT::IMessageBase</a> *msg = <font class="keyword">new</font> <a class="code" href="classNLAIAGENT_1_1CSuccessMsg.html">NLAIAGENT::CSuccessMsg</a>((<a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *)NULL); +00101 msg-><a class="code" href="classNLAIAGENT_1_1IMessageBase.html#a9">setPerformatif</a>(<a class="code" href="classNLAIAGENT_1_1IMessageBase.html#s10s5">NLAIAGENT::IMessageBase::PTell</a>); +00102 msg-><a class="code" href="classNLAIAGENT_1_1IMessageBase.html#z165_0">setSender</a>( <font class="keyword">this</font> ); +00103 msg-><a class="code" href="classNLAIAGENT_1_1IMessageBase.html#z165_1">setReceiver</a>( <a class="code" href="classNLAILOGIC_1_1IGoal.html#n7">_Sender</a>); +00104 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n7">_Sender</a>-><a class="code" href="classNLAIAGENT_1_1IBasicAgent.html#a5">sendMessage</a>(msg); +00105 } +00106 } +00107 +<a name="l00108"></a><a class="code" href="classNLAILOGIC_1_1IGoal.html#a12">00108</a> <font class="keywordtype">void</font> IGoal::success() +00109 { +00110 +00111 <font class="keywordflow">if</font> ( <a class="code" href="classNLAILOGIC_1_1IGoal.html#n7">_Sender</a> != NULL ) +00112 { +00113 <a class="code" href="classNLAIAGENT_1_1IMessageBase.html">NLAIAGENT::IMessageBase</a> *msg = <font class="keyword">new</font> <a class="code" href="classNLAIAGENT_1_1CSuccessMsg.html">NLAIAGENT::CSuccessMsg</a>((<a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *)NULL); +00114 msg-><a class="code" href="classNLAIAGENT_1_1IMessageBase.html#a9">setPerformatif</a>(<a class="code" href="classNLAIAGENT_1_1IMessageBase.html#s10s5">NLAIAGENT::IMessageBase::PTell</a>); +00115 msg-><a class="code" href="classNLAIAGENT_1_1IMessageBase.html#z165_0">setSender</a>( <font class="keyword">this</font> ); +00116 msg-><a class="code" href="classNLAIAGENT_1_1IMessageBase.html#z165_1">setReceiver</a>( <a class="code" href="classNLAILOGIC_1_1IGoal.html#n7">_Sender</a> ); +00117 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n7">_Sender</a>-><a class="code" href="classNLAIAGENT_1_1IBasicAgent.html#a5">sendMessage</a>(msg); +00118 } +00119 } +00120 +<a name="l00121"></a><a class="code" href="classNLAILOGIC_1_1IGoal.html#a13">00121</a> <font class="keywordtype">void</font> IGoal::operatorSuccess(<a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *op) +00122 { +00123 <a class="code" href="classNLAILOGIC_1_1IGoal.html#a12">success</a>(); +00124 <font class="comment">// nlinfo("operatorSuccess: 0x%0x, %d, (0x%0x, %s)", this, _Successors.size(),op,(const char *)op->getType());</font> +00125 std::vector<NLAIAGENT::IBasicAgent *>::iterator it_s = <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.begin(); +00126 <font class="keywordflow">while</font> ( it_s != <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.end() ) +00127 { +00128 <font class="comment">/*</font> +00129 <font class="comment"> nlinfo("\t0x%0x",*it_s);</font> +00130 <font class="comment"> nlinfo("\t\t%s", (const char *)(*it_s)->getType());</font> +00131 <font class="comment">*/</font> +00132 <font class="keywordflow">if</font> ( (**it_s) == *op ) +00133 { +00134 (*it_s)->release(); +00135 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.erase( it_s ); +00136 <font class="keywordflow">break</font>; +00137 } +00138 it_s++; +00139 } +00140 +00141 <font class="keywordflow">switch</font> ( _Mode ) +00142 { +00143 <font class="keywordflow">case</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#s5s0">achieveOnce</a>: +00144 ( (<a class="code" href="classNLAIAGENT_1_1CAgentScript.html">NLAIAGENT::CAgentScript</a> *) <a class="code" href="classNLAILOGIC_1_1IGoal.html#n8">_Receiver</a>)->removeGoal( (<a class="code" href="classNLAILOGIC_1_1CGoal.html">NLAILOGIC::CGoal</a> *) <font class="keyword">this</font> ); +00145 <font class="keywordflow">break</font>; +00146 +00147 <font class="keywordflow">case</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#s5s1">achieveForever</a>: +00148 <font class="keywordflow">break</font>; +00149 } +00150 +00151 } +00152 +<a name="l00153"></a><a class="code" href="classNLAILOGIC_1_1IGoal.html#a14">00153</a> <font class="keywordtype">void</font> IGoal::operatorFailure(<a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *op) +00154 { +00155 <a class="code" href="classNLAILOGIC_1_1IGoal.html#a11">failure</a>(); +00156 std::vector<NLAIAGENT::IBasicAgent *>::iterator it_s = <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.begin(); +00157 <font class="keywordflow">while</font> ( it_s != <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.end() ) +00158 { +00159 <font class="keywordflow">if</font> ( (**it_s) == *op ) +00160 { +00161 (*it_s)->release(); +00162 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.erase( it_s ); +00163 <font class="keywordflow">break</font>; +00164 } +00165 it_s++; +00166 } +00167 +00168 <font class="keywordflow">switch</font> ( _Mode ) +00169 { +00170 <font class="keywordflow">case</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#s5s0">achieveOnce</a>: +00171 ( (<a class="code" href="classNLAIAGENT_1_1CAgentScript.html">NLAIAGENT::CAgentScript</a> *) <a class="code" href="classNLAILOGIC_1_1IGoal.html#n8">_Receiver</a> )->removeGoal( (<a class="code" href="classNLAILOGIC_1_1CGoal.html">NLAILOGIC::CGoal</a> *) <font class="keyword">this</font> ); +00172 <font class="keywordflow">break</font>; +00173 +00174 <font class="keywordflow">case</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#s5s1">achieveForever</a>: +00175 <font class="keywordflow">break</font>; +00176 } +00177 } +00178 +<a name="l00179"></a><a class="code" href="classNLAILOGIC_1_1IGoal.html#a15">00179</a> <font class="keywordtype">bool</font> IGoal::isExclusive() +00180 { +00181 <font class="keywordflow">if</font> ( <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.empty() ) +00182 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00183 <font class="keywordflow">else</font> +00184 <font class="keywordflow">return</font> ( (<a class="code" href="classNLAIAGENT_1_1COperatorScript.html">NLAIAGENT::COperatorScript</a> *)<a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.front())->isExclusive(); +00185 } +00186 +<a name="l00187"></a><a class="code" href="classNLAILOGIC_1_1IGoal.html#a16">00187</a> <font class="keywordtype">void</font> IGoal::setPriority(<font class="keywordtype">float</font> p) +00188 { +00189 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n6">_Priority</a> = p; +00190 } +00191 +<a name="l00192"></a><a class="code" href="classNLAILOGIC_1_1IGoal.html#a17">00192</a> <font class="keywordtype">void</font> IGoal::calcPriority() +00193 { +00194 } +00195 +<a name="l00196"></a><a class="code" href="classNLAILOGIC_1_1IGoal.html#a18">00196</a> <font class="keywordtype">float</font> IGoal::getPriority() +00197 { +00198 <font class="keywordflow">return</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#n6">_Priority</a>; +00199 } +00200 +00201 +00204 +<a name="l00205"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a0">00205</a> CGoal::CGoal() : IGoal() +00206 { +00207 } +00208 +<a name="l00209"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a1">00209</a> CGoal::CGoal(<font class="keyword">const</font> <a class="code" href="classNLAIAGENT_1_1IVarName.html">NLAIAGENT::IVarName</a> &name, TTypeOfGoal mode) : IGoal(name, mode) +00210 { +00211 } +00212 +<a name="l00213"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a2">00213</a> CGoal::CGoal(<font class="keyword">const</font> <a class="code" href="classNLAIAGENT_1_1IVarName.html">NLAIAGENT::IVarName</a> &name, <a class="code" href="classstd_1_1list.html">std::list<const NLAIAGENT::IObjectIA *></a> &args, TTypeOfGoal mode) : IGoal(name, args, mode) +00214 { +00215 } +00216 +<a name="l00217"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a3">00217</a> CGoal::CGoal(<font class="keyword">const</font> CGoal &c) : IGoal( c ) +00218 { +00219 } +00220 +<a name="l00221"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a4">00221</a> CGoal::~CGoal() +00222 { +00223 } +00224 +<a name="l00225"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a9">00225</a> <font class="keywordtype">void</font> CGoal::operatorSuccess(<a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *op) +00226 { +00227 <a class="code" href="classNLAILOGIC_1_1IGoal.html#a12">success</a>(); +00228 <font class="comment">// nlinfo("operatorSuccess: 0x%0x, %d, (0x%0x, %s)", this, _Successors.size(),op,(const char *)op->getType());</font> +00229 std::vector<NLAIAGENT::IBasicAgent *>::iterator it_s = <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.begin(); +00230 <font class="keywordflow">while</font> ( it_s != <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.end() ) +00231 { +00232 <font class="comment">/*</font> +00233 <font class="comment"> nlinfo("\t0x%0x",*it_s);</font> +00234 <font class="comment"> nlinfo("\t\t%s", (const char *)(*it_s)->getType());</font> +00235 <font class="comment">*/</font> +00236 <font class="keywordflow">if</font> ( (**it_s) == *op ) +00237 { +00238 (*it_s)->release(); +00239 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.erase( it_s ); +00240 <font class="keywordflow">break</font>; +00241 } +00242 it_s++; +00243 } +00244 +00245 <font class="keywordflow">switch</font> ( _Mode ) +00246 { +00247 <font class="keywordflow">case</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#s5s0">achieveOnce</a>: +00248 { +00249 <a class="code" href="classNLAIAGENT_1_1CAgentScript.html">NLAIAGENT::CAgentScript</a> *dest = (<a class="code" href="classNLAIAGENT_1_1CAgentScript.html">NLAIAGENT::CAgentScript</a> *) <a class="code" href="classNLAILOGIC_1_1IGoal.html#n8">_Receiver</a>; +00250 dest-><a class="code" href="classNLAIAGENT_1_1CAgentScript.html#a13">removeGoal</a>( <font class="keyword">this</font> ); +00251 } +00252 <font class="keywordflow">break</font>; +00253 +00254 <font class="keywordflow">case</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#s5s1">achieveForever</a>: +00255 <font class="keywordflow">break</font>; +00256 } +00257 +00258 } +00259 +<a name="l00260"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a10">00260</a> <font class="keywordtype">void</font> CGoal::operatorFailure(<a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *op) +00261 { +00262 <a class="code" href="classNLAILOGIC_1_1IGoal.html#a11">failure</a>(); +00263 std::vector<NLAIAGENT::IBasicAgent *>::iterator it_s = <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.begin(); +00264 <font class="keywordflow">while</font> ( it_s != <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.end() ) +00265 { +00266 <font class="keywordflow">if</font> ( (**it_s) == *op ) +00267 { +00268 (*it_s)->release(); +00269 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.erase( it_s ); +00270 <font class="keywordflow">break</font>; +00271 } +00272 it_s++; +00273 } +00274 +00275 <font class="keywordflow">switch</font> ( _Mode ) +00276 { +00277 <font class="keywordflow">case</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#s5s0">achieveOnce</a>: +00278 ( (<a class="code" href="classNLAIAGENT_1_1CAgentScript.html">NLAIAGENT::CAgentScript</a> *) <a class="code" href="classNLAILOGIC_1_1IGoal.html#n8">_Receiver</a> )->removeGoal( <font class="keyword">this</font> ); +00279 <font class="keywordflow">break</font>; +00280 +00281 <font class="keywordflow">case</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#s5s1">achieveForever</a>: +00282 <font class="keywordflow">break</font>; +00283 } +00284 } +00285 +<a name="l00286"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a12">00286</a> <font class="keyword">const</font> <a class="code" href="classNLAIC_1_1IBasicType.html">NLAIC::IBasicType</a> *CGoal::clone()<font class="keyword"> const</font> +00287 <font class="keyword"> </font>{ +00288 <a class="code" href="classNLAIC_1_1IBasicInterface.html">NLAIC::IBasicInterface</a> *m = <font class="keyword">new</font> <a class="code" href="classNLAILOGIC_1_1CGoal.html#a0">CGoal</a>( *<font class="keyword">this</font> ); +00289 <font class="keywordflow">return</font> m; +00290 } +00291 +<a name="l00292"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a13">00292</a> <font class="keyword">const</font> <a class="code" href="classNLAIC_1_1IBasicType.html">NLAIC::IBasicType</a> *CGoal::newInstance()<font class="keyword"> const</font> +00293 <font class="keyword"> </font>{ +00294 <font class="keywordflow">return</font> <a class="code" href="classNLAILOGIC_1_1CGoal.html#a12">clone</a>(); +00295 } +00296 +00297 +<a name="l00298"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a14">00298</a> <font class="keywordtype">void</font> CGoal::save(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &os) +00299 { +00300 } +00301 +<a name="l00302"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a15">00302</a> <font class="keywordtype">void</font> CGoal::load(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &is) +00303 { +00304 IObjectIA::load( is ); +00305 } +00306 +<a name="l00307"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a16">00307</a> <font class="keywordtype">void</font> CGoal::getDebugString(std::string &text)<font class="keyword"> const</font> +00308 <font class="keyword"> </font>{ +00309 text += <font class="stringliteral">"<CGoal> ("</font>; +00310 <font class="keywordflow">if</font> ( _Name ) +00311 text += <a class="code" href="classNLAILOGIC_1_1IGoal.html#n0">_Name</a>-><a class="code" href="classNLAIAGENT_1_1IVarName.html#a1">getString</a>(); +00312 std::string buf; +00313 <font class="keywordtype">int</font> i; +00314 <font class="keywordflow">for</font> ( i = 0; i < (int) <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>.size(); i++ ) +00315 { +00316 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>[i]->getDebugString(buf); +00317 text += <font class="stringliteral">" "</font>; +00318 text += buf; +00319 } +00320 text += <font class="stringliteral">") - "</font>; +00321 +00322 text += <a class="code" href="namespaceNLAIC.html#a5">NLAIC::stringGetBuild</a>(<font class="stringliteral">" PRI = %f"</font>, <a class="code" href="classNLAILOGIC_1_1CGoal.html#a26">priority</a>() ); +00323 text += <font class="stringliteral">" PRE = "</font>; +00324 +00325 <font class="keywordflow">for</font> ( i = 0; i < (int) <a class="code" href="classNLAILOGIC_1_1IGoal.html#n2">_Predecessors</a>.size(); i++ ) +00326 { +00327 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n2">_Predecessors</a>[i]->getDebugString( buf ); +00328 text += buf; +00329 } +00330 text += <font class="stringliteral">" POST = "</font>; +00331 <font class="keywordflow">for</font> ( i = 0; i < (int) <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.size(); i++ ) +00332 { +00333 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>[i]->getDebugString( buf ); +00334 text += buf; +00335 } +00336 } +00337 +<a name="l00338"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a17">00338</a> <font class="keywordtype">bool</font> CGoal::isTrue()<font class="keyword"> const</font> +00339 <font class="keyword"> </font>{ +00340 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00341 } +00342 +<a name="l00343"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a18">00343</a> <font class="keywordtype">float</font> CGoal::truthValue()<font class="keyword"> const</font> +00344 <font class="keyword"> </font>{ +00345 <font class="keywordflow">return</font> 1.0; +00346 } +00347 +<a name="l00348"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a19">00348</a> <font class="keyword">const</font> <a class="code" href="structNLAIAGENT_1_1IObjectIA_1_1CProcessResult.html">NLAIAGENT::IObjectIA::CProcessResult</a> &CGoal::run() +00349 { +00350 <font class="keywordflow">return</font> IObjectIA::ProcessRun; +00351 } +00352 +<a name="l00353"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a20">00353</a> <font class="keywordtype">bool</font> <a class="code" href="chain_8cpp.html#a2">CGoal::isEqual</a>(<font class="keyword">const</font> CGoal &a)<font class="keyword"> const</font> +00354 <font class="keyword"> </font>{ +00355 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00356 } +00357 +<a name="l00358"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a21">00358</a> <font class="keywordtype">bool</font> <a class="code" href="chain_8cpp.html#a2">CGoal::isEqual</a>(<font class="keyword">const</font> <a class="code" href="classNLAIAGENT_1_1IBasicObjectIA.html">NLAIAGENT::IBasicObjectIA</a> &a)<font class="keyword"> const</font> +00359 <font class="keyword"> </font>{ +00360 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00361 } +00362 +<a name="l00363"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a6">00363</a> <font class="keyword">const</font> std::vector<NLAIAGENT::IObjectIA *> &CGoal::getArgs() +00364 { +00365 <font class="keywordflow">return</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>; +00366 } +00367 +<a name="l00368"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a22">00368</a> <font class="keyword">const</font> <a class="code" href="classNLAIC_1_1CIdentType.html">NLAIC::CIdentType</a> &CGoal::getType()<font class="keyword"> const</font> +00369 <font class="keyword"> </font>{ +00370 <font class="keywordflow">return</font> <a class="code" href="classNLAILOGIC_1_1CGoal.html#p0">IdGoal</a>; +00371 } +00372 +<a name="l00373"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a5">00373</a> <font class="keywordtype">void</font> CGoal::setArgs(<a class="code" href="classstd_1_1list.html">std::list<NLAIAGENT::IObjectIA *></a> &args) +00374 { +00375 <a class="code" href="classstd_1_1list.html">std::list<NLAIAGENT::IObjectIA *></a>::iterator it_var = args.begin(); +00376 <font class="keywordflow">while</font> ( it_var != args.end() ) +00377 { +00378 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>.push_back( (<a class="code" href="classNLAIAGENT_1_1IObjectIA.html">NLAIAGENT::IObjectIA</a> *) (*it_var)->clone() ); +00379 it_var++; +00380 } +00381 } +00382 +<a name="l00383"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a23">00383</a> NLAIAGENT::tQueue CGoal::isMember(<font class="keyword">const</font> <a class="code" href="classNLAIAGENT_1_1IVarName.html">NLAIAGENT::IVarName</a> *className,<font class="keyword">const</font> <a class="code" href="classNLAIAGENT_1_1IVarName.html">NLAIAGENT::IVarName</a> *funcName,<font class="keyword">const</font> <a class="code" href="classNLAIAGENT_1_1IObjectIA.html">NLAIAGENT::IObjectIA</a> &<a class="code" href="driver__opengl__extension__def_8h.html#a357">params</a>)<font class="keyword"> const</font> +00384 <font class="keyword"> </font>{ +00385 +00386 <font class="preprocessor">#ifdef NL_DEBUG </font> +00387 <font class="preprocessor"></font> std::string nameP; +00388 std::string nameM; +00389 funcName-><a class="code" href="classNLAIC_1_1IBasicType.html#a5">getDebugString</a>(nameM); +00390 params.<a class="code" href="classNLAIC_1_1IBasicType.html#a5">getDebugString</a>(nameP); +00391 <font class="keyword">const</font> <font class="keywordtype">char</font> *dbg_class_name = (<font class="keyword">const</font> <font class="keywordtype">char</font> *) <a class="code" href="classNLAILOGIC_1_1CGoal.html#a22">getType</a>(); +00392 <font class="preprocessor">#endif</font> +00393 <font class="preprocessor"></font> <font class="keyword">static</font> <a class="code" href="classNLAIAGENT_1_1CStringVarName.html">NLAIAGENT::CStringVarName</a> constructor_name(<font class="stringliteral">"Constructor"</font>); +00394 <font class="keyword">static</font> <a class="code" href="classNLAIAGENT_1_1CStringVarName.html">NLAIAGENT::CStringVarName</a> mode_once_name(<font class="stringliteral">"SetModeOnce"</font>); +00395 <font class="keyword">static</font> <a class="code" href="classNLAIAGENT_1_1CStringVarName.html">NLAIAGENT::CStringVarName</a> mode_repeat_name(<font class="stringliteral">"SetModeRepeat"</font>); +00396 <font class="keyword">static</font> <a class="code" href="classNLAIAGENT_1_1CStringVarName.html">NLAIAGENT::CStringVarName</a> reply_to_name(<font class="stringliteral">"ReplyTo"</font>); +00397 +00398 NLAIAGENT::tQueue <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>; +00399 <font class="keywordflow">if</font>(className == NULL) +00400 { +00401 <font class="keywordflow">if</font>( (*funcName) == constructor_name ) +00402 { +00403 <a class="code" href="classNLAIAGENT_1_1CObjectType.html">NLAIAGENT::CObjectType</a> *c = <font class="keyword">new</font> <a class="code" href="classNLAIAGENT_1_1CObjectType.html">NLAIAGENT::CObjectType</a>( <font class="keyword">new</font> <a class="code" href="classNLAIC_1_1CIdentType.html">NLAIC::CIdentType</a>( CGoal::IdGoal ) ); +00404 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>.push( <a class="code" href="structNLAIAGENT_1_1CIdMethod.html">NLAIAGENT::CIdMethod</a>( 0 + IObjetOp::getMethodIndexSize(), 0.0, NULL, c) ); +00405 } +00406 +00407 <font class="keywordflow">if</font>( (*funcName) == mode_once_name ) +00408 { +00409 <a class="code" href="classNLAIAGENT_1_1CObjectType.html">NLAIAGENT::CObjectType</a> *c = <font class="keyword">new</font> <a class="code" href="classNLAIAGENT_1_1CObjectType.html">NLAIAGENT::CObjectType</a>( <font class="keyword">new</font> <a class="code" href="classNLAIC_1_1CIdentType.html">NLAIC::CIdentType</a>( CGoal::IdGoal ) ); +00410 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>.push( <a class="code" href="structNLAIAGENT_1_1CIdMethod.html">NLAIAGENT::CIdMethod</a>( 1 + IObjetOp::getMethodIndexSize(), 0.0, NULL, c) ); +00411 } +00412 +00413 <font class="keywordflow">if</font>( (*funcName) == mode_repeat_name ) +00414 { +00415 <a class="code" href="classNLAIAGENT_1_1CObjectType.html">NLAIAGENT::CObjectType</a> *c = <font class="keyword">new</font> <a class="code" href="classNLAIAGENT_1_1CObjectType.html">NLAIAGENT::CObjectType</a>( <font class="keyword">new</font> <a class="code" href="classNLAIC_1_1CIdentType.html">NLAIC::CIdentType</a>( CGoal::IdGoal ) ); +00416 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>.push( <a class="code" href="structNLAIAGENT_1_1CIdMethod.html">NLAIAGENT::CIdMethod</a>( 2 + IObjetOp::getMethodIndexSize(), 0.0, NULL, c) ); +00417 } +00418 +00419 <font class="keywordflow">if</font>( (*funcName) == reply_to_name ) +00420 { +00421 <a class="code" href="classNLAIAGENT_1_1CObjectType.html">NLAIAGENT::CObjectType</a> *c = <font class="keyword">new</font> <a class="code" href="classNLAIAGENT_1_1CObjectType.html">NLAIAGENT::CObjectType</a>( <font class="keyword">new</font> <a class="code" href="classNLAIC_1_1CIdentType.html">NLAIC::CIdentType</a>( CGoal::IdGoal ) ); +00422 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>.push( <a class="code" href="structNLAIAGENT_1_1CIdMethod.html">NLAIAGENT::CIdMethod</a>( 3 + IObjetOp::getMethodIndexSize(), 0.0, NULL, c) ); +00423 } +00424 } +00425 +00426 <font class="keywordflow">if</font> ( <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>.empty() ) +00427 <font class="keywordflow">return</font> IBaseBoolType::isMember(className, funcName, params); +00428 <font class="keywordflow">else</font> +00429 <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>; +00430 } +00431 +00433 +<a name="l00434"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#z925_0">00434</a> <a class="code" href="structNLAIAGENT_1_1IObjectIA_1_1CProcessResult.html">NLAIAGENT::IObjectIA::CProcessResult</a> CGoal::runMethodeMember(sint32, sint32, <a class="code" href="classNLAIAGENT_1_1IObjectIA.html">NLAIAGENT::IObjectIA</a> *) +00435 { +00436 <font class="keywordflow">return</font> IObjectIA::CProcessResult(); +00437 } +00438 +<a name="l00439"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#z925_1">00439</a> <a class="code" href="structNLAIAGENT_1_1IObjectIA_1_1CProcessResult.html">NLAIAGENT::IObjectIA::CProcessResult</a> CGoal::runMethodeMember(sint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <a class="code" href="classNLAIAGENT_1_1IObjectIA.html">NLAIAGENT::IObjectIA</a> *p) +00440 { +00441 <a class="code" href="classNLAIAGENT_1_1IBaseGroupType.html">NLAIAGENT::IBaseGroupType</a> *<a class="code" href="driver__opengl__extension__def_8h.html#a382">param</a> = (<a class="code" href="classNLAIAGENT_1_1IBaseGroupType.html">NLAIAGENT::IBaseGroupType</a> *)p; +00442 +00443 <font class="keywordflow">switch</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> - IObjetOp::getMethodIndexSize()) +00444 { +00445 <font class="keywordflow">case</font> 0: +00446 { +00447 +00448 <a class="code" href="classNLAIAGENT_1_1CStringType.html">NLAIAGENT::CStringType</a> *name = (<a class="code" href="classNLAIAGENT_1_1CStringType.html">NLAIAGENT::CStringType</a> *) param-><a class="code" href="classNLAIAGENT_1_1IBaseGroupType.html#z136_11">getFront</a>(); +00449 param-><a class="code" href="classNLAIAGENT_1_1IBaseGroupType.html#z136_9">popFront</a>(); +00450 <font class="preprocessor">#ifdef NL_DEBUG</font> +00451 <font class="preprocessor"></font> <font class="keyword">const</font> <font class="keywordtype">char</font> *dbg_name = name-><a class="code" href="classNLAIAGENT_1_1CStringType.html#a10">getStr</a>().getString(); +00452 <font class="preprocessor">#endif</font> +00453 <font class="preprocessor"></font> <font class="comment">// If the constructor() function is explicitely called and the object has already been initialised</font> +00454 <font class="keywordflow">if</font> ( _Name ) +00455 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n0">_Name</a>-><a class="code" href="classNLAIC_1_1IPointerGestion.html#a3">release</a>(); +00456 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>.clear(); +00457 +00458 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n0">_Name</a> = (<a class="code" href="classNLAIAGENT_1_1IVarName.html">NLAIAGENT::IVarName</a> *) name-><a class="code" href="classNLAIAGENT_1_1CStringType.html#a10">getStr</a>().clone(); +00459 <a class="code" href="classstd_1_1list.html">std::list<const NLAIAGENT::IObjectIA *></a> args; +00460 <font class="keywordflow">while</font> ( param-><a class="code" href="classNLAIAGENT_1_1IBaseGroupType.html#z136_12">size</a>() ) +00461 { +00462 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>.push_back( (<a class="code" href="classNLAIAGENT_1_1IObjectIA.html">NLAIAGENT::IObjectIA</a> *) param-><a class="code" href="classNLAIAGENT_1_1IBaseGroupType.html#z136_11">getFront</a>()->clone() ); +00463 param-><a class="code" href="classNLAIAGENT_1_1IBaseGroupType.html#z136_9">popFront</a>(); +00464 } +00465 name-><a class="code" href="classNLAIC_1_1IPointerGestion.html#a3">release</a>(); +00466 <font class="keywordflow">return</font> IObjectIA::CProcessResult(); +00467 } +00468 <font class="keywordflow">break</font>; +00469 +00470 <font class="keywordflow">case</font> 1: +00471 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n4">_Mode</a> = <a class="code" href="classNLAILOGIC_1_1IGoal.html#s5s0">achieveOnce</a>; +00472 <font class="keywordflow">break</font>; +00473 +00474 <font class="keywordflow">case</font> 2: +00475 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n4">_Mode</a> = <a class="code" href="classNLAILOGIC_1_1IGoal.html#s5s1">achieveForever</a>; +00476 <font class="keywordflow">break</font>; +00477 +00478 <font class="keywordflow">case</font> 3: +00479 { +00480 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n7">_Sender</a> = ( <a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *) ( (<a class="code" href="classNLAIAGENT_1_1CLocalAgentMail.html">NLAIAGENT::CLocalAgentMail</a> *) ( (<a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *) param-><a class="code" href="classNLAIAGENT_1_1IBaseGroupType.html#z136_11">getFront</a>()) )->getHost(); +00481 param-><a class="code" href="classNLAIAGENT_1_1IBaseGroupType.html#z136_9">popFront</a>(); +00482 } +00483 <font class="keywordflow">break</font>; +00484 } +00485 +00486 <font class="keywordflow">return</font> IObjectIA::CProcessResult(); +00487 } +00488 +<a name="l00489"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#z925_2">00489</a> sint32 CGoal::getMethodIndexSize()<font class="keyword"> const</font> +00490 <font class="keyword"> </font>{ +00491 <font class="keywordflow">return</font> IBaseBoolType::getMethodIndexSize() + 4; +00492 } +00494 +<a name="l00495"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a7">00495</a> <font class="keywordtype">void</font> CGoal::addSuccessor(<a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>) +00496 { +00497 <font class="comment">//nlinfo("addSuccessor: 0x%0x, %d, (0x%0x, %s)", this, _Successors.size(),s,(const char *)s->getType());</font> +00498 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.push_back(s); +00499 s-><a class="code" href="classNLAIC_1_1IPointerGestion.html#a2">incRef</a>(); +00500 } +00501 +<a name="l00502"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a8">00502</a> <font class="keywordtype">void</font> CGoal::addPredecessor(<a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *p) +00503 { +00504 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n2">_Predecessors</a>.push_back(p); +00505 p-><a class="code" href="classNLAIC_1_1IPointerGestion.html#a2">incRef</a>(); +00506 } +00507 +<a name="l00508"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a24">00508</a> <font class="keywordtype">bool</font> CGoal::operator==(<font class="keyword">const</font> CGoal &g) +00509 { +00510 <font class="keywordflow">if</font> ( (*g._Name) == (*_Name) && <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>.size() == g._Args.size() ) +00511 <font class="keywordflow">return</font> <font class="keyword">true</font>; +00512 +00513 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00514 } +00515 +<a name="l00516"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a25">00516</a> <font class="keywordtype">void</font> CGoal::cancel() +00517 { +00518 std::vector<NLAIAGENT::IBasicAgent *>::iterator i, end = <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.end(); +00519 <font class="keywordflow">for</font> ( i = <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.begin(); i != end; i++ ) +00520 { +00521 ( (<a class="code" href="classNLAIAGENT_1_1COperatorScript.html">NLAIAGENT::COperatorScript</a> *)*i )->cancel(); +00522 } +00523 } +00524 +<a name="l00525"></a><a class="code" href="classNLAILOGIC_1_1CGoal.html#a26">00525</a> <font class="keywordtype">float</font> CGoal::priority()<font class="keyword"> const</font> +00526 <font class="keyword"> </font>{ +00527 <font class="keywordflow">if</font> ( <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.empty() ) +00528 <font class="keywordflow">return</font> 0.0; +00529 +00530 <font class="keywordtype">float</font> pri = 256; +00531 std::vector<NLAIAGENT::IBasicAgent *>::const_iterator i, end = <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.end(); +00532 <font class="keywordflow">for</font> ( i = <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.begin(); i != end; i++ ) +00533 { +00534 <font class="keywordtype">float</font> suc_pri = ( (<a class="code" href="classNLAIAGENT_1_1COperatorScript.html">NLAIAGENT::COperatorScript</a> *)*i )->priority(); +00535 <font class="keywordflow">if</font> ( suc_pri < pri ) +00536 { +00537 pri = suc_pri; +00538 } +00539 } +00540 <font class="keywordflow">return</font> pri; +00541 } +00542 +00545 +<a name="l00546"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a0">00546</a> CInternalGoal::CInternalGoal() : IGoal() +00547 { +00548 <a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#o0">_Property</a> = NULL; +00549 } +00550 +<a name="l00551"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a1">00551</a> CInternalGoal::CInternalGoal(<font class="keyword">const</font> <a class="code" href="classNLAIAGENT_1_1IVarName.html">NLAIAGENT::IVarName</a> &name, TTypeOfGoal mode) : IGoal(name, mode) +00552 { +00553 <a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#o0">_Property</a> = NULL; +00554 } +00555 +<a name="l00556"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a2">00556</a> CInternalGoal::CInternalGoal(<font class="keyword">const</font> <a class="code" href="classNLAIAGENT_1_1IVarName.html">NLAIAGENT::IVarName</a> &name, <a class="code" href="classstd_1_1list.html">std::list<const NLAIAGENT::IObjectIA *></a> &args, TTypeOfGoal mode) : IGoal(name, args, mode) +00557 { +00558 <a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#o0">_Property</a> = NULL; +00559 } +00560 +<a name="l00561"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a3">00561</a> CInternalGoal::CInternalGoal(<font class="keyword">const</font> CInternalGoal &c) : IGoal( c ) +00562 { +00563 <font class="keywordflow">if</font> ( c._Property != NULL ) +00564 <a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a31">setProperty</a>( c._Property ); +00565 <font class="keywordflow">else</font> +00566 <a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#o0">_Property</a> = NULL; +00567 } +00568 +<a name="l00569"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a4">00569</a> CInternalGoal::~CInternalGoal() +00570 { +00571 <font class="keywordflow">if</font> ( <a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#o0">_Property</a> != NULL ) +00572 <a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#o0">_Property</a>-><a class="code" href="classNLAIC_1_1IPointerGestion.html#a3">release</a>(); +00573 } +00574 +<a name="l00575"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a9">00575</a> <font class="keywordtype">void</font> CInternalGoal::operatorSuccess(<a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *op) +00576 { +00577 <font class="comment">// nlinfo("operatorSuccess: 0x%0x, %d, (0x%0x, %s)", this, _Successors.size(),op,(const char *)op->getType());</font> +00578 std::vector<NLAIAGENT::IBasicAgent *>::iterator it_s = <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.begin(); +00579 <font class="keywordflow">while</font> ( it_s != <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.end() ) +00580 { +00581 <font class="keywordflow">if</font> ( (**it_s) == *op ) +00582 { +00583 (*it_s)->release(); +00584 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.erase( it_s ); +00585 <font class="keywordflow">break</font>; +00586 } +00587 it_s++; +00588 } +00589 +00590 <font class="keywordflow">switch</font> ( _Mode ) +00591 { +00592 <font class="keywordflow">case</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#s5s0">achieveOnce</a>: +00593 ( (<a class="code" href="classNLAIAGENT_1_1CAgentScript.html">NLAIAGENT::CAgentScript</a> *) <a class="code" href="classNLAILOGIC_1_1IGoal.html#n8">_Receiver</a>)->removeGoal( (<a class="code" href="classNLAILOGIC_1_1CGoal.html">NLAILOGIC::CGoal</a> *) <font class="keyword">this</font> ); +00594 <font class="keywordflow">break</font>; +00595 +00596 <font class="keywordflow">case</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#s5s1">achieveForever</a>: +00597 <font class="keywordflow">break</font>; +00598 } +00599 +00600 } +00601 +<a name="l00602"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a10">00602</a> <font class="keywordtype">void</font> CInternalGoal::operatorFailure(<a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *op) +00603 { +00604 std::vector<NLAIAGENT::IBasicAgent *>::iterator it_s = <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.begin(); +00605 <font class="keywordflow">while</font> ( it_s != <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.end() ) +00606 { +00607 <font class="keywordflow">if</font> ( (**it_s) == *op ) +00608 { +00609 (*it_s)->release(); +00610 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.erase( it_s ); +00611 <font class="keywordflow">break</font>; +00612 } +00613 it_s++; +00614 } +00615 +00616 <font class="keywordflow">switch</font> ( _Mode ) +00617 { +00618 <font class="keywordflow">case</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#s5s0">achieveOnce</a>: +00619 ( (<a class="code" href="classNLAIAGENT_1_1CAgentScript.html">NLAIAGENT::CAgentScript</a> *) <a class="code" href="classNLAILOGIC_1_1IGoal.html#n8">_Receiver</a> )->removeGoal( (<a class="code" href="classNLAILOGIC_1_1CGoal.html">NLAILOGIC::CGoal</a> *) <font class="keyword">this</font> ); +00620 <font class="keywordflow">break</font>; +00621 +00622 <font class="keywordflow">case</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#s5s1">achieveForever</a>: +00623 <font class="keywordflow">break</font>; +00624 } +00625 } +00626 +<a name="l00627"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a12">00627</a> <font class="keyword">const</font> <a class="code" href="classNLAIC_1_1IBasicType.html">NLAIC::IBasicType</a> *CInternalGoal::clone()<font class="keyword"> const</font> +00628 <font class="keyword"> </font>{ +00629 <a class="code" href="classNLAIC_1_1IBasicInterface.html">NLAIC::IBasicInterface</a> *m = <font class="keyword">new</font> <a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a0">CInternalGoal</a>( *<font class="keyword">this</font> ); +00630 <font class="keywordflow">return</font> m; +00631 } +00632 +<a name="l00633"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a13">00633</a> <font class="keyword">const</font> <a class="code" href="classNLAIC_1_1IBasicType.html">NLAIC::IBasicType</a> *CInternalGoal::newInstance()<font class="keyword"> const</font> +00634 <font class="keyword"> </font>{ +00635 <font class="keywordflow">return</font> <a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a12">clone</a>(); +00636 } +00637 +00638 +<a name="l00639"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a14">00639</a> <font class="keywordtype">void</font> CInternalGoal::save(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &os) +00640 { +00641 } +00642 +<a name="l00643"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a15">00643</a> <font class="keywordtype">void</font> CInternalGoal::load(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &is) +00644 { +00645 IObjectIA::load( is ); +00646 } +00647 +<a name="l00648"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a16">00648</a> <font class="keywordtype">void</font> CInternalGoal::getDebugString(std::string &text)<font class="keyword"> const</font> +00649 <font class="keyword"> </font>{ +00650 text += <font class="stringliteral">"<CInternalGoal> ("</font>; +00651 <font class="keywordflow">if</font> ( _Name ) +00652 text += <a class="code" href="classNLAILOGIC_1_1IGoal.html#n0">_Name</a>-><a class="code" href="classNLAIAGENT_1_1IVarName.html#a1">getString</a>(); +00653 std::string buf; +00654 <font class="keywordtype">int</font> i; +00655 <font class="keywordflow">for</font> ( i = 0; i < (int) <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>.size(); i++ ) +00656 { +00657 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>[i]->getDebugString(buf); +00658 text += <font class="stringliteral">" "</font>; +00659 text += buf; +00660 } +00661 text += <font class="stringliteral">") - "</font>; +00662 +00663 text += <a class="code" href="namespaceNLAIC.html#a5">NLAIC::stringGetBuild</a>(<font class="stringliteral">" PRI = %f"</font>, <a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a30">priority</a>() ); +00664 text += <font class="stringliteral">" PRE = "</font>; +00665 +00666 <font class="keywordflow">for</font> ( i = 0; i < (int) <a class="code" href="classNLAILOGIC_1_1IGoal.html#n2">_Predecessors</a>.size(); i++ ) +00667 { +00668 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n2">_Predecessors</a>[i]->getDebugString( buf ); +00669 text += buf; +00670 } +00671 text += <font class="stringliteral">" POST = "</font>; +00672 <font class="keywordflow">for</font> ( i = 0; i < (int) <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.size(); i++ ) +00673 { +00674 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>[i]->getDebugString( buf ); +00675 text += buf; +00676 } +00677 } +00678 +<a name="l00679"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a17">00679</a> <font class="keywordtype">bool</font> CInternalGoal::isTrue()<font class="keyword"> const</font> +00680 <font class="keyword"> </font>{ +00681 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00682 } +00683 +<a name="l00684"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a18">00684</a> <font class="keywordtype">float</font> CInternalGoal::truthValue()<font class="keyword"> const</font> +00685 <font class="keyword"> </font>{ +00686 <font class="keywordflow">return</font> 1.0; +00687 } +00688 +<a name="l00689"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a19">00689</a> <font class="keyword">const</font> <a class="code" href="structNLAIAGENT_1_1IObjectIA_1_1CProcessResult.html">NLAIAGENT::IObjectIA::CProcessResult</a> &CInternalGoal::run() +00690 { +00691 <font class="keywordflow">return</font> IObjectIA::ProcessRun; +00692 } +00693 +<a name="l00694"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a20">00694</a> <font class="keywordtype">bool</font> <a class="code" href="chain_8cpp.html#a2">CInternalGoal::isEqual</a>(<font class="keyword">const</font> CInternalGoal &a)<font class="keyword"> const</font> +00695 <font class="keyword"> </font>{ +00696 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00697 } +00698 +<a name="l00699"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a21">00699</a> <font class="keywordtype">bool</font> <a class="code" href="chain_8cpp.html#a2">CInternalGoal::isEqual</a>(<font class="keyword">const</font> <a class="code" href="classNLAIAGENT_1_1IBasicObjectIA.html">NLAIAGENT::IBasicObjectIA</a> &a)<font class="keyword"> const</font> +00700 <font class="keyword"> </font>{ +00701 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00702 } +00703 +<a name="l00704"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a6">00704</a> <font class="keyword">const</font> std::vector<NLAIAGENT::IObjectIA *> &CInternalGoal::getArgs() +00705 { +00706 <font class="keywordflow">return</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>; +00707 } +00708 +<a name="l00709"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a22">00709</a> <font class="keyword">const</font> <a class="code" href="classNLAIC_1_1CIdentType.html">NLAIC::CIdentType</a> &CInternalGoal::getType()<font class="keyword"> const</font> +00710 <font class="keyword"> </font>{ +00711 <font class="keywordflow">return</font> <a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#p0">IdInternalGoal</a>; +00712 } +00713 +<a name="l00714"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a5">00714</a> <font class="keywordtype">void</font> CInternalGoal::setArgs(<a class="code" href="classstd_1_1list.html">std::list<NLAIAGENT::IObjectIA *></a> &args) +00715 { +00716 <a class="code" href="classstd_1_1list.html">std::list<NLAIAGENT::IObjectIA *></a>::iterator it_var = args.begin(); +00717 <font class="keywordflow">while</font> ( it_var != args.end() ) +00718 { +00719 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>.push_back( (<a class="code" href="classNLAIAGENT_1_1IObjectIA.html">NLAIAGENT::IObjectIA</a> *) (*it_var)->clone() ); +00720 it_var++; +00721 } +00722 } +00723 +<a name="l00724"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a23">00724</a> NLAIAGENT::tQueue CInternalGoal::isMember(<font class="keyword">const</font> <a class="code" href="classNLAIAGENT_1_1IVarName.html">NLAIAGENT::IVarName</a> *className,<font class="keyword">const</font> <a class="code" href="classNLAIAGENT_1_1IVarName.html">NLAIAGENT::IVarName</a> *funcName,<font class="keyword">const</font> <a class="code" href="classNLAIAGENT_1_1IObjectIA.html">NLAIAGENT::IObjectIA</a> &<a class="code" href="driver__opengl__extension__def_8h.html#a357">params</a>)<font class="keyword"> const</font> +00725 <font class="keyword"> </font>{ +00726 +00727 <font class="preprocessor">#ifdef NL_DEBUG </font> +00728 <font class="preprocessor"></font> std::string nameP; +00729 std::string nameM; +00730 funcName-><a class="code" href="classNLAIC_1_1IBasicType.html#a5">getDebugString</a>(nameM); +00731 params.<a class="code" href="classNLAIC_1_1IBasicType.html#a5">getDebugString</a>(nameP); +00732 <font class="keyword">const</font> <font class="keywordtype">char</font> *dbg_class_name = (<font class="keyword">const</font> <font class="keywordtype">char</font> *) <a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a22">getType</a>(); +00733 <font class="preprocessor">#endif</font> +00734 <font class="preprocessor"></font> <font class="keyword">static</font> <a class="code" href="classNLAIAGENT_1_1CStringVarName.html">NLAIAGENT::CStringVarName</a> constructor_name(<font class="stringliteral">"Constructor"</font>); +00735 <font class="keyword">static</font> <a class="code" href="classNLAIAGENT_1_1CStringVarName.html">NLAIAGENT::CStringVarName</a> mode_once_name(<font class="stringliteral">"SetModeOnce"</font>); +00736 <font class="keyword">static</font> <a class="code" href="classNLAIAGENT_1_1CStringVarName.html">NLAIAGENT::CStringVarName</a> mode_repeat_name(<font class="stringliteral">"SetModeRepeat"</font>); +00737 NLAIAGENT::tQueue <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>; +00738 <font class="keywordflow">if</font>(className == NULL) +00739 { +00740 <font class="keywordflow">if</font>( (*funcName) == constructor_name ) +00741 { +00742 <a class="code" href="classNLAIAGENT_1_1CObjectType.html">NLAIAGENT::CObjectType</a> *c = <font class="keyword">new</font> <a class="code" href="classNLAIAGENT_1_1CObjectType.html">NLAIAGENT::CObjectType</a>( <font class="keyword">new</font> <a class="code" href="classNLAIC_1_1CIdentType.html">NLAIC::CIdentType</a>( CInternalGoal::IdInternalGoal ) ); +00743 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>.push( <a class="code" href="structNLAIAGENT_1_1CIdMethod.html">NLAIAGENT::CIdMethod</a>( 0 + IObjetOp::getMethodIndexSize(), 0.0, NULL, c) ); +00744 } +00745 +00746 <font class="keywordflow">if</font>( (*funcName) == mode_once_name ) +00747 { +00748 <a class="code" href="classNLAIAGENT_1_1CObjectType.html">NLAIAGENT::CObjectType</a> *c = <font class="keyword">new</font> <a class="code" href="classNLAIAGENT_1_1CObjectType.html">NLAIAGENT::CObjectType</a>( <font class="keyword">new</font> <a class="code" href="classNLAIC_1_1CIdentType.html">NLAIC::CIdentType</a>( CInternalGoal::IdInternalGoal ) ); +00749 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>.push( <a class="code" href="structNLAIAGENT_1_1CIdMethod.html">NLAIAGENT::CIdMethod</a>( 1 + IObjetOp::getMethodIndexSize(), 0.0, NULL, c) ); +00750 } +00751 +00752 <font class="keywordflow">if</font>( (*funcName) == mode_repeat_name ) +00753 { +00754 <a class="code" href="classNLAIAGENT_1_1CObjectType.html">NLAIAGENT::CObjectType</a> *c = <font class="keyword">new</font> <a class="code" href="classNLAIAGENT_1_1CObjectType.html">NLAIAGENT::CObjectType</a>( <font class="keyword">new</font> <a class="code" href="classNLAIC_1_1CIdentType.html">NLAIC::CIdentType</a>( CInternalGoal::IdInternalGoal ) ); +00755 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>.push( <a class="code" href="structNLAIAGENT_1_1CIdMethod.html">NLAIAGENT::CIdMethod</a>( 2 + IObjetOp::getMethodIndexSize(), 0.0, NULL, c) ); +00756 } +00757 +00758 } +00759 +00760 <font class="keywordflow">if</font> ( <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>.empty() ) +00761 <font class="keywordflow">return</font> IBaseBoolType::isMember(className, funcName, params); +00762 <font class="keywordflow">else</font> +00763 <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>; +00764 } +00765 +00767 +<a name="l00768"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#z926_0">00768</a> <a class="code" href="structNLAIAGENT_1_1IObjectIA_1_1CProcessResult.html">NLAIAGENT::IObjectIA::CProcessResult</a> CInternalGoal::runMethodeMember(sint32, sint32, <a class="code" href="classNLAIAGENT_1_1IObjectIA.html">NLAIAGENT::IObjectIA</a> *) +00769 { +00770 <font class="keywordflow">return</font> IObjectIA::CProcessResult(); +00771 } +00772 +<a name="l00773"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#z926_1">00773</a> <a class="code" href="structNLAIAGENT_1_1IObjectIA_1_1CProcessResult.html">NLAIAGENT::IObjectIA::CProcessResult</a> CInternalGoal::runMethodeMember(sint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <a class="code" href="classNLAIAGENT_1_1IObjectIA.html">NLAIAGENT::IObjectIA</a> *p) +00774 { +00775 <a class="code" href="classNLAIAGENT_1_1IBaseGroupType.html">NLAIAGENT::IBaseGroupType</a> *<a class="code" href="driver__opengl__extension__def_8h.html#a382">param</a> = (<a class="code" href="classNLAIAGENT_1_1IBaseGroupType.html">NLAIAGENT::IBaseGroupType</a> *)p; +00776 +00777 <font class="keywordflow">switch</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> - IObjetOp::getMethodIndexSize()) +00778 { +00779 <font class="keywordflow">case</font> 0: +00780 { +00781 +00782 <a class="code" href="classNLAIAGENT_1_1CStringType.html">NLAIAGENT::CStringType</a> *name = (<a class="code" href="classNLAIAGENT_1_1CStringType.html">NLAIAGENT::CStringType</a> *) param-><a class="code" href="classNLAIAGENT_1_1IBaseGroupType.html#z136_11">getFront</a>(); +00783 param-><a class="code" href="classNLAIAGENT_1_1IBaseGroupType.html#z136_9">popFront</a>(); +00784 <font class="preprocessor">#ifdef NL_DEBUG</font> +00785 <font class="preprocessor"></font> <font class="keyword">const</font> <font class="keywordtype">char</font> *dbg_name = name-><a class="code" href="classNLAIAGENT_1_1CStringType.html#a10">getStr</a>().getString(); +00786 <font class="preprocessor">#endif</font> +00787 <font class="preprocessor"></font> <font class="comment">// If the constructor() function is explicitely called and the object has already been initialised</font> +00788 <font class="keywordflow">if</font> ( _Name ) +00789 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n0">_Name</a>-><a class="code" href="classNLAIC_1_1IPointerGestion.html#a3">release</a>(); +00790 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>.clear(); +00791 +00792 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n0">_Name</a> = (<a class="code" href="classNLAIAGENT_1_1IVarName.html">NLAIAGENT::IVarName</a> *) name-><a class="code" href="classNLAIAGENT_1_1CStringType.html#a10">getStr</a>().clone(); +00793 <a class="code" href="classstd_1_1list.html">std::list<const NLAIAGENT::IObjectIA *></a> args; +00794 <font class="keywordflow">while</font> ( param-><a class="code" href="classNLAIAGENT_1_1IBaseGroupType.html#z136_12">size</a>() ) +00795 { +00796 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>.push_back( (<a class="code" href="classNLAIAGENT_1_1IObjectIA.html">NLAIAGENT::IObjectIA</a> *) param-><a class="code" href="classNLAIAGENT_1_1IBaseGroupType.html#z136_11">getFront</a>()->clone() ); +00797 param-><a class="code" href="classNLAIAGENT_1_1IBaseGroupType.html#z136_9">popFront</a>(); +00798 } +00799 name-><a class="code" href="classNLAIC_1_1IPointerGestion.html#a3">release</a>(); +00800 <font class="keywordflow">return</font> IObjectIA::CProcessResult(); +00801 } +00802 <font class="keywordflow">break</font>; +00803 +00804 <font class="keywordflow">case</font> 1: +00805 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n4">_Mode</a> = <a class="code" href="classNLAILOGIC_1_1IGoal.html#s5s0">achieveOnce</a>; +00806 <font class="keywordflow">break</font>; +00807 +00808 <font class="keywordflow">case</font> 2: +00809 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n4">_Mode</a> = <a class="code" href="classNLAILOGIC_1_1IGoal.html#s5s1">achieveForever</a>; +00810 <font class="keywordflow">break</font>; +00811 } +00812 +00813 <font class="keywordflow">return</font> IObjectIA::CProcessResult(); +00814 } +00815 +<a name="l00816"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#z926_2">00816</a> sint32 CInternalGoal::getMethodIndexSize()<font class="keyword"> const</font> +00817 <font class="keyword"> </font>{ +00818 <font class="keywordflow">return</font> IBaseBoolType::getMethodIndexSize() + 3; +00819 } +00821 +<a name="l00822"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a7">00822</a> <font class="keywordtype">void</font> CInternalGoal::addSuccessor(<a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>) +00823 { +00824 <font class="comment">//nlinfo("addSuccessor: 0x%0x, %d, (0x%0x, %s)", this, _Successors.size(),s,(const char *)s->getType());</font> +00825 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.push_back(s); +00826 s-><a class="code" href="classNLAIC_1_1IPointerGestion.html#a2">incRef</a>(); +00827 } +00828 +<a name="l00829"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a8">00829</a> <font class="keywordtype">void</font> CInternalGoal::addPredecessor(<a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *p) +00830 { +00831 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n2">_Predecessors</a>.push_back(p); +00832 p-><a class="code" href="classNLAIC_1_1IPointerGestion.html#a2">incRef</a>(); +00833 } +00834 +<a name="l00835"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a24">00835</a> <font class="keywordtype">bool</font> CInternalGoal::operator==(<font class="keyword">const</font> CInternalGoal &g) +00836 { +00837 <font class="keywordflow">if</font> ( (*g._Name) == (*_Name) && <a class="code" href="classNLAILOGIC_1_1IGoal.html#n1">_Args</a>.size() == g._Args.size() ) +00838 <font class="keywordflow">return</font> <font class="keyword">true</font>; +00839 +00840 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00841 } +00842 +<a name="l00843"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a25">00843</a> <font class="keywordtype">void</font> CInternalGoal::setSender(<a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>) +00844 { +00845 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n7">_Sender</a> = s; +00846 } +00847 +<a name="l00848"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a26">00848</a> <font class="keywordtype">void</font> CInternalGoal::setReceiver(<a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>) +00849 { +00850 <a class="code" href="classNLAILOGIC_1_1IGoal.html#n8">_Receiver</a> = r; +00851 } +00852 +<a name="l00853"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a27">00853</a> <a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *CInternalGoal::getSender() +00854 { +00855 <font class="keywordflow">return</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#n7">_Sender</a>; +00856 } +00857 +<a name="l00858"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a28">00858</a> <a class="code" href="classNLAIAGENT_1_1IBasicAgent.html">NLAIAGENT::IBasicAgent</a> *CInternalGoal::getReceiver() +00859 { +00860 <font class="keywordflow">return</font> <a class="code" href="classNLAILOGIC_1_1IGoal.html#n8">_Receiver</a>; +00861 } +00862 +<a name="l00863"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a29">00863</a> <font class="keywordtype">void</font> CInternalGoal::cancel() +00864 { +00865 std::vector<NLAIAGENT::IBasicAgent *>::iterator i, end = <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.end(); +00866 <font class="keywordflow">for</font> ( i = <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.begin(); i != end; i++ ) +00867 { +00868 ( (<a class="code" href="classNLAIAGENT_1_1COperatorScript.html">NLAIAGENT::COperatorScript</a> *)*i )->cancel(); +00869 } +00870 } +00871 +<a name="l00872"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a30">00872</a> <font class="keywordtype">float</font> CInternalGoal::priority()<font class="keyword"> const</font> +00873 <font class="keyword"> </font>{ +00874 <font class="keywordflow">if</font> ( <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.empty() ) +00875 <font class="keywordflow">return</font> 0.0; +00876 +00877 <font class="keywordtype">float</font> pri = 256; +00878 std::vector<NLAIAGENT::IBasicAgent *>::const_iterator i, end = <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.end(); +00879 <font class="keywordflow">for</font> ( i = <a class="code" href="classNLAILOGIC_1_1IGoal.html#n3">_Successors</a>.begin(); i != end; i++ ) +00880 { +00881 <font class="keywordtype">float</font> suc_pri = ( (<a class="code" href="classNLAIAGENT_1_1COperatorScript.html">NLAIAGENT::COperatorScript</a> *)*i )->priority(); +00882 <font class="keywordflow">if</font> ( suc_pri < pri ) +00883 { +00884 pri = suc_pri; +00885 } +00886 } +00887 <font class="keywordflow">return</font> pri; +00888 } +00889 +00890 +<a name="l00891"></a><a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#a31">00891</a> <font class="keywordtype">void</font> CInternalGoal::setProperty(<a class="code" href="classNLAIAGENT_1_1IObjectIA.html">NLAIAGENT::IObjectIA</a> *property) +00892 { +00893 <font class="keywordflow">if</font> ( <a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#o0">_Property</a> != NULL ) +00894 { +00895 <a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#o0">_Property</a>-><a class="code" href="classNLAIC_1_1IPointerGestion.html#a3">release</a>(); +00896 } +00897 <a class="code" href="classNLAILOGIC_1_1CInternalGoal.html#o0">_Property</a> = property; +00898 } +00899 } +00900 +00901 +00902 +00903 +00904 +00905 +00906 +00907 +</pre></div> + +<!-- footer --> +<BR><FONT Size=+5> </FONT> +</TD> +<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD> +</TR> +</TABLE> +</BODY> +</HTML> |