Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > 68c0c2ff89d8bf9051ff1b9773ed48e4 > files > 8003

libzypp-doc-17.9.0-1.1.mga7.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libzypp: zypp::callback Namespace Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">libzypp
   &#160;<span id="projectnumber">17.9.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('namespacezypp_1_1callback.html','');});
/* @license-end */
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a>  </div>
  <div class="headertitle">
<div class="title">zypp::callback Namespace Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Callbacks light.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classzypp_1_1callback_1_1DistributeReport.html">DistributeReport</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structzypp_1_1callback_1_1ReceiveReport.html">ReceiveReport</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structzypp_1_1callback_1_1ReportBase.html">ReportBase</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structzypp_1_1callback_1_1SendReport.html">SendReport</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structzypp_1_1callback_1_1TempConnect.html">TempConnect</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Temporarily connect a <a class="el" href="structzypp_1_1callback_1_1ReceiveReport.html">ReceiveReport</a> then restore the previous one.  <a href="structzypp_1_1callback_1_1TempConnect.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classzypp_1_1callback_1_1UserData.html">UserData</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Typesafe passing of user data via callbacks.  <a href="classzypp_1_1callback_1_1UserData.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Callbacks light. </p>
<dl class="section user"><dt>The task report structure (SENDER SIDE).</dt><dd></dd></dl>
<p>A default constructible struct derived from <a class="el" href="structzypp_1_1callback_1_1ReportBase.html">callback::ReportBase</a>. It <b>must</b> <b>not</b> contain any data, just virtual methods.</p>
<p>These are the functions the sender invokes, and which will be forwarded to some receiver. If no receiver is present, the defined default implementations are invoked.</p>
<p>For methods returning non-void, define a reasonable return value, because this is what you get back in case no receiver is listening.</p>
<p>That way the sending side does not need to know whether some receiver is listening. And it enables the receiver to return a reasonable value, in case he's got no idea, what else to return.</p>
<div class="fragment"><div class="line"><span class="keyword">struct </span>Foo : <span class="keyword">public</span> callback::ReportBase</div><div class="line">{</div><div class="line">  <span class="keyword">virtual</span> <span class="keywordtype">void</span> ping( <span class="keywordtype">int</span> i )</div><div class="line">  {}</div><div class="line">  <span class="keyword">virtual</span> <span class="keywordtype">int</span> pong()</div><div class="line">  { <span class="keywordflow">return</span> -1; }</div><div class="line"></div><div class="line">};</div></div><!-- fragment --><dl class="section user"><dt>Sending a Task report (SENDER SIDE).</dt><dd></dd></dl>
<p>Simply create a callback::SendReport&lt;TReport&gt;, where TReport is your task report structure. Invoke the callback functions as needed. That's it.</p>
<dl class="section note"><dt>Note</dt><dd>Even creation and destruction of a <a class="el" href="structzypp_1_1callback_1_1SendReport.html">callback::SendReport</a> are indicated to a receiver. So even in case of an <a class="el" href="classzypp_1_1Exception.html" title="Base class for Exception.">Exception</a>, the receiver is able to recognize, that the task ended. So don't create it without need.</dd></dl>
<div class="fragment"><div class="line">{</div><div class="line">  callback::SendReport&lt;Foo&gt; <a class="code" href="MediaCurl_8cc.html#a4e0826ef1eedfec4b8c01665fedeb6d6">report</a>;</div><div class="line">  <a class="code" href="MediaCurl_8cc.html#a4e0826ef1eedfec4b8c01665fedeb6d6">report</a>-&gt;ping( 13 );</div><div class="line">  <span class="keywordtype">int</span> response = <a class="code" href="MediaCurl_8cc.html#a4e0826ef1eedfec4b8c01665fedeb6d6">report</a>-&gt;pong();</div><div class="line">}</div></div><!-- fragment --><dl class="section user"><dt>Receiving Task reports (RECEIVER SIDE).</dt><dd></dd></dl>
<p>To receive task reports of type <code>Foo</code> the recipient class derives from <a class="el" href="structzypp_1_1callback_1_1ReceiveReport.html">callback::ReceiveReport</a>&lt;Foo&gt;. <a class="el" href="structzypp_1_1callback_1_1ReceiveReport.html">callback::ReceiveReport</a> inherits <code>Foo</code> and provides two additional virtual methods:</p>
<div class="fragment"><div class="line"><span class="keyword">virtual</span> <span class="keywordtype">void</span> reportbegin() {}</div><div class="line"><span class="keyword">virtual</span> <span class="keywordtype">void</span> reportend() {}</div></div><!-- fragment --><p>These two are automatically invoked, whenever the sender creates a <a class="el" href="structzypp_1_1callback_1_1SendReport.html">callback::SendReport</a> instance, and when it gets destructed. So even if the sending task is aborted without sending an explicit notification, the reciever may notice it, by overloading <code>reportend</code>.</p>
<p>Overload the methods you're interested in.</p>
<dl class="section note"><dt>Note</dt><dd>In case you must return some value and don't know which, return the task structures default. The author of the task structure had to provide this value, so it's probabely better than anything you <em>invent</em>. <div class="fragment"><div class="line"><span class="keywordtype">int</span> somefunction()</div><div class="line">{</div><div class="line">  ...<span class="comment">// don&#39;t know what to return?</span></div><div class="line">  <span class="keywordflow">return</span> Foo::somefunction();</div><div class="line">}</div></div><!-- fragment --></dd></dl>
<dl class="section user"><dt>Connecting the Receiver</dt><dd></dd></dl>
<p>For this <a class="el" href="structzypp_1_1callback_1_1ReceiveReport.html">callback::ReceiveReport</a> provides 4 methods: </p><div class="fragment"><div class="line"><span class="keywordtype">void</span> connect();</div><div class="line"><span class="keywordtype">void</span> disconnect();</div><div class="line"><span class="keywordtype">bool</span> connected() <span class="keyword">const</span>;</div><div class="line">ReceiveReport * whoIsConnected() <span class="keyword">const</span>;</div></div><!-- fragment --><ul>
<li><code>connect</code> Connect this <a class="el" href="structzypp_1_1callback_1_1ReceiveReport.html">ReceiveReport</a> (in case some other <a class="el" href="structzypp_1_1callback_1_1ReceiveReport.html">ReceiveReport</a> is connected, it get disconnected. Remember its a Callback light). </li>
<li><code>disconnect</code> Disconnect this <a class="el" href="structzypp_1_1callback_1_1ReceiveReport.html">ReceiveReport</a> in case it is connected. If not connected nothing happens. </li>
<li><code>connected</code> Test whether this <a class="el" href="structzypp_1_1callback_1_1ReceiveReport.html">ReceiveReport</a> is currently connected. </li>
<li><code>whoIsConnected</code> Return a 'ReceiveReport*' to the currently connected <a class="el" href="structzypp_1_1callback_1_1ReceiveReport.html">ReceiveReport</a>, or <code>NULL</code> if none is connected.</li>
</ul>
<dl class="section user"><dt>Passing Userdata via Callbacks</dt><dd></dd></dl>
<p>For typesafe passing of user data via callbacks </p><dl class="section see"><dt>See also</dt><dd><a class="el" href="classzypp_1_1callback_1_1UserData.html">UserData</a>.</dd></dl>
<p><a class="el" href="structzypp_1_1callback_1_1ReportBase.html">ReportBase</a> provides a generic callback::ReportBase:report method which can be used to communicate by encoding everything in its <em><a class="el" href="classzypp_1_1callback_1_1UserData.html" title="Typesafe passing of user data via callbacks.">UserData</a></em> argument.</p>
<p>Convenient sending can be achieved by installing non-virtual methods in the TReport class, which encode the arguments in <a class="el" href="classzypp_1_1callback_1_1UserData.html" title="Typesafe passing of user data via callbacks.">UserData</a> and send them via <a class="el" href="structzypp_1_1callback_1_1ReportBase.html#a98d3195c01eb5f9011627acb3361fc70" title="The most generic way of sending/receiving data.">ReportBase::report()</a>.</p>
<p>Convenient receiving can be achieved by installing virtual methods in the TReport class, which can be simply overloaded by the receiver. Downside of this is that adding virtual methods breaks binary compatibility. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespacezypp.html">zypp</a></li><li class="navelem"><a class="el" href="namespacezypp_1_1callback.html">callback</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li>
  </ul>
</div>
</body>
</html>