<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>incron: appinst.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="index.html"><span>Main Page</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>appinst.h</h1><a href="appinst_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <a name="l00003"></a>00003 <a name="l00021"></a>00021 <span class="preprocessor">#ifndef APPINST_H_</span> <a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#define APPINST_H_</span> <a name="l00023"></a>00023 <span class="preprocessor"></span> <a name="l00024"></a>00024 <a name="l00025"></a>00025 <span class="preprocessor">#include <string></span> <a name="l00026"></a>00026 <a name="l00027"></a>00027 <a name="l00028"></a><a class="code" href="appinst_8h.html#651ca697147eccbb0087eede2a4ebfbd">00028</a> <span class="preprocessor">#define APPLOCK_BASEDIR "/var/run"</span> <a name="l00029"></a>00029 <span class="preprocessor"></span> <a name="l00030"></a>00030 <a name="l00032"></a>00032 <a name="l00035"></a><a class="code" href="classAppInstException.html">00035</a> <span class="keyword">class </span><a class="code" href="classAppInstException.html" title="Exception class.">AppInstException</a> <a name="l00036"></a>00036 { <a name="l00037"></a>00037 <span class="keyword">public</span>: <a name="l00039"></a>00039 <a name="l00042"></a><a class="code" href="classAppInstException.html#88b045356af72977294f1a5599f77697">00042</a> <a class="code" href="classAppInstException.html#88b045356af72977294f1a5599f77697" title="Constructor.">AppInstException</a>(<span class="keywordtype">int</span> iErr) : m_iErr(iErr) {} <a name="l00043"></a>00043 <a name="l00045"></a>00045 <a name="l00048"></a><a class="code" href="classAppInstException.html#7bfb1a0f40dcc86ca6de461dc11e3f4c">00048</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="classAppInstException.html#7bfb1a0f40dcc86ca6de461dc11e3f4c" title="Returns the error number.">GetErrorNumber</a>()<span class="keyword"> const</span> <a name="l00049"></a>00049 <span class="keyword"> </span>{ <a name="l00050"></a>00050 <span class="keywordflow">return</span> m_iErr; <a name="l00051"></a>00051 } <a name="l00052"></a>00052 <a name="l00053"></a>00053 <span class="keyword">private</span>: <a name="l00054"></a>00054 <span class="keywordtype">int</span> m_iErr; <a name="l00055"></a>00055 <a name="l00056"></a>00056 }; <a name="l00057"></a>00057 <a name="l00059"></a>00059 <a name="l00064"></a><a class="code" href="classAppInstance.html">00064</a> <span class="keyword">class </span><a class="code" href="classAppInstance.html" title="Application instance management class.">AppInstance</a> <a name="l00065"></a>00065 { <a name="l00066"></a>00066 <span class="keyword">public</span>: <a name="l00068"></a>00068 <a name="l00075"></a>00075 <a class="code" href="classAppInstance.html#2a449bd473f7f01a790c6ec6332de422" title="Constructor.">AppInstance</a>(<span class="keyword">const</span> std::string& rName, <span class="keyword">const</span> std::string& rBase = <a class="code" href="appinst_8h.html#651ca697147eccbb0087eede2a4ebfbd">APPLOCK_BASEDIR</a>); <a name="l00076"></a>00076 <a name="l00078"></a>00078 <a class="code" href="classAppInstance.html#44197310b9cc55a28af3f277628b0c9e" title="Destructor.">~AppInstance</a>(); <a name="l00079"></a>00079 <a name="l00081"></a>00081 <a name="l00089"></a>00089 <span class="keywordtype">bool</span> <a class="code" href="classAppInstance.html#0b1fbc87f3bb3939b4827a32d03ee106" title="Attempts to lock the instance.">Lock</a>(); <a name="l00090"></a>00090 <a name="l00092"></a>00092 <a name="l00097"></a>00097 <span class="keywordtype">void</span> <a class="code" href="classAppInstance.html#ce6ab6d8af431016266745d4ce2e2218" title="Unlocks the instance.">Unlock</a>(); <a name="l00098"></a>00098 <a name="l00100"></a>00100 <a name="l00107"></a>00107 <span class="keywordtype">bool</span> <a class="code" href="classAppInstance.html#8bc91492e89eff2cb6ff26d89b36049a" title="Checks whether an instance of this application exists.">Exists</a>() <span class="keyword">const</span>; <a name="l00108"></a>00108 <a name="l00110"></a>00110 <a name="l00116"></a>00116 <span class="keywordtype">bool</span> <a class="code" href="classAppInstance.html#33dce0ebfae8374da6421db4a544a2dd" title="Sends a signal to an instance of this application.">SendSignal</a>(<span class="keywordtype">int</span> iSigNo) <span class="keyword">const</span>; <a name="l00117"></a>00117 <a name="l00119"></a>00119 <a name="l00124"></a><a class="code" href="classAppInstance.html#a05646167429e3cbe2bddbfaa5ce7d49">00124</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classAppInstance.html#a05646167429e3cbe2bddbfaa5ce7d49" title="Terminates an instance of this application.">Terminate</a>()<span class="keyword"> const</span> <a name="l00125"></a>00125 <span class="keyword"> </span>{ <a name="l00126"></a>00126 <span class="keywordflow">return</span> <a class="code" href="classAppInstance.html#33dce0ebfae8374da6421db4a544a2dd" title="Sends a signal to an instance of this application.">SendSignal</a>(SIGTERM); <a name="l00127"></a>00127 } <a name="l00128"></a>00128 <a name="l00129"></a>00129 <span class="keyword">protected</span>: <a name="l00130"></a>00130 <span class="keywordtype">bool</span> <a class="code" href="classAppInstance.html#7849ed73845c0aeb3746d3d7e1b49ef9">DoLock</a>(); <a name="l00131"></a>00131 <a name="l00132"></a>00132 <span class="keyword">private</span>: <a name="l00133"></a>00133 std::string m_path; <a name="l00134"></a>00134 <span class="keywordtype">bool</span> m_fLocked; <a name="l00135"></a>00135 }; <a name="l00136"></a>00136 <a name="l00137"></a>00137 <span class="preprocessor">#endif </span><span class="comment">/*APPINST_H_*/</span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Sun Jun 21 22:27:24 2009 for incron by <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>