Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > os > by-pkgid > 9c481c872fb0ae0cbadccdc2f4a18ab6 > files > 234

libasync-devel-0.17.0-5.fc14.x86_64.rpm

<!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">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Async: Async::Timer Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.2-20100208 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespaceAsync.html">Async</a>::<a class="el" href="classAsync_1_1Timer.html">Timer</a>
  </div>
</div>
<div class="contents">
<h1>Async::Timer Class Reference</h1><!-- doxytag: class="Async::Timer" -->
<p>A class that produces timer events.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="AsyncTimer_8h_source.html">AsyncTimer.h</a>&gt;</code></p>

<p><a href="classAsync_1_1Timer-members.html">List of all members.</a></p>
<h2>Public Types</h2>
<ul>
<li>enum <a class="el" href="classAsync_1_1Timer.html#a113ca6dbd092d592fa10e224f3f99ce4">Type</a> { <a class="el" href="classAsync_1_1Timer.html#a113ca6dbd092d592fa10e224f3f99ce4ab0979d53c709ad785cbd670b01048203">TYPE_ONESHOT</a>, 
<a class="el" href="classAsync_1_1Timer.html#a113ca6dbd092d592fa10e224f3f99ce4a2fc5ee9add40fddebecf2a009d91255a">TYPE_PERIODIC</a>
 }
<dl class="el"><dd class="mdescRight"><p>The type of the timer. </p>
 <a href="classAsync_1_1Timer.html#a113ca6dbd092d592fa10e224f3f99ce4">More...</a><br/></dl></ul>
<h2>Public Member Functions</h2>
<ul>
<li><a class="el" href="classAsync_1_1Timer.html#a92d48c80063aa06e7b1b897d8248b76a">Timer</a> (int timeout_ms=0, <a class="el" href="classAsync_1_1Timer.html#a113ca6dbd092d592fa10e224f3f99ce4">Type</a> type=TYPE_ONESHOT)
<dl class="el"><dd class="mdescRight">Constructor.  <a href="#a92d48c80063aa06e7b1b897d8248b76a"></a><br/></dl><li><a class="el" href="classAsync_1_1Timer.html#a2003cbca6220d0067e145190b9e257f0">~Timer</a> (void)
<dl class="el"><dd class="mdescRight">Destructor.  <a href="#a2003cbca6220d0067e145190b9e257f0"></a><br/></dl><li><a class="el" href="classAsync_1_1Timer.html#a113ca6dbd092d592fa10e224f3f99ce4">Type</a> <a class="el" href="classAsync_1_1Timer.html#a6a96c384703dd9dd14c7e2cb30faaf43">type</a> (void) const 
<dl class="el"><dd class="mdescRight">Return the type of this timer.  <a href="#a6a96c384703dd9dd14c7e2cb30faaf43"></a><br/></dl><li>void <a class="el" href="classAsync_1_1Timer.html#a76f34ef1d8de22424ad46683dac07e8d">setTimeout</a> (int timeout_ms)
<dl class="el"><dd class="mdescRight">Set (change) the timeout value.  <a href="#a76f34ef1d8de22424ad46683dac07e8d"></a><br/></dl><li>int <a class="el" href="classAsync_1_1Timer.html#a2446fb78b6a7f271aaeda61d7b19fbea">timeout</a> (void) const 
<dl class="el"><dd class="mdescRight">Return the setting of the timeout value.  <a href="#a2446fb78b6a7f271aaeda61d7b19fbea"></a><br/></dl><li>void <a class="el" href="classAsync_1_1Timer.html#ad2b6f5e24b9619c354e2ecf1e21241bc">setEnable</a> (bool do_enable)
<dl class="el"><dd class="mdescRight">Enable or disable the timer.  <a href="#ad2b6f5e24b9619c354e2ecf1e21241bc"></a><br/></dl><li>bool <a class="el" href="classAsync_1_1Timer.html#a9d54660cdc9f40ccf336472b4930dbbe">isEnabled</a> (void) const 
<dl class="el"><dd class="mdescRight">Check if the timer is enabled.  <a href="#a9d54660cdc9f40ccf336472b4930dbbe"></a><br/></dl><li>void <a class="el" href="classAsync_1_1Timer.html#aa839ecf5ba0f52c25138a034597b59c2">reset</a> (void)
<dl class="el"><dd class="mdescRight">Reset (restart) the timer.  <a href="#aa839ecf5ba0f52c25138a034597b59c2"></a><br/></dl></ul>
<h2>Public Attributes</h2>
<ul>
<li>SigC::Signal1&lt; void, <a class="el" href="classAsync_1_1Timer.html">Timer</a> * &gt; <a class="el" href="classAsync_1_1Timer.html#a5ecea935e5b236d595bdd2314280b992">expired</a>
<dl class="el"><dd class="mdescRight">A signal that is emitted when the timer expires.  <a href="#a5ecea935e5b236d595bdd2314280b992"></a><br/></dl></ul>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>A class that produces timer events. </p>
<dl class="author"><dt><b>Author:</b></dt><dd>Tobias Blomberg </dd></dl>
<dl class="date"><dt><b>Date:</b></dt><dd>2003-03-26</dd></dl>
<p>This class is used to create timer objects. These objects will emit a signal when the specified time has elapsed. An example of how to use it is shown below.</p>
<div class="fragment"><pre class="fragment"><span class="preprocessor">#include &lt;iostream&gt;</span>
<span class="preprocessor">#include &lt;<a class="code" href="AsyncCppApplication_8h.html" title="The core class for writing asyncronous cpp applications.">AsyncCppApplication.h</a>&gt;</span>
<span class="preprocessor">#include &lt;<a class="code" href="AsyncTimer_8h.html" title="Contains a single shot or periodic timer that emits a signal on timeout.">AsyncTimer.h</a>&gt;</span>

<span class="keyword">using namespace </span>std;
<span class="keyword">using namespace </span>Async;

<span class="keyword">class </span>MyClass : <span class="keyword">public</span> SigC::Object
{
  <span class="keyword">public</span>:
    MyClass(<span class="keywordtype">void</span>) : count(0)
    {
      timer = <span class="keyword">new</span> <a class="code" href="classAsync_1_1Timer.html#a92d48c80063aa06e7b1b897d8248b76a" title="Constructor.">Timer</a>(1000, <a class="code" href="classAsync_1_1Timer.html#a113ca6dbd092d592fa10e224f3f99ce4a2fc5ee9add40fddebecf2a009d91255a" title="A timer that restarts itself every time it expires.">Timer::TYPE_PERIODIC</a>);
      timer-&gt;expired.connect(slot(*<span class="keyword">this</span>, &amp;MyClass::onTimerExpired));
    }
    
    ~MyClass(<span class="keywordtype">void</span>)
    {
      <span class="keyword">delete</span> timer;
    }

  <span class="keyword">private</span>:
    <a class="code" href="classAsync_1_1Timer.html#a92d48c80063aa06e7b1b897d8248b76a" title="Constructor.">Timer</a> * timer;
    <span class="keywordtype">int</span>     count;
    
    <span class="keywordtype">void</span> onTimerExpired(<a class="code" href="classAsync_1_1Timer.html#a92d48c80063aa06e7b1b897d8248b76a" title="Constructor.">Timer</a> *t)
    {
      <span class="keywordflow">if</span> (++count == 3)
      {
        <a class="code" href="classAsync_1_1Application.html#aa6d446d6b333e0a1e5cc1400c07aa898" title="Get the one and only application instance.">Application::app</a>().quit();
      }
      cout &lt;&lt; <span class="stringliteral">&quot;Timer expired &quot;</span> &lt;&lt; count &lt;&lt; <span class="stringliteral">&quot;...\n&quot;</span>;
    }
};

<span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)
{
  CppApplication app;
  MyClass my_class;
  app.exec();
}
</pre></div> <dl><dt><b>Examples: </b></dt><dd>
<p><a class="el" href="AsyncTimer__demo_8cpp-example.html#_a0">AsyncTimer_demo.cpp</a>.</p>
</dd>
</dl>
<p>Definition at line <a class="el" href="AsyncTimer_8h_source.html#l00116">116</a> of file <a class="el" href="AsyncTimer_8h_source.html">AsyncTimer.h</a>.</p>
<hr/><h2>Member Enumeration Documentation</h2>
<a class="anchor" id="a113ca6dbd092d592fa10e224f3f99ce4"></a><!-- doxytag: member="Async::Timer::Type" ref="a113ca6dbd092d592fa10e224f3f99ce4" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="classAsync_1_1Timer.html#a113ca6dbd092d592fa10e224f3f99ce4">Async::Timer::Type</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The type of the timer. </p>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="a113ca6dbd092d592fa10e224f3f99ce4ab0979d53c709ad785cbd670b01048203"></a><!-- doxytag: member="TYPE_ONESHOT" ref="a113ca6dbd092d592fa10e224f3f99ce4ab0979d53c709ad785cbd670b01048203" args="" -->TYPE_ONESHOT</em>&nbsp;</td><td>
<p>A timer that expires once. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a113ca6dbd092d592fa10e224f3f99ce4a2fc5ee9add40fddebecf2a009d91255a"></a><!-- doxytag: member="TYPE_PERIODIC" ref="a113ca6dbd092d592fa10e224f3f99ce4a2fc5ee9add40fddebecf2a009d91255a" args="" -->TYPE_PERIODIC</em>&nbsp;</td><td>
<p>A timer that restarts itself every time it expires. </p>
</td></tr>
</table>
</dd>
</dl>

<p>Definition at line <a class="el" href="AsyncTimer_8h_source.html#l00122">122</a> of file <a class="el" href="AsyncTimer_8h_source.html">AsyncTimer.h</a>.</p>

</div>
</div>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a92d48c80063aa06e7b1b897d8248b76a"></a><!-- doxytag: member="Async::Timer::Timer" ref="a92d48c80063aa06e7b1b897d8248b76a" args="(int timeout_ms=0, Type type=TYPE_ONESHOT)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Async::Timer::Timer </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>timeout_ms</em> = <code>0</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classAsync_1_1Timer.html#a113ca6dbd092d592fa10e224f3f99ce4">Type</a>&nbsp;</td>
          <td class="paramname"> <em>type</em> = <code>TYPE_ONESHOT</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Constructor. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>timeout_ms</em>&nbsp;</td><td>The timeout value in milliseconds </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>type</em>&nbsp;</td><td>The type of timer to use (see <a class="el" href="classAsync_1_1Timer.html#a113ca6dbd092d592fa10e224f3f99ce4">Type</a>)</td></tr>
  </table>
  </dd>
</dl>
<p>If no arguments are given (default constructor) a timer that expires immediately will be created. Such a timer can for example be used to delay the execution of some function until all active callbacks have returned. </p>

</div>
</div>
<a class="anchor" id="a2003cbca6220d0067e145190b9e257f0"></a><!-- doxytag: member="Async::Timer::~Timer" ref="a2003cbca6220d0067e145190b9e257f0" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Async::Timer::~Timer </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Destructor. </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a9d54660cdc9f40ccf336472b4930dbbe"></a><!-- doxytag: member="Async::Timer::isEnabled" ref="a9d54660cdc9f40ccf336472b4930dbbe" args="(void) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Async::Timer::isEnabled </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Check if the timer is enabled. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns <em>true</em> if the timer is enabled or <em>false</em> if it is disabled </dd></dl>

<p>Definition at line <a class="el" href="AsyncTimer_8h_source.html#l00180">180</a> of file <a class="el" href="AsyncTimer_8h_source.html">AsyncTimer.h</a>.</p>

</div>
</div>
<a class="anchor" id="aa839ecf5ba0f52c25138a034597b59c2"></a><!-- doxytag: member="Async::Timer::reset" ref="aa839ecf5ba0f52c25138a034597b59c2" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Async::Timer::reset </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Reset (restart) the timer. </p>
<p>This function is used to reset the timer. After reset it will take <em>timeout</em> milliseconds before the timer expires, where <em>timeout</em> is the previously set timeout value. If the timer is disabled, this function will do nothing. </p>

</div>
</div>
<a class="anchor" id="ad2b6f5e24b9619c354e2ecf1e21241bc"></a><!-- doxytag: member="Async::Timer::setEnable" ref="ad2b6f5e24b9619c354e2ecf1e21241bc" args="(bool do_enable)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Async::Timer::setEnable </td>
          <td>(</td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>do_enable</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Enable or disable the timer. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>do_enable</em>&nbsp;</td><td>Set to <em>true</em> to enable the timer or <em>false</em> to disable it </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a76f34ef1d8de22424ad46683dac07e8d"></a><!-- doxytag: member="Async::Timer::setTimeout" ref="a76f34ef1d8de22424ad46683dac07e8d" args="(int timeout_ms)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Async::Timer::setTimeout </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>timeout_ms</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set (change) the timeout value. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>timeout_ms</em>&nbsp;</td><td>The new timeout value in milliseconds</td></tr>
  </table>
  </dd>
</dl>
<p>Use this function to set a new timeout value on an existing timer. The timer will expire when the new timeout time has elapsed. If the timer is disabled, this function will set the new timeout value but it will not enable the timer. </p>

</div>
</div>
<a class="anchor" id="a2446fb78b6a7f271aaeda61d7b19fbea"></a><!-- doxytag: member="Async::Timer::timeout" ref="a2446fb78b6a7f271aaeda61d7b19fbea" args="(void) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Async::Timer::timeout </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Return the setting of the timeout value. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns the timeout value in milliseconds </dd></dl>

<p>Definition at line <a class="el" href="AsyncTimer_8h_source.html#l00166">166</a> of file <a class="el" href="AsyncTimer_8h_source.html">AsyncTimer.h</a>.</p>

</div>
</div>
<a class="anchor" id="a6a96c384703dd9dd14c7e2cb30faaf43"></a><!-- doxytag: member="Async::Timer::type" ref="a6a96c384703dd9dd14c7e2cb30faaf43" args="(void) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classAsync_1_1Timer.html#a113ca6dbd092d592fa10e224f3f99ce4">Type</a> Async::Timer::type </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Return the type of this timer. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns the type of this timer </dd></dl>

<p>Definition at line <a class="el" href="AsyncTimer_8h_source.html#l00149">149</a> of file <a class="el" href="AsyncTimer_8h_source.html">AsyncTimer.h</a>.</p>

</div>
</div>
<hr/><h2>Member Data Documentation</h2>
<a class="anchor" id="a5ecea935e5b236d595bdd2314280b992"></a><!-- doxytag: member="Async::Timer::expired" ref="a5ecea935e5b236d595bdd2314280b992" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SigC::Signal1&lt;void, <a class="el" href="classAsync_1_1Timer.html">Timer</a> *&gt; <a class="el" href="classAsync_1_1Timer.html#a5ecea935e5b236d595bdd2314280b992">Async::Timer::expired</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>A signal that is emitted when the timer expires. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>timer</em>&nbsp;</td><td>A pointer to the timer that has expired</td></tr>
  </table>
  </dd>
</dl>
<p>This signal is emitted when the timer expires. It is perfectly legal to delete the timer in the connected slot if it is known to be the only connected slot. </p>

<p>Definition at line <a class="el" href="AsyncTimer_8h_source.html#l00200">200</a> of file <a class="el" href="AsyncTimer_8h_source.html">AsyncTimer.h</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="AsyncTimer_8h_source.html">AsyncTimer.h</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address>
</body>
</html>