root/doc/html/itassert_8h-source.html @ 353

Revision 353, 13.3 kB (checked in by smidl, 15 years ago)

doc

RevLine 
[353]1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3<title>mixpp: itassert.h Source File</title>
4<link href="tabs.css" rel="stylesheet" type="text/css">
5<link href="doxygen.css" rel="stylesheet" type="text/css">
6</head><body>
7<!-- Generated by Doxygen 1.5.8 -->
8<script type="text/javascript">
9<!--
10function changeDisplayState (e){
11  var num=this.id.replace(/[^[0-9]/g,'');
12  var button=this.firstChild;
13  var sectionDiv=document.getElementById('dynsection'+num);
14  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
15    sectionDiv.style.display='block';
16    button.src='open.gif';
17  }else{
18    sectionDiv.style.display='none';
19    button.src='closed.gif';
20  }
21}
22function initDynSections(){
23  var divs=document.getElementsByTagName('div');
24  var sectionCounter=1;
25  for(var i=0;i<divs.length-1;i++){
26    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
27      var header=divs[i];
28      var section=divs[i+1];
29      var button=header.firstChild;
30      if (button!='IMG'){
31        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
32        button=document.createElement('img');
33        divs[i].insertBefore(button,divs[i].firstChild);
34      }
35      header.style.cursor='pointer';
36      header.onclick=changeDisplayState;
37      header.id='dynheader'+sectionCounter;
38      button.src='closed.gif';
39      section.id='dynsection'+sectionCounter;
40      section.style.display='none';
41      section.style.marginLeft='14px';
42      sectionCounter++;
43    }
44  }
45}
46window.onload = initDynSections;
47-->
48</script>
49<div class="navigation" id="top">
50  <div class="tabs">
51    <ul>
52      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
53      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
54      <li><a href="modules.html"><span>Modules</span></a></li>
55      <li><a href="annotated.html"><span>Classes</span></a></li>
56      <li class="current"><a href="files.html"><span>Files</span></a></li>
57    </ul>
58  </div>
59  <div class="tabs">
60    <ul>
61      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
62      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
63    </ul>
64  </div>
65<h1>itassert.h</h1><a href="itassert_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
66<a name="l00029"></a>00029 <span class="preprocessor">#ifndef ITASSERT_H</span>
67<a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#define ITASSERT_H</span>
68<a name="l00031"></a>00031 <span class="preprocessor"></span>
69<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;sstream&gt;</span>
70<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;string&gt;</span>
71<a name="l00034"></a>00034
72<a name="l00035"></a>00035
73<a name="l00036"></a>00036 <span class="keyword">namespace </span>itpp
74<a name="l00037"></a>00037 {
75<a name="l00038"></a>00038
76<a name="l00066"></a>00066
77<a name="l00067"></a>00067
78<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="group__errorhandlingfunc.html#ge75ba7a501dbe8083fc9569df545bfbf" title="Helper function for the it_assert and it_assert_debug macros.">it_assert_f</a>(std::string ass, std::string msg, std::string file, <span class="keywordtype">int</span> line);
79<a name="l00071"></a>00071 <span class="keywordtype">void</span> <a class="code" href="group__errorhandlingfunc.html#g6433649664140b535c257b7e676d6802" title="Helper function for the it_error and it_error_if macros.">it_error_f</a>(std::string msg, std::string file, <span class="keywordtype">int</span> line);
80<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="group__errorhandlingfunc.html#g3918817375e27902994abcd4a7dcd0b0" title="Helper function for the it_info and it_info_debug macros.">it_info_f</a>(std::string msg);
81<a name="l00075"></a>00075 <span class="keywordtype">void</span> <a class="code" href="group__errorhandlingfunc.html#gf7cd873ef7191dbdae7f34d635b2b336" title="Helper function for the it_warning macro.">it_warning_f</a>(std::string msg, std::string file, <span class="keywordtype">int</span> line);
82<a name="l00076"></a>00076
83<a name="l00078"></a>00078 <span class="keywordtype">void</span> <a class="code" href="group__errorhandlingfunc.html#gbfeae66baa360366476a1cbff5bd9a55" title="Enable/disable using exceptions for error handling.">it_enable_exceptions</a>(<span class="keywordtype">bool</span> on);
84<a name="l00080"></a>00080 <span class="keywordtype">void</span> <a class="code" href="group__errorhandlingfunc.html#ge6044970b0d1826008f4bd9126cdfbff" title="Enable warnings.">it_enable_warnings</a>();
85<a name="l00082"></a>00082 <span class="keywordtype">void</span> <a class="code" href="group__errorhandlingfunc.html#gb62a8f63f3fe7247b80ea6bd298c868f" title="Disable warnings.">it_disable_warnings</a>();
86<a name="l00084"></a>00084 <span class="keywordtype">void</span> <a class="code" href="group__errorhandlingfunc.html#gf735d09367b95f954d99462845f9b878" title="Redirect warnings to the ostream warn_stream.">it_redirect_warnings</a>(std::ostream *warn_stream);
87<a name="l00085"></a>00085
88<a name="l00087"></a><a class="code" href="group__errorhandlingfunc.html#g240f2880b00be0707d042f2ce94c60eb">00087</a> <span class="keyword">enum</span> <a class="code" href="group__errorhandlingfunc.html#g240f2880b00be0707d042f2ce94c60eb" title="Style of assert, error and warning messages.">error_msg_style</a> { Full, Minimum };
89<a name="l00088"></a>00088
90<a name="l00090"></a>00090 <span class="keywordtype">void</span> <a class="code" href="group__errorhandlingfunc.html#g570195341cb1731c69519f556ad8de8b" title="Set preferred style of assert, error and warning messages.">it_error_msg_style</a>(<a class="code" href="group__errorhandlingfunc.html#g240f2880b00be0707d042f2ce94c60eb" title="Style of assert, error and warning messages.">error_msg_style</a> style);
91<a name="l00091"></a>00091
92<a name="l00092"></a>00092
93<a name="l00094"></a><a class="code" href="group__errorhandlingfunc.html#gd5c34b291e5018534fd2344486e2b5a1">00094</a> <span class="preprocessor">#define it_assert(t,s)      \</span>
94<a name="l00095"></a>00095 <span class="preprocessor">  if (!(t)) {       \</span>
95<a name="l00096"></a>00096 <span class="preprocessor">    std::ostringstream m_sout;     \</span>
96<a name="l00097"></a>00097 <span class="preprocessor">    m_sout &lt;&lt; s;      \</span>
97<a name="l00098"></a>00098 <span class="preprocessor">    itpp::it_assert_f(#t,m_sout.str(),__FILE__,__LINE__); \</span>
98<a name="l00099"></a>00099 <span class="preprocessor">  } else       \</span>
99<a name="l00100"></a>00100 <span class="preprocessor">    ((void) 0)</span>
100<a name="l00101"></a>00101 <span class="preprocessor"></span>
101<a name="l00102"></a>00102 <span class="preprocessor">#if defined(NDEBUG)</span>
102<a name="l00104"></a>00104 <span class="preprocessor">#  define it_assert_debug(t,s) ((void) 0)</span>
103<a name="l00105"></a>00105 <span class="preprocessor"></span><span class="preprocessor">#else</span>
104<a name="l00107"></a><a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6">00107</a> <span class="preprocessor">#  define it_assert_debug(t,s) it_assert(t,s)</span>
105<a name="l00108"></a>00108 <span class="preprocessor"></span><span class="preprocessor">#endif // if defined(NDEBUG)</span>
106<a name="l00109"></a>00109 <span class="preprocessor"></span>
107<a name="l00111"></a><a class="code" href="group__errorhandlingfunc.html#gb2f2da10388e221de696f6ab7df51ba3">00111</a> <span class="preprocessor">#define it_assert0(t,s) it_assert_debug(t,s)</span>
108<a name="l00113"></a><a class="code" href="group__errorhandlingfunc.html#gdbf38dd073ce8b5bd14251a071477b0a">00113</a> <span class="preprocessor">#define it_assert1(t,s) it_assert_debug(t,s)</span>
109<a name="l00114"></a>00114 <span class="preprocessor"></span>
110<a name="l00115"></a>00115
111<a name="l00117"></a><a class="code" href="group__errorhandlingfunc.html#g0dfeed1c189885b05ebebe78abcc9785">00117</a> <span class="preprocessor">#define it_error_if(t,s)    \</span>
112<a name="l00118"></a>00118 <span class="preprocessor">  if((t)) {      \</span>
113<a name="l00119"></a>00119 <span class="preprocessor">    std::ostringstream m_sout;    \</span>
114<a name="l00120"></a>00120 <span class="preprocessor">    m_sout &lt;&lt; s;     \</span>
115<a name="l00121"></a>00121 <span class="preprocessor">    itpp::it_error_f(m_sout.str(),__FILE__,__LINE__); \</span>
116<a name="l00122"></a>00122 <span class="preprocessor">  } else      \</span>
117<a name="l00123"></a>00123 <span class="preprocessor">    ((void) 0)</span>
118<a name="l00124"></a>00124 <span class="preprocessor"></span>
119<a name="l00126"></a><a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce">00126</a> <span class="preprocessor">#define it_error(s)     \</span>
120<a name="l00127"></a>00127 <span class="preprocessor">  if (true) {      \</span>
121<a name="l00128"></a>00128 <span class="preprocessor">    std::ostringstream m_sout;    \</span>
122<a name="l00129"></a>00129 <span class="preprocessor">    m_sout &lt;&lt; s;     \</span>
123<a name="l00130"></a>00130 <span class="preprocessor">    itpp::it_error_f(m_sout.str(),__FILE__,__LINE__); \</span>
124<a name="l00131"></a>00131 <span class="preprocessor">  } else      \</span>
125<a name="l00132"></a>00132 <span class="preprocessor">    ((void) 0)</span>
126<a name="l00133"></a>00133 <span class="preprocessor"></span>
127<a name="l00134"></a>00134
128<a name="l00136"></a><a class="code" href="group__errorhandlingfunc.html#g9fd46bf5a2e2228d99769b2341c18c0c">00136</a> <span class="preprocessor">#define it_info(s)    \</span>
129<a name="l00137"></a>00137 <span class="preprocessor">  if (true) {     \</span>
130<a name="l00138"></a>00138 <span class="preprocessor">    std::ostringstream m_sout;   \</span>
131<a name="l00139"></a>00139 <span class="preprocessor">    m_sout &lt;&lt; s &lt;&lt; std::endl;   \</span>
132<a name="l00140"></a>00140 <span class="preprocessor">    itpp::it_info_f(m_sout.str());  \</span>
133<a name="l00141"></a>00141 <span class="preprocessor">  } else     \</span>
134<a name="l00142"></a>00142 <span class="preprocessor">    ((void) 0)</span>
135<a name="l00143"></a>00143 <span class="preprocessor"></span>
136<a name="l00145"></a><a class="code" href="group__errorhandlingfunc.html#ga5f50a438e793967af5f4ccbce0fd200">00145</a> <span class="preprocessor">#define it_info_no_endl(s)   \</span>
137<a name="l00146"></a>00146 <span class="preprocessor">  if (true) {     \</span>
138<a name="l00147"></a>00147 <span class="preprocessor">    std::ostringstream m_sout;   \</span>
139<a name="l00148"></a>00148 <span class="preprocessor">    m_sout &lt;&lt; s;    \</span>
140<a name="l00149"></a>00149 <span class="preprocessor">    itpp::it_info_f(m_sout.str());  \</span>
141<a name="l00150"></a>00150 <span class="preprocessor">  } else     \</span>
142<a name="l00151"></a>00151 <span class="preprocessor">    ((void) 0)</span>
143<a name="l00152"></a>00152 <span class="preprocessor"></span>
144<a name="l00153"></a>00153 <span class="preprocessor">#if defined(NDEBUG)</span>
145<a name="l00155"></a>00155 <span class="preprocessor">#  define it_info_debug(s) ((void) 0)</span>
146<a name="l00156"></a>00156 <span class="preprocessor"></span>
147<a name="l00160"></a>00160 <span class="preprocessor">#  define it_info_no_endl_debug(s) ((void) 0)</span>
148<a name="l00161"></a>00161 <span class="preprocessor"></span><span class="preprocessor">#else</span>
149<a name="l00163"></a><a class="code" href="group__errorhandlingfunc.html#ga504b34ee91d002167e90daa5808963c">00163</a> <span class="preprocessor">#  define it_info_debug(s) it_info(s)</span>
150<a name="l00164"></a>00164 <span class="preprocessor"></span>
151<a name="l00168"></a><a class="code" href="group__errorhandlingfunc.html#gb6ec26d80721b2990fd0ca0393daf430">00168</a> <span class="preprocessor">#  define it_info_no_endl_debug(s) it_info_no_endl(s)</span>
152<a name="l00169"></a>00169 <span class="preprocessor"></span><span class="preprocessor">#endif // if defined(NDEBUG)</span>
153<a name="l00170"></a>00170 <span class="preprocessor"></span>
154<a name="l00171"></a>00171
155<a name="l00173"></a><a class="code" href="group__errorhandlingfunc.html#g365842195965b61b7ab3ac7938c58b77">00173</a> <span class="preprocessor">#define it_warning(s)     \</span>
156<a name="l00174"></a>00174 <span class="preprocessor">  if (true) {      \</span>
157<a name="l00175"></a>00175 <span class="preprocessor">    std::ostringstream m_sout;    \</span>
158<a name="l00176"></a>00176 <span class="preprocessor">    m_sout &lt;&lt; s;     \</span>
159<a name="l00177"></a>00177 <span class="preprocessor">    itpp::it_warning_f(m_sout.str(),__FILE__,__LINE__); \</span>
160<a name="l00178"></a>00178 <span class="preprocessor">  } else      \</span>
161<a name="l00179"></a>00179 <span class="preprocessor">    ((void) 0)</span>
162<a name="l00180"></a>00180 <span class="preprocessor"></span>
163<a name="l00182"></a>00182
164<a name="l00183"></a>00183 } <span class="comment">// namespace itpp</span>
165<a name="l00184"></a>00184
166<a name="l00185"></a>00185 <span class="preprocessor">#endif // #ifndef ITASSERT_H</span>
167</pre></div></div>
168<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:11 2009 for mixpp by&nbsp;
169<a href="http://www.doxygen.org/index.html">
170<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
171</body>
172</html>
Note: See TracBrowser for help on using the browser.