Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bad97183153701b09df5fae1052b1c30 > files > 1394

crystalspace-doc-1.2.1-5mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Crystal Space 1.2.1: csutil/cssubscription.h Source File (Crystal Space 1.2.1 Public API Reference)</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="head">
 <tr height="59">
  <td class="head" width="202" valign="bottom" style="padding-left:0;"><a href="http://www.crystalspace3d.org/"><img src="csblur.png" width="236" height="59" alt="CrystalSpace" border="0"></a></td>
  <td class="head"><h2>Public API Reference</h2></td>
 </tr>
 <tr height="11">
  <td colspan="2" class="headshadow" valign="top" style="padding-left:0;"><img src="csblurb.png" width="236" height="11" alt="" border="0"></td>
 </tr>
</table>
<div class="content">
<!-- Generated by Doxygen 1.5.3 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="namespaces.html"><span>Namespaces</span></a></li>
    <li><a href="classes.html"><span>Classes</span></a></li>
    <li class="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<h1>csutil/cssubscription.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">  Crystal Space 3D engine - Event Subscription internals</span>
<a name="l00003"></a>00003 <span class="comment">  Copyright (C) 2005 by Adam D. Bradley &lt;artdodge@cs.bu.edu&gt;</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment">  This library is free software; you can redistribute it and/or</span>
<a name="l00006"></a>00006 <span class="comment">  modify it under the terms of the GNU Library General Public</span>
<a name="l00007"></a>00007 <span class="comment">  License as published by the Free Software Foundation; either</span>
<a name="l00008"></a>00008 <span class="comment">  version 2 of the License, or (at your option) any later version.</span>
<a name="l00009"></a>00009 <span class="comment"></span>
<a name="l00010"></a>00010 <span class="comment">  This library is distributed in the hope that it will be useful,</span>
<a name="l00011"></a>00011 <span class="comment">  but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00012"></a>00012 <span class="comment">  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00013"></a>00013 <span class="comment">  Library General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment"></span>
<a name="l00015"></a>00015 <span class="comment">  You should have received a copy of the GNU Library General Public</span>
<a name="l00016"></a>00016 <span class="comment">  License along with this library; if not, write to the Free</span>
<a name="l00017"></a>00017 <span class="comment">  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</span>
<a name="l00018"></a>00018 <span class="comment">*/</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="preprocessor">#ifndef __CS_CSEVENTSUBSCRIPTION_H__</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#define __CS_CSEVENTSUBSCRIPTION_H__</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span>
<a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="partialorder_8h.html" title="Generic finite partial order.">csutil/partialorder.h</a>"</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="tree_8h.html" title="Generic tree class.">csutil/tree.h</a>"</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="list_8h.html" title="Double-linked list.">csutil/list.h</a>"</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="csutil_2eventhandlers_8h.html" title="Event handler naming, name management, indexing, and instantiation.">csutil/eventhandlers.h</a>"</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="eventh_8h.html" title="Event handler interface.">iutil/eventh.h</a>"</span>
<a name="l00028"></a>00028 
<a name="l00029"></a>00029 <span class="keyword">class </span><a class="code" href="classcsEventQueue.html" title="This class represents a general event queue.">csEventQueue</a>;
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 
<a name="l00041"></a><a class="code" href="classcsEventTree.html">00041</a> <span class="keyword">class </span><a class="code" href="classcsEventTree.html" title="This class is used to represent the event namespace (tree).">csEventTree</a> : <span class="keyword">public</span> <a class="code" href="classcsTreeNode.html" title="A generic tree class.">csTreeNode</a>
<a name="l00042"></a>00042 {
<a name="l00043"></a>00043 <span class="keyword">public</span>:
<a name="l00044"></a>00044   <span class="comment">// forward declarator</span>
<a name="l00045"></a>00045   <span class="keyword">class </span><a class="code" href="classcsEventTree_1_1SubscriberIterator.html" title="The SubscriberIterator is a wrapper for the messy internals of figuring out which...">SubscriberIterator</a>;
<a name="l00046"></a>00046 
<a name="l00052"></a>00052   <a class="code" href="classcsEventTree.html" title="This class is used to represent the event namespace (tree).">csEventTree</a> *<a class="code" href="classcsEventTree.html#0ca5357e751f53f7e1c1a8f0244d7e59" title="Find a node with a given name in the event tree owned by q .">FindNode</a> (<a class="code" href="group__event__handling.html#g51e1762faeeefdadf693499fc93db757" title="A csEventID is a handle for a string representing an event&amp;#39;s hierarchical name...">csEventID</a> name, <a class="code" href="classcsEventQueue.html" title="This class represents a general event queue.">csEventQueue</a> *q);
<a name="l00059"></a>00059   <span class="keywordtype">bool</span> <a class="code" href="classcsEventTree.html#04ca4d1748524ab5411de2e882603dad" title="Subscribe a given handler to a given event name subtree via a given event queue.">Subscribe</a> (<a class="code" href="group__event__handling.html#gd62f963e20f1180634a9557b392d987d">csHandlerID</a>, <a class="code" href="group__event__handling.html#g51e1762faeeefdadf693499fc93db757" title="A csEventID is a handle for a string representing an event&amp;#39;s hierarchical name...">csEventID</a>, <a class="code" href="classcsEventQueue.html" title="This class represents a general event queue.">csEventQueue</a> *q);
<a name="l00069"></a>00069   <span class="keywordtype">void</span> <a class="code" href="classcsEventTree.html#69588cc4abc05a5f8946951b1ff51f8d" title="Unubscribe a given handler to a given event name subtree via a given event queue...">Unsubscribe</a>(<a class="code" href="group__event__handling.html#gd62f963e20f1180634a9557b392d987d">csHandlerID</a>, <a class="code" href="group__event__handling.html#g51e1762faeeefdadf693499fc93db757" title="A csEventID is a handle for a string representing an event&amp;#39;s hierarchical name...">csEventID</a>, <a class="code" href="classcsEventQueue.html" title="This class represents a general event queue.">csEventQueue</a> *q);
<a name="l00070"></a>00070   
<a name="l00075"></a>00075   <span class="keywordtype">void</span> <a class="code" href="classcsEventTree.html#8a88fe2ec87f564c36addb46e9529ff3" title="Send the provided event to all subscribers, regardless of their return values.">Notify</a>();
<a name="l00080"></a>00080   <span class="keywordtype">void</span> <a class="code" href="classcsEventTree.html#934653e6616a0277dc72724f884bcbba" title="Send the provided event to all subscribers, using the normal return and Broadcast...">Dispatch</a>(<a class="code" href="structiEvent.html" title="This interface describes any system event.">iEvent</a> &amp;e);
<a name="l00081"></a>00081   
<a name="l00082"></a>00082 <span class="preprocessor">#ifdef ADB_DEBUG</span>
<a name="l00083"></a>00083 <span class="preprocessor"></span>  <span class="comment">// Dump the event tree and subscriptions to stderr.</span>
<a name="l00084"></a>00084   <span class="keywordtype">void</span> Dump();
<a name="l00085"></a>00085 <span class="preprocessor">#endif</span>
<a name="l00086"></a>00086 <span class="preprocessor"></span>  
<a name="l00087"></a><a class="code" href="classcsEventTree.html#4832611faa7aec972e57ebe36b483d8c">00087</a>   <span class="keyword">static</span> <span class="keyword">inline</span> <a class="code" href="classcsEventTree.html" title="This class is used to represent the event namespace (tree).">csEventTree</a> *<a class="code" href="classcsEventTree.html#4832611faa7aec972e57ebe36b483d8c">CreateRootNode</a>(<a class="code" href="classcsRef.html" title="A smart pointer.">csRef&lt;iEventHandlerRegistry&gt;</a> &amp;reg1,
<a name="l00088"></a>00088                                             <a class="code" href="classcsRef.html" title="A smart pointer.">csRef&lt;iEventNameRegistry&gt;</a> &amp;reg2, 
<a name="l00089"></a>00089                                             <a class="code" href="classcsEventQueue.html" title="This class represents a general event queue.">csEventQueue</a> *q)
<a name="l00090"></a>00090   {
<a name="l00091"></a>00091     <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classcsEventTree.html" title="This class is used to represent the event namespace (tree).">csEventTree</a> (reg1, reg2, reg2-&gt;GetID(<span class="stringliteral">""</span>), 0, q);
<a name="l00092"></a>00092   }
<a name="l00093"></a>00093   
<a name="l00094"></a><a class="code" href="classcsEventTree.html#b7b5a0f24320fce00d7893438eb0342e">00094</a>   <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classcsEventTree.html#b7b5a0f24320fce00d7893438eb0342e">DeleteRootNode</a>(<a class="code" href="classcsEventTree.html" title="This class is used to represent the event namespace (tree).">csEventTree</a> *node)
<a name="l00095"></a>00095   {
<a name="l00096"></a>00096     <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(node);
<a name="l00097"></a>00097     <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(node-&gt;<a class="code" href="classcsEventTree.html#efca51c85a84b2ecc589e38f01f20163">self</a> == node-&gt;<a class="code" href="classcsEventTree.html#96b8e3be4c30d8ff7f70448328453ffe">name_reg</a>-&gt;GetID(<span class="stringliteral">""</span>));
<a name="l00098"></a>00098     <span class="keyword">delete</span> node;
<a name="l00099"></a>00099   }
<a name="l00100"></a>00100     
<a name="l00101"></a>00101 <span class="keyword">private</span>:
<a name="l00102"></a>00102   <a class="code" href="classcsRef.html" title="A smart pointer.">csRef&lt;iEventHandlerRegistry&gt;</a> handler_reg;
<a name="l00103"></a>00103   <a class="code" href="classcsRef.html" title="A smart pointer.">csRef&lt;iEventNameRegistry&gt;</a> name_reg;
<a name="l00104"></a>00104 <span class="preprocessor">#ifdef ADB_DEBUG</span>
<a name="l00105"></a>00105 <span class="preprocessor"></span>  <span class="keywordtype">void</span> Dump(<span class="keywordtype">int</span> depth);
<a name="l00106"></a>00106 <span class="preprocessor">#endif</span>
<a name="l00107"></a>00107 <span class="preprocessor"></span>
<a name="l00108"></a>00108   <a class="code" href="classcsEventTree.html" title="This class is used to represent the event namespace (tree).">csEventTree</a> *FindNodeInternal(<a class="code" href="group__event__handling.html#g51e1762faeeefdadf693499fc93db757" title="A csEventID is a handle for a string representing an event&amp;#39;s hierarchical name...">csEventID</a> &amp;name, <a class="code" href="classcsEventQueue.html" title="This class represents a general event queue.">csEventQueue</a> *q);
<a name="l00109"></a>00109   
<a name="l00116"></a>00116   <a class="code" href="classcsEventTree.html" title="This class is used to represent the event namespace (tree).">csEventTree</a> (<a class="code" href="classcsRef.html" title="A smart pointer.">csRef&lt;iEventHandlerRegistry&gt;</a> &amp;,
<a name="l00117"></a>00117                <a class="code" href="classcsRef.html" title="A smart pointer.">csRef&lt;iEventNameRegistry&gt;</a> &amp;, 
<a name="l00118"></a>00118                <a class="code" href="group__event__handling.html#g51e1762faeeefdadf693499fc93db757" title="A csEventID is a handle for a string representing an event&amp;#39;s hierarchical name...">csEventID</a> name, <a class="code" href="classcsEventTree.html" title="This class is used to represent the event namespace (tree).">csEventTree</a> *<a class="code" href="classcsTreeNode.html#69ff22a180d65c9ff3b7473bb8b97357">parent</a>, <a class="code" href="classcsEventQueue.html" title="This class represents a general event queue.">csEventQueue</a> *q);
<a name="l00119"></a>00119   ~<a class="code" href="classcsEventTree.html" title="This class is used to represent the event namespace (tree).">csEventTree</a> ();
<a name="l00120"></a>00120   
<a name="l00121"></a>00121   <a class="code" href="group__event__handling.html#g51e1762faeeefdadf693499fc93db757" title="A csEventID is a handle for a string representing an event&amp;#39;s hierarchical name...">csEventID</a> <span class="keyword">self</span>;
<a name="l00122"></a>00122   <a class="code" href="classcsEventQueue.html" title="This class represents a general event queue.">csEventQueue</a> *queue;
<a name="l00123"></a>00123   
<a name="l00124"></a>00124   <span class="keywordtype">bool</span> SubscribeInternal (<a class="code" href="group__event__handling.html#gd62f963e20f1180634a9557b392d987d">csHandlerID</a>, <a class="code" href="group__event__handling.html#g51e1762faeeefdadf693499fc93db757" title="A csEventID is a handle for a string representing an event&amp;#39;s hierarchical name...">csEventID</a>);
<a name="l00125"></a>00125   <span class="keywordtype">void</span> UnsubscribeInternal (<a class="code" href="group__event__handling.html#gd62f963e20f1180634a9557b392d987d">csHandlerID</a>);
<a name="l00134"></a>00134   <span class="keywordtype">bool</span> fatNode;
<a name="l00135"></a>00135 
<a name="l00143"></a>00143   <span class="keyword">class </span>FatRecordObject
<a name="l00144"></a>00144   {
<a name="l00145"></a>00145   <span class="keyword">private</span>:
<a name="l00146"></a>00146     <a class="code" href="classcsRef.html" title="A smart pointer.">csRef&lt;iEventHandlerRegistry&gt;</a> handler_reg;
<a name="l00147"></a>00147     <a class="code" href="classcsRef.html" title="A smart pointer.">csRef&lt;iEventNameRegistry&gt;</a> name_reg;
<a name="l00148"></a>00148   <span class="keyword">public</span>:
<a name="l00149"></a>00149     FatRecordObject(<a class="code" href="classcsEventTree.html" title="This class is used to represent the event namespace (tree).">csEventTree</a> *root,
<a name="l00150"></a>00150                     <a class="code" href="classcsRef.html" title="A smart pointer.">csRef&lt;iEventHandlerRegistry&gt;</a> &amp;h_reg,
<a name="l00151"></a>00151                     <a class="code" href="classcsRef.html" title="A smart pointer.">csRef&lt;iEventNameRegistry&gt;</a> &amp;n_reg,
<a name="l00152"></a>00152                     <a class="code" href="classcsPartialOrder.html" title="A generic finite partial order class.">csPartialOrder&lt;csHandlerID&gt;</a> *new_sg,
<a name="l00153"></a>00153                     <a class="code" href="classcsList.html" title="A lightweight double-linked list template.">csList&lt;iEventHandler *&gt;</a> *new_sq) :
<a name="l00154"></a>00154       handler_reg (h_reg), name_reg (n_reg), 
<a name="l00155"></a>00155       SubscriberGraph (new_sg), SubscriberQueue (new_sq), 
<a name="l00156"></a>00156       my_root (root), iterator (0), iterating_for (0)
<a name="l00157"></a>00157     {
<a name="l00158"></a>00158       <span class="comment">/* If there's no SQ, mark it for creation */</span>
<a name="l00159"></a>00159       StaleSubscriberQueue = (SubscriberQueue==0);
<a name="l00160"></a>00160     }
<a name="l00161"></a>00161 
<a name="l00162"></a>00162     ~FatRecordObject()
<a name="l00163"></a>00163     {
<a name="l00164"></a>00164       <span class="keyword">delete</span> SubscriberGraph;
<a name="l00165"></a>00165       <span class="keywordflow">if</span> (SubscriberQueue)
<a name="l00166"></a>00166         <span class="keyword">delete</span> SubscriberQueue;
<a name="l00167"></a>00167       <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a> (iterator == 0);
<a name="l00168"></a>00168       <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a> (iterating_for == 0);
<a name="l00169"></a>00169     }
<a name="l00170"></a>00170 
<a name="l00174"></a>00174     <span class="keywordtype">void</span> RebuildQueue();
<a name="l00178"></a>00178     <a class="code" href="classcsPartialOrder.html" title="A generic finite partial order class.">csPartialOrder&lt;csHandlerID&gt;</a> *SubscribeInternal(<a class="code" href="group__event__handling.html#gd62f963e20f1180634a9557b392d987d">csHandlerID</a>, <a class="code" href="group__event__handling.html#g51e1762faeeefdadf693499fc93db757" title="A csEventID is a handle for a string representing an event&amp;#39;s hierarchical name...">csEventID</a>);
<a name="l00182"></a>00182     <span class="keywordtype">void</span> UnsubscribeInternal(<a class="code" href="group__event__handling.html#gd62f963e20f1180634a9557b392d987d">csHandlerID</a>);
<a name="l00183"></a>00183 
<a name="l00187"></a>00187     <a class="code" href="classcsPartialOrder.html" title="A generic finite partial order class.">csPartialOrder&lt;csHandlerID&gt;</a> *SubscriberGraph;
<a name="l00192"></a>00192     <a class="code" href="classcsList.html" title="A lightweight double-linked list template.">csList&lt;iEventHandler *&gt;</a> *SubscriberQueue;
<a name="l00198"></a>00198     <span class="keywordtype">bool</span> StaleSubscriberQueue;
<a name="l00202"></a>00202     <a class="code" href="classcsEventTree.html" title="This class is used to represent the event namespace (tree).">csEventTree</a> *my_root;
<a name="l00208"></a>00208     <a class="code" href="classcsEventTree.html#7800d352f191e799ea200a6f4006c30a">SubscriberIterator</a> *iterator;
<a name="l00213"></a>00213     <a class="code" href="classcsEventTree.html" title="This class is used to represent the event namespace (tree).">csEventTree</a> *iterating_for;
<a name="l00214"></a>00214   };
<a name="l00215"></a>00215 
<a name="l00216"></a>00216   FatRecordObject *fatRecord;
<a name="l00217"></a>00217 
<a name="l00224"></a>00224   <span class="keywordtype">void</span> ForceFatCopy();
<a name="l00225"></a>00225 
<a name="l00230"></a>00230   <span class="keywordtype">void</span> KillFatCopy();
<a name="l00231"></a>00231 
<a name="l00237"></a>00237   <span class="keywordtype">void</span> PushFatCopy(FatRecordObject *);
<a name="l00238"></a>00238   
<a name="l00239"></a>00239 
<a name="l00240"></a>00240  <span class="keyword">public</span>:
<a name="l00251"></a><a class="code" href="classcsEventTree_1_1SubscriberIterator.html">00251</a>   <span class="keyword">class </span><a class="code" href="classcsEventTree_1_1SubscriberIterator.html" title="The SubscriberIterator is a wrapper for the messy internals of figuring out which...">SubscriberIterator</a> 
<a name="l00252"></a>00252   {
<a name="l00253"></a>00253   <span class="keyword">public</span>:
<a name="l00258"></a><a class="code" href="classcsEventTree_1_1SubscriberIterator.html#67a979eb741e7db6ee1528e5b05d6bc8">00258</a>     <a class="code" href="classcsEventTree_1_1SubscriberIterator.html#67a979eb741e7db6ee1528e5b05d6bc8" title="Constructor.">SubscriberIterator</a> (<a class="code" href="structiEventHandlerRegistry.html" title="This interface represents a general event handler registry/resolver.">iEventHandlerRegistry</a>* r, <a class="code" href="classcsEventTree.html" title="This class is used to represent the event namespace (tree).">csEventTree</a> *t, 
<a name="l00259"></a>00259       <a class="code" href="group__event__handling.html#g51e1762faeeefdadf693499fc93db757" title="A csEventID is a handle for a string representing an event&amp;#39;s hierarchical name...">csEventID</a> bevent) : handler_reg(r), record(t-&gt;fatRecord), 
<a name="l00260"></a>00260         baseevent(bevent), mode(SI_LIST), qit(0)
<a name="l00261"></a>00261     {
<a name="l00262"></a>00262       <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(record-&gt;iterator == 0);
<a name="l00263"></a>00263       record-&gt;iterator = <span class="keyword">this</span>;
<a name="l00264"></a>00264       record-&gt;iterating_for = t;
<a name="l00265"></a>00265       <span class="keywordflow">if</span> (t-&gt;<a class="code" href="classcsEventTree.html#ec83adb2990f9f843329cc4db6dfd2a4">fatRecord</a>-&gt;SubscriberQueue)
<a name="l00266"></a>00266         qit = <span class="keyword">new</span> <a class="code" href="classcsList.html#9830fc407400559db7e7783cc10a9394">csList&lt;iEventHandler *&gt;::Iterator</a> (
<a name="l00267"></a>00267           *t-&gt;<a class="code" href="classcsEventTree.html#ec83adb2990f9f843329cc4db6dfd2a4">fatRecord</a>-&gt;SubscriberQueue);
<a name="l00268"></a>00268       <span class="keywordflow">else</span>
<a name="l00269"></a>00269         GraphMode();
<a name="l00270"></a>00270     }
<a name="l00271"></a>00271 
<a name="l00275"></a><a class="code" href="classcsEventTree_1_1SubscriberIterator.html#db68e7387db5d2404a16a1a46b591fea">00275</a>     <a class="code" href="classcsEventTree_1_1SubscriberIterator.html#db68e7387db5d2404a16a1a46b591fea" title="Destructor.">~SubscriberIterator</a> ()
<a name="l00276"></a>00276     {
<a name="l00277"></a>00277       <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(record-&gt;iterator == <span class="keyword">this</span>);
<a name="l00278"></a>00278       record-&gt;iterator = 0;
<a name="l00279"></a>00279       record-&gt;iterating_for = 0;
<a name="l00280"></a>00280       <span class="keyword">delete</span> qit;
<a name="l00281"></a>00281     }
<a name="l00282"></a>00282 
<a name="l00284"></a><a class="code" href="classcsEventTree_1_1SubscriberIterator.html#933e8e3585e7fc7e58d9c99307a09d4a">00284</a>     <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classcsEventTree_1_1SubscriberIterator.html#933e8e3585e7fc7e58d9c99307a09d4a" title="Test if there is another available handler.">HasNext</a> () 
<a name="l00285"></a>00285     {
<a name="l00286"></a>00286       <span class="keywordflow">switch</span>(mode) 
<a name="l00287"></a>00287       {
<a name="l00288"></a>00288       <span class="keywordflow">case</span> SI_LIST:
<a name="l00289"></a>00289         <span class="keywordflow">return</span> qit-&gt;HasNext ();
<a name="l00290"></a>00290         
<a name="l00291"></a>00291       <span class="keywordflow">case</span> SI_GRAPH:
<a name="l00292"></a>00292         <span class="keywordflow">do</span> 
<a name="l00293"></a>00293         {
<a name="l00294"></a>00294           <a class="code" href="group__event__handling.html#gd62f963e20f1180634a9557b392d987d">csHandlerID</a> <span class="keywordtype">id</span> = record-&gt;SubscriberGraph-&gt;GetEnabled (
<a name="l00295"></a>00295                 <a class="code" href="group__event__handling.html#gea5ee8f1eba9a0173e3a0f343b9d0603">CS_HANDLER_INVALID</a>);
<a name="l00296"></a>00296           <span class="keywordflow">if</span> (<span class="keywordtype">id</span> == <a class="code" href="group__event__handling.html#gea5ee8f1eba9a0173e3a0f343b9d0603">CS_HANDLER_INVALID</a>)
<a name="l00297"></a>00297             <span class="keywordflow">break</span>;
<a name="l00298"></a>00298           <span class="keywordflow">else</span> <span class="keywordflow">if</span> (handler_reg-&gt;IsInstance(<span class="keywordtype">id</span>))
<a name="l00299"></a>00299             <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00300"></a>00300           <span class="keywordflow">else</span>
<a name="l00301"></a>00301             record-&gt;SubscriberGraph-&gt;Mark(<span class="keywordtype">id</span>);
<a name="l00302"></a>00302         } 
<a name="l00303"></a>00303         <span class="keywordflow">while</span> (<span class="keyword">true</span>);
<a name="l00304"></a>00304         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00305"></a>00305         
<a name="l00306"></a>00306       <span class="keywordflow">default</span>:
<a name="l00307"></a>00307         <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>((mode == SI_LIST) ||
<a name="l00308"></a>00308                   (mode == SI_GRAPH));
<a name="l00309"></a>00309         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00310"></a>00310       }
<a name="l00311"></a>00311     }
<a name="l00312"></a>00312 
<a name="l00314"></a><a class="code" href="classcsEventTree_1_1SubscriberIterator.html#8b1cf47c6bc5ba7f071b527d79cd0c3a">00314</a>     <span class="keyword">inline</span> <a class="code" href="structiEventHandler.html" title="This interface describes an entity that can receive events.">iEventHandler</a> *<a class="code" href="classcsEventTree_1_1SubscriberIterator.html#8b1cf47c6bc5ba7f071b527d79cd0c3a" title="Return an available handler and mark it as &amp;quot;done&amp;quot;.">Next</a> () 
<a name="l00315"></a>00315     {
<a name="l00316"></a>00316       <span class="keywordflow">switch</span>(mode) 
<a name="l00317"></a>00317       {
<a name="l00318"></a>00318       <span class="keywordflow">case</span> SI_LIST:
<a name="l00319"></a>00319         <span class="comment">/* DOME : see if the current element has been deleted. */</span>
<a name="l00320"></a>00320         <span class="keywordflow">return</span> qit-&gt;Next ();
<a name="l00321"></a>00321         
<a name="l00322"></a>00322       <span class="keywordflow">case</span> SI_GRAPH:
<a name="l00323"></a>00323         <span class="comment">/* see if the current element has been flagged for deletion. */</span>
<a name="l00324"></a>00324         <span class="keywordflow">do</span> 
<a name="l00325"></a>00325         {
<a name="l00326"></a>00326           <a class="code" href="group__event__handling.html#gd62f963e20f1180634a9557b392d987d">csHandlerID</a> <span class="keywordtype">id</span> = record-&gt;SubscriberGraph-&gt;GetEnabled (
<a name="l00327"></a>00327                 <a class="code" href="group__event__handling.html#gea5ee8f1eba9a0173e3a0f343b9d0603">CS_HANDLER_INVALID</a>);
<a name="l00328"></a>00328           <span class="keywordflow">if</span> (<span class="keywordtype">id</span> == <a class="code" href="group__event__handling.html#gea5ee8f1eba9a0173e3a0f343b9d0603">CS_HANDLER_INVALID</a>)
<a name="l00329"></a>00329             <span class="keywordflow">break</span>;
<a name="l00330"></a>00330           <span class="keywordflow">else</span> <span class="keywordflow">if</span> (handler_reg-&gt;IsInstance (<span class="keywordtype">id</span>)) 
<a name="l00331"></a>00331           {
<a name="l00332"></a>00332             record-&gt;SubscriberGraph-&gt;Mark (<span class="keywordtype">id</span>);
<a name="l00333"></a>00333             <span class="keywordflow">return</span> handler_reg-&gt;GetHandler (<span class="keywordtype">id</span>);
<a name="l00334"></a>00334           } 
<a name="l00335"></a>00335           <span class="keywordflow">else</span>
<a name="l00336"></a>00336             record-&gt;SubscriberGraph-&gt;Mark(<span class="keywordtype">id</span>);
<a name="l00337"></a>00337         } 
<a name="l00338"></a>00338         <span class="keywordflow">while</span> (<span class="keyword">true</span>);
<a name="l00339"></a>00339         <span class="keywordflow">return</span> 0;
<a name="l00340"></a>00340         
<a name="l00341"></a>00341       <span class="keywordflow">default</span>:
<a name="l00342"></a>00342         <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>((mode == SI_LIST) ||
<a name="l00343"></a>00343                   (mode == SI_GRAPH));
<a name="l00344"></a>00344         <span class="keywordflow">return</span> 0;
<a name="l00345"></a>00345       }
<a name="l00346"></a>00346     }
<a name="l00347"></a>00347     
<a name="l00348"></a>00348     <span class="comment">/* SI_GRAPH mode data structures and methods */</span>
<a name="l00349"></a>00349     <span class="keywordtype">void</span> GraphMode (); <span class="comment">// change to graph (SI_GRAPH) iterator mode.</span>
<a name="l00350"></a>00350     
<a name="l00351"></a>00351   <span class="keyword">private</span>:
<a name="l00352"></a><a class="code" href="classcsEventTree_1_1SubscriberIterator.html#38be8f61f3116fd02fd4b301a7d7ce9c">00352</a>     <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classcsEventTree.html" title="This class is used to represent the event namespace (tree).">csEventTree</a>;
<a name="l00353"></a><a class="code" href="classcsEventTree_1_1SubscriberIterator.html#f404f613d3150d4f80c6da84fa375a24">00353</a>     <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classcsEventTree_1_1SubscriberIterator.html#f404f613d3150d4f80c6da84fa375a24">csEventQueueTest</a>;
<a name="l00354"></a>00354 
<a name="l00355"></a>00355     <a class="code" href="classcsRef.html" title="A smart pointer.">csRef&lt;iEventHandlerRegistry&gt;</a> handler_reg;
<a name="l00356"></a>00356     FatRecordObject *record;
<a name="l00357"></a>00357     <a class="code" href="group__event__handling.html#g51e1762faeeefdadf693499fc93db757" title="A csEventID is a handle for a string representing an event&amp;#39;s hierarchical name...">csEventID</a> baseevent;
<a name="l00358"></a>00358     <span class="keyword">enum</span>
<a name="l00359"></a>00359     {
<a name="l00360"></a>00360       SI_LIST,
<a name="l00361"></a>00361       SI_GRAPH
<a name="l00362"></a>00362     } mode;
<a name="l00363"></a>00363     
<a name="l00364"></a>00364     <span class="comment">/* SI_LIST mode data structures */</span>
<a name="l00365"></a>00365     <a class="code" href="classcsList.html" title="A lightweight double-linked list template.">csList&lt;iEventHandler *&gt;::Iterator</a>* qit;
<a name="l00366"></a>00366   };
<a name="l00367"></a><a class="code" href="classcsEventTree.html#7800d352f191e799ea200a6f4006c30a">00367</a>   <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classcsEventTree_1_1SubscriberIterator.html" title="The SubscriberIterator is a wrapper for the messy internals of figuring out which...">SubscriberIterator</a>;
<a name="l00368"></a><a class="code" href="classcsEventTree.html#f404f613d3150d4f80c6da84fa375a24">00368</a>   <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classcsEventTree.html#f404f613d3150d4f80c6da84fa375a24">csEventQueueTest</a>;
<a name="l00369"></a>00369 
<a name="l00374"></a>00374   <a class="code" href="classcsEventTree_1_1SubscriberIterator.html" title="The SubscriberIterator is a wrapper for the messy internals of figuring out which...">SubscriberIterator</a> *<a class="code" href="classcsEventTree.html#5c4f2048abf471ca761e3e2517792581" title="Return a csEventTree::SubscriberIterator for all subscribers to this event name (and...">GetIterator</a>();
<a name="l00375"></a>00375 
<a name="l00376"></a>00376 };
<a name="l00377"></a>00377 
<a name="l00378"></a>00378 <span class="preprocessor">#endif // __CS_CSEVENTSUBSCRIPTION_H__</span>
</pre></div><hr size="1"><address><small>Generated for Crystal Space 1.2.1 by 
<a href="http://www.doxygen.org/index.html">doxygen</a> 1.5.3 
</small></address> </div></body> </html>