<!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>adevs: /home/rotten/adevs-2.6/include/adevs_exception.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">adevs </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.7.5 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <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> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <div class="title">/home/rotten/adevs-2.6/include/adevs_exception.h</div> </div> </div> <div class="contents"> <div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/***************</span> <a name="l00002"></a>00002 <span class="comment">Copyright (C) 2000-2006 by James Nutaro</span> <a name="l00003"></a>00003 <span class="comment"></span> <a name="l00004"></a>00004 <span class="comment">This library is free software; you can redistribute it and/or</span> <a name="l00005"></a>00005 <span class="comment">modify it under the terms of the GNU Lesser General Public</span> <a name="l00006"></a>00006 <span class="comment">License as published by the Free Software Foundation; either</span> <a name="l00007"></a>00007 <span class="comment">version 2 of the License, or (at your option) any later version.</span> <a name="l00008"></a>00008 <span class="comment"></span> <a name="l00009"></a>00009 <span class="comment">This library is distributed in the hope that it will be useful,</span> <a name="l00010"></a>00010 <span class="comment">but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00011"></a>00011 <span class="comment">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00012"></a>00012 <span class="comment">Lesser General Public License for more details.</span> <a name="l00013"></a>00013 <span class="comment"></span> <a name="l00014"></a>00014 <span class="comment">You should have received a copy of the GNU Lesser General Public</span> <a name="l00015"></a>00015 <span class="comment">License along with this library; if not, write to the Free Software</span> <a name="l00016"></a>00016 <span class="comment">Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span> <a name="l00017"></a>00017 <span class="comment"></span> <a name="l00018"></a>00018 <span class="comment">Bugs, comments, and questions can be sent to nutaro@gmail.com</span> <a name="l00019"></a>00019 <span class="comment">***************/</span> <a name="l00020"></a>00020 <a name="l00021"></a>00021 <span class="preprocessor">#ifndef _adevs_exception_h_</span> <a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#define _adevs_exception_h_</span> <a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#include <string></span> <a name="l00024"></a>00024 <span class="preprocessor">#include <exception></span> <a name="l00025"></a>00025 <a name="l00026"></a>00026 <span class="keyword">namespace </span>adevs <a name="l00027"></a>00027 { <a name="l00028"></a>00028 <a name="l00033"></a>00033 <span class="keyword">class </span>exception: <span class="keyword">public</span> std::exception <a name="l00034"></a>00034 { <a name="l00035"></a>00035 <span class="keyword">public</span>: <a name="l00041"></a><a class="code" href="classadevs_1_1exception.html#ab3f1e6fbf8a50304d77930204bdbe904">00041</a> <a class="code" href="classadevs_1_1exception.html#ab3f1e6fbf8a50304d77930204bdbe904">exception</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* msg, <span class="keywordtype">void</span>* model = NULL): <a name="l00042"></a>00042 std::<a class="code" href="classadevs_1_1exception.html">exception</a>(), <a name="l00043"></a>00043 msg(msg), <a name="l00044"></a>00044 model(model) <a name="l00045"></a>00045 {} <a name="l00047"></a><a class="code" href="classadevs_1_1exception.html#a44394f56ec35b8dc1895ac0ba65df516">00047</a> <a class="code" href="classadevs_1_1exception.html#ab3f1e6fbf8a50304d77930204bdbe904">exception</a>(<span class="keyword">const</span> <a class="code" href="classadevs_1_1exception.html">adevs::exception</a>& src): <a name="l00048"></a>00048 std::<a class="code" href="classadevs_1_1exception.html">exception</a>(src), <a name="l00049"></a>00049 msg(src.msg), <a name="l00050"></a>00050 model(src.model) <a name="l00051"></a>00051 {} <a name="l00053"></a><a class="code" href="classadevs_1_1exception.html#a757964f8c164c74395ebdffebf695c11">00053</a> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="classadevs_1_1exception.html#a757964f8c164c74395ebdffebf695c11" title="Get the error message.">what</a>() <span class="keyword">const</span> throw() <a name="l00054"></a>00054 { <a name="l00055"></a>00055 <span class="keywordflow">return</span> msg.c_str(); <a name="l00056"></a>00056 } <a name="l00058"></a><a class="code" href="classadevs_1_1exception.html#a3dd5f3668a2b516aeff18c1b537eb8ae">00058</a> <span class="keywordtype">void</span>* <a class="code" href="classadevs_1_1exception.html#a3dd5f3668a2b516aeff18c1b537eb8ae" title="Get a pointer to the model that created the error.">who</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> model; } <a name="l00060"></a><a class="code" href="classadevs_1_1exception.html#a2f3509f199502975fc4e9d6a291e82db">00060</a> <a class="code" href="classadevs_1_1exception.html#a2f3509f199502975fc4e9d6a291e82db" title="Destructor.">~exception</a>() throw(){} <a name="l00061"></a>00061 <span class="keyword">private</span>: <a name="l00062"></a>00062 std::string msg; <a name="l00063"></a>00063 <span class="keywordtype">void</span>* model; <a name="l00064"></a>00064 }; <a name="l00065"></a>00065 <a name="l00070"></a>00070 <span class="keyword">class </span>method_not_supported_exception: <a name="l00071"></a>00071 <span class="keyword">public</span> exception <a name="l00072"></a>00072 { <a name="l00073"></a>00073 <span class="keyword">public</span>: <a name="l00078"></a><a class="code" href="classadevs_1_1method__not__supported__exception.html#a26747af7802cbbafcf5e4cec1ef61d30">00078</a> <a class="code" href="classadevs_1_1method__not__supported__exception.html#a26747af7802cbbafcf5e4cec1ef61d30">method_not_supported_exception</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* method, <span class="keywordtype">void</span>* model): <a name="l00079"></a>00079 <a class="code" href="classadevs_1_1exception.html">exception</a>((std::string(<span class="stringliteral">"Unsupported method: "</span>)+std::string(method)).c_str(), <a name="l00080"></a>00080 model) <a name="l00081"></a>00081 { <a name="l00082"></a>00082 } <a name="l00083"></a>00083 }; <a name="l00084"></a>00084 <a name="l00089"></a>00089 <span class="keyword">class </span>lookahead_impossible_exception: <a name="l00090"></a>00090 <span class="keyword">public</span> exception <a name="l00091"></a>00091 { <a name="l00092"></a>00092 <span class="keyword">public</span>: <a name="l00093"></a>00093 lookahead_impossible_exception(): <a name="l00094"></a>00094 <a class="code" href="classadevs_1_1exception.html#ab3f1e6fbf8a50304d77930204bdbe904">exception</a>(<span class="stringliteral">"Lookahead cannot proceed"</span>) <a name="l00095"></a>00095 { <a name="l00096"></a>00096 } <a name="l00097"></a>00097 }; <a name="l00098"></a>00098 <a name="l00099"></a>00099 } <span class="comment">// end of namespace</span> <a name="l00100"></a>00100 <a name="l00101"></a>00101 <span class="preprocessor">#endif</span> <a name="l00102"></a>00102 <span class="preprocessor"></span> </pre></div></div> </div> <hr class="footer"/><address class="footer"><small> Generated on Sun Jun 10 2012 18:42:49 for adevs by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.7.5 </small></address> </body> </html>