Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 29c369053a983cc5d8c880dc6e0a2237 > files > 390

libdtn-devel-2.6.0-2mdv2009.1.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: LinkScheduleEstimator.h Source File</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.5.8 -->
<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>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>LinkScheduleEstimator.h</h1><a href="LinkScheduleEstimator_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 2005-2006 Intel Corporation</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">#include &lt;vector&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;oasys/util/IntUtils.h&gt;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;oasys/debug/Log.h&gt;</span>
<a name="l00020"></a>00020 
<a name="l00021"></a><a class="code" href="LinkScheduleEstimator_8h.html#8f5e7a313f30d7fae0aace3ea6cd46cb">00021</a> <span class="preprocessor">#define CONTACT(s, d) { s, d }</span>
<a name="l00022"></a><a class="code" href="LinkScheduleEstimator_8h.html#e64a9d9db36a4799b748b089556ce693">00022</a> <span class="preprocessor"></span><span class="preprocessor">#define absdiff(x,y) ((x&lt;y)?((y)-(x)):((x)-(y)))</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span>
<a name="l00024"></a><a class="code" href="LinkScheduleEstimator_8h.html#cc9f39477dafecc1ae1915ed6e80c949">00024</a> <span class="preprocessor">#define WARPING_WINDOW .02</span>
<a name="l00025"></a><a class="code" href="LinkScheduleEstimator_8h.html#84a4dcaf53749e9e0b0cff22345a29c3">00025</a> <span class="preprocessor"></span><span class="preprocessor">#define PERIOD_TOLERANCE .02</span>
<a name="l00026"></a><a class="code" href="LinkScheduleEstimator_8h.html#e4f6058c45a018de2c45bc43f0c405ae">00026</a> <span class="preprocessor"></span><span class="preprocessor">#define MAX_DIST 1&lt;&lt;30</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span>
<a name="l00028"></a>00028 <span class="keyword">namespace </span>dtn {
<a name="l00029"></a>00029     
<a name="l00046"></a><a class="code" href="classdtn_1_1LinkScheduleEstimator.html">00046</a> <span class="keyword">class </span><a class="code" href="classdtn_1_1LinkScheduleEstimator.html" title="Given a log on the form (start1, duration1), .">LinkScheduleEstimator</a> : <span class="keyword">public</span> oasys::<a class="code" href="classoasys_1_1Logger.html">Logger</a> {
<a name="l00047"></a>00047 <span class="keyword">public</span>:
<a name="l00048"></a><a class="code" href="structdtn_1_1LinkScheduleEstimator_1_1LogEntry.html">00048</a>     <span class="keyword">typedef</span> <span class="keyword">struct </span>{
<a name="l00049"></a><a class="code" href="structdtn_1_1LinkScheduleEstimator_1_1LogEntry.html#998c08c2e89d07a241b7a796481a6a4b">00049</a>       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> start;
<a name="l00050"></a><a class="code" href="structdtn_1_1LinkScheduleEstimator_1_1LogEntry.html#d5d94573912674010064c9ddbdff15e7">00050</a>       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> duration;
<a name="l00051"></a>00051     } <a class="code" href="structdtn_1_1LinkScheduleEstimator_1_1LogEntry.html">LogEntry</a>;
<a name="l00052"></a>00052     
<a name="l00053"></a><a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">00053</a>     <span class="keyword">typedef</span> std::vector&lt;LogEntry&gt; <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a>;
<a name="l00054"></a>00054     
<a name="l00055"></a>00055     <span class="keyword">static</span> <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a>* <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#04c89a1b33385566625dba0bcec80ac7">find_schedule</a>(<a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a>* <a class="code" href="namespacedtn.html#68bf4270dd0a7e5e8390869b83889922">log</a>);
<a name="l00056"></a>00056 
<a name="l00057"></a>00057     <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#cfee9ac8dfeba476eaecbef83af396c6">LinkScheduleEstimator</a>();
<a name="l00058"></a>00058 <span class="keyword">private</span>:
<a name="l00059"></a>00059     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#9bdc8a6a5b4cd5b4cd06f6d7555cce95">entry_dist</a>(<a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;a, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> a_index, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> a_offset,
<a name="l00060"></a>00060                             <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;b, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> b_index, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> b_offset,
<a name="l00061"></a>00061                             <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> warping_window);
<a name="l00062"></a>00062 
<a name="l00063"></a>00063     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#fb24f952b197b3d1bd6f7ba5ba33da35">log_dist_r</a>(<a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;a, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> a_index, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> a_offset,
<a name="l00064"></a>00064                             <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;b, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> b_index, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> b_offset,
<a name="l00065"></a>00065                             <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> warping_window);
<a name="l00066"></a>00066     
<a name="l00067"></a>00067        
<a name="l00068"></a>00068     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#4f92af378017bf063a3b5144dd3680ee">log_dist</a>(<a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;a, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> a_offset,
<a name="l00069"></a>00069                  <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;b, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> b_offset,
<a name="l00070"></a>00070                  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> warping_window, <span class="keywordtype">int</span> print_table);
<a name="l00071"></a>00071     
<a name="l00072"></a>00072     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#a61e879bc1ff9495bca8c0ae83d9c3a6">autocorrelation</a>(<a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;<a class="code" href="namespacedtn.html#68bf4270dd0a7e5e8390869b83889922">log</a>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> phase, <span class="keywordtype">int</span> print_table);    
<a name="l00073"></a>00073     <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#bd21da2cc439402e70d7fc0cf2a2c6ca">print_log</a>(<a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;<a class="code" href="namespacedtn.html#68bf4270dd0a7e5e8390869b83889922">log</a>, <span class="keywordtype">int</span> relative_dates);
<a name="l00074"></a>00074     
<a name="l00075"></a>00075     <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a>* <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#b8b4ab28ded6c1b5dba2d97cfbe02c51">generate_samples</a>(<a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;schedule,
<a name="l00076"></a>00076                           <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> log_size,
<a name="l00077"></a>00077                           <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> start_jitter,
<a name="l00078"></a>00078                           <span class="keywordtype">double</span> duration_jitter);
<a name="l00079"></a>00079     
<a name="l00080"></a>00080     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#d265c8f04daa7f58afe62733465fc747">estimate_period</a>(<a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;<a class="code" href="namespacedtn.html#68bf4270dd0a7e5e8390869b83889922">log</a>);       
<a name="l00081"></a>00081     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#1735a8401a37cf5e7f7473f797c16cb7" title="return the index of the closest log entry at or before the given date.">seek_to_before_date</a>(<a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;<a class="code" href="namespacedtn.html#68bf4270dd0a7e5e8390869b83889922">log</a>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> date);                
<a name="l00082"></a>00082     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#3a8b1347b7e2346fb47e9f3086eecd6d" title="return the index of the closest log entry to the given date">closest_entry_to_date</a>(<a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;<a class="code" href="namespacedtn.html#68bf4270dd0a7e5e8390869b83889922">log</a>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> date);
<a name="l00083"></a>00083     <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a>* <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#d682bec963c07b745a074e0f9227e4c4">clone_subsequence</a>(<a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;<a class="code" href="namespacedtn.html#68bf4270dd0a7e5e8390869b83889922">log</a>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> start, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="num2sdnv_8c.html#fed088663f8704004425cdae2120b9b3">len</a>);
<a name="l00084"></a>00084         
<a name="l00085"></a>00085     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#500562bbb64e252746e50df3bf6b7ef7">badness_of_match</a>(<a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;<a class="code" href="dtnperf-client_8c.html#71808395b2460b32d8b1048e44faef6e">pattern</a>,
<a name="l00086"></a>00086                                   <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;<a class="code" href="namespacedtn.html#68bf4270dd0a7e5e8390869b83889922">log</a>,
<a name="l00087"></a>00087                                   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> warping_window, 
<a name="l00088"></a>00088                                   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> period);
<a name="l00089"></a>00089     
<a name="l00090"></a>00090     <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a>* <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#53c3d355d5d0f4c13365dfc5319f2cb8">extract_schedule</a>(<a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;<a class="code" href="namespacedtn.html#68bf4270dd0a7e5e8390869b83889922">log</a>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> period_estimate);    
<a name="l00091"></a>00091     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#72909ef9d3fdd911fd87e8756b554edd">refine_period</a>(<a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;<a class="code" href="namespacedtn.html#68bf4270dd0a7e5e8390869b83889922">log</a>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> period_estimate);
<a name="l00092"></a>00092     <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a>* <a class="code" href="classdtn_1_1LinkScheduleEstimator.html#04c89a1b33385566625dba0bcec80ac7">find_schedule</a>(<a class="code" href="classdtn_1_1LinkScheduleEstimator.html#03f2dd943b7f8c9b0edc879ee4edabdf">Log</a> &amp;<a class="code" href="namespacedtn.html#68bf4270dd0a7e5e8390869b83889922">log</a>);    
<a name="l00093"></a>00093 };
<a name="l00094"></a>00094 
<a name="l00095"></a>00095 
<a name="l00096"></a>00096 }
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Fri Jan 30 09:26:57 2009 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.8 </small></address>
</body>
</html>