diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/a05964.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to 'docs/doxygen/nel/a05964.html')
-rw-r--r-- | docs/doxygen/nel/a05964.html | 246 |
1 files changed, 246 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a05964.html b/docs/doxygen/nel/a05964.html new file mode 100644 index 00000000..1e4aee7b --- /dev/null +++ b/docs/doxygen/nel/a05964.html @@ -0,0 +1,246 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: mailbox.cpp Source File</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.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">Data Structures</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">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>mailbox.cpp</h1><a href="a04541.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 +00006 <span class="comment">/* Copyright, 2000 Nevrax Ltd.</span> +00007 <span class="comment"> *</span> +00008 <span class="comment"> * This file is part of NEVRAX NEL.</span> +00009 <span class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</span> +00010 <span class="comment"> * it under the terms of the GNU General Public License as published by</span> +00011 <span class="comment"> * the Free Software Foundation; either version 2, or (at your option)</span> +00012 <span class="comment"> * any later version.</span> +00013 <span class="comment"></span> +00014 <span class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</span> +00015 <span class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</span> +00016 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> +00017 <span class="comment"> * General Public License for more details.</span> +00018 <span class="comment"></span> +00019 <span class="comment"> * You should have received a copy of the GNU General Public License</span> +00020 <span class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</span> +00021 <span class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</span> +00022 <span class="comment"> * MA 02111-1307, USA.</span> +00023 <span class="comment"> */</span> +00024 <span class="preprocessor">#include "<a class="code" href="a03970.html">nel/ai/agent/agent.h</a>"</span> +00025 <span class="preprocessor">#include "<a class="code" href="a03990.html">nel/ai/agent/agent_script.h</a>"</span> +00026 +00027 <span class="keyword">namespace </span>NLAIAGENT +00028 { +00029 +<a name="l00030"></a><a class="code" href="a02786.html#NLAIAGENT_1_1IMailBoxa24">00030</a> IMailBox::IMailBox(<span class="keyword">const</span> <a class="code" href="a03887.html">IWordNumRef</a> *parent):<a class="code" href="a02164.html">IConnectIA</a>(parent) +00031 { +00032 } +00033 +<a name="l00034"></a><a class="code" href="a02786.html#NLAIAGENT_1_1IMailBoxa23">00034</a> IMailBox::IMailBox(<span class="keyword">const</span> <a class="code" href="a02786.html">IMailBox</a> &c) : <a class="code" href="a02164.html">IConnectIA</a>(c) +00035 { +00036 } +00037 +<a name="l00038"></a><a class="code" href="a02786.html#NLAIAGENT_1_1IMailBoxa22">00038</a> IMailBox::IMailBox(<a class="code" href="a02270.html">NLMISC::IStream</a> &is):<a class="code" href="a02164.html">IConnectIA</a>(is) +00039 { +00040 } +00041 +<a name="l00042"></a><a class="code" href="a02786.html#NLAIAGENT_1_1IMailBoxa54">00042</a> IMailBox::~IMailBox() +00043 { +00044 } +00045 +<a name="l00046"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa5">00046</a> CLocalMailBox::CLocalMailBox (<span class="keyword">const</span> <a class="code" href="a03887.html">IWordNumRef</a> *parent):<a class="code" href="a02786.html">IMailBox</a>(parent),_Size(0) +00047 { +00048 } +00049 +<a name="l00050"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa4">00050</a> CLocalMailBox::CLocalMailBox(<a class="code" href="a02270.html">NLMISC::IStream</a> &is):<a class="code" href="a02786.html">IMailBox</a>(is),_Size(0) +00051 { +00052 <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa34">load</a>(is); +00053 } +00054 +00055 +<a name="l00056"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa3">00056</a> CLocalMailBox::CLocalMailBox (<span class="keyword">const</span> <a class="code" href="a02785.html">CLocalMailBox</a> &A):<a class="code" href="a02786.html">IMailBox</a>(A),_RunState(A._RunState),_Size(0) +00057 { +00058 } +00059 +<a name="l00060"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa59">00060</a> CLocalMailBox::~CLocalMailBox() +00061 { +00062 <span class="keywordflow">while</span>(<a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr1">_ListMessageIn</a>.begin() != <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr1">_ListMessageIn</a>.end()) +00063 { +00064 <a class="code" href="a02325.html">IMessageBase</a> *msg = (<a class="code" href="a02325.html">IMessageBase</a> *)<a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr1">_ListMessageIn</a>.back(); +00065 msg-><a class="code" href="a02145.html#NLAIAGENT_1_1VectorTypea46">release</a>(); +00066 <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr1">_ListMessageIn</a>.pop_back(); +00067 } +00068 +00069 } +00070 +<a name="l00071"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa12">00071</a> <span class="keyword">const</span> <a class="code" href="a02325.html">IMessageBase</a> &CLocalMailBox::getMessage() +00072 { +00073 <span class="keywordflow">return</span> *<a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr1">_ListMessageIn</a>.back(); +00074 } +00075 +<a name="l00076"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa40">00076</a> <span class="keywordtype">void</span> CLocalMailBox::popMessage() +00077 { +00078 ((<a class="code" href="a02325.html">IMessageBase</a> *)<a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr1">_ListMessageIn</a>.back())->release(); +00079 <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr1">_ListMessageIn</a>.pop_back(); +00080 _Size --; +00081 } +00082 +<a name="l00083"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa13">00083</a> <a class="code" href="a04558.html#a10">sint32</a> CLocalMailBox::getMessageCount()<span class="keyword"> const</span> +00084 <span class="keyword"> </span>{ +00085 <span class="keywordflow">return</span> _Size; +00086 } +00087 +<a name="l00088"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa29">00088</a> <span class="keywordtype">bool</span> CLocalMailBox::isEmpty()<span class="keyword"> const</span> +00089 <span class="keyword"> </span>{ +00090 <span class="keywordflow">return</span> _Size == 0; +00091 } +00092 +<a name="l00093"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa51">00093</a> <a class="code" href="a03869.html">IObjectIA::CProcessResult</a> CLocalMailBox::sendMessage(<a class="code" href="a02325.html">IMessageBase</a> *m) +00094 { +00095 m-><a class="code" href="a02145.html#NLAIAGENT_1_1VectorTypea46">release</a>(); +00096 <span class="keywordflow">return</span> IObjectIA::ProcessRun; +00097 } +00098 +<a name="l00099"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa1">00099</a> <span class="keywordtype">void</span> CLocalMailBox::addMessage(<a class="code" href="a02325.html">IMessageBase</a> *msg) +00100 { +00101 <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr1">_ListMessageIn</a>.push_front(msg); +00102 _Size ++; +00103 } +00104 +00105 <span class="comment">// Ajoute une boite aux lettre dans la liste des boites aux lettres "source" (les bals à consulter).</span> +<a name="l00106"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa0">00106</a> <span class="keywordtype">void</span> CLocalMailBox::addMailBox(<a class="code" href="a02786.html">IMailBox</a> *mail) +00107 { +00108 <a class="code" href="a02164.html#NLAIAGENT_1_1IMainAgenta5">connect</a>( mail ); +00109 <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr0">_ListMailBox</a>.push_back((<a class="code" href="a02786.html">IMailBox</a> *)mail); +00110 +00111 } +00112 +00113 <span class="comment">// Supprime une boite aux lettre dans la liste des boites aux lettres "source" (les bals à consulter).</span> +<a name="l00114"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa43">00114</a> <span class="keywordtype">void</span> CLocalMailBox::removeMailBox(<a class="code" href="a02786.html">IMailBox</a> *mail) +00115 { +00116 eraseFromList<IMailBox *>(&<a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr0">_ListMailBox</a>,mail); +00117 <a class="code" href="a02164.html#NLAIAGENT_1_1IMainAgenta35">removeConnection</a>(mail); +00118 } +00119 +00120 +00121 +<a name="l00122"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa6">00122</a> <span class="keyword">const</span> <a class="code" href="a02151.html">NLAIC::IBasicType</a> *CLocalMailBox::clone()<span class="keyword"> const</span> +00123 <span class="keyword"> </span>{ +00124 <a class="code" href="a02151.html">NLAIC::IBasicType</a> *a = <span class="keyword">new</span> <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa5">CLocalMailBox</a>(*<span class="keyword">this</span>); +00125 <span class="keywordflow">return</span> a; +00126 } +00127 +<a name="l00128"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa35">00128</a> <span class="keyword">const</span> <a class="code" href="a02151.html">NLAIC::IBasicType</a> *CLocalMailBox::newInstance()<span class="keyword"> const</span> +00129 <span class="keyword"> </span>{ +00130 <a class="code" href="a02151.html">NLAIC::IBasicType</a> *a; +00131 <span class="keywordflow">if</span>(<a class="code" href="a02164.html#NLAIAGENT_1_1IMainAgenta16">getParent</a>() != NULL) +00132 a = <span class="keyword">new</span> <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa5">CLocalMailBox</a>((<span class="keyword">const</span> <a class="code" href="a03887.html">IWordNumRef</a> *)<a class="code" href="a02164.html#NLAIAGENT_1_1IMainAgenta16">getParent</a>()); +00133 <span class="keywordflow">else</span> +00134 a = <span class="keyword">new</span> <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa5">CLocalMailBox</a>((<span class="keyword">const</span> <a class="code" href="a03887.html">IWordNumRef</a> *)NULL); +00135 <span class="keywordflow">return</span> a; +00136 } +00137 +<a name="l00138"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa25">00138</a> <span class="keyword">const</span> <a class="code" href="a02650.html">NLAIC::CIdentType</a> &CLocalMailBox::getType()<span class="keyword"> const</span> +00139 <span class="keyword"> </span>{ +00140 <span class="keywordflow">return</span> <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxs0">IdLocalMailBox</a>; +00141 } +00142 +<a name="l00143"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa36">00143</a> <span class="keywordtype">void</span> CLocalMailBox::onKill(<a class="code" href="a02164.html">IConnectIA</a> *a) +00144 { +00145 eraseFromList<IMailBox *>(&<a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr0">_ListMailBox</a>,(<a class="code" href="a02786.html">IMailBox</a> *)a); +00146 +00147 <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxw5">TListMessageIter</a> msgItr = <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr1">_ListMessageIn</a>.begin(); +00148 <span class="keywordflow">while</span>(msgItr != <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr1">_ListMessageIn</a>.end()) +00149 { +00150 <a class="code" href="a02325.html">IMessageBase</a> *msg = (<a class="code" href="a02325.html">IMessageBase</a> *)*msgItr; +00151 +00152 <span class="keywordflow">if</span>(msg-><a class="code" href="a02325.html#NLAIAGENT_1_1IMessageBasez1714_2">getSender</a>() == a || msg-><a class="code" href="a02325.html#NLAIAGENT_1_1IMessageBasez1714_0">getContinuation</a>() == a || msg-><a class="code" href="a02325.html#NLAIAGENT_1_1IMessageBasez1714_1">getReceiver</a>() == a) +00153 { +00154 <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxw5">TListMessageIter</a> iTmp = msgItr++; +00155 <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr1">_ListMessageIn</a>.erase(iTmp); +00156 msg-><a class="code" href="a02145.html#NLAIAGENT_1_1VectorTypea46">release</a>(); +00157 _Size --; +00158 } +00159 <span class="keywordflow">else</span> msgItr++; +00160 } +00161 +00162 } +00163 +<a name="l00164"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa30">00164</a> <span class="keywordtype">bool</span> <a class="code" href="a04116.html#a2">CLocalMailBox::isEqual</a>(<span class="keyword">const</span> <a class="code" href="a02153.html">IBasicObjectIA</a> &a)<span class="keyword"> const</span> +00165 <span class="keyword"> </span>{ +00166 <span class="keyword">const</span> <a class="code" href="a02786.html">IMailBox</a> &m = (<span class="keyword">const</span> <a class="code" href="a02786.html">IMailBox</a> &)a; +00167 <span class="keywordflow">return</span> (<span class="keyword">const</span> <a class="code" href="a03887.html">IWordNumRef</a> &)m == (<span class="keyword">const</span> <a class="code" href="a03887.html">IWordNumRef</a> &)*<span class="keyword">this</span>; +00168 } +00169 +<a name="l00170"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa48">00170</a> <span class="keywordtype">void</span> CLocalMailBox::save(<a class="code" href="a02270.html">NLMISC::IStream</a> &os) +00171 { +00172 IMailBox::save(os); +00173 <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a04223.html#a587">size</a> = <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr0">_ListMailBox</a>.size(); +00174 os.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>( <a class="code" href="a04223.html#a587">size</a> ); +00175 <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxw1">TListMailBoxCstIter</a> k = <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr0">_ListMailBox</a>.begin(); +00176 <span class="keywordflow">while</span>(k != <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr0">_ListMailBox</a>.end()) +00177 { +00178 <a class="code" href="a02786.html">IMailBox</a> *mail = *k++; +00179 ((<a class="code" href="a03887.html">IWordNumRef</a> *)(<span class="keyword">const</span> <a class="code" href="a03887.html">NLAIAGENT::IWordNumRef</a> *)*mail)->save(os); +00180 } +00181 +00182 <a class="code" href="a04223.html#a587">size</a> = <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr1">_ListMessageIn</a>.size(); +00183 os.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>( <a class="code" href="a04223.html#a587">size</a> ); +00184 <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxw5">TListMessageIter</a> msgItr = <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr1">_ListMessageIn</a>.begin(); +00185 <span class="keywordflow">while</span>(msgItr != <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr1">_ListMessageIn</a>.end()) +00186 { +00187 <a class="code" href="a02325.html">IMessageBase</a> *msg = (<a class="code" href="a02325.html">IMessageBase</a> *)*msgItr++; +00188 os.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>( (<a class="code" href="a02650.html">NLAIC::CIdentType</a> &) (msg-><a class="code" href="a02151.html#NLAICHARACTER_1_1IZonea20">getType</a>()) ); +00189 msg-><a class="code" href="a02325.html#NLAIAGENT_1_1IMessageBasea47">save</a>(os); +00190 } +00191 +00192 } +00193 +<a name="l00194"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa34">00194</a> <span class="keywordtype">void</span> CLocalMailBox::load(<a class="code" href="a02270.html">NLMISC::IStream</a> &is) +00195 { +00196 IMailBox::load(is); +00197 <a class="code" href="a04558.html#a10">sint32</a> i; +00198 <a class="code" href="a02651.html">NLAIC::CIdentTypeAlloc</a> <span class="keywordtype">id</span>; +00199 is.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(i); +00200 _Size = 0; +00201 <span class="keywordflow">if</span>(i) +00202 { +00203 <span class="keywordflow">while</span>(i --) +00204 { +00205 is.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(<span class="keywordtype">id</span>); +00206 <a class="code" href="a03887.html">IWordNumRef</a> *<a class="code" href="a04223.html#a653">num</a> = (<a class="code" href="a03887.html">IWordNumRef</a> *)<span class="keywordtype">id</span>.allocClass(); +00207 <a class="code" href="a04223.html#a653">num</a>->load(is); +00208 <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxr0">_ListMailBox</a>.push_back((<a class="code" href="a02786.html">IMailBox</a> *)((<span class="keyword">const</span> <a class="code" href="a02165.html">IRefrence</a> *)*<a class="code" href="a04223.html#a653">num</a>)); +00209 _Size ++; +00210 <span class="keyword">delete</span> <a class="code" href="a04223.html#a653">num</a>; +00211 } +00212 } +00213 } +00214 +<a name="l00215"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa20">00215</a> <span class="keyword">const</span> <a class="code" href="a03869.html">IObjectIA::CProcessResult</a> &CLocalMailBox::getState()<span class="keyword"> const </span> +00216 <span class="keyword"> </span>{ +00217 <span class="keywordflow">return</span> _RunState; +00218 } +00219 +<a name="l00220"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa54">00220</a> <span class="keywordtype">void</span> CLocalMailBox::setState(TProcessStatement state, <a class="code" href="a02149.html">IObjectIA</a> *result) +00221 { +00222 _RunState.<a class="code" href="a03869.html#NLAIAGENT_1_1IObjectIA_1_1CProcessResulto1">ResultState</a> = state; +00223 _RunState.<a class="code" href="a03869.html#NLAIAGENT_1_1IObjectIA_1_1CProcessResulto0">Result</a> = result; +00224 } +00225 +<a name="l00226"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa44">00226</a> <span class="keyword">const</span> <a class="code" href="a03869.html">IObjectIA::CProcessResult</a> &CLocalMailBox::run() +00227 { +00228 <span class="keywordflow">return</span> <a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa20">getState</a>(); +00229 } +00230 +<a name="l00231"></a><a class="code" href="a02785.html#NLAIAGENT_1_1CLocalMailBoxa9">00231</a> <span class="keywordtype">void</span> CLocalMailBox::getDebugString(std::string &<a class="code" href="a04223.html#a627">t</a>)<span class="keyword"> const</span> +00232 <span class="keyword"> </span>{ +00233 <a class="code" href="a04223.html#a627">t</a> += <span class="stringliteral">"class CLocalMailBox parent"</span>; +00234 +00235 } +00236 } +</pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:27:56 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |