You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
11KB

  1. <HTML>
  2. <HEAD>
  3. <TITLE>The RtAudio Home Page</TITLE>
  4. <LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
  5. <LINK REL="SHORTCUT ICON" HREF="http://www.music.mcgill.ca/~gary/favicon.ico">
  6. </HEAD>
  7. <BODY BGCOLOR="#FFFFFF">
  8. <CENTER>
  9. <a class="qindex" href="index.html">Home</a> &nbsp; <a class="qindex" href="annotated.html">Class/Enum List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; </CENTER>
  10. <HR>
  11. <!-- Generated by Doxygen 1.8.2 -->
  12. </div><!-- top -->
  13. <div class="header">
  14. <div class="headertitle">
  15. <div class="title">RtError.h</div> </div>
  16. </div><!--header-->
  17. <div class="contents">
  18. <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">/************************************************************************/</span></div>
  19. <div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment">/************************************************************************/</span></div>
  20. <div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;</div>
  21. <div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="preprocessor">#ifndef RTERROR_H</span></div>
  22. <div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define RTERROR_H</span></div>
  23. <div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="preprocessor"></span></div>
  24. <div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="preprocessor">#include &lt;exception&gt;</span></div>
  25. <div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div>
  26. <div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div>
  27. <div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;</div>
  28. <div class="line"><a name="l00019"></a><span class="lineno"><a class="code" href="classRtError.html"> 19</a></span>&#160;<span class="keyword">class </span><a class="code" href="classRtError.html" title="Exception handling class for RtAudio &amp; RtMidi.">RtError</a> : <span class="keyword">public</span> std::exception</div>
  29. <div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;{</div>
  30. <div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160; <span class="keyword">public</span>:</div>
  31. <div class="line"><a name="l00023"></a><span class="lineno"><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903ac"> 23</a></span>&#160; <span class="keyword">enum</span> <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903ac" title="Defined RtError types.">Type</a> {</div>
  32. <div class="line"><a name="l00024"></a><span class="lineno"><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca3a1603c24a56cbdaf5f8ae4ddcb86398"> 24</a></span>&#160; <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca3a1603c24a56cbdaf5f8ae4ddcb86398">WARNING</a>, </div>
  33. <div class="line"><a name="l00025"></a><span class="lineno"><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca20e5a369394d19b704ace17002007eba"> 25</a></span>&#160; <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca20e5a369394d19b704ace17002007eba">DEBUG_WARNING</a>, </div>
  34. <div class="line"><a name="l00026"></a><span class="lineno"><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca444efd3ccf774b2ba9f9bde70ec71cd6"> 26</a></span>&#160; <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca444efd3ccf774b2ba9f9bde70ec71cd6">UNSPECIFIED</a>, </div>
  35. <div class="line"><a name="l00027"></a><span class="lineno"><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acaf267eb2d710f33d649ba840eeab6ff82"> 27</a></span>&#160; <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acaf267eb2d710f33d649ba840eeab6ff82">NO_DEVICES_FOUND</a>, </div>
  36. <div class="line"><a name="l00028"></a><span class="lineno"><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acad6064062066fffdba258237a7c2159b1"> 28</a></span>&#160; <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acad6064062066fffdba258237a7c2159b1">INVALID_DEVICE</a>, </div>
  37. <div class="line"><a name="l00029"></a><span class="lineno"><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acab4f813e5a36905c89d4081a59497432e"> 29</a></span>&#160; <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acab4f813e5a36905c89d4081a59497432e">MEMORY_ERROR</a>, </div>
  38. <div class="line"><a name="l00030"></a><span class="lineno"><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acaa3eabf0f71120beaba94148a1b78fed6"> 30</a></span>&#160; <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acaa3eabf0f71120beaba94148a1b78fed6">INVALID_PARAMETER</a>, </div>
  39. <div class="line"><a name="l00031"></a><span class="lineno"><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca8e65f51a3fbdc1a4a1552b3260df36bc"> 31</a></span>&#160; <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca8e65f51a3fbdc1a4a1552b3260df36bc">INVALID_USE</a>, </div>
  40. <div class="line"><a name="l00032"></a><span class="lineno"><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca995e97ecf6beeedaba525022a63aec6b"> 32</a></span>&#160; <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca995e97ecf6beeedaba525022a63aec6b">DRIVER_ERROR</a>, </div>
  41. <div class="line"><a name="l00033"></a><span class="lineno"><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca8947d0a2e2a84ecf3646271844e06a6b"> 33</a></span>&#160; <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca8947d0a2e2a84ecf3646271844e06a6b">SYSTEM_ERROR</a>, </div>
  42. <div class="line"><a name="l00034"></a><span class="lineno"><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acaeb6282f991e2d93ab294a4272fc3f6c6"> 34</a></span>&#160; <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acaeb6282f991e2d93ab294a4272fc3f6c6">THREAD_ERROR</a> </div>
  43. <div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; };</div>
  44. <div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;</div>
  45. <div class="line"><a name="l00038"></a><span class="lineno"><a class="code" href="classRtError.html#aa479a305ccbe56be0fd9137b9b405a37"> 38</a></span>&#160; <a class="code" href="classRtError.html#aa479a305ccbe56be0fd9137b9b405a37" title="The constructor.">RtError</a>( <span class="keyword">const</span> std::string&amp; message, <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903ac" title="Defined RtError types.">Type</a> type = <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca444efd3ccf774b2ba9f9bde70ec71cd6">RtError::UNSPECIFIED</a> ) throw() : message_(message), type_(type) {}</div>
  46. <div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; </div>
  47. <div class="line"><a name="l00041"></a><span class="lineno"><a class="code" href="classRtError.html#a6793e03386e7e69ffafb65a296dfa48c"> 41</a></span>&#160; <span class="keyword">virtual</span> <a class="code" href="classRtError.html#a6793e03386e7e69ffafb65a296dfa48c" title="The destructor.">~RtError</a>( <span class="keywordtype">void</span> ) throw() {}</div>
  48. <div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160;</div>
  49. <div class="line"><a name="l00044"></a><span class="lineno"><a class="code" href="classRtError.html#a251dcdac396c998c91706dd2dd3b8bfc"> 44</a></span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classRtError.html#a251dcdac396c998c91706dd2dd3b8bfc" title="Prints thrown error message to stderr.">printMessage</a>( <span class="keywordtype">void</span> ) <span class="keyword">const</span> throw() { std::cerr &lt;&lt; <span class="charliteral">&#39;\n&#39;</span> &lt;&lt; message_ &lt;&lt; <span class="stringliteral">&quot;\n\n&quot;</span>; }</div>
  50. <div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160;</div>
  51. <div class="line"><a name="l00047"></a><span class="lineno"><a class="code" href="classRtError.html#a3e316dc9b9b41fe2f64cabf34beb4fe7"> 47</a></span>&#160; <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903ac" title="Defined RtError types.">Type</a>&amp; <a class="code" href="classRtError.html#a3e316dc9b9b41fe2f64cabf34beb4fe7" title="Returns the thrown error message type.">getType</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span> throw() { <span class="keywordflow">return</span> type_; }</div>
  52. <div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;</div>
  53. <div class="line"><a name="l00050"></a><span class="lineno"><a class="code" href="classRtError.html#afd067ba6b46edd37f989cad02cd70b50"> 50</a></span>&#160; <span class="keyword">virtual</span> <span class="keyword">const</span> std::string&amp; <a class="code" href="classRtError.html#afd067ba6b46edd37f989cad02cd70b50" title="Returns the thrown error message string.">getMessage</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span> throw() { <span class="keywordflow">return</span> message_; }</div>
  54. <div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;</div>
  55. <div class="line"><a name="l00053"></a><span class="lineno"><a class="code" href="classRtError.html#aeb843b7a7785d66061c61ebfc29e7e9d"> 53</a></span>&#160; <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="classRtError.html#aeb843b7a7785d66061c61ebfc29e7e9d" title="Returns the thrown error message as a c-style string.">what</a>( <span class="keywordtype">void</span> ) <span class="keyword">const</span> throw() { <span class="keywordflow">return</span> message_.c_str(); }</div>
  56. <div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;</div>
  57. <div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; <span class="keyword">protected</span>:</div>
  58. <div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; std::string message_;</div>
  59. <div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903ac" title="Defined RtError types.">Type</a> type_;</div>
  60. <div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;};</div>
  61. <div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160;</div>
  62. <div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;<span class="preprocessor">#endif</span></div>
  63. </div><!-- fragment --></div><!-- contents -->
  64. <HR>
  65. <table><tr><td><img src="../images/mcgill.gif" width=165></td>
  66. <td>&copy;2001-2013 Gary P. Scavone, McGill University. All Rights Reserved.<br>Maintained by <a href="http://www.music.mcgill.ca/~gary/">Gary P. Scavone</a>.</td></tr>
  67. </table>
  68. </BODY>
  69. </HTML>