Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > ea24284f03fd4a8a4b64047514d93f64 > files > 159

lib64kdegames1-devel-3.5.9-2mdv2008.1.x86_64.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US">

<head>
  <title>libkdegames: KGameProcess Class Reference (libkdegames)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <meta http-equiv="Content-Style-Type" content="text/css" />

  <meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" comment "ICRAonline DE v2.0" l gen true for "http://www.kde.org"  r (nz 1 vz 1 lz 1 oz 1 cb 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://www.kde.org"  r (n 0 s 0 v 0 l 0))' />

  <meta name="trademark" content="KDE e.V." />
  <meta name="description" content="K Desktop Environment Homepage, KDE.org" />
  <meta name="MSSmartTagsPreventParsing" content="true" />
  <meta name="robots" content="all" />

  <link rel="shortcut icon" href="../../favicon.ico" />

<link rel="stylesheet" media="screen" type="text/css" title="APIDOX" href="doxygen.css" />



</head>

<body>

<div id="nav_header_top" align="right">
  <a href="#content" class="doNotDisplay" accesskey="2">Skip to main content ::</a>

  <a href="../.."><img id="nav_header_logo" alt="Home" align="left" src="../../kde_gear_64.png" border="0" /></a>
  <span class="doNotDisplay">::</span>

  <div id="nav_header_title" align="left">KDE API Reference</div>


</div>

<div id="nav_header_bottom" align="right">
  <span class="doNotDisplay">:: <a href="#navigation" accesskey="5">Skip to Link Menu</a><br/></span>
  <div id="nav_header_bottom_right" style="text-align: left;">
/ <a href="../..">API Reference</a>
 / <a href=".">libkdegames</a>
  </div>
</div>


<table id="main" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
      <td valign="top" class="menuheader" height="0"></td>

  <td id="contentcolumn" valign="top" rowspan="2" >
    <div id="content" style="padding-top: 0px;"><div style="width:100%; margin: 0px; padding: 0px;">
    <a name="content"></a>


<!-- Generated by Doxygen 1.5.5 -->
<div class="contents">
<h1>KGameProcess Class Reference</h1><!-- doxytag: class="KGameProcess" --><!-- doxytag: inherits="QObject" --><code>#include &lt;<a class="el" href="kgameprocess_8h-source.html">kgameprocess.h</a>&gt;</code>
<p>
Inherits QObject.
<p>

<p>
<a href="classKGameProcess-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>
This is the process class used on the computer player side to communicate with its counterpart KProcessIO class. 
<p>
Using these two classes will give fully transparent communication via QDataStreams. 
<p>Definition at line <a class="el" href="kgameprocess_8h-source.html#l00042">42</a> of file <a class="el" href="kgameprocess_8h-source.html">kgameprocess.h</a>.</p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Signals</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameProcess.html#5ef2a3adb595ef45eb828e1ac84880ad">signalCommand</a> (QDataStream &amp;inputStream, int msgid, int receiver, int sender)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameProcess.html#fb4ef05f8e0d4af6953e7196513ba7b7">signalTurn</a> (QDataStream &amp;stream, bool turn)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameProcess.html#f7bad25a5e1425f9b819c9e86b5cf062">signalInit</a> (QDataStream &amp;stream, int userid)</td></tr>

<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameProcess.html#6f34a0ef5f5c34df1d13fe62a9f3b63c">KGameProcess</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameProcess.html#9419ec97ebf608621a8b6514ddc48f27">~KGameProcess</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameProcess.html#40967d8b35aee5f5bdb2ef7cfc50fd4e">exec</a> (int argc, char *argv[])</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameProcess.html#4a1841596e170dd0da622af23be5a601">terminate</a> () const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameProcess.html#b2cc6883b2d21eabe100a207713bcb05">setTerminate</a> (bool b)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameProcess.html#0667de5598bb696fb506f7ab0bb581b7">sendMessage</a> (QDataStream &amp;stream, int msgid, Q_UINT32 receiver=0)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameProcess.html#261048429198c46c126fe3a462591e6d">sendSystemMessage</a> (QDataStream &amp;stream, int msgid, Q_UINT32 receiver=0)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">KRandomSequence *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameProcess.html#afeb0b0347ca5be96c5575f502d58cf9">random</a> ()</td></tr>

<tr><td colspan="2"><br><h2>Protected Slots</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameProcess.html#27570120c538871ba5250e162db780e6">receivedMessage</a> (const QByteArray &amp;receiveBuffer)</td></tr>

<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameProcess.html#a3ad604ee94dfba7a070364bca42a06a">processArgs</a> (int argc, char *argv[])</td></tr>

<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b67aadb0d71c1c9949daee6db3a8d03a"></a><!-- doxytag: member="KGameProcess::mTerminate" ref="b67aadb0d71c1c9949daee6db3a8d03a" args="" -->
bool&nbsp;</td><td class="memItemRight" valign="bottom"><b>mTerminate</b></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="15bb9e0e9628716f37264f479ee07d0c"></a><!-- doxytag: member="KGameProcess::mMessageIO" ref="15bb9e0e9628716f37264f479ee07d0c" args="" -->
KMessageFilePipe *&nbsp;</td><td class="memItemRight" valign="bottom"><b>mMessageIO</b></td></tr>

</table>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="6f34a0ef5f5c34df1d13fe62a9f3b63c"></a><!-- doxytag: member="KGameProcess::KGameProcess" ref="6f34a0ef5f5c34df1d13fe62a9f3b63c" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">KGameProcess::KGameProcess           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Creates a <a class="el" href="classKGameProcess.html" title="This is the process class used on the computer player side to communicate with its...">KGameProcess</a> class. 
<p>
Done only in the computer player. To activate the communication you have to call the exec function of this class which will listen to the communication and emit signals to notify you of any incoming messages. Note: This function will only return after you set setTerminate(true) in one of the received signals. So you can not do any computer calculation after the exec function. Instead you react on the signals which are emitted after a message is received and perform the calculations there! Example: <div class="fragment"><pre class="fragment">  <span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc ,<span class="keywordtype">char</span> * argv[])
  {
    <a class="code" href="classKGameProcess.html" title="This is the process class used on the computer player side to communicate with its...">KGameProcess</a> proc;
    connect(&amp;proc,SIGNAL(<a class="code" href="classKGameProcess.html#5ef2a3adb595ef45eb828e1ac84880ad" title="The generic communication signal.">signalCommand</a>(QDataStream &amp;,<span class="keywordtype">int</span> ,<span class="keywordtype">int</span> ,<span class="keywordtype">int</span> )),
                    <span class="keyword">this</span>,SLOT(slotCommand(QDataStream &amp; ,<span class="keywordtype">int</span> ,<span class="keywordtype">int</span> ,<span class="keywordtype">int</span> )));
    connect(&amp;proc,SIGNAL(<a class="code" href="classKGameProcess.html#f7bad25a5e1425f9b819c9e86b5cf062" title="This signal is emmited when the process is initialized, i.e.">signalInit</a>(QDataStream &amp;,<span class="keywordtype">int</span>)),
                    <span class="keyword">this</span>,SLOT(slotInit(QDataStream &amp; ,<span class="keywordtype">int</span> )));
    connect(&amp;proc,SIGNAL(<a class="code" href="classKGameProcess.html#fb4ef05f8e0d4af6953e7196513ba7b7" title="This signal is emmited if the computer player should perform a turn.">signalTurn</a>(QDataStream &amp;,<span class="keywordtype">bool</span> )),
                    <span class="keyword">this</span>,SLOT(slotTurn(QDataStream &amp; ,<span class="keywordtype">bool</span> )));
    <span class="keywordflow">return</span> proc.<a class="code" href="classKGameProcess.html#40967d8b35aee5f5bdb2ef7cfc50fd4e" title="Enters the event loop of the computer process.">exec</a>(argc,argv);
  }
</pre></div> 
<p>Definition at line <a class="el" href="kgameprocess_8cpp-source.html#l00046">46</a> of file <a class="el" href="kgameprocess_8cpp-source.html">kgameprocess.cpp</a>.</p>

</div>
</div><p>
<a class="anchor" name="9419ec97ebf608621a8b6514ddc48f27"></a><!-- doxytag: member="KGameProcess::~KGameProcess" ref="9419ec97ebf608621a8b6514ddc48f27" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">KGameProcess::~KGameProcess           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Destruct the process. 
<p>

<p>Definition at line <a class="el" href="kgameprocess_8cpp-source.html#l00064">64</a> of file <a class="el" href="kgameprocess_8cpp-source.html">kgameprocess.cpp</a>.</p>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="40967d8b35aee5f5bdb2ef7cfc50fd4e"></a><!-- doxytag: member="KGameProcess::exec" ref="40967d8b35aee5f5bdb2ef7cfc50fd4e" args="(int argc, char *argv[])" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool KGameProcess::exec           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>argc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>argv</em>[]</td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Enters the event loop of the computer process. 
<p>
Does only return on setTerminate(true)! 
<p>Definition at line <a class="el" href="kgameprocess_8cpp-source.html#l00076">76</a> of file <a class="el" href="kgameprocess_8cpp-source.html">kgameprocess.cpp</a>.</p>

</div>
</div><p>
<a class="anchor" name="4a1841596e170dd0da622af23be5a601"></a><!-- doxytag: member="KGameProcess::terminate" ref="4a1841596e170dd0da622af23be5a601" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool KGameProcess::terminate           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Should the computer process leave its exec function? Activated if you setTerminate(true);. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>true/false </dd></dl>

<p>Definition at line <a class="el" href="kgameprocess_8h-source.html#l00091">91</a> of file <a class="el" href="kgameprocess_8h-source.html">kgameprocess.h</a>.</p>

</div>
</div><p>
<a class="anchor" name="b2cc6883b2d21eabe100a207713bcb05"></a><!-- doxytag: member="KGameProcess::setTerminate" ref="b2cc6883b2d21eabe100a207713bcb05" args="(bool b)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void KGameProcess::setTerminate           </td>
          <td>(</td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>b</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set this to true if the computer process should end, ie leave its exec function. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>b</em>&nbsp;</td><td>true for exit the exec function </td></tr>
  </table>
</dl>

<p>Definition at line <a class="el" href="kgameprocess_8h-source.html#l00099">99</a> of file <a class="el" href="kgameprocess_8h-source.html">kgameprocess.h</a>.</p>

</div>
</div><p>
<a class="anchor" name="0667de5598bb696fb506f7ab0bb581b7"></a><!-- doxytag: member="KGameProcess::sendMessage" ref="0667de5598bb696fb506f7ab0bb581b7" args="(QDataStream &amp;stream, int msgid, Q_UINT32 receiver=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void KGameProcess::sendMessage           </td>
          <td>(</td>
          <td class="paramtype">QDataStream &amp;&nbsp;</td>
          <td class="paramname"> <em>stream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>msgid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Q_UINT32&nbsp;</td>
          <td class="paramname"> <em>receiver</em> = <code>0</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sends a message to the corresponding <a class="el" href="classKGameIO.html" title="Base class for IO devices for games.">KGameIO</a> device. 
<p>
Works like the sendSystemMessage but for user id's<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>stream</em>&nbsp;</td><td>the QDataStream containing the message </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>msgid</em>&nbsp;</td><td>the message id for the message </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>receiver</em>&nbsp;</td><td>unused </td></tr>
  </table>
</dl>

<p>Definition at line <a class="el" href="kgameprocess_8cpp-source.html#l00110">110</a> of file <a class="el" href="kgameprocess_8cpp-source.html">kgameprocess.cpp</a>.</p>

</div>
</div><p>
<a class="anchor" name="261048429198c46c126fe3a462591e6d"></a><!-- doxytag: member="KGameProcess::sendSystemMessage" ref="261048429198c46c126fe3a462591e6d" args="(QDataStream &amp;stream, int msgid, Q_UINT32 receiver=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void KGameProcess::sendSystemMessage           </td>
          <td>(</td>
          <td class="paramtype">QDataStream &amp;&nbsp;</td>
          <td class="paramname"> <em>stream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>msgid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Q_UINT32&nbsp;</td>
          <td class="paramname"> <em>receiver</em> = <code>0</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sends a system message to the corresonding <a class="el" href="classKGameIO.html" title="Base class for IO devices for games.">KGameIO</a> device. 
<p>
This will normally be either a performed move or a query (IdProcessQuery). The query option is a way to communicate with the <a class="el" href="classKGameIO.html" title="Base class for IO devices for games.">KGameIO</a> at the other side and e.g. retrieve some game relevant data from here. Exmaple for a query: <div class="fragment"><pre class="fragment">  QByteArray buffer;
  QDataStream out(buffer,IO_WriteOnly);
  <span class="keywordtype">int</span> msgid=KGameMessage::IdProcessQuery;
  out &lt;&lt; (int)1;
  proc.<a class="code" href="classKGameProcess.html#261048429198c46c126fe3a462591e6d" title="Sends a system message to the corresonding KGameIO device.">sendSystemMessage</a>(out,msgid,0);
</pre></div><p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>stream</em>&nbsp;</td><td>the QDataStream containing the message </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>msgid</em>&nbsp;</td><td>the message id for the message </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>receiver</em>&nbsp;</td><td>unused </td></tr>
  </table>
</dl>

<p>Definition at line <a class="el" href="kgameprocess_8cpp-source.html#l00091">91</a> of file <a class="el" href="kgameprocess_8cpp-source.html">kgameprocess.cpp</a>.</p>

</div>
</div><p>
<a class="anchor" name="afeb0b0347ca5be96c5575f502d58cf9"></a><!-- doxytag: member="KGameProcess::random" ref="afeb0b0347ca5be96c5575f502d58cf9" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">KRandomSequence* KGameProcess::random           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns a pointer to a KRandomSequence. 
<p>
You can generate random numbers via e.g. <div class="fragment"><pre class="fragment">   <a class="code" href="classKGameProcess.html#afeb0b0347ca5be96c5575f502d58cf9" title="Returns a pointer to a KRandomSequence.">random</a>()-&gt;getLong(100);
</pre></div><p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>KRandomSequence pointer </dd></dl>

<p>Definition at line <a class="el" href="kgameprocess_8h-source.html#l00142">142</a> of file <a class="el" href="kgameprocess_8h-source.html">kgameprocess.h</a>.</p>

</div>
</div><p>
<a class="anchor" name="a3ad604ee94dfba7a070364bca42a06a"></a><!-- doxytag: member="KGameProcess::processArgs" ref="a3ad604ee94dfba7a070364bca42a06a" args="(int argc, char *argv[])" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void KGameProcess::processArgs           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>argc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>argv</em>[]</td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
processes the command line argumens to set up the computer player Pass the argumens exactely as given by main() 
<p>

<p>Definition at line <a class="el" href="kgameprocess_8cpp-source.html#l00115">115</a> of file <a class="el" href="kgameprocess_8cpp-source.html">kgameprocess.cpp</a>.</p>

</div>
</div><p>
<a class="anchor" name="27570120c538871ba5250e162db780e6"></a><!-- doxytag: member="KGameProcess::receivedMessage" ref="27570120c538871ba5250e162db780e6" args="(const QByteArray &amp;receiveBuffer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void KGameProcess::receivedMessage           </td>
          <td>(</td>
          <td class="paramtype">const QByteArray &amp;&nbsp;</td>
          <td class="paramname"> <em>receiveBuffer</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [protected, slot]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
A message is received via the interprocess connection. 
<p>
The appropriate signals are called. 
<p>Definition at line <a class="el" href="kgameprocess_8cpp-source.html#l00132">132</a> of file <a class="el" href="kgameprocess_8cpp-source.html">kgameprocess.cpp</a>.</p>

</div>
</div><p>
<a class="anchor" name="5ef2a3adb595ef45eb828e1ac84880ad"></a><!-- doxytag: member="KGameProcess::signalCommand" ref="5ef2a3adb595ef45eb828e1ac84880ad" args="(QDataStream &amp;inputStream, int msgid, int receiver, int sender)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void KGameProcess::signalCommand           </td>
          <td>(</td>
          <td class="paramtype">QDataStream &amp;&nbsp;</td>
          <td class="paramname"> <em>inputStream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>msgid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>receiver</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>sender</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [signal]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
The generic communication signal. 
<p>
You have to connect to this signal to generate a valid computer response onto arbitrary messages. All signals but IdIOAdded and IdTurn end up here! Example: <div class="fragment"><pre class="fragment"> <span class="keywordtype">void</span> Computer::slotCommand(<span class="keywordtype">int</span> &amp;msgid,QDataStream &amp;in,QDataStream &amp;out)
 {
   Q_INT32 data,move;
   in &gt;&gt; data;
   <span class="comment">// compute move ...</span>
   move=data*2;
   out &lt;&lt; move;
 }
</pre></div><p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>inputStream</em>&nbsp;</td><td>the incoming data stream </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>msgid</em>&nbsp;</td><td>the message id of the message which got transmitted to the computer </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>receiver</em>&nbsp;</td><td>the id of the receiver </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>sender</em>&nbsp;</td><td>the id of the sender </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="fb4ef05f8e0d4af6953e7196513ba7b7"></a><!-- doxytag: member="KGameProcess::signalTurn" ref="fb4ef05f8e0d4af6953e7196513ba7b7" args="(QDataStream &amp;stream, bool turn)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void KGameProcess::signalTurn           </td>
          <td>(</td>
          <td class="paramtype">QDataStream &amp;&nbsp;</td>
          <td class="paramname"> <em>stream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>turn</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [signal]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This signal is emmited if the computer player should perform a turn. 
<p>
Calculations can be made here and the move can then be send back with sendSystemMessage with the message id KGameMessage::IdPlayerInput. These must provide a move which complies to your other move syntax as e.g. produces by keyboard or mouse input. Additonal data which have been written into the stream from the ProcessIO's signal signalPrepareTurn can be retrieved from the stream here. Example: <div class="fragment"><pre class="fragment"> <span class="keywordtype">void</span> slotTurn(QDataStream &amp;in,<span class="keywordtype">bool</span> turn)
 {
   <span class="keywordtype">int</span> id;
   <span class="keywordtype">int</span> recv;
   QByteArray buffer;
   QDataStream out(buffer,IO_WriteOnly);
   <span class="keywordflow">if</span> (turn)
   {
     <span class="comment">// Create a move - the format is yours to decide</span>
     <span class="comment">// It arrives exactly as this in the kgame inputMove function!!</span>
     Q_INT8 x1,y1,pl;
     pl=-1;
     x1=proc.<a class="code" href="classKGameProcess.html#afeb0b0347ca5be96c5575f502d58cf9" title="Returns a pointer to a KRandomSequence.">random</a>()-&gt;getLong(8);
     y1=proc.<a class="code" href="classKGameProcess.html#afeb0b0347ca5be96c5575f502d58cf9" title="Returns a pointer to a KRandomSequence.">random</a>()-&gt;getLong(8);
     <span class="comment">// Stream it</span>
     out &lt;&lt; pl &lt;&lt; x1 &lt;&lt; y1;
     <span class="keywordtype">id</span>=KGameMessage::IdPlayerInput;
     proc.<a class="code" href="classKGameProcess.html#261048429198c46c126fe3a462591e6d" title="Sends a system message to the corresonding KGameIO device.">sendSystemMessage</a>(out,<span class="keywordtype">id</span>,0);
   }
 }
</pre></div><p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>stream</em>&nbsp;</td><td>The datastream which contains user data </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>turn</em>&nbsp;</td><td>True or false whether the turn is activated or deactivated </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="f7bad25a5e1425f9b819c9e86b5cf062"></a><!-- doxytag: member="KGameProcess::signalInit" ref="f7bad25a5e1425f9b819c9e86b5cf062" args="(QDataStream &amp;stream, int userid)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void KGameProcess::signalInit           </td>
          <td>(</td>
          <td class="paramtype">QDataStream &amp;&nbsp;</td>
          <td class="paramname"> <em>stream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>userid</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [signal]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This signal is emmited when the process is initialized, i.e. 
<p>
added to a <a class="el" href="classKPlayer.html" title="Base class for a game player.">KPlayer</a>. Initial initialisation can be performed here be reacting to the KProcessIO signal signalIOAdded and retrieving the data here from the stream. It works just as the <a class="el" href="classKGameProcess.html#fb4ef05f8e0d4af6953e7196513ba7b7" title="This signal is emmited if the computer player should perform a turn.">signalTurn()</a> but is only send when the player is added to the game, i.e. it needs some initialization data<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>stream</em>&nbsp;</td><td>The datastream which contains user data </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>userid</em>&nbsp;</td><td>The userId of the player. (Careful to rely on it yet) </td></tr>
  </table>
</dl>

</div>
</div><p>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="kgameprocess_8h-source.html">kgameprocess.h</a><li><a class="el" href="kgameprocess_8cpp-source.html">kgameprocess.cpp</a></ul>
</div>
    </div></div>


      </td>
  </tr>
  <tr>
    <td valign="top" id="leftmenu" width="25%">
      <a name="navigation"></a>
      <div class="menu_box"><h2>libkdegames</h2>
<div class="nav_list">
<ul><li><a href="index.html">Main Page</a></li><li><a href="hierarchy.html">Class Hierarchy</a></li><li><a href="classes.html">Alphabetical List</a></li><li><a href="annotated.html">Class List</a></li><li><a href="files.html">File List</a></li><li><a href="functions.html">Class Members</a></li><li><a href="pages.html">Related Pages</a></li></ul>
<!--
<h2>Class Picker</h2>
<div style="text-align: center;">
<form name="guideform">
<select name="guidelinks" style="width:100%;" onChange="window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value">
<option value="annotated.html">-- Choose --</option>
  <option value="classKCanvasRootPixmap.html">kcanvasrootpixmap</option>,  <option value="classKCardDialog.html">kcarddialog</option>,  <option value="classKChat.html">kchat</option>,  <option value="classKChatBase.html">kchatbase</option>,  <option value="classKChatBaseText.html">kchatbasetext</option>,  <option value="classKExtHighscore_1_1Item.html">kexthighscore::item</option>,  <option value="classKExtHighscore_1_1ItemArray.html">kexthighscore::itemarray</option>,  <option value="classKExtHighscore_1_1Manager.html">kexthighscore::manager</option>,  <option value="classKExtHighscore_1_1MultiplayerScores.html">kexthighscore::multiplayerscores</option>,  <option value="classKExtHighscore_1_1Score.html">kexthighscore::score</option>,  <option value="classKGame.html">kgame</option>,  <option value="classKGameChat.html">kgamechat</option>,  <option value="classKGameComputerIO.html">kgamecomputerio</option>,  <option value="classKGameConnectDialog.html">kgameconnectdialog</option>,  <option value="classKGameDialog.html">kgamedialog</option>,  <option value="classKGameDialogChatConfig.html">kgamedialogchatconfig</option>,  <option value="classKGameDialogConfig.html">kgamedialogconfig</option>,  <option value="classKGameErrorDialog.html">kgameerrordialog</option>,  <option value="classKGameErrorMessageDialog.html">kgameerrormessagedialog</option>,  <option value="classKGameIO.html">kgameio</option>,  <option value="classKGameKeyIO.html">kgamekeyio</option>,  <option value="classKGameLCD.html">kgamelcd</option>,  <option value="classKGameLCDClock.html">kgamelcdclock</option>,  <option value="classKGameLCDList.html">kgamelcdlist</option>,  <option value="classKGameMisc.html">kgamemisc</option>,  <option value="classKGameMouseIO.html">kgamemouseio</option>,  <option value="classKGameNetwork.html">kgamenetwork</option>,  <option value="classKGameProcess.html">kgameprocess</option>,  <option value="classKGameProcessIO.html">kgameprocessio</option>,  <option value="classKGameProgress.html">kgameprogress</option>,  <option value="classKGameProperty.html">kgameproperty</option>,  <option value="classKGamePropertyBase.html">kgamepropertybase</option>,  <option value="classKGamePropertyHandler.html">kgamepropertyhandler</option>,  <option value="classKGameSequence.html">kgamesequence</option>,  <option value="classKGrid2D_1_1Generic.html">kgrid2d::generic</option>,  <option value="classKGrid2D_1_1Hexagonal.html">kgrid2d::hexagonal</option>,  <option value="classKGrid2D_1_1HexagonalBase.html">kgrid2d::hexagonalbase</option>,  <option value="classKGrid2D_1_1Square.html">kgrid2d::square</option>,  <option value="classKGrid2D_1_1SquareBase.html">kgrid2d::squarebase</option>,  <option value="classKHighscore.html">khighscore</option>,  <option value="classKMessageClient.html">kmessageclient</option>,  <option value="classKMessageDirect.html">kmessagedirect</option>,  <option value="classKMessageIO.html">kmessageio</option>,  <option value="classKMessageServer.html">kmessageserver</option>,  <option value="classKMessageServerSocket.html">kmessageserversocket</option>,  <option value="classKMessageSocket.html">kmessagesocket</option>,  <option value="classKPlayer.html">kplayer</option>,  <option value="classKScoreDialog.html">kscoredialog</option>,  <option value="classKStdGameAction.html">kstdgameaction</option>,
</select>
</form>
</div>
-->
</div></div>
<div class="menu_box"><h2>API Dox</h2>
<div class="nav_list">
<ul>
<li><a href="../../libkdegames/html/index.html">libkdegames</a></li>
</ul></div></div>


        </td>
</tr>
</table>

<span class="doNotDisplay">
  <a href="http://www.kde.org/" accesskey="8">KDE Home</a> |
  <a href="http://accessibility.kde.org/" accesskey="9">KDE Accessibility Home</a> |
  <a href="http://www.kde.org/media/accesskeys.php" accesskey="0">Description of Access Keys</a>
</span>


<div style="height: 8px"></div>

<div id="footer">
  <div id="footer_left">
    Maintained by <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;groo&#116;&#64;kde&#46;or&#x67;">Adriaan de Groot</a>
and
<a href="&#109;a&#105;&#108;&#116;&#111;&#58;w&#105;nter&#64;kde&#46;or&#x67">Allen Winter</a>.
<br/>
    KDE and K Desktop Environment are trademarks of <a href="http://www.kde.org/areas/kde-ev/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> |
    <a href="http://www.kde.org/contact/impressum.php">Legal</a>
  </div>
  <div id="footer_right"><img src="/media/images/footer_right.png" style="margin: 0px" alt="" /></div>
</div>

<!--
WARNING: DO NOT SEND MAIL TO THE FOLLOWING EMAIL ADDRESS! YOU WILL
BE BLOCKED INSTANTLY AND PERMANENTLY!
<a href="mailto:aaaatrap-425acc3b5374943f@kde.org">Block me</a>
WARNING END
-->

</body>
</html>