This file is indexed.

/usr/share/doc/libloki-doc/html/a00029.html is in libloki-doc 0.1.7-3ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Loki: Loki::ContractChecker&lt; Host, ExceptionPolicy &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</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>
    <li>
      <form action="search.php" method="get">
        <table cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
          </tr>
        </table>
      </form>
    </li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="classes.html"><span>Class&nbsp;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="a00192.html">Loki</a>::<a class="el" href="a00029.html">ContractChecker</a>
  </div>
</div>
<div class="contents">
<h1>Loki::ContractChecker&lt; Host, ExceptionPolicy &gt; Class Template Reference</h1><!-- doxytag: class="Loki::ContractChecker" --><code>#include &lt;Checker.h&gt;</code>
<p>

<p>
<a href="a00301.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="041784de821e2ca4fa00aef169acc18b"></a><!-- doxytag: member="Loki::ContractChecker::Validator" ref="041784de821e2ca4fa00aef169acc18b" args=")(void) const " -->
typedef bool(Host::*&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#041784de821e2ca4fa00aef169acc18b">Validator</a> )(void) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Signature for the validation function. <br></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#47a88a788d4099204e3a49593e4ff2a2">ContractChecker</a> (const Host *host, <a class="el" href="a00029.html#041784de821e2ca4fa00aef169acc18b">Validator</a> validator, <a class="el" href="a00029.html#041784de821e2ca4fa00aef169acc18b">Validator</a> pre=0, <a class="el" href="a00029.html#041784de821e2ca4fa00aef169acc18b">Validator</a> post=0)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#ac668398deabba5291b9025b4ac4eafd">~ContractChecker</a> (void)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#812565f4dccc8d50be8f7b9c91841a51">Check</a> (void) const </td></tr>

</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<h3>template&lt;class Host, template&lt; class &gt; class ExceptionPolicy&gt;<br>
 class Loki::ContractChecker&lt; Host, ExceptionPolicy &gt;</h3>

This class determines if a function violated any class invariant, but it also determines if a function fulfills its contract with client code. In the "Design by Contract" paradigm, each function has certain pre-conditions and post-conditions which may differ from the class invariants. This asserts if a check for an invariant fails as well as if any pre- or post-condition fails. It also demonstrate which exception safety level a function provides.<p>
<dl class="user" compact><dt><b>Usage</b></dt><dd><ol type=1>
<li>Implement a function that checks each class invariant. The function must have the signature similar to the Validator type. Something like: "bool Host::IsValid( void ) const;"<ul>
<li>The function should return true if everything is okay, but false if something is wrong.</li><li>Or it could assert if anything is wrong.</li><li>Ideally, it should be private.</li></ul>
</li><li>Implement similar functions to check for pre-conditions and post-conditions. Functions which verify pre-conditions and post-conditions do not need to check all class invariants, just conditions specific to certain public functions in the host class.</li><li>Declare some typedef's inside the class declaration like these. Make one typedef for each exception policy you use. I typedef'ed the <a class="el" href="a00020.html">CheckForNothing</a> policy as CheckInvariants because even if a function can't provide either the no-throw nor the no-change policies, it should still make sure the object remains in a valid state.<ul>
<li>typedef Loki::ContractChecker&lt; Host, ::Loki::CheckForNoThrow  &gt; <a class="el" href="a00021.html">CheckForNoThrow</a>;</li><li>typedef Loki::ContractChecker&lt; Host, ::Loki::CheckForNoChange &gt; <a class="el" href="a00018.html">CheckForNoChange</a>;</li><li>typedef Loki::ContractChecker&lt; Host, ::Loki::CheckForEquality &gt; <a class="el" href="a00017.html">CheckForEquality</a>;</li><li>typedef Loki::ContractChecker&lt; Host, ::Loki::CheckForNothing  &gt; CheckInvariants;</li></ul>
</li><li>Construct a checker near the top of each member function - except in the validator member function. Pass the this pointer and the address of your validator function into the checker's constructor. You may also pass in pointers to function which check pre- and post-conditions.<ul>
<li>If the function never throws, then use the <a class="el" href="a00021.html">CheckForNoThrow</a> policy.</li><li>If the function never changes any data members, then use <a class="el" href="a00017.html">CheckForEquality</a> policy.</li><li>If the function's normal execution flow changes data, but must make sure data remains unchanged when any exceptions occur, then use the <a class="el" href="a00018.html">CheckForNoChange</a> policy.</li><li>Otherwise use the CheckInvariants policy.</li></ul>
</li><li>Recompile a debug version of your program, run the program and all the unit tests, and look for which assertions failed. </li></ol>
</dd></dl>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="47a88a788d4099204e3a49593e4ff2a2"></a><!-- doxytag: member="Loki::ContractChecker::ContractChecker" ref="47a88a788d4099204e3a49593e4ff2a2" args="(const Host *host, Validator validator, Validator pre=0, Validator post=0)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class Host , template&lt; class &gt; class ExceptionPolicy&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00029.html">Loki::ContractChecker</a>&lt; Host, ExceptionPolicy &gt;::<a class="el" href="a00029.html">ContractChecker</a>           </td>
          <td>(</td>
          <td class="paramtype">const Host *&nbsp;</td>
          <td class="paramname"> <em>host</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="a00029.html#041784de821e2ca4fa00aef169acc18b">Validator</a>&nbsp;</td>
          <td class="paramname"> <em>validator</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="a00029.html#041784de821e2ca4fa00aef169acc18b">Validator</a>&nbsp;</td>
          <td class="paramname"> <em>pre</em> = <code>0</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="a00029.html#041784de821e2ca4fa00aef169acc18b">Validator</a>&nbsp;</td>
          <td class="paramname"> <em>post</em> = <code>0</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
The constructor makes sure the host is valid at the time the checker was created, thus insuring the host object was not corrupt from the start. <dl class="user" compact><dt><b>host Pointer to host object.</b></dt><dd></dd></dl>
<dl class="user" compact><dt><b>validator Pointer to function that checks class invariants.</b></dt><dd></dd></dl>
<dl class="user" compact><dt><b>pre Optional pointer to function that checks pre-conditions.</b></dt><dd></dd></dl>
<dl class="user" compact><dt><b>post Optional pointer to function that checks post-conditions.</b></dt><dd></dd></dl>

<p>References <a class="el" href="a00232.html#l00328">Loki::ContractChecker&lt; Host, ExceptionPolicy &gt;::Check()</a>.</p>

<p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>

</div>
</div><p>
<a class="anchor" name="ac668398deabba5291b9025b4ac4eafd"></a><!-- doxytag: member="Loki::ContractChecker::~ContractChecker" ref="ac668398deabba5291b9025b4ac4eafd" args="(void)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class Host , template&lt; class &gt; class ExceptionPolicy&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00029.html">Loki::ContractChecker</a>&lt; Host, ExceptionPolicy &gt;::~<a class="el" href="a00029.html">ContractChecker</a>           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
The destructor checks if any Host invariants failed, and then calls the ExceptionPolicy's Check function to determine what to do in case of an exception. 
<p>References <a class="el" href="a00232.html#l00328">Loki::ContractChecker&lt; Host, ExceptionPolicy &gt;::Check()</a>.</p>

<p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="812565f4dccc8d50be8f7b9c91841a51"></a><!-- doxytag: member="Loki::ContractChecker::Check" ref="812565f4dccc8d50be8f7b9c91841a51" args="(void) const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class Host , template&lt; class &gt; class ExceptionPolicy&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="a00029.html">Loki::ContractChecker</a>&lt; Host, ExceptionPolicy &gt;::Check           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This first checks the invariants for <a class="el" href="a00029.html">ContractChecker</a>, and then calls the validator function for the host to make sure no class invariants were broken by the host within the Host's member function body. The host member function can call Check directly to verify the object remains valid at any time. This does not care if the pre- and post-condition validator pointers are null since a host class may pass in NULL pointers for either to indicate the pre-conditions or post-conditions are the same as the overall class invariants. 
<p>Referenced by <a class="el" href="a00232.html#l00294">Loki::ContractChecker&lt; Host, ExceptionPolicy &gt;::ContractChecker()</a>, and <a class="el" href="a00232.html#l00311">Loki::ContractChecker&lt; Host, ExceptionPolicy &gt;::~ContractChecker()</a>.</p>

</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="a00147.html">Checker.h</a></ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Thu Jan 29 18:51:42 2009 for Loki by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>