<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>libdap++: libdap::SignalHandler Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript"> $(document).ready(initResizable); </script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.3 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">libdap++ <span id="projectnumber">Updated for version 3.8.2</span></div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="classes.html"><span>Class Index</span></a></li> <li><a href="inherits.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> </div> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> initNavTree('classlibdap_1_1SignalHandler.html',''); </script> <div id="doc-content"> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> | <a href="#pub-static-methods">Static Public Member Functions</a> | <a href="#friends">Friends</a> </div> <div class="headertitle"> <h1>libdap::SignalHandler Class Reference</h1> </div> </div> <div class="contents"> <!-- doxytag: class="libdap::SignalHandler" --> <p><code>#include <<a class="el" href="SignalHandler_8h_source.html">SignalHandler.h</a>></code></p> <div class="dynheader"> Collaboration diagram for libdap::SignalHandler:</div> <div class="dyncontent"> <div class="center"><img src="classlibdap_1_1SignalHandler__coll__graph.png" border="0" usemap="#libdap_1_1SignalHandler_coll__map" alt="Collaboration graph"/></div> <map name="libdap_1_1SignalHandler_coll__map" id="libdap_1_1SignalHandler_coll__map"> <area shape="rect" id="node3" href="classlibdap_1_1EventHandler.html" title="{libdap::EventHandler\n||+ handle_signal()\l+ ~EventHandler()\l}" alt="" coords="5,6,227,98"/></map> <center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div> <p><a href="classlibdap_1_1SignalHandler-members.html">List of all members.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classlibdap_1_1EventHandler.html">EventHandler</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classlibdap_1_1SignalHandler.html#a1188177d392bdc1db6cf4450132c6d9f">register_handler</a> (int signum, <a class="el" href="classlibdap_1_1EventHandler.html">EventHandler</a> *eh, bool override=false)</td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classlibdap_1_1EventHandler.html">EventHandler</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classlibdap_1_1SignalHandler.html#ac9a9ddb318ad6b372604a4c8d58481de">remove_handler</a> (int signum)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classlibdap_1_1SignalHandler.html#a3aafd093a1a3e93f144cd9e0b048a60d">~SignalHandler</a> ()</td></tr> <tr><td colspan="2"><h2><a name="pub-static-methods"></a> Static Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classlibdap_1_1SignalHandler.html">SignalHandler</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classlibdap_1_1SignalHandler.html#a930f996d318cadd5f0875da0784cb32a">instance</a> ()</td></tr> <tr><td colspan="2"><h2><a name="friends"></a> Friends</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="classlibdap_1_1SignalHandler.html#a76bd6ce419aad54c8c87e993f5bd11c9">HTTPCacheTest</a></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="classlibdap_1_1SignalHandler.html#a6856f863c401edb2bf3b0b147a5008f6">SignalHandlerTest</a></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <div class="textblock"><p>Singleton to handle signals. This class adapts the C-style function call interface to one suited for C++. This class records a signal's old action/handler when it installs new handler. When a signal is caught, the new handler (registered with this class) is run and then the old action/handler is performed. This ensures that when libdap++ is embedded in code which has a handler for a signal such as SIGINT which does something other than the default, that thing, whatever it may be, gets done.</p> <p>This class treats signals it registers (using the <a class="el" href="classlibdap_1_1EventHandler.html">EventHandler</a> abstract class) differently than ones registered using the <code>signal()</code> or <code>sigaction()</code> system interfaces. If the <a class="el" href="classlibdap_1_1SignalHandler.html#a1188177d392bdc1db6cf4450132c6d9f">register_handler()</a> method is called and an instance of <a class="el" href="classlibdap_1_1EventHandler.html">EventHandler</a> is already bound to <em>signum</em>, then the old <a class="el" href="classlibdap_1_1EventHandler.html">EventHandler</a> is returned. However, if there's an existing handler that was set up with <code>sigaction()</code>, ..., it won't be returned. Instead it will either be run after the newly registered <a class="el" href="classlibdap_1_1EventHandler.html">EventHandler</a> or ignored, depending on <a class="el" href="classlibdap_1_1SignalHandler.html#a1188177d392bdc1db6cf4450132c6d9f">register_handler()</a>'s <em>override</em> parameter. This feature may be used only for POSIX.1 signals which cause process termination. They are: SIGHUP, SIGINT, SIGKILL, SIGPIPE, SIGALRM, SIGTERM, SIGUSR1, and SIGUSR2.</p> <dl class="note"><dt><b>Note:</b></dt><dd>Based on "Applying Design Patterns to Simplify Signal Handling", Douglas C. Schmidt, 1998, <a href="http://www.cs.wustl.edu/~schmidt/signal-patterns.html.">http://www.cs.wustl.edu/~schmidt/signal-patterns.html.</a></dd></dl> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classlibdap_1_1EventHandler.html">EventHandler</a> </dd></dl> <dl class="author"><dt><b>Author:</b></dt><dd>James Gallagher <<a href="mailto:jgallagher@opendap.org">jgallagher@opendap.org</a>> </dd></dl> <p>Definition at line <a class="el" href="SignalHandler_8h_source.html#l00066">66</a> of file <a class="el" href="SignalHandler_8h_source.html">SignalHandler.h</a>.</p> </div><hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="a3aafd093a1a3e93f144cd9e0b048a60d"></a><!-- doxytag: member="libdap::SignalHandler::~SignalHandler" ref="a3aafd093a1a3e93f144cd9e0b048a60d" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual libdap::SignalHandler::~SignalHandler </td> <td>(</td> <td class="paramname"></td><td>)</td> <td><code> [inline, virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="SignalHandler_8h_source.html#l00107">107</a> of file <a class="el" href="SignalHandler_8h_source.html">SignalHandler.h</a>.</p> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a930f996d318cadd5f0875da0784cb32a"></a><!-- doxytag: member="libdap::SignalHandler::instance" ref="a930f996d318cadd5f0875da0784cb32a" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classlibdap_1_1SignalHandler.html">SignalHandler</a> * libdap::SignalHandler::instance </td> <td>(</td> <td class="paramname"></td><td>)</td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Get a pointer to the single instance of <a class="el" href="classlibdap_1_1SignalHandler.html">SignalHandler</a>. </p> <p>Definition at line <a class="el" href="SignalHandler_8cc_source.html#l00129">129</a> of file <a class="el" href="SignalHandler_8cc_source.html">SignalHandler.cc</a>.</p> </div> </div> <a class="anchor" id="a1188177d392bdc1db6cf4450132c6d9f"></a><!-- doxytag: member="libdap::SignalHandler::register_handler" ref="a1188177d392bdc1db6cf4450132c6d9f" args="(int signum, EventHandler *eh, bool override=false)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classlibdap_1_1EventHandler.html">EventHandler</a> * libdap::SignalHandler::register_handler </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"><em>signum</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classlibdap_1_1EventHandler.html">EventHandler</a> * </td> <td class="paramname"><em>eh</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">bool </td> <td class="paramname"><em>override</em> = <code>false</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Register an event handler. By default run any previously registered action/handler such as those installed using <code>sigaction()</code>. For signals such as SIGALRM (the alarm signal) this may not be what you want; see the <em>override</em> parameter. See also the class description.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">signum</td><td>Bind the event handler to this signal number. Limited to those signals that, according to POSIX.1, cause process termination. </td></tr> <tr><td class="paramname">eh</td><td>A pointer to the <a class="el" href="classlibdap_1_1EventHandler.html">EventHandler</a> for <code>signum</code>. </td></tr> <tr><td class="paramname">override</td><td>If <code>true</code>, do not run the default handler/action. Instead run <em>eh</em> and then treat the signal as if the original action was SIG_IGN. Default is false. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>A pointer to the old <a class="el" href="classlibdap_1_1EventHandler.html">EventHandler</a> or null. </dd></dl> <p>Definition at line <a class="el" href="SignalHandler_8cc_source.html#l00149">149</a> of file <a class="el" href="SignalHandler_8cc_source.html">SignalHandler.cc</a>.</p> <p>References <a class="el" href="util_8cc_source.html#l00440">libdap::long_to_string()</a>.</p> <p>Referenced by <a class="el" href="DODSFilter_8cc_source.html#l00625">libdap::DODSFilter::establish_timeout()</a>.</p> <p><div class="dynheader"> Here is the call graph for this function:</div> <div class="dyncontent"> <div class="center"><img src="classlibdap_1_1SignalHandler_a1188177d392bdc1db6cf4450132c6d9f_cgraph.png" border="0" usemap="#classlibdap_1_1SignalHandler_a1188177d392bdc1db6cf4450132c6d9f_cgraph" alt=""/></div> <map name="classlibdap_1_1SignalHandler_a1188177d392bdc1db6cf4450132c6d9f_cgraph" id="classlibdap_1_1SignalHandler_a1188177d392bdc1db6cf4450132c6d9f_cgraph"> <area shape="rect" id="node3" href="namespacelibdap.html#a317edea830aab50d2137a5bd313cc86a" title="libdap::long_to_string" alt="" coords="467,5,709,32"/><area shape="rect" id="node5" href="namespacelibdap.html#a576580781bca7dcd4b5a84cc06892aff" title="libdap::append_long_to_string" alt="" coords="757,5,1069,32"/></map> </div> </p> </div> </div> <a class="anchor" id="ac9a9ddb318ad6b372604a4c8d58481de"></a><!-- doxytag: member="libdap::SignalHandler::remove_handler" ref="ac9a9ddb318ad6b372604a4c8d58481de" args="(int signum)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classlibdap_1_1EventHandler.html">EventHandler</a> * libdap::SignalHandler::remove_handler </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"><em>signum</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Remove the event hander. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">signum</td><td>The signal number of the handler to remove. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>The old event handler </dd></dl> <p>Definition at line <a class="el" href="SignalHandler_8cc_source.html#l00218">218</a> of file <a class="el" href="SignalHandler_8cc_source.html">SignalHandler.cc</a>.</p> </div> </div> <hr/><h2>Friends And Related Function Documentation</h2> <a class="anchor" id="a76bd6ce419aad54c8c87e993f5bd11c9"></a><!-- doxytag: member="libdap::SignalHandler::HTTPCacheTest" ref="a76bd6ce419aad54c8c87e993f5bd11c9" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">friend class HTTPCacheTest<code> [friend]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="SignalHandler_8h_source.html#l00101">101</a> of file <a class="el" href="SignalHandler_8h_source.html">SignalHandler.h</a>.</p> </div> </div> <a class="anchor" id="a6856f863c401edb2bf3b0b147a5008f6"></a><!-- doxytag: member="libdap::SignalHandler::SignalHandlerTest" ref="a6856f863c401edb2bf3b0b147a5008f6" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">friend class SignalHandlerTest<code> [friend]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="SignalHandler_8h_source.html#l00100">100</a> of file <a class="el" href="SignalHandler_8h_source.html">SignalHandler.h</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following files:<ul> <li><a class="el" href="SignalHandler_8h_source.html">SignalHandler.h</a></li> <li><a class="el" href="SignalHandler_8cc_source.html">SignalHandler.cc</a></li> </ul> </div> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespacelibdap.html">libdap</a> </li> <li class="navelem"><a class="el" href="classlibdap_1_1SignalHandler.html">SignalHandler</a> </li> <li class="footer">Generated on Tue Feb 8 2011 for libdap++ by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li> </ul> </div> </body> </html>