no_exception_support.xml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE section PUBLIC "-//Boost//DTD BoostBook XML V1.1//EN"
  3. "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
  4. <section id="safe_numerics.exception_policies.no_exception_support">
  5. <title>no_exception_support&lt;NoError, UnInitalized, Overflow, Underflow,
  6. Range, Domain&gt;</title>
  7. <section>
  8. <title>Description</title>
  9. <para>This exception policy can be used in an environment where one cannot
  10. or does not want to use exceptions.</para>
  11. <para>Parameters are pointers to static functions which are invoked for
  12. each kind of error encountered in the library. The function signature of
  13. these functions are <code>void function(const char * message)</code> where
  14. <code>message</code> is the address of a literal string with information
  15. regarding the error.</para>
  16. </section>
  17. <section>
  18. <title>Template Parameters</title>
  19. <para>Function objects to be invoked are specified for each error
  20. condition via template parameters.</para>
  21. <informaltable>
  22. <tgroup cols="4">
  23. <colspec align="left"/>
  24. <colspec align="left" colwidth="3*"/>
  25. <colspec align="left" colwidth="6*"/>
  26. <thead>
  27. <row>
  28. <entry align="left">Parameter</entry>
  29. <entry align="left">Type Requirements</entry>
  30. <entry>Description</entry>
  31. </row>
  32. </thead>
  33. <tbody>
  34. <row>
  35. <entry><code>NoError</code></entry>
  36. <entry><code>void (*NoError)(const char *)</code></entry>
  37. <entry><para>Function to call on when an operation is invoked
  38. which COULD throw but does not.</para></entry>
  39. </row>
  40. <row>
  41. <entry><code>UnInitalized</code></entry>
  42. <entry><code>void (*UnInitalizized)(const char *)</code></entry>
  43. <entry><para>Function to call on when value is
  44. uninitialized</para></entry>
  45. </row>
  46. <row>
  47. <entry><code>Overflow</code></entry>
  48. <entry><code>void (*Overflow)(const char *)</code></entry>
  49. <entry><para>Function to call on overflow error</para></entry>
  50. </row>
  51. <row>
  52. <entry><code>Overflow</code></entry>
  53. <entry><code>void (*Overflow)(const char *)</code></entry>
  54. <entry><para>Function to call on overflow error</para></entry>
  55. </row>
  56. <row>
  57. <entry><code>Underflow</code></entry>
  58. <entry><code>void (*Underflow)(const char *)</code></entry>
  59. <entry><para>Function to call on underflow error</para></entry>
  60. </row>
  61. <row>
  62. <entry><code>Range</code></entry>
  63. <entry><code>void (*Range)(const char *)</code></entry>
  64. <entry><para>Function to call on range error</para></entry>
  65. </row>
  66. <row>
  67. <entry><code>Domain</code></entry>
  68. <entry><code>void (*Domain)(const char *)</code></entry>
  69. <entry>Function to call on domain error</entry>
  70. </row>
  71. </tbody>
  72. </tgroup>
  73. </informaltable>
  74. </section>
  75. <section>
  76. <title>Model of</title>
  77. <para><link
  78. linkend="safe_numerics.promotion_policy">ExceptionPolicy</link></para>
  79. </section>
  80. <section>
  81. <title>Header</title>
  82. <para><code><ulink url="../../include/exception_policy.hpp"><code>#include
  83. &lt;boost/safe_numerics/exception_policy.hpp&gt;
  84. </code></ulink></code></para>
  85. </section>
  86. <section>
  87. <title>Example of use</title>
  88. <para>[A code fragment involving the type.]</para>
  89. <programlisting>void no_error(const char * msg);
  90. void uninitialize(const char * msg);
  91. void overflow(const char * msg);
  92. void underflow(const char * msg);
  93. void range_error(const char * msg);
  94. void domain_error(const char * msg);
  95. using ep = ignore_exception&lt;
  96. no_error,
  97. uninitialized,
  98. overflow,
  99. underflow,
  100. range_error,
  101. domain_error
  102. &gt;;
  103. safe&lt;int, native, ep&gt; st(4);</programlisting>
  104. </section>
  105. </section>