Sophie

Sophie

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

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: GlobalStore.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>GlobalStore.h</h1><a href="GlobalStore_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 2004-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">#ifndef _GLOBAL_STORE_H_</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define _GLOBAL_STORE_H_</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;oasys/debug/DebugUtils.h&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;oasys/debug/Log.h&gt;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;oasys/serialize/Serialize.h&gt;</span>
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="comment">// forward decl</span>
<a name="l00025"></a>00025 <span class="keyword">namespace </span>oasys {
<a name="l00026"></a>00026 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> _Type&gt; <span class="keyword">class </span>SingleTypeDurableTable;
<a name="l00027"></a>00027 <span class="keyword">class </span>DurableStore;
<a name="l00028"></a>00028 <span class="keyword">class </span>Mutex;
<a name="l00029"></a>00029 <span class="keyword">class </span>StorageConfig;
<a name="l00030"></a>00030 }
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="keyword">namespace </span>dtn {
<a name="l00033"></a>00033 
<a name="l00034"></a>00034 <span class="keyword">class </span>Globals;
<a name="l00035"></a>00035 
<a name="l00042"></a><a class="code" href="classdtn_1_1GlobalStore.html">00042</a> <span class="keyword">class </span><a class="code" href="classdtn_1_1GlobalStore.html" title="Class for those elements of the router that need to be persistently stored but are...">GlobalStore</a> : <span class="keyword">public</span> oasys::<a class="code" href="classoasys_1_1Logger.html">Logger</a> {
<a name="l00043"></a>00043 <span class="keyword">public</span>:
<a name="l00044"></a><a class="code" href="classdtn_1_1GlobalStore.html#c49069461c18c4fcc29fbbb42fe02232">00044</a>     <span class="keyword">static</span> <span class="keyword">const</span> u_int32_t <a class="code" href="classdtn_1_1GlobalStore.html#c49069461c18c4fcc29fbbb42fe02232">CURRENT_VERSION</a>;
<a name="l00045"></a>00045     
<a name="l00049"></a><a class="code" href="classdtn_1_1GlobalStore.html#84112e55922524eb85a143be7d5197a0">00049</a>     <span class="keyword">static</span> <a class="code" href="classdtn_1_1GlobalStore.html" title="Class for those elements of the router that need to be persistently stored but are...">GlobalStore</a>* <a class="code" href="classdtn_1_1GlobalStore.html#84112e55922524eb85a143be7d5197a0" title="Singleton instance accessor.">instance</a>() {
<a name="l00050"></a>00050         <span class="keywordflow">if</span> (<a class="code" href="classdtn_1_1GlobalStore.html#cddeeabc9fbd02c65c9bccc30cc92661" title="singleton instance">instance_</a> == NULL) {
<a name="l00051"></a>00051             PANIC(<span class="stringliteral">"GlobalStore::init not called yet"</span>);
<a name="l00052"></a>00052         }
<a name="l00053"></a>00053         <span class="keywordflow">return</span> <a class="code" href="classdtn_1_1GlobalStore.html#cddeeabc9fbd02c65c9bccc30cc92661" title="singleton instance">instance_</a>;
<a name="l00054"></a>00054     }
<a name="l00055"></a>00055 
<a name="l00060"></a>00060     <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1GlobalStore.html#87cea517050ba03905ec0f9b288783cc" title="Boot time initializer.">init</a>(<span class="keyword">const</span> oasys::StorageConfig&amp; cfg, 
<a name="l00061"></a>00061                     oasys::DurableStore*        store);
<a name="l00062"></a>00062 
<a name="l00066"></a>00066     <a class="code" href="classdtn_1_1GlobalStore.html#6f4f3b455773baf77dfb80d6300ee6a3" title="Constructor.">GlobalStore</a>();
<a name="l00067"></a>00067 
<a name="l00071"></a>00071     <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1GlobalStore.html#3638bc6ee40e3be5b24b7bcbde0e5c7e" title="Real initialization method.">do_init</a>(<span class="keyword">const</span> oasys::StorageConfig&amp; cfg, 
<a name="l00072"></a>00072                 oasys::DurableStore*        store);
<a name="l00073"></a>00073     
<a name="l00077"></a><a class="code" href="classdtn_1_1GlobalStore.html#fab631e45c3d2136d3f227be9f07bbcb">00077</a>     <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classdtn_1_1GlobalStore.html#fab631e45c3d2136d3f227be9f07bbcb" title="Return true if initialization has completed.">initialized</a>() { <span class="keywordflow">return</span> (<a class="code" href="classdtn_1_1GlobalStore.html#cddeeabc9fbd02c65c9bccc30cc92661" title="singleton instance">instance_</a> != NULL); }
<a name="l00078"></a>00078     
<a name="l00082"></a>00082     <a class="code" href="classdtn_1_1GlobalStore.html#639c03b947345cef9815c529df76d37a" title="Destructor.">~GlobalStore</a>();
<a name="l00083"></a>00083 
<a name="l00089"></a>00089     u_int32_t <a class="code" href="classdtn_1_1GlobalStore.html#70842bf9404fe5c9ec84bb9fc99c657e" title="Get a new bundle id, updating the value in the store.">next_bundleid</a>();
<a name="l00090"></a>00090     
<a name="l00098"></a>00098     u_int32_t <a class="code" href="classdtn_1_1GlobalStore.html#0cd22769f4f62af9ef5779f453814d16" title="Get a new unique registration id, updating the running value in the persistent table...">next_regid</a>();
<a name="l00099"></a>00099 
<a name="l00103"></a>00103     <span class="keywordtype">bool</span> <a class="code" href="classdtn_1_1GlobalStore.html#f13b2a032c0320672940f4bff3b5c0d7" title="Load in the globals.">load</a>();
<a name="l00104"></a>00104 
<a name="l00108"></a>00108     <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1GlobalStore.html#75296d47a62dd53eaf6f4e6844e56da9" title="Close (and flush) the data store.">close</a>();
<a name="l00109"></a>00109 
<a name="l00110"></a>00110 <span class="keyword">protected</span>:
<a name="l00114"></a>00114     <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1GlobalStore.html#a1ccd629fa2ff5f48068702895eaab7f" title="Update the globals in the store.">update</a>();
<a name="l00115"></a>00115 
<a name="l00119"></a>00119     <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1GlobalStore.html#acf08d987fd4d96a0bd7f55a65199052" title="Calculate a digest of on-disk serialized objects.">calc_digest</a>(u_char* digest);
<a name="l00120"></a>00120 
<a name="l00121"></a><a class="code" href="classdtn_1_1GlobalStore.html#a4f769642ccfd052bce745507bab471f">00121</a>     <span class="keywordtype">bool</span> <a class="code" href="classdtn_1_1GlobalStore.html#a4f769642ccfd052bce745507bab471f">loaded_</a>;
<a name="l00122"></a><a class="code" href="classdtn_1_1GlobalStore.html#362bfa46205417ad036335ddaa03f8ad">00122</a>     <a class="code" href="classdtn_1_1Globals.html">Globals</a>* <a class="code" href="classdtn_1_1GlobalStore.html#362bfa46205417ad036335ddaa03f8ad">globals_</a>;
<a name="l00123"></a><a class="code" href="classdtn_1_1GlobalStore.html#b57f9969fa2b0bf21bf050d2be3db3bc">00123</a>     oasys::SingleTypeDurableTable&lt;Globals&gt;* <a class="code" href="classdtn_1_1GlobalStore.html#b57f9969fa2b0bf21bf050d2be3db3bc">store_</a>;
<a name="l00124"></a>00124 
<a name="l00125"></a><a class="code" href="classdtn_1_1GlobalStore.html#6eafeca26db895e83de98e0b644eb695">00125</a>     oasys::Mutex* <a class="code" href="classdtn_1_1GlobalStore.html#6eafeca26db895e83de98e0b644eb695">lock_</a>;
<a name="l00126"></a>00126 
<a name="l00127"></a><a class="code" href="classdtn_1_1GlobalStore.html#cddeeabc9fbd02c65c9bccc30cc92661">00127</a>     <span class="keyword">static</span> <a class="code" href="classdtn_1_1GlobalStore.html" title="Class for those elements of the router that need to be persistently stored but are...">GlobalStore</a>* <a class="code" href="classdtn_1_1GlobalStore.html#cddeeabc9fbd02c65c9bccc30cc92661" title="singleton instance">instance_</a>; 
<a name="l00128"></a>00128 };
<a name="l00129"></a>00129 } <span class="comment">// namespace dtn</span>
<a name="l00130"></a>00130 
<a name="l00131"></a>00131 <span class="preprocessor">#endif </span><span class="comment">/* _GLOBAL_STORE_H_ */</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Jul 21 14:09:45 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>