<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>mstate.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.5 on Mon Oct 14 14:16:38 2002 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="pages.html">Related Pages</a> </center> <hr><h1>mstate.h</h1><div class="fragment"><pre>00001 <font class="comment">//</font> 00002 <font class="comment">// mstate.h</font> 00003 <font class="comment">//</font> 00004 <font class="comment">// Copyright (C) 1996 Limit Point Systems, Inc.</font> 00005 <font class="comment">//</font> 00006 <font class="comment">// Author: Curtis Janssen <cljanss@limitpt.com></font> 00007 <font class="comment">// Maintainer: LPS</font> 00008 <font class="comment">//</font> 00009 <font class="comment">// This file is part of the SC Toolkit.</font> 00010 <font class="comment">//</font> 00011 <font class="comment">// The SC Toolkit is free software; you can redistribute it and/or modify</font> 00012 <font class="comment">// it under the terms of the GNU Library General Public License as published by</font> 00013 <font class="comment">// the Free Software Foundation; either version 2, or (at your option)</font> 00014 <font class="comment">// any later version.</font> 00015 <font class="comment">//</font> 00016 <font class="comment">// The SC Toolkit is distributed in the hope that it will be useful,</font> 00017 <font class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</font> 00018 <font class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</font> 00019 <font class="comment">// GNU Library General Public License for more details.</font> 00020 <font class="comment">//</font> 00021 <font class="comment">// You should have received a copy of the GNU Library General Public License</font> 00022 <font class="comment">// along with the SC Toolkit; see the file COPYING.LIB. If not, write to</font> 00023 <font class="comment">// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.</font> 00024 <font class="comment">//</font> 00025 <font class="comment">// The U.S. Government is granted a limited license as per AL 91-7.</font> 00026 <font class="comment">//</font> 00027 00028 <font class="preprocessor">#ifdef __GNUC__</font> 00029 <font class="preprocessor"></font><font class="preprocessor">#pragma interface</font> 00030 <font class="preprocessor"></font><font class="preprocessor">#endif</font> 00031 <font class="preprocessor"></font> 00032 <font class="preprocessor">#ifndef _util_group_mstate_h</font> 00033 <font class="preprocessor"></font><font class="preprocessor">#define _util_group_mstate_h</font> 00034 <font class="preprocessor"></font> 00035 <font class="preprocessor">#include <util/state/state.h></font> 00036 <font class="preprocessor">#include <util/state/statein.h></font> 00037 <font class="preprocessor">#include <util/state/stateout.h></font> 00038 <font class="preprocessor">#include <util/group/message.h></font> 00039 00040 <font class="keyword">namespace </font>sc { 00041 <a name="l00045"></a><a class="code" href="class_sc__MsgStateSend.html">00045</a> <font class="keyword">class </font>MsgStateSend: <font class="keyword">public</font> StateOut { 00046 <font class="keyword">private</font>: 00047 <font class="comment">// do not allow copy constructor or assignment</font> 00048 MsgStateSend(<font class="keyword">const</font> MsgStateSend&); 00049 <font class="keywordtype">void</font> operator=(<font class="keyword">const</font> MsgStateSend&); 00050 <font class="keyword">protected</font>: 00051 Ref<MessageGrp> grp; 00052 <font class="keywordtype">int</font> nbuf; <font class="comment">// the number of bytes used in the buffer</font> 00053 <font class="keywordtype">int</font> bufsize; <font class="comment">// the allocated size of the data buffer</font> 00054 <font class="keywordtype">char</font>* buffer; <font class="comment">// the data buffer</font> 00055 <font class="keywordtype">char</font>* send_buffer; <font class="comment">// the buffer used to send data (includes nbuf)</font> 00056 <font class="keywordtype">int</font> nheader; <font class="comment">// nbuf + nheader = the number of bytes in send_buffer to send</font> 00057 <font class="keywordtype">int</font>* nbuf_buffer; <font class="comment">// the pointer to the nbuf stored in the buffer</font> 00058 00059 <font class="keywordtype">int</font> put_array_void(<font class="keyword">const</font> <font class="keywordtype">void</font>*, <font class="keywordtype">int</font>); 00060 <font class="keyword">public</font>: 00061 MsgStateSend(<font class="keyword">const</font> Ref<MessageGrp>&); 00062 <font class="keyword">virtual</font> ~MsgStateSend(); 00063 00065 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="class_sc__MsgStateSend.html#a2">flush</a>() = 0; 00066 00069 <font class="keywordtype">void</font> <a class="code" href="class_sc__MsgStateSend.html#a3">set_buffer_size</a>(<font class="keywordtype">int</font>); 00070 00073 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateSend.html#a4">put</a>(<font class="keyword">const</font> ClassDesc*); 00074 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateSend.html#a4">put</a>(<font class="keywordtype">char</font> r); 00075 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateSend.html#a4">put</a>(<font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> r); 00076 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateSend.html#a4">put</a>(<font class="keywordtype">int</font> r); 00077 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateSend.html#a4">put</a>(<font class="keywordtype">float</font> r); 00078 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateSend.html#a4">put</a>(<font class="keywordtype">double</font> r); 00079 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateSend.html#a4">put</a>(<font class="keyword">const</font> <font class="keywordtype">char</font>*,<font class="keywordtype">int</font>); 00080 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateSend.html#a4">put</a>(<font class="keyword">const</font> <font class="keywordtype">int</font>*,<font class="keywordtype">int</font>); 00081 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateSend.html#a4">put</a>(<font class="keyword">const</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font>*,<font class="keywordtype">int</font>); 00082 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateSend.html#a4">put</a>(<font class="keyword">const</font> <font class="keywordtype">float</font>*,<font class="keywordtype">int</font>); 00083 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateSend.html#a4">put</a>(<font class="keyword">const</font> <font class="keywordtype">double</font>*,<font class="keywordtype">int</font>); 00084 }; 00085 <a name="l00089"></a><a class="code" href="class_sc__MsgStateBufRecv.html">00089</a> <font class="keyword">class </font>MsgStateBufRecv: <font class="keyword">public</font> StateIn { 00090 <font class="keyword">private</font>: 00091 <font class="comment">// do not allow copy constructor or assignment</font> 00092 <a class="code" href="class_sc__MsgStateBufRecv.html#a1">MsgStateBufRecv</a>(<font class="keyword">const</font> MsgStateBufRecv&); 00093 <font class="keywordtype">void</font> operator=(<font class="keyword">const</font> MsgStateBufRecv&); 00094 <font class="keyword">protected</font>: 00095 Ref<MessageGrp> grp; 00096 <font class="keywordtype">int</font> nbuf; <font class="comment">// the number of bytes used in the buffer</font> 00097 <font class="keywordtype">int</font> ibuf; <font class="comment">// the current pointer withing the buffer</font> 00098 <font class="keywordtype">int</font> bufsize; <font class="comment">// the allocated size of the buffer</font> 00099 <font class="keywordtype">char</font>* buffer; <font class="comment">// the data buffer</font> 00100 <font class="keywordtype">char</font>* send_buffer; <font class="comment">// the buffer used to send data (includes nbuf)</font> 00101 <font class="keywordtype">int</font> nheader; <font class="comment">// nbuf + nheader = the number of bytes in send_buffer to send</font> 00102 <font class="keywordtype">int</font>* nbuf_buffer; <font class="comment">// the pointer to the nbuf stored in the buffer</font> 00103 00104 <font class="keywordtype">int</font> get_array_void(<font class="keywordtype">void</font>*,<font class="keywordtype">int</font>); 00105 00107 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="class_sc__MsgStateBufRecv.html#b1">next_buffer</a>() = 0; 00108 <font class="keyword">public</font>: 00110 <a class="code" href="class_sc__MsgStateBufRecv.html#a1">MsgStateBufRecv</a>(<font class="keyword">const</font> Ref<MessageGrp>&); 00112 <a class="code" href="class_sc__MsgStateBufRecv.html#a1">MsgStateBufRecv</a>(); 00113 00114 <font class="keyword">virtual</font> ~MsgStateBufRecv(); 00115 00118 <font class="keywordtype">void</font> <a class="code" href="class_sc__MsgStateBufRecv.html#a3">set_buffer_size</a>(<font class="keywordtype">int</font>); 00119 }; 00120 <a name="l00123"></a><a class="code" href="class_sc__MsgStateRecv.html">00123</a> <font class="keyword">class </font>MsgStateRecv: <font class="keyword">public</font> MsgStateBufRecv { 00124 <font class="keyword">private</font>: 00125 <font class="comment">// do not allow copy constructor or assignment</font> 00126 <a class="code" href="class_sc__MsgStateRecv.html#a0">MsgStateRecv</a>(<font class="keyword">const</font> MsgStateRecv&); 00127 <font class="keywordtype">void</font> operator=(<font class="keyword">const</font> MsgStateRecv&); 00128 <font class="keyword">public</font>: 00130 <a class="code" href="class_sc__MsgStateRecv.html#a0">MsgStateRecv</a>(<font class="keyword">const</font> Ref<MessageGrp>&); 00131 00132 <font class="keyword">virtual</font> ~MsgStateRecv(); 00133 00137 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateRecv.html#a2">version</a>(<font class="keyword">const</font> ClassDesc*); 00138 00141 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateRecv.html#a3">get</a>(<font class="keyword">const</font> ClassDesc**); 00142 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateRecv.html#a3">get</a>(<font class="keywordtype">char</font>&r, <font class="keyword">const</font> <font class="keywordtype">char</font> *key = 0); 00143 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateRecv.html#a3">get</a>(<font class="keywordtype">unsigned</font> <font class="keywordtype">int</font>&r, <font class="keyword">const</font> <font class="keywordtype">char</font> *key = 0); 00144 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateRecv.html#a3">get</a>(<font class="keywordtype">int</font>&r, <font class="keyword">const</font> <font class="keywordtype">char</font> *key = 0); 00145 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateRecv.html#a3">get</a>(<font class="keywordtype">float</font>&r, <font class="keyword">const</font> <font class="keywordtype">char</font> *key = 0); 00146 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateRecv.html#a3">get</a>(<font class="keywordtype">double</font>&r, <font class="keyword">const</font> <font class="keywordtype">char</font> *key = 0); 00147 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateRecv.html#a3">get</a>(<font class="keywordtype">char</font>*&); 00148 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateRecv.html#a3">get</a>(<font class="keywordtype">unsigned</font> <font class="keywordtype">int</font>*&); 00149 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateRecv.html#a3">get</a>(<font class="keywordtype">int</font>*&); 00150 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateRecv.html#a3">get</a>(<font class="keywordtype">float</font>*&); 00151 <font class="keywordtype">int</font> <a class="code" href="class_sc__MsgStateRecv.html#a3">get</a>(<font class="keywordtype">double</font>*&); 00152 }; 00153 <a name="l00157"></a><a class="code" href="class_sc__StateSend.html">00157</a> <font class="keyword">class </font>StateSend: <font class="keyword">public</font> MsgStateSend { 00158 <font class="keyword">private</font>: 00159 <font class="comment">// do not allow copy constructor or assignment</font> 00160 <a class="code" href="class_sc__StateSend.html#a0">StateSend</a>(<font class="keyword">const</font> StateSend&); 00161 <font class="keywordtype">void</font> operator=(<font class="keyword">const</font> StateSend&); 00162 <font class="keyword">private</font>: 00163 <font class="keywordtype">int</font> target_; 00164 <font class="keyword">public</font>: 00166 <a class="code" href="class_sc__StateSend.html#a0">StateSend</a>(<font class="keyword">const</font> Ref<MessageGrp>&); 00167 00168 ~StateSend(); 00170 <font class="keywordtype">void</font> <a class="code" href="class_sc__StateSend.html#a2">target</a>(<font class="keywordtype">int</font>); 00172 <font class="keywordtype">void</font> <a class="code" href="class_sc__StateSend.html#a3">flush</a>(); 00173 }; 00174 <a name="l00178"></a><a class="code" href="class_sc__StateRecv.html">00178</a> <font class="keyword">class </font>StateRecv: <font class="keyword">public</font> MsgStateRecv { 00179 <font class="keyword">private</font>: 00180 <font class="comment">// do not allow copy constructor or assignment</font> 00181 <a class="code" href="class_sc__StateRecv.html#a0">StateRecv</a>(<font class="keyword">const</font> StateRecv&); 00182 <font class="keywordtype">void</font> operator=(<font class="keyword">const</font> StateRecv&); 00183 <font class="keyword">private</font>: 00184 <font class="keywordtype">int</font> source_; 00185 <font class="keyword">protected</font>: 00186 <font class="keywordtype">void</font> <a class="code" href="class_sc__StateRecv.html#b0">next_buffer</a>(); 00187 <font class="keyword">public</font>: 00189 <a class="code" href="class_sc__StateRecv.html#a0">StateRecv</a>(<font class="keyword">const</font> Ref<MessageGrp>&); 00191 <font class="keywordtype">void</font> <a class="code" href="class_sc__StateRecv.html#a1">source</a>(<font class="keywordtype">int</font>); 00192 }; 00193 <a name="l00197"></a><a class="code" href="class_sc__BcastStateSend.html">00197</a> <font class="keyword">class </font>BcastStateSend: <font class="keyword">public</font> MsgStateSend { 00198 <font class="keyword">private</font>: 00199 <font class="comment">// do not allow copy constructor or assignment</font> 00200 <a class="code" href="class_sc__BcastStateSend.html#a0">BcastStateSend</a>(<font class="keyword">const</font> BcastStateSend&); 00201 <font class="keywordtype">void</font> operator=(<font class="keyword">const</font> BcastStateSend&); 00202 <font class="keyword">public</font>: 00204 <a class="code" href="class_sc__BcastStateSend.html#a0">BcastStateSend</a>(<font class="keyword">const</font> Ref<MessageGrp>&); 00205 00206 ~BcastStateSend(); 00208 <font class="keywordtype">void</font> <a class="code" href="class_sc__BcastStateSend.html#a2">flush</a>(); 00209 }; 00210 <a name="l00214"></a><a class="code" href="class_sc__BcastStateRecv.html">00214</a> <font class="keyword">class </font>BcastStateRecv: <font class="keyword">public</font> MsgStateRecv { 00215 <font class="keyword">private</font>: 00216 <font class="comment">// do not allow copy constructor or assignment</font> 00217 <a class="code" href="class_sc__BcastStateRecv.html#a0">BcastStateRecv</a>(<font class="keyword">const</font> BcastStateRecv&); 00218 <font class="keywordtype">void</font> operator=(<font class="keyword">const</font> BcastStateRecv&); 00219 <font class="keyword">protected</font>: 00220 <font class="keywordtype">int</font> source_; 00221 <font class="keywordtype">void</font> <a class="code" href="class_sc__BcastStateRecv.html#b0">next_buffer</a>(); 00222 <font class="keyword">public</font>: 00224 <a class="code" href="class_sc__BcastStateRecv.html#a0">BcastStateRecv</a>(<font class="keyword">const</font> Ref<MessageGrp>&, <font class="keywordtype">int</font> source = 0); 00226 <font class="keywordtype">void</font> <a class="code" href="class_sc__BcastStateRecv.html#a1">source</a>(<font class="keywordtype">int</font> s); 00227 }; 00228 <a name="l00232"></a><a class="code" href="class_sc__BcastState.html">00232</a> <font class="keyword">class </font>BcastState { 00233 <font class="keyword">private</font>: 00234 BcastStateRecv *recv_; 00235 BcastStateSend *send_; 00236 <font class="keyword">public</font>: 00238 <a class="code" href="class_sc__BcastState.html#a0">BcastState</a>(<font class="keyword">const</font> Ref<MessageGrp> &, <font class="keywordtype">int</font> source = 0); 00239 00240 ~BcastState(); 00241 00245 <font class="keywordtype">void</font> <a class="code" href="class_sc__BcastState.html#a2">bcast</a>(<font class="keywordtype">int</font> &); 00246 <font class="keywordtype">void</font> <a class="code" href="class_sc__BcastState.html#a2">bcast</a>(<font class="keywordtype">double</font> &); 00247 <font class="keywordtype">void</font> <a class="code" href="class_sc__BcastState.html#a2">bcast</a>(<font class="keywordtype">int</font> *&, <font class="keywordtype">int</font>); 00248 <font class="keywordtype">void</font> <a class="code" href="class_sc__BcastState.html#a2">bcast</a>(<font class="keywordtype">double</font> *&, <font class="keywordtype">int</font>); 00249 template <class T> <font class="keywordtype">void</font> <a class="code" href="class_sc__BcastState.html#a2">bcast</a>(Ref<T>&a)<font class="keyword"></font> 00250 <font class="keyword"> </font>{ 00251 <font class="keywordflow">if</font> (recv_) { 00252 a << SavableState::restore_state(*recv_); 00253 } 00254 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (send_) { 00255 SavableState::save_state(a.pointer(),*send_); 00256 } 00257 } 00258 00261 <font class="keywordtype">void</font> <a class="code" href="class_sc__BcastState.html#a7">flush</a>(); 00262 00265 <font class="keywordtype">void</font> <a class="code" href="class_sc__BcastState.html#a8">forget_references</a>(); 00266 00268 <font class="keywordtype">void</font> <a class="code" href="class_sc__BcastState.html#a9">set_buffer_size</a>(<font class="keywordtype">int</font>); 00269 }; 00270 <a name="l00274"></a><a class="code" href="class_sc__BcastStateInBin.html">00274</a> <font class="keyword">class </font>BcastStateInBin: <font class="keyword">public</font> MsgStateBufRecv { 00275 <font class="keyword">private</font>: 00276 <font class="comment">// do not allow copy constructor or assignment</font> 00277 <a class="code" href="class_sc__BcastStateInBin.html#a0">BcastStateInBin</a>(<font class="keyword">const</font> BcastStateRecv&); 00278 <font class="keywordtype">void</font> operator=(<font class="keyword">const</font> BcastStateRecv&); 00279 <font class="keyword">protected</font>: 00280 <font class="keywordtype">int</font> opened_; 00281 <font class="keywordtype">int</font> file_position_; 00282 std::streambuf *buf_; 00283 00284 <font class="keywordtype">void</font> <a class="code" href="class_sc__BcastStateInBin.html#b0">next_buffer</a>(); 00285 <font class="keywordtype">int</font> get_array_void(<font class="keywordtype">void</font>*, <font class="keywordtype">int</font>); 00286 <font class="keyword">public</font>: 00288 <a class="code" href="class_sc__BcastStateInBin.html#a0">BcastStateInBin</a>(<font class="keyword">const</font> Ref<KeyVal> &); 00290 <a class="code" href="class_sc__BcastStateInBin.html#a0">BcastStateInBin</a>(<font class="keyword">const</font> Ref<MessageGrp>&, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename); 00291 00292 ~BcastStateInBin(); 00293 00294 <font class="keyword">virtual</font> <font class="keywordtype">int</font> open(<font class="keyword">const</font> <font class="keywordtype">char</font> *name); 00295 <font class="keyword">virtual</font> <font class="keywordtype">void</font> close(); 00296 00297 <font class="keywordtype">void</font> <a class="code" href="class_sc__BcastStateInBin.html#a5">seek</a>(<font class="keywordtype">int</font> loc); 00298 <font class="keywordtype">int</font> <a class="code" href="class_sc__BcastStateInBin.html#a6">seekable</a>(); 00299 <font class="keywordtype">int</font> <a class="code" href="class_sc__BcastStateInBin.html#a7">tell</a>(); 00300 <font class="keywordtype">int</font> <a class="code" href="class_sc__BcastStateInBin.html#a8">use_directory</a>(); 00301 }; 00302 00303 } 00304 00305 <font class="preprocessor">#endif</font> 00306 <font class="preprocessor"></font> 00307 <font class="comment">// Local Variables:</font> 00308 <font class="comment">// mode: c++</font> 00309 <font class="comment">// c-file-style: "CLJ"</font> 00310 <font class="comment">// End:</font> </div></pre><hr> <address> <small> Generated at Mon Oct 14 14:16:38 2002 for <a href="http://aros.ca.sandia.gov/~cljanss/mpqc">MPQC</a> 2.1.2 using the documentation package <a href="http://www.stack.nl/~dimitri/doxygen/index.html">Doxygen</a> 1.2.5. </small> </address> </body> </html>