Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > d9faa203c2b0b6fbb179d93daaea81b7 > files > 40

libdtn-devel-2.6.0-1mdv2009.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>DTN Reference Implementation: Alarm.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
<h1>Alarm.h</h1><a href="Alarm_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> *    Copyright 2007 Baylor University</span>
<a name="l00003"></a>00003 <span class="comment"> * </span>
<a name="l00004"></a>00004 <span class="comment"> *    Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="l00005"></a>00005 <span class="comment"> *    you may not use this file except in compliance with the License.</span>
<a name="l00006"></a>00006 <span class="comment"> *    You may obtain a copy of the License at</span>
<a name="l00007"></a>00007 <span class="comment"> * </span>
<a name="l00008"></a>00008 <span class="comment"> *        http://www.apache.org/licenses/LICENSE-2.0</span>
<a name="l00009"></a>00009 <span class="comment"> * </span>
<a name="l00010"></a>00010 <span class="comment"> *    Unless required by applicable law or agreed to in writing, software</span>
<a name="l00011"></a>00011 <span class="comment"> *    distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="l00012"></a>00012 <span class="comment"> *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="l00013"></a>00013 <span class="comment"> *    See the License for the specific language governing permissions and</span>
<a name="l00014"></a>00014 <span class="comment"> *    limitations under the License.</span>
<a name="l00015"></a>00015 <span class="comment"> */</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#ifndef _PROPHET_ALARM_H_</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define _PROPHET_ALARM_H_</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;sys/time.h&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;sys/types.h&gt;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="keyword">namespace </span>prophet
<a name="l00026"></a>00026 {
<a name="l00027"></a>00027 
<a name="l00031"></a><a class="code" href="classprophet_1_1ExpirationHandler.html">00031</a> <span class="keyword">class </span><a class="code" href="classprophet_1_1ExpirationHandler.html" title="Alarm expiration handler.">ExpirationHandler</a>
<a name="l00032"></a>00032 {
<a name="l00033"></a>00033 <span class="keyword">public</span>:
<a name="l00037"></a><a class="code" href="classprophet_1_1ExpirationHandler.html#4d07a4e23a7f9e1f96d579662125a890">00037</a>     <a class="code" href="classprophet_1_1ExpirationHandler.html#4d07a4e23a7f9e1f96d579662125a890" title="Constructor.">ExpirationHandler</a>(<span class="keyword">const</span> std::string&amp; <a class="code" href="classprophet_1_1ExpirationHandler.html#a1d4ba4922d44190ba483eaf0da31607" title="Accessor.">name</a> = <span class="stringliteral">""</span>)
<a name="l00038"></a>00038         : <a class="code" href="classprophet_1_1ExpirationHandler.html#553d23aa37f20372b0e36808016d40c2">name_</a>(<a class="code" href="classprophet_1_1ExpirationHandler.html#a1d4ba4922d44190ba483eaf0da31607" title="Accessor.">name</a>) {}
<a name="l00039"></a>00039 
<a name="l00043"></a><a class="code" href="classprophet_1_1ExpirationHandler.html#325e7e22f6d9a2681b9a2470d6873879">00043</a>     <span class="keyword">virtual</span> <a class="code" href="classprophet_1_1ExpirationHandler.html#325e7e22f6d9a2681b9a2470d6873879" title="Destructor.">~ExpirationHandler</a>() {}
<a name="l00044"></a>00044 
<a name="l00048"></a>00048     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classprophet_1_1ExpirationHandler.html#bbdbff285abd02df47b26ae6dab909c8" title="Method to invoke when associated alarm expires.">handle_timeout</a>() = 0;
<a name="l00049"></a>00049 
<a name="l00053"></a><a class="code" href="classprophet_1_1ExpirationHandler.html#a1d4ba4922d44190ba483eaf0da31607">00053</a>     <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="classprophet_1_1ExpirationHandler.html#a1d4ba4922d44190ba483eaf0da31607" title="Accessor.">name</a>() { <span class="keywordflow">return</span> <a class="code" href="classprophet_1_1ExpirationHandler.html#553d23aa37f20372b0e36808016d40c2">name_</a>.c_str(); }
<a name="l00054"></a>00054 
<a name="l00058"></a><a class="code" href="classprophet_1_1ExpirationHandler.html#2fc197ff66100e9aa15837199277eb8a">00058</a>     <span class="keywordtype">void</span> <a class="code" href="classprophet_1_1ExpirationHandler.html#2fc197ff66100e9aa15837199277eb8a" title="Mutator.">set_name</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="classprophet_1_1ExpirationHandler.html#a1d4ba4922d44190ba483eaf0da31607" title="Accessor.">name</a>) { <a class="code" href="classprophet_1_1ExpirationHandler.html#553d23aa37f20372b0e36808016d40c2">name_</a>.assign(name); }
<a name="l00059"></a>00059 
<a name="l00060"></a>00060 <span class="keyword">protected</span>:
<a name="l00061"></a><a class="code" href="classprophet_1_1ExpirationHandler.html#553d23aa37f20372b0e36808016d40c2">00061</a>     std::string <a class="code" href="classprophet_1_1ExpirationHandler.html#553d23aa37f20372b0e36808016d40c2">name_</a>;
<a name="l00062"></a>00062 
<a name="l00063"></a>00063 }; <span class="comment">// class ExpirationHandler</span>
<a name="l00064"></a>00064 
<a name="l00068"></a><a class="code" href="classprophet_1_1Alarm.html">00068</a> <span class="keyword">class </span><a class="code" href="classprophet_1_1Alarm.html" title="Alarm registration.">Alarm</a>
<a name="l00069"></a>00069 {
<a name="l00070"></a>00070 <span class="keyword">public</span>:
<a name="l00074"></a><a class="code" href="classprophet_1_1Alarm.html#987f663429fa93cdbc7884d5411eb703">00074</a>     <a class="code" href="classprophet_1_1Alarm.html#987f663429fa93cdbc7884d5411eb703" title="Constructor.">Alarm</a>(<a class="code" href="classprophet_1_1ExpirationHandler.html" title="Alarm expiration handler.">ExpirationHandler</a>* handler)
<a name="l00075"></a>00075         : <a class="code" href="classprophet_1_1Alarm.html#2b6199fb54a7298db1a256e70565d42d" title="action to perform when alarm expires">handler_</a>(handler) {}
<a name="l00076"></a>00076     
<a name="l00080"></a><a class="code" href="classprophet_1_1Alarm.html#651ac71929528bf130564c31ae5d9c5e">00080</a>     <span class="keyword">virtual</span> <a class="code" href="classprophet_1_1Alarm.html#651ac71929528bf130564c31ae5d9c5e" title="Destructor.">~Alarm</a>() {}
<a name="l00081"></a>00081 
<a name="l00085"></a>00085     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classprophet_1_1Alarm.html#63c754c7cac177eba56e52a1a0dda218" title="How many milliseconds in the future to schedule this alarm.">schedule</a>(u_int milliseconds) = 0;
<a name="l00086"></a>00086 
<a name="l00090"></a>00090     <span class="keyword">virtual</span> u_int <a class="code" href="classprophet_1_1Alarm.html#3304d46e4d44b59e1e2387c7c2f3bb07" title="Milliseconds remaining until alarm expires.">time_remaining</a>() <span class="keyword">const</span> = 0;
<a name="l00091"></a>00091 
<a name="l00097"></a>00097     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classprophet_1_1Alarm.html#508522f8fbea59f5b6a64a6fafae5f4c" title="Disable the alarm; do not execute the handler.">cancel</a>() = 0;
<a name="l00098"></a>00098 
<a name="l00103"></a><a class="code" href="classprophet_1_1Alarm.html#2b338adb4dc614f739697d18813f88b5">00103</a>     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classprophet_1_1Alarm.html#2b338adb4dc614f739697d18813f88b5" title="Invoke timeout handler.">timeout</a>() { <a class="code" href="classprophet_1_1Alarm.html#2b6199fb54a7298db1a256e70565d42d" title="action to perform when alarm expires">handler_</a>-&gt;<a class="code" href="classprophet_1_1ExpirationHandler.html#bbdbff285abd02df47b26ae6dab909c8" title="Method to invoke when associated alarm expires.">handle_timeout</a>(); }
<a name="l00104"></a>00104 
<a name="l00106"></a>00106     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classprophet_1_1Alarm.html#6d7567c66026f23fa7ef545b23110fe5" title="Accessors.">pending</a>() <span class="keyword">const</span> = 0;
<a name="l00107"></a>00107     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classprophet_1_1Alarm.html#c091adaa44e62772c19f20d23efebd92" title="Accessors.">cancelled</a>() <span class="keyword">const</span> = 0;
<a name="l00109"></a>00109 
<a name="l00110"></a>00110 <span class="keyword">protected</span>: 
<a name="l00111"></a><a class="code" href="classprophet_1_1Alarm.html#2b6199fb54a7298db1a256e70565d42d">00111</a>     <a class="code" href="classprophet_1_1ExpirationHandler.html" title="Alarm expiration handler.">ExpirationHandler</a>* <span class="keyword">const</span> <a class="code" href="classprophet_1_1Alarm.html#2b6199fb54a7298db1a256e70565d42d" title="action to perform when alarm expires">handler_</a>; 
<a name="l00112"></a>00112 
<a name="l00113"></a>00113 }; <span class="comment">// class Alarm</span>
<a name="l00114"></a>00114 
<a name="l00115"></a>00115 }; <span class="comment">// namespace prophet</span>
<a name="l00116"></a>00116 
<a name="l00117"></a>00117 <span class="preprocessor">#endif // _PROPHET_ALARM_H_</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Jul 21 14:09:37 2008 for DTN Reference Implementation by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>