1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>omniEventsLog.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.15 -->
<center>
<a class="qindex" href="main.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</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="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center>
<hr><h1>omniEventsLog.h</h1><a href="a00113.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">// -*- Mode: C++; -*-</font>
00002 <font class="comment">// Package : omniEvents</font>
00003 <font class="comment">// omniEventsLog.h Created : 1/10/99</font>
00004 <font class="comment">// Author : Paul Nader (pwn)</font>
00005 <font class="comment">//</font>
00006 <font class="comment">// Copyright (C) 1998 Paul Nader, 2004 Alex Tingle.</font>
00007 <font class="comment">//</font>
00008 <font class="comment">// This file is part of the omniEvents application.</font>
00009 <font class="comment">//</font>
00010 <font class="comment">// omniEvents is free software; you can redistribute it and/or</font>
00011 <font class="comment">// modify it under the terms of the GNU Lesser General Public</font>
00012 <font class="comment">// License as published by the Free Software Foundation; either</font>
00013 <font class="comment">// version 2.1 of the License, or (at your option) any later version.</font>
00014 <font class="comment">//</font>
00015 <font class="comment">// omniEvents is distributed in the hope that it will be useful,</font>
00016 <font class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00017 <font class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00018 <font class="comment">// Lesser General Public License for more details.</font>
00019 <font class="comment">//</font>
00020 <font class="comment">// You should have received a copy of the GNU Lesser General Public</font>
00021 <font class="comment">// License along with this library; if not, write to the Free Software</font>
00022 <font class="comment">// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</font>
00023 <font class="comment">//</font>
00024 <font class="comment">// Description:</font>
00025 <font class="comment">//</font>
00026
00027 <font class="comment">/*</font>
00028 <font class="comment"> $Log: omniEventsLog.h,v $</font>
00029 <font class="comment"> Revision 1.6.2.1 2004/11/16 21:46:11 alextingle</font>
00030 <font class="comment"> Made several methods virtual to allow users of libomniEvents to override</font>
00031 <font class="comment"> the default persistency behaviour. (Dirk O. Siebnich)</font>
00032 <font class="comment"></font>
00033 <font class="comment"> Revision 1.6 2004/09/11 23:08:39 alextingle</font>
00034 <font class="comment"> WriteLock now non-copyable.</font>
00035 <font class="comment"></font>
00036 <font class="comment"> Revision 1.5 2004/07/26 16:27:08 alextingle</font>
00037 <font class="comment"> Support for NT service on windows: main() moved into daemon.cc.</font>
00038 <font class="comment"> New (laxer) start up syntax. Port is now set with -p (not -s). There is no</font>
00039 <font class="comment"> special cold start mode.</font>
00040 <font class="comment"> More flexible naming service name option -N. (No more -K option).</font>
00041 <font class="comment"></font>
00042 <font class="comment"> Revision 1.4 2004/04/20 17:16:17 alextingle</font>
00043 <font class="comment"> Corrected openOfstream() arg name/comments.</font>
00044 <font class="comment"></font>
00045 <font class="comment"> Revision 1.3 2004/03/28 01:03:58 alextingle</font>
00046 <font class="comment"> Refactored class omniEventsLog to allow for more EventChannelFactory parameters.\nNew omniEvents params: -v, -a (alternate endPoint).</font>
00047 <font class="comment"></font>
00048 <font class="comment"> Revision 1.2 2004/01/11 16:57:26 alextingle</font>
00049 <font class="comment"> New persistancy log file format, implemented by PersistNode.h/cc. The new format enables new nodes to be added and old ones erased by appending a single line to the file, rather than by re-persisting the whole application. This is much more efficient when lots of proxies are being created all at once. It's also a much simpler solution, with far fewer lines of code.</font>
00050 <font class="comment"></font>
00051 <font class="comment"> Revision 1.1 2003/12/21 16:19:49 alextingle</font>
00052 <font class="comment"> Moved into 'src' directory as part of the change to POA implementation.</font>
00053 <font class="comment"></font>
00054 <font class="comment"> Revision 1.4 2003/11/14 13:54:48 alextingle</font>
00055 <font class="comment"> New output() members functions. Eliminates the need for friend ostream</font>
00056 <font class="comment"> functions that are problematic on earlier versions of Microsoft</font>
00057 <font class="comment"> VisualC++.</font>
00058 <font class="comment"></font>
00059 <font class="comment"> Revision 1.3 2003/11/03 22:35:08 alextingle</font>
00060 <font class="comment"> Removed all platform specific switches. Now uses autoconf, config.h.</font>
00061 <font class="comment"> Added private helper functions initializeFileNames(), setFilename() &</font>
00062 <font class="comment"> openOfstream() to simplify the implementation.</font>
00063 <font class="comment"> Removed member `logdir', as it's only used during object construction.</font>
00064 <font class="comment"> Renamed configuration macro LOGDIR_ENV_VAR to OMNIEVENTS_LOGDIR_ENV_VAR</font>
00065 <font class="comment"> for consistency with other configuration macros.</font>
00066 <font class="comment"></font>
00067 <font class="comment"> Revision 1.1.1.1.2.1 2002/09/28 22:20:51 shamus13</font>
00068 <font class="comment"> Added ifdefs to enable omniEvents to compile</font>
00069 <font class="comment"> with both omniORB3 and omniORB4. If __OMNIORB4__</font>
00070 <font class="comment"> is defined during compilation, omniORB4 headers</font>
00071 <font class="comment"> and command line option syntax is used, otherwise</font>
00072 <font class="comment"> fall back to omniORB3 style.</font>
00073 <font class="comment"></font>
00074 <font class="comment"> Revision 1.1.1.1 2002/09/25 19:00:32 shamus13</font>
00075 <font class="comment"> Import of OmniEvents source tree from release 2.1.1</font>
00076 <font class="comment"></font>
00077 <font class="comment"> Revision 1.3 2000/08/30 04:21:56 naderp</font>
00078 <font class="comment"> Port to omniORB 3.0.1.</font>
00079 <font class="comment"></font>
00080 <font class="comment"> Revision 1.2 2000/03/02 04:19:17 naderp</font>
00081 <font class="comment"> Passing factory by reference to init() for initialisation.</font>
00082 <font class="comment"></font>
00083 <font class="comment"> Revision 1.1 1999/11/02 13:40:56 naderp</font>
00084 <font class="comment"> Rearranged data member definitions to avoid compiler warnings during</font>
00085 <font class="comment"> initialisation.</font>
00086 <font class="comment"></font>
00087 <font class="comment"> Revision 1.0 1999/11/01 16:48:21 naderp</font>
00088 <font class="comment"> Initial revision</font>
00089 <font class="comment"></font>
00090 <font class="comment">*/</font>
00091
00092 <font class="preprocessor">#ifndef _OMNIEVENTSLOG_H_</font>
00093 <font class="preprocessor"></font><font class="preprocessor">#define _OMNIEVENTSLOG_H_</font>
00094 <font class="preprocessor"></font>
00095 <font class="preprocessor">#ifdef HAVE_CONFIG_H</font>
00096 <font class="preprocessor"></font><font class="preprocessor"># include "<a class="code" href="a00082.html">config.h</a>"</font>
00097 <font class="preprocessor">#endif</font>
00098 <font class="preprocessor"></font>
00099 <font class="preprocessor">#ifdef HAVE_IOSTREAM</font>
00100 <font class="preprocessor"></font><font class="preprocessor"># include <iostream></font>
00101 <font class="preprocessor"># include <fstream></font>
00102 <font class="preprocessor">#else</font>
00103 <font class="preprocessor"></font><font class="preprocessor"># include <iostream.h></font>
00104 <font class="preprocessor"># include <fstream.h></font>
00105 <font class="preprocessor">#endif</font>
00106 <font class="preprocessor"></font>
00107 <font class="preprocessor">#ifdef HAVE_STD_IOSTREAM</font>
00108 <font class="preprocessor"></font><font class="keyword">using</font> <font class="keyword">namespace </font>std;
00109 <font class="preprocessor">#endif</font>
00110 <font class="preprocessor"></font>
00111 <font class="preprocessor">#ifdef HAVE_OMNIORB3</font>
00112 <font class="preprocessor"></font><font class="preprocessor"># include <omniORB3/CORBA.h></font>
00113 <font class="preprocessor">#endif</font>
00114 <font class="preprocessor"></font>
00115 <font class="preprocessor">#ifdef HAVE_OMNIORB4</font>
00116 <font class="preprocessor"></font><font class="preprocessor"># include <omniORB4/CORBA.h></font>
00117 <font class="preprocessor">#endif</font>
00118 <font class="preprocessor"></font>
00119 <font class="keyword">namespace </font>OmniEvents {
00120
00121 <font class="keyword">class </font>EventChannelFactory_i;
00122 <font class="keyword">class </font>PersistNode;
00123
00124 <font class="preprocessor">#ifndef OMNIEVENTS_LOGDIR_ENV_VAR</font>
<a name="l00125"></a><a class="code" href="a00113.html#a0">00125</a> <font class="preprocessor"></font><font class="preprocessor"># define OMNIEVENTS_LOGDIR_ENV_VAR "OMNIEVENTS_LOGDIR"</font>
00126 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00127 <font class="preprocessor"></font>
<a name="l00128"></a><a class="code" href="a00056.html">00128</a> <font class="keyword">class </font><a class="code" href="a00056.html">omniEventsLog</a>
00129 {
00130 <font class="keyword">public</font>:
00131 <a class="code" href="a00056.html#a0">omniEventsLog</a>(<font class="keyword">const</font> <font class="keywordtype">char</font>* logdir=NULL);
00132 <font class="keyword">virtual</font> <a class="code" href="a00056.html#a1">~omniEventsLog</a>();
00133
00134 <font class="keywordtype">bool</font> <a class="code" href="a00056.html#a2">fileExists</a>(<font class="keyword">const</font> <font class="keywordtype">char</font>* filename) <font class="keyword">const</font>;
<a name="l00135"></a><a class="code" href="a00056.html#a3">00135</a> <font class="keyword">const</font> <font class="keywordtype">char</font>* <a class="code" href="a00056.html#a3">activeFilename</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> <a class="code" href="a00056.html#o1">_activeFilename</a>; }
<a name="l00136"></a><a class="code" href="a00056.html#a4">00136</a> <font class="keyword">const</font> <font class="keywordtype">char</font>* <a class="code" href="a00056.html#a4">backupFilename</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> <a class="code" href="a00056.html#o2">_backupFilename</a>; }
00137
00142 PersistNode* <a class="code" href="a00056.html#a5">bootstrap</a>(<font class="keywordtype">int</font> port, <font class="keyword">const</font> <font class="keywordtype">char</font>* endPointNoListen);
00143
00148 <font class="keyword">virtual</font> PersistNode* <a class="code" href="a00056.html#a6">parse</a>();
00149
00153 <font class="keywordtype">void</font> <a class="code" href="a00056.html#a7">incarnateFactory</a>(PersistNode* initialState);
00154
00158 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="a00056.html#a8">runWorker</a>();
00159
<a name="l00161"></a><a class="code" href="a00056.html#a9">00161</a> <a class="code" href="a00047.html">EventChannelFactory_i</a>* <a class="code" href="a00056.html#a9">factory</a>() {<font class="keywordflow">return</font> <a class="code" href="a00056.html#o5">_factory</a>;}
00162
00167 <font class="keywordtype">void</font> <a class="code" href="a00056.html#a10">checkpoint</a>(<font class="keywordtype">void</font>);
00168
00169 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="a00056.html#a11">output</a>(ostream& os);
00170
00171 <font class="keyword">public</font>:
<a name="l00172"></a><a class="code" href="a00057.html">00172</a> <font class="keyword">class </font><a class="code" href="a00057.html">IOError</a> {};
00173
00174 <font class="keyword">protected</font>:
00175 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="a00056.html#b0">initializeFileNames</a>(<font class="keyword">const</font> <font class="keywordtype">char</font>* logdir);
00176 <font class="keywordtype">void</font> <a class="code" href="a00056.html#b1">setFilename</a>(
00177 <font class="keywordtype">char</font>*& filename,
00178 <font class="keyword">const</font> <font class="keywordtype">char</font>* logdir,
00179 <font class="keyword">const</font> <font class="keywordtype">char</font>* sep,
00180 <font class="keyword">const</font> <font class="keywordtype">char</font>* logname,
00181 <font class="keyword">const</font> <font class="keywordtype">char</font>* hostname,
00182 <font class="keyword">const</font> <font class="keywordtype">char</font>* ext
00183 );
00184 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="a00056.html#b2">openOfstream</a>(
00185 ofstream& s,
00186 <font class="keyword">const</font> <font class="keywordtype">char</font>* filename,
00187 <font class="keywordtype">int</font> flags=0,
00188 <font class="keywordtype">int</font>* fd=NULL
00189 );
00190
00191 <font class="keyword">private</font>:
00192 <font class="keyword">static</font> <a class="code" href="a00056.html#a0">omniEventsLog</a>* <a class="code" href="a00056.html#r0">theLog</a>;
00193
<a name="l00194"></a><a class="code" href="a00056.html#o0">00194</a> ofstream <a class="code" href="a00056.html#o0">_logstream</a>;
<a name="l00195"></a><a class="code" href="a00056.html#o1">00195</a> <font class="keywordtype">char</font>* <a class="code" href="a00056.html#o1">_activeFilename</a>;
<a name="l00196"></a><a class="code" href="a00056.html#o2">00196</a> <font class="keywordtype">char</font>* <a class="code" href="a00056.html#o2">_backupFilename</a>;
<a name="l00197"></a><a class="code" href="a00056.html#o3">00197</a> <font class="keywordtype">char</font>* <a class="code" href="a00056.html#o3">_checkpointFilename</a>;
<a name="l00198"></a><a class="code" href="a00056.html#o4">00198</a> omni_thread* <a class="code" href="a00056.html#o4">_workerThread</a>;
<a name="l00199"></a><a class="code" href="a00056.html#o5">00199</a> <a class="code" href="a00047.html">EventChannelFactory_i</a>* <a class="code" href="a00056.html#o5">_factory</a>;
<a name="l00200"></a><a class="code" href="a00056.html#o6">00200</a> <font class="keywordtype">bool</font> <a class="code" href="a00056.html#o6">_checkpointNeeded</a>;
<a name="l00201"></a><a class="code" href="a00056.html#o7">00201</a> omni_mutex <a class="code" href="a00056.html#o7">_lock</a>;
00202
<a name="l00203"></a><a class="code" href="a00056.html#l0">00203</a> <font class="keyword">friend</font> <font class="keyword">class </font><a class="code" href="a00080.html">WriteLock</a>;
00204 };
00205
<a name="l00206"></a><a class="code" href="a00058.html">00206</a> <font class="keyword">class </font><a class="code" href="a00058.html">omniEventsLogWorker</a> : <font class="keyword">public</font> omni_thread
00207 {
00208 <font class="keyword">public</font>:
<a name="l00209"></a><a class="code" href="a00058.html#s0">00209</a> <font class="keyword">typedef</font> void (omniEventsLog::*<a class="code" href="a00058.html#s0">Method</a>)(void);
00210 <a class="code" href="a00058.html#c0">omniEventsLogWorker</a>(
00211 <a class="code" href="a00056.html">omniEventsLog</a>* object,
00212 <a class="code" href="a00058.html#s0">Method</a> method,
00213 priority_t priority=PRIORITY_NORMAL
00214 );
00215 <font class="keywordtype">void</font>* <a class="code" href="a00058.html#a1">run_undetached</a>(<font class="keywordtype">void</font> *);
00216 <a class="code" href="a00058.html#a2">~omniEventsLogWorker</a>();
00217 <font class="keyword">private</font>:
<a name="l00218"></a><a class="code" href="a00058.html#o0">00218</a> <a class="code" href="a00056.html">omniEventsLog</a>* <a class="code" href="a00058.html#o0">_object</a>;
<a name="l00219"></a><a class="code" href="a00058.html#o1">00219</a> <a class="code" href="a00058.html#s0">Method</a> <a class="code" href="a00058.html#o1">_method</a>;
00220 <a class="code" href="a00058.html#c0">omniEventsLogWorker</a>();
00221 };
00222
00223
<a name="l00228"></a><a class="code" href="a00080.html">00228</a> <font class="keyword">class </font><a class="code" href="a00080.html">WriteLock</a>
00229 {
00230 <font class="keyword">public</font>:
<a name="l00231"></a><a class="code" href="a00080.html#a0">00231</a> <a class="code" href="a00080.html#a0">WriteLock</a>():
00232 <a class="code" href="a00080.html#m0">os</a>(<a class="code" href="a00056.html">omniEventsLog</a>::theLog->_logstream),
00233 <a class="code" href="a00080.html#o0">l</a>(<a class="code" href="a00056.html">omniEventsLog</a>::theLog->_lock)
00234 {}
<a name="l00235"></a><a class="code" href="a00080.html#a1">00235</a> <a class="code" href="a00080.html#a1">~WriteLock</a>()
00236 {
00237 <a class="code" href="a00080.html#m0">os</a>.flush();
00238 omniEventsLog::theLog->_checkpointNeeded=<font class="keyword">true</font>;
00239 }
<a name="l00240"></a><a class="code" href="a00080.html#m0">00240</a> ostream& <a class="code" href="a00080.html#m0">os</a>;
00241 <font class="keyword">private</font>:
<a name="l00242"></a><a class="code" href="a00080.html#o0">00242</a> omni_mutex_lock <a class="code" href="a00080.html#o0">l</a>;
00243 <a class="code" href="a00080.html#a0">WriteLock</a>(<font class="keyword">const</font> <a class="code" href="a00080.html">WriteLock</a>&);
00244 };
00245
00246 }; <font class="comment">// end namespace OmniEvents</font>
00247
00248 <font class="preprocessor">#endif </font><font class="comment">/* _OMNIEVENTSLOG_H_ */</font>
</pre></div><hr><address align="right"><small>Generated on Fri Nov 19 17:42:20 2004 for OmniEvents by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0
width=110 height=53></a>1.2.15 </small></address>
</body>
</html>
|