<!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>CVC3: clause.h Source File</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.7.4 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">CVC3 <span id="projectnumber">2.4.1</span></div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</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> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <div class="title">clause.h</div> </div> </div> <div class="contents"> <a href="clause_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*****************************************************************************/</span><span class="comment"></span> <a name="l00002"></a>00002 <span class="comment">/*!</span> <a name="l00003"></a>00003 <span class="comment"> * \file clause.h</span> <a name="l00004"></a>00004 <span class="comment"> * </span> <a name="l00005"></a>00005 <span class="comment"> * Author: Sergey Berezin</span> <a name="l00006"></a>00006 <span class="comment"> * </span> <a name="l00007"></a>00007 <span class="comment"> * Created: Fri Mar 7 16:03:38 2003</span> <a name="l00008"></a>00008 <span class="comment"> *</span> <a name="l00009"></a>00009 <span class="comment"> * <hr></span> <a name="l00010"></a>00010 <span class="comment"> *</span> <a name="l00011"></a>00011 <span class="comment"> * License to use, copy, modify, sell and/or distribute this software</span> <a name="l00012"></a>00012 <span class="comment"> * and its documentation for any purpose is hereby granted without</span> <a name="l00013"></a>00013 <span class="comment"> * royalty, subject to the terms and conditions defined in the \ref</span> <a name="l00014"></a>00014 <span class="comment"> * LICENSE file provided with this distribution.</span> <a name="l00015"></a>00015 <span class="comment"> * </span> <a name="l00016"></a>00016 <span class="comment"> * <hr></span> <a name="l00017"></a>00017 <span class="comment"> * </span> <a name="l00018"></a>00018 <span class="comment"> * Class to represent a clause, which is a disjunction of formulas</span> <a name="l00019"></a>00019 <span class="comment"> * which are literals for conflict clauses, and possibly more complex</span> <a name="l00020"></a>00020 <span class="comment"> * formulas for the clauses derived from the user-asserted formulas.</span> <a name="l00021"></a>00021 <span class="comment"> * </span> <a name="l00022"></a>00022 <span class="comment"> * class Clause is implemented as a smart pointer to ClauseValue, so</span> <a name="l00023"></a>00023 <span class="comment"> * it can be freely copied and assigned with low overhead (like</span> <a name="l00024"></a>00024 <span class="comment"> * Theorem or Expr).</span> <a name="l00025"></a>00025 <span class="comment"> */</span> <a name="l00026"></a>00026 <span class="comment">/*****************************************************************************/</span> <a name="l00027"></a>00027 <a name="l00028"></a>00028 <span class="comment">// Include it before ifndef, since it includes this file recursively</span> <a name="l00029"></a>00029 <span class="preprocessor">#ifndef DOXYGEN</span> <a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="variable_8h.html">variable.h</a>"</span> <a name="l00031"></a>00031 <span class="preprocessor">#endif</span> <a name="l00032"></a>00032 <span class="preprocessor"></span> <a name="l00033"></a>00033 <span class="preprocessor">#ifndef _cvc3__include__clause_h_</span> <a name="l00034"></a><a class="code" href="clause_8h.html#a7e619f61e494d086a09186e8a31aba73">00034</a> <span class="preprocessor"></span><span class="preprocessor">#define _cvc3__include__clause_h_</span> <a name="l00035"></a>00035 <span class="preprocessor"></span> <a name="l00036"></a>00036 <span class="keyword">namespace </span>CVC3 { <a name="l00037"></a>00037 <a name="l00038"></a>00038 <span class="keyword">class </span>Clause; <a name="l00039"></a>00039 <span class="keyword">class </span>ClauseOwner; <a name="l00040"></a>00040 <span class="keyword">class </span>TheoryCore; <a name="l00041"></a>00041 <a name="l00042"></a><a class="code" href="classCVC3_1_1ClauseValue.html">00042</a> <span class="keyword">class </span><a class="code" href="classCVC3_1_1ClauseValue.html">ClauseValue</a> { <a name="l00043"></a><a class="code" href="classCVC3_1_1ClauseValue.html#af7597d8bf07bbb27fb18e7b16537108a">00043</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>; <a name="l00044"></a>00044 <span class="keyword">private</span>:<span class="comment"></span> <a name="l00045"></a>00045 <span class="comment"> //! Ref. counter</span> <a name="l00046"></a><a class="code" href="classCVC3_1_1ClauseValue.html#a2002fbd254e10953e689c49c3717aab3">00046</a> <span class="comment"></span> <span class="keywordtype">int</span> <a class="code" href="classCVC3_1_1ClauseValue.html#a2002fbd254e10953e689c49c3717aab3" title="Ref. counter.">d_refcount</a>;<span class="comment"></span> <a name="l00047"></a>00047 <span class="comment"> //! Ref. counter of ClauseOwner classes holding it</span> <a name="l00048"></a><a class="code" href="classCVC3_1_1ClauseValue.html#a97429716574526ed7e0035d04e13c401">00048</a> <span class="comment"></span> <span class="keywordtype">int</span> <a class="code" href="classCVC3_1_1ClauseValue.html#a97429716574526ed7e0035d04e13c401" title="Ref. counter of ClauseOwner classes holding it.">d_refcountOwner</a>; <a name="l00049"></a>00049 <span class="comment">// The original clause (disjunction of literals)</span> <a name="l00050"></a><a class="code" href="classCVC3_1_1ClauseValue.html#a8426f4b48a7732129ecd1139efe75ac4">00050</a> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> <a class="code" href="classCVC3_1_1ClauseValue.html#a8426f4b48a7732129ecd1139efe75ac4">d_thm</a>; <a name="l00051"></a>00051 <span class="comment">// Scope where the clause is valid</span> <a name="l00052"></a><a class="code" href="classCVC3_1_1ClauseValue.html#a17d76be777d232c3182e6f6667e43117">00052</a> <span class="keywordtype">int</span> <a class="code" href="classCVC3_1_1ClauseValue.html#a17d76be777d232c3182e6f6667e43117">d_scope</a>; <a name="l00053"></a>00053 <span class="comment">// Theorems l_i <=> l'_i for each literal l_i</span> <a name="l00054"></a>00054 <span class="comment">// FIXME: more efficient implementation for fixed arrays of CDOs</span> <a name="l00055"></a><a class="code" href="classCVC3_1_1ClauseValue.html#a6696e3c06ab4301893d759559470f917">00055</a> std::vector<Literal> <a class="code" href="classCVC3_1_1ClauseValue.html#a6696e3c06ab4301893d759559470f917">d_literals</a>; <a name="l00056"></a>00056 <span class="comment">// Disallow copy constructor and assignment (make private)</span> <a name="l00057"></a>00057 <a class="code" href="classCVC3_1_1ClauseValue.html#aa9a93c758484961cc52689f2660caed2">ClauseValue</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1ClauseValue.html">ClauseValue</a>& c); <span class="comment">// Undefined (since it cannot be used)</span> <a name="l00058"></a><a class="code" href="classCVC3_1_1ClauseValue.html#aaee74fca4faa432a4a86c80f1569586a">00058</a> <a class="code" href="classCVC3_1_1ClauseValue.html">ClauseValue</a>& <a class="code" href="classCVC3_1_1ClauseValue.html#aaee74fca4faa432a4a86c80f1569586a">operator=</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1ClauseValue.html">ClauseValue</a>& c) { <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00059"></a>00059 <span class="comment">// Pointers to watched literals (Watch Pointers). They are not</span> <a name="l00060"></a>00060 <span class="comment">// backtrackable.</span> <a name="l00061"></a><a class="code" href="classCVC3_1_1ClauseValue.html#a4080e117c47d6416c256e6a7c5d9f7e7">00061</a> <span class="keywordtype">size_t</span> <a class="code" href="classCVC3_1_1ClauseValue.html#a4080e117c47d6416c256e6a7c5d9f7e7">d_wp</a>[2]; <a name="l00062"></a>00062 <span class="comment">// Direction flags for the watch pointers (1 or -1)</span> <a name="l00063"></a>00063 <span class="comment">// FIXME: should we use one bit of d_wp{1,2} instead? (efficiency</span> <a name="l00064"></a>00064 <span class="comment">// vs. space)</span> <a name="l00065"></a><a class="code" href="classCVC3_1_1ClauseValue.html#a6ccefdca104c4a24a2f45c65db8c3be0">00065</a> <span class="keywordtype">int</span> <a class="code" href="classCVC3_1_1ClauseValue.html#a6ccefdca104c4a24a2f45c65db8c3be0">d_dir</a>[2]; <a name="l00066"></a>00066 <span class="comment">// A flag indicating that the clause is shown satisfiable</span> <a name="l00067"></a><a class="code" href="classCVC3_1_1ClauseValue.html#ae187971f8c1759d203d4d207923eb186">00067</a> <a class="code" href="classCVC3_1_1CDO.html">CDO<bool></a> <a class="code" href="classCVC3_1_1ClauseValue.html#ae187971f8c1759d203d4d207923eb186">d_sat</a>; <a name="l00068"></a>00068 <span class="comment">// Marks the clause as deleted</span> <a name="l00069"></a><a class="code" href="classCVC3_1_1ClauseValue.html#a648d7b3be67a263a2d1b0938880f2c48">00069</a> <span class="keywordtype">bool</span> <a class="code" href="classCVC3_1_1ClauseValue.html#a648d7b3be67a263a2d1b0938880f2c48">d_deleted</a>; <a name="l00070"></a>00070 <span class="comment">// Creation file and line number (for debugging)</span> <a name="l00071"></a>00071 <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(std::string d_file; <span class="keywordtype">int</span> d_line;) <a name="l00072"></a>00072 <span class="comment">// Constructor: takes the main clause theorem which must be a</span> <a name="l00073"></a>00073 <span class="comment">// disjunction of literals and have no assumptions.</span> <a name="l00074"></a>00074 <a class="code" href="classCVC3_1_1ClauseValue.html#aa9a93c758484961cc52689f2660caed2">ClauseValue</a>(<a class="code" href="classCVC3_1_1TheoryCore.html" title="This theory handles the built-in logical connectives plus equality. It also handles the registration ...">TheoryCore</a>* core, <a class="code" href="classCVC3_1_1VariableManager.html">VariableManager</a>* vm, <a name="l00075"></a>00075 <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>& clause, <span class="keywordtype">int</span> scope); <a name="l00076"></a>00076 <span class="keyword">public</span>: <a name="l00077"></a>00077 <span class="comment">// Destructor</span> <a name="l00078"></a>00078 <a class="code" href="classCVC3_1_1ClauseValue.html#aad3b57cc63ad2bc763022112de4899bf">~ClauseValue</a>(); <a name="l00079"></a>00079 <a name="l00080"></a>00080 }; <span class="comment">// end of class ClauseValue</span> <a name="l00081"></a>00081 <span class="comment"></span> <a name="l00082"></a>00082 <span class="comment"> //! A class representing a CNF clause (a smart pointer)</span> <a name="l00083"></a><a class="code" href="classCVC3_1_1Clause.html">00083</a> <span class="comment"></span> <span class="keyword">class </span><a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a> { <a name="l00084"></a>00084 <span class="keyword">private</span>: <a name="l00085"></a><a class="code" href="classCVC3_1_1Clause.html#a9ec1b299748dd15af6ebcb9b1f1f6a23">00085</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classCVC3_1_1ClauseOwner.html" title="Same as class Clause, but when destroyed, marks the clause as deleted.">ClauseOwner</a>;<span class="comment"></span> <a name="l00086"></a>00086 <span class="comment"> //! The only value member</span> <a name="l00087"></a><a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc">00087</a> <span class="comment"></span> <a class="code" href="classCVC3_1_1ClauseValue.html">ClauseValue</a>* <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>;<span class="comment"></span> <a name="l00088"></a>00088 <span class="comment"> //! Export owner refcounting to ClauseOwner</span> <a name="l00089"></a><a class="code" href="classCVC3_1_1Clause.html#a81569af778b6560a6a05e97c26ec9bcc">00089</a> <span class="comment"></span> <span class="keywordtype">int</span>& <a class="code" href="classCVC3_1_1Clause.html#a81569af778b6560a6a05e97c26ec9bcc" title="Export owner refcounting to ClauseOwner.">countOwner</a>() { <a name="l00090"></a>00090 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a> != NULL, <span class="stringliteral">""</span>); <a name="l00091"></a>00091 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#a97429716574526ed7e0035d04e13c401" title="Ref. counter of ClauseOwner classes holding it.">d_refcountOwner</a>; <a name="l00092"></a>00092 } <a name="l00093"></a>00093 <span class="keyword">public</span>: <a name="l00094"></a><a class="code" href="classCVC3_1_1Clause.html#acae4255e91f5c855b4371fcb393b2554">00094</a> <a class="code" href="classCVC3_1_1Clause.html#acae4255e91f5c855b4371fcb393b2554">Clause</a>(): <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>(NULL) { } <a name="l00095"></a>00095 <span class="comment">// Constructors</span> <a name="l00096"></a><a class="code" href="classCVC3_1_1Clause.html#a3b97c11fb450efb6e88d68ecc69f3205">00096</a> <a class="code" href="classCVC3_1_1Clause.html#acae4255e91f5c855b4371fcb393b2554">Clause</a>(<a class="code" href="classCVC3_1_1TheoryCore.html" title="This theory handles the built-in logical connectives plus equality. It also handles the registration ...">TheoryCore</a>* core, <a class="code" href="classCVC3_1_1VariableManager.html">VariableManager</a>* vm, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>& clause, <a name="l00097"></a>00097 <span class="keywordtype">int</span> scope, <span class="keyword">const</span> std::string& file = <span class="stringliteral">""</span>, <span class="keywordtype">int</span> line = 0) <a name="l00098"></a>00098 : <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>(new <a class="code" href="classCVC3_1_1ClauseValue.html">ClauseValue</a>(core, vm, clause, scope)) { <a name="l00099"></a>00099 <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#a2002fbd254e10953e689c49c3717aab3" title="Ref. counter.">d_refcount</a>++; <a name="l00100"></a>00100 <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(<a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>->d_file = file; <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>->d_line=line;) <a name="l00101"></a>00101 } <a name="l00102"></a>00102 <span class="comment">// Copy constructor</span> <a name="l00103"></a><a class="code" href="classCVC3_1_1Clause.html#af68486a625e745a9136a22f3e763da10">00103</a> <a class="code" href="classCVC3_1_1Clause.html#af68486a625e745a9136a22f3e763da10">Clause</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>& c): <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>(c.<a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>) { <a name="l00104"></a>00104 <span class="keywordflow">if</span>(<a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a> != NULL) <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#a2002fbd254e10953e689c49c3717aab3" title="Ref. counter.">d_refcount</a>++; <a name="l00105"></a>00105 } <a name="l00106"></a>00106 <span class="comment">// Destructor</span> <a name="l00107"></a>00107 <a class="code" href="classCVC3_1_1Clause.html#aacf7ed78bdf948f49fc3eec100b1213b">~Clause</a>(); <a name="l00108"></a>00108 <span class="comment">// Assignment operator</span> <a name="l00109"></a>00109 <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>& <a class="code" href="classCVC3_1_1Clause.html#aeba63913bd39d5a49979459c4a6b5b52">operator=</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>& c); <a name="l00110"></a>00110 <a name="l00111"></a><a class="code" href="classCVC3_1_1Clause.html#a60c298aa79d5cec791f8eeef2086e92f">00111</a> <span class="keywordtype">bool</span> <a class="code" href="classCVC3_1_1Clause.html#a60c298aa79d5cec791f8eeef2086e92f">isNull</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a> == NULL; } <a name="l00112"></a>00112 <span class="comment">// Other public methods</span> <a name="l00113"></a><a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">00113</a> <span class="keywordtype">size_t</span> <a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>()<span class="keyword"> const </span>{ <a name="l00114"></a>00114 <span class="keywordflow">return</span> (<a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a> == NULL)? 0 : <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#a6696e3c06ab4301893d759559470f917">d_literals</a>.size(); <a name="l00115"></a>00115 } <a name="l00116"></a>00116 <span class="comment">// Get the theorem representing the entire clause</span> <a name="l00117"></a><a class="code" href="classCVC3_1_1Clause.html#aa933cec7528780d7971be0c10b76dc02">00117</a> <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>& <a class="code" href="classCVC3_1_1Clause.html#aa933cec7528780d7971be0c10b76dc02">getTheorem</a>()<span class="keyword"> const </span>{ <a name="l00118"></a>00118 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!<a class="code" href="classCVC3_1_1Clause.html#a60c298aa79d5cec791f8eeef2086e92f">isNull</a>(), <span class="stringliteral">"Clause::getTheorem(): Null Clause"</span>); <a name="l00119"></a>00119 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#a8426f4b48a7732129ecd1139efe75ac4">d_thm</a>; <a name="l00120"></a>00120 } <a name="l00121"></a>00121 <span class="comment">// Get the scope where the clause is valid</span> <a name="l00122"></a><a class="code" href="classCVC3_1_1Clause.html#af505679fdb9d5b220115747cb4548612">00122</a> <span class="keywordtype">int</span> <a class="code" href="classCVC3_1_1Clause.html#af505679fdb9d5b220115747cb4548612">getScope</a>()<span class="keyword"> const </span>{ <a name="l00123"></a>00123 <span class="keywordflow">if</span>(<a class="code" href="classCVC3_1_1Clause.html#a60c298aa79d5cec791f8eeef2086e92f">isNull</a>()) <span class="keywordflow">return</span> 0; <a name="l00124"></a>00124 <span class="keywordflow">else</span> <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#a17d76be777d232c3182e6f6667e43117">d_scope</a>; <a name="l00125"></a>00125 } <a name="l00126"></a>00126 <span class="comment">// Get the current value of the i-th literal</span> <a name="l00127"></a><a class="code" href="classCVC3_1_1Clause.html#a80356479c3ca0ca5340c7746980d033e">00127</a> <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Literal.html">Literal</a>& <a class="code" href="classCVC3_1_1Clause.html#a80356479c3ca0ca5340c7746980d033e">getLiteral</a>(<span class="keywordtype">size_t</span> i)<span class="keyword"> const </span>{ <a name="l00128"></a>00128 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!<a class="code" href="classCVC3_1_1Clause.html#a60c298aa79d5cec791f8eeef2086e92f">isNull</a>(), <span class="stringliteral">"Clause::getLiteral(): Null Clause"</span>); <a name="l00129"></a>00129 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(i < <a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>(), <a name="l00130"></a>00130 <span class="stringliteral">"Clause::getLiteral("</span> + <a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(i) <a name="l00131"></a>00131 + <span class="stringliteral">"): i >= size = "</span> + <a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>())); <a name="l00132"></a>00132 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#a6696e3c06ab4301893d759559470f917">d_literals</a>[i]; <a name="l00133"></a>00133 } <a name="l00134"></a>00134 <span class="comment">// Get the current value of the i-th literal</span> <a name="l00135"></a><a class="code" href="classCVC3_1_1Clause.html#a8d8f9619cf3a6b0b8bc656e6f4e6dc1a">00135</a> <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Literal.html">Literal</a>& <a class="code" href="classCVC3_1_1Clause.html#a8d8f9619cf3a6b0b8bc656e6f4e6dc1a">operator[]</a>(<span class="keywordtype">size_t</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a80356479c3ca0ca5340c7746980d033e">getLiteral</a>(i); } <a name="l00136"></a>00136 <a name="l00137"></a>00137 <span class="comment">// Get the reference to the vector of literals, for fast access</span> <a name="l00138"></a><a class="code" href="classCVC3_1_1Clause.html#afbdcb9cd34cb4ff3e14f2e5aace81d7e">00138</a> <span class="keyword">const</span> std::vector<Literal>& <a class="code" href="classCVC3_1_1Clause.html#afbdcb9cd34cb4ff3e14f2e5aace81d7e">getLiterals</a>()<span class="keyword"> const </span>{ <a name="l00139"></a>00139 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!<a class="code" href="classCVC3_1_1Clause.html#a60c298aa79d5cec791f8eeef2086e92f">isNull</a>(), <span class="stringliteral">"Clause::getLiterals(): Null Clause"</span>); <a name="l00140"></a>00140 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#a6696e3c06ab4301893d759559470f917">d_literals</a>; <a name="l00141"></a>00141 } <a name="l00142"></a>00142 <span class="comment">// Get the values of watch pointers</span> <a name="l00143"></a><a class="code" href="classCVC3_1_1Clause.html#ad399ff73eb62edf9cc4d1135e91afdcb">00143</a> <span class="keywordtype">size_t</span> <a class="code" href="classCVC3_1_1Clause.html#ad399ff73eb62edf9cc4d1135e91afdcb">wp</a>(<span class="keywordtype">int</span> i)<span class="keyword"> const </span>{ <a name="l00144"></a>00144 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!<a class="code" href="classCVC3_1_1Clause.html#a60c298aa79d5cec791f8eeef2086e92f">isNull</a>(), <span class="stringliteral">"Clause::wp(i): Null Clause"</span>); <a name="l00145"></a>00145 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(i==0 || i==1, <a name="l00146"></a>00146 <span class="stringliteral">"wp(i): Watch pointer index is out of bounds: i = "</span> <a name="l00147"></a>00147 + <a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(i)); <a name="l00148"></a>00148 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#a4080e117c47d6416c256e6a7c5d9f7e7">d_wp</a>[i]; <a name="l00149"></a>00149 } <a name="l00150"></a>00150 <span class="comment">// Get the watched literals</span> <a name="l00151"></a><a class="code" href="classCVC3_1_1Clause.html#a4a2b1e46395f03fe87a6a5b7558292f0">00151</a> <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Literal.html">Literal</a>& <a class="code" href="classCVC3_1_1Clause.html#a4a2b1e46395f03fe87a6a5b7558292f0">watched</a>(<span class="keywordtype">int</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a80356479c3ca0ca5340c7746980d033e">getLiteral</a>(<a class="code" href="classCVC3_1_1Clause.html#ad399ff73eb62edf9cc4d1135e91afdcb">wp</a>(i)); } <a name="l00152"></a>00152 <span class="comment">// Set the watch pointers and return the new value</span> <a name="l00153"></a><a class="code" href="classCVC3_1_1Clause.html#a8d651070ee46e190670b2e37d655fcf9">00153</a> <span class="keywordtype">size_t</span> <a class="code" href="classCVC3_1_1Clause.html#a8d651070ee46e190670b2e37d655fcf9">wp</a>(<span class="keywordtype">int</span> i, <span class="keywordtype">size_t</span> l)<span class="keyword"> const </span>{ <a name="l00154"></a>00154 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!<a class="code" href="classCVC3_1_1Clause.html#a60c298aa79d5cec791f8eeef2086e92f">isNull</a>(), <span class="stringliteral">"Clause::wp(i,l): Null Clause"</span>); <a name="l00155"></a>00155 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(i==0 || i==1, <a name="l00156"></a>00156 <span class="stringliteral">"wp(i,l): Watch pointer index is out of bounds: i = "</span> <a name="l00157"></a>00157 + <a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(i)); <a name="l00158"></a>00158 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(l < <a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>(), <span class="stringliteral">"Clause::wp(i = "</span> + <a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(i) <a name="l00159"></a>00159 + <span class="stringliteral">", l = "</span> + <a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(l) <a name="l00160"></a>00160 + <span class="stringliteral">"): l >= size() = "</span> + <a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>())); <a name="l00161"></a>00161 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"clauses"</span>, <span class="stringliteral">" **clauses** UPDATE wp(idx="</span> <a name="l00162"></a>00162 +<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(i)+<span class="stringliteral">", l="</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(l), <a name="l00163"></a>00163 <span class="stringliteral">")\n clause #: "</span>, <span class="keywordtype">id</span>()); <a name="l00164"></a>00164 <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#a4080e117c47d6416c256e6a7c5d9f7e7">d_wp</a>[i] = l; <a name="l00165"></a>00165 <span class="keywordflow">return</span> l; <a name="l00166"></a>00166 } <a name="l00167"></a>00167 <span class="comment">// Get the direction of the i-th watch pointer</span> <a name="l00168"></a><a class="code" href="classCVC3_1_1Clause.html#a4c9a2e81c05572893ba1a3b09526d172">00168</a> <span class="keywordtype">int</span> <a class="code" href="classCVC3_1_1Clause.html#a4c9a2e81c05572893ba1a3b09526d172">dir</a>(<span class="keywordtype">int</span> i)<span class="keyword"> const </span>{ <a name="l00169"></a>00169 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!<a class="code" href="classCVC3_1_1Clause.html#a60c298aa79d5cec791f8eeef2086e92f">isNull</a>(), <span class="stringliteral">"Clause::dir(i): Null Clause"</span>); <a name="l00170"></a>00170 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(i==0 || i==1, <a name="l00171"></a>00171 <span class="stringliteral">"dir(i): Watch pointer index is out of bounds: i = "</span> <a name="l00172"></a>00172 + <a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(i)); <a name="l00173"></a>00173 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#a6ccefdca104c4a24a2f45c65db8c3be0">d_dir</a>[i]; <a name="l00174"></a>00174 } <a name="l00175"></a>00175 <span class="comment">// Set the direction of the i-th watch pointer</span> <a name="l00176"></a><a class="code" href="classCVC3_1_1Clause.html#a6940a2041da94ff0697f8d26c277cdab">00176</a> <span class="keywordtype">int</span> <a class="code" href="classCVC3_1_1Clause.html#a6940a2041da94ff0697f8d26c277cdab">dir</a>(<span class="keywordtype">int</span> i, <span class="keywordtype">int</span> d)<span class="keyword"> const </span>{ <a name="l00177"></a>00177 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!<a class="code" href="classCVC3_1_1Clause.html#a60c298aa79d5cec791f8eeef2086e92f">isNull</a>(), <span class="stringliteral">"Clause::dir(i,d): Null Clause"</span>); <a name="l00178"></a>00178 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(i==0 || i==1, <a name="l00179"></a>00179 <span class="stringliteral">"dir(i="</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(i)+<span class="stringliteral">",d="</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(d) <a name="l00180"></a>00180 +<span class="stringliteral">"): Watch pointer index is out of bounds"</span>); <a name="l00181"></a>00181 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(d==1 || d==-1, <span class="stringliteral">"dir(i="</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(i)+<span class="stringliteral">",d="</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(d) <a name="l00182"></a>00182 +<span class="stringliteral">"): Direction is out of bounds"</span>); <a name="l00183"></a>00183 <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#a6ccefdca104c4a24a2f45c65db8c3be0">d_dir</a>[i] = d; <a name="l00184"></a>00184 <span class="keywordflow">return</span> d; <a name="l00185"></a>00185 }<span class="comment"></span> <a name="l00186"></a>00186 <span class="comment"> //! Check if the clause marked as SAT</span> <a name="l00187"></a><a class="code" href="classCVC3_1_1Clause.html#a1e5660eadbc4e0c0ad18c6a9aae45d39">00187</a> <span class="comment"></span> <span class="keywordtype">bool</span> <a class="code" href="classCVC3_1_1Clause.html#a1e5660eadbc4e0c0ad18c6a9aae45d39" title="Check if the clause marked as SAT.">sat</a>()<span class="keyword"> const </span>{ <a name="l00188"></a>00188 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!<a class="code" href="classCVC3_1_1Clause.html#a60c298aa79d5cec791f8eeef2086e92f">isNull</a>(), <span class="stringliteral">"Clause::sat()"</span>); <a name="l00189"></a>00189 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#ae187971f8c1759d203d4d207923eb186">d_sat</a>; <a name="l00190"></a>00190 }<span class="comment"></span> <a name="l00191"></a>00191 <span class="comment"> //! Precise version of sat(): check all the literals and cache the result</span> <a name="l00192"></a><a class="code" href="classCVC3_1_1Clause.html#a80b8c7c207788b8b340d312cbcc61a37">00192</a> <span class="comment"></span> <span class="keywordtype">bool</span> <a class="code" href="classCVC3_1_1Clause.html#a80b8c7c207788b8b340d312cbcc61a37" title="Precise version of sat(): check all the literals and cache the result.">sat</a>(<span class="keywordtype">bool</span> ignored)<span class="keyword"> const </span>{ <a name="l00193"></a>00193 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!<a class="code" href="classCVC3_1_1Clause.html#a60c298aa79d5cec791f8eeef2086e92f">isNull</a>(), <span class="stringliteral">"Clause::sat()"</span>); <a name="l00194"></a>00194 <span class="keywordtype">bool</span> flag = <span class="keyword">false</span>; <a name="l00195"></a>00195 <span class="keywordflow">if</span> (!<a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#ae187971f8c1759d203d4d207923eb186">d_sat</a>) { <a name="l00196"></a>00196 <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; !flag && i < <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#a6696e3c06ab4301893d759559470f917">d_literals</a>.size(); ++i) <a name="l00197"></a>00197 <span class="keywordflow">if</span> (<a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#a6696e3c06ab4301893d759559470f917">d_literals</a>[i].getValue() == 1) <a name="l00198"></a>00198 flag = <span class="keyword">true</span>; <a name="l00199"></a>00199 } <a name="l00200"></a>00200 <span class="keywordflow">if</span> (flag) { <a name="l00201"></a>00201 <span class="comment">//std::cout << "*** Manually marking SAT" << std::endl;</span> <a name="l00202"></a>00202 <a class="code" href="classCVC3_1_1Clause.html#ae266a9c156142d2f9f53ec741d7304df">markSat</a>(); <a name="l00203"></a>00203 } <a name="l00204"></a>00204 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#ae187971f8c1759d203d4d207923eb186">d_sat</a>; <a name="l00205"></a>00205 } <a name="l00206"></a>00206 <span class="comment">// Mark the clause as SAT</span> <a name="l00207"></a><a class="code" href="classCVC3_1_1Clause.html#ae266a9c156142d2f9f53ec741d7304df">00207</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1Clause.html#ae266a9c156142d2f9f53ec741d7304df">markSat</a>()<span class="keyword"> const </span>{ <a name="l00208"></a>00208 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!<a class="code" href="classCVC3_1_1Clause.html#a60c298aa79d5cec791f8eeef2086e92f">isNull</a>(), <span class="stringliteral">"Clause::markSat()"</span>); <a name="l00209"></a>00209 <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#ae187971f8c1759d203d4d207923eb186">d_sat</a> = <span class="keyword">true</span>; <a name="l00210"></a>00210 } <a name="l00211"></a>00211 <span class="comment">// Check / mark the clause as deleted</span> <a name="l00212"></a><a class="code" href="classCVC3_1_1Clause.html#a420281d9272ac052c75859be690bfd4d">00212</a> <span class="keywordtype">bool</span> <a class="code" href="classCVC3_1_1Clause.html#a420281d9272ac052c75859be690bfd4d">deleted</a>()<span class="keyword"> const </span>{ <a name="l00213"></a>00213 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!<a class="code" href="classCVC3_1_1Clause.html#a60c298aa79d5cec791f8eeef2086e92f">isNull</a>(), <span class="stringliteral">"Clause::deleted()"</span>); <a name="l00214"></a>00214 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#a648d7b3be67a263a2d1b0938880f2c48">d_deleted</a>; <a name="l00215"></a>00215 } <a name="l00216"></a>00216 <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1Clause.html#a47d7c887d12dce3ad803bd7e9fbdefe8">markDeleted</a>() <span class="keyword">const</span>; <a name="l00217"></a>00217 <a name="l00218"></a>00218 <span class="comment">// For debugging: return some kind of unique ID</span> <a name="l00219"></a><a class="code" href="classCVC3_1_1Clause.html#a3b3fad14d36eec81247fb512acc73b41">00219</a> <span class="keywordtype">size_t</span> <a class="code" href="classCVC3_1_1Clause.html#a3b3fad14d36eec81247fb512acc73b41">id</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (<span class="keywordtype">size_t</span>) <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>; } <a name="l00220"></a>00220 <a name="l00221"></a>00221 <span class="comment">// Equality: compare the pointers</span> <a name="l00222"></a><a class="code" href="classCVC3_1_1Clause.html#a942fff24fc6b33e44b06a41aa223294c">00222</a> <span class="keywordtype">bool</span> <a class="code" href="classCVC3_1_1Clause.html#a942fff24fc6b33e44b06a41aa223294c">operator==</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>& c)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a> == c.<a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>; } <a name="l00223"></a>00223 <span class="comment"></span> <a name="l00224"></a>00224 <span class="comment"> //! Tell how many owners this clause has (for debugging)</span> <a name="l00225"></a><a class="code" href="classCVC3_1_1Clause.html#a4be95d5cff0e0ffb20f01f8c2036caa3">00225</a> <span class="comment"></span> <span class="keywordtype">int</span> <a class="code" href="classCVC3_1_1Clause.html#a4be95d5cff0e0ffb20f01f8c2036caa3" title="Tell how many owners this clause has (for debugging)">owners</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>-><a class="code" href="classCVC3_1_1ClauseValue.html#a97429716574526ed7e0035d04e13c401" title="Ref. counter of ClauseOwner classes holding it.">d_refcountOwner</a>; } <a name="l00226"></a>00226 <a name="l00227"></a>00227 <span class="comment">// Printing</span> <a name="l00228"></a>00228 std::string <a class="code" href="classCVC3_1_1Clause.html#a97eeb3430667cd3c05a3c977d7285102">toString</a>() <span class="keyword">const</span>; <a name="l00229"></a>00229 <a name="l00230"></a>00230 <span class="keyword">friend</span> std::ostream& <a class="code" href="classCVC3_1_1Clause.html#ac9926dca26ee870cb35ae18cfd4f40d4">operator<<</a>(std::ostream& os, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>& c); <a name="l00231"></a>00231 <a name="l00232"></a>00232 <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(<span class="keywordtype">bool</span> wpCheck() <span class="keyword">const</span>;) <a name="l00233"></a>00233 <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(<span class="keyword">const</span> std::string& getFile() <span class="keyword">const</span> { <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>->d_file; }) <a name="l00234"></a>00234 <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(<span class="keywordtype">int</span> getLine() <span class="keyword">const</span> { <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>->d_line; }) <a name="l00235"></a>00235 <a name="l00236"></a>00236 }; <span class="comment">// end of class Clause</span> <a name="l00237"></a>00237 <span class="comment"></span> <a name="l00238"></a>00238 <span class="comment"> //! Same as class Clause, but when destroyed, marks the clause as deleted</span> <a name="l00239"></a>00239 <span class="comment"></span><span class="comment"> /*! Needed for backtraking data structures. When the SAT solver</span> <a name="l00240"></a>00240 <span class="comment"> backtracks, some clauses will be thrown away automatically, and we</span> <a name="l00241"></a>00241 <span class="comment"> need to mark those as deleted. */</span> <a name="l00242"></a><a class="code" href="classCVC3_1_1ClauseOwner.html">00242</a> <span class="keyword">class </span><a class="code" href="classCVC3_1_1ClauseOwner.html" title="Same as class Clause, but when destroyed, marks the clause as deleted.">ClauseOwner</a> { <a name="l00243"></a><a class="code" href="classCVC3_1_1ClauseOwner.html#a173c46133b3a2c4be003eb9201e87e33">00243</a> <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a> <a class="code" href="classCVC3_1_1ClauseOwner.html#a173c46133b3a2c4be003eb9201e87e33">d_clause</a>;<span class="comment"></span> <a name="l00244"></a>00244 <span class="comment"> //! Disable default constructor</span> <a name="l00245"></a><a class="code" href="classCVC3_1_1ClauseOwner.html#a037e76a3c478a3c6b69ea171c9b89706">00245</a> <span class="comment"></span> <a class="code" href="classCVC3_1_1ClauseOwner.html#a037e76a3c478a3c6b69ea171c9b89706" title="Disable default constructor.">ClauseOwner</a>() { } <a name="l00246"></a>00246 <span class="keyword">public</span>:<span class="comment"></span> <a name="l00247"></a>00247 <span class="comment"> //! Constructor from class Clause</span> <a name="l00248"></a><a class="code" href="classCVC3_1_1ClauseOwner.html#a816e7bd5c84431c83b8183250f00ab3a">00248</a> <span class="comment"></span> <a class="code" href="classCVC3_1_1ClauseOwner.html#a816e7bd5c84431c83b8183250f00ab3a" title="Constructor from class Clause.">ClauseOwner</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>& c): <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>(c) { <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>.countOwner()++; }<span class="comment"></span> <a name="l00249"></a>00249 <span class="comment"> //! Construct a new Clause</span> <a name="l00250"></a><a class="code" href="classCVC3_1_1ClauseOwner.html#a40fc626e6d3ec5d12e0b1c943212d3b4">00250</a> <span class="comment"></span> <a class="code" href="classCVC3_1_1Clause.html#a9ec1b299748dd15af6ebcb9b1f1f6a23">ClauseOwner</a>(<a class="code" href="classCVC3_1_1TheoryCore.html" title="This theory handles the built-in logical connectives plus equality. It also handles the registration ...">TheoryCore</a>* core, <a class="code" href="classCVC3_1_1VariableManager.html">VariableManager</a>* vm, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>& clause, <a name="l00251"></a>00251 <span class="keywordtype">int</span> scope): <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>(core, vm, clause, scope) { <a name="l00252"></a>00252 <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>.countOwner()++; <a name="l00253"></a>00253 }<span class="comment"></span> <a name="l00254"></a>00254 <span class="comment"> //! Copy constructor (keep track of refcounts)</span> <a name="l00255"></a><a class="code" href="classCVC3_1_1ClauseOwner.html#a0734fdbcc9824e4c0d9a22d0fe456ca5">00255</a> <span class="comment"></span> <a class="code" href="classCVC3_1_1ClauseOwner.html#a0734fdbcc9824e4c0d9a22d0fe456ca5" title="Copy constructor (keep track of refcounts)">ClauseOwner</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1ClauseOwner.html" title="Same as class Clause, but when destroyed, marks the clause as deleted.">ClauseOwner</a>& c): <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>(c.<a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>) { <a name="l00256"></a>00256 <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>.countOwner()++; <a name="l00257"></a>00257 }<span class="comment"></span> <a name="l00258"></a>00258 <span class="comment"> //! Assignment (keep track of refcounts)</span> <a name="l00259"></a><a class="code" href="classCVC3_1_1ClauseOwner.html#ace299e519444ca160863d7d6c2fadc79">00259</a> <span class="comment"></span> <a class="code" href="classCVC3_1_1ClauseOwner.html" title="Same as class Clause, but when destroyed, marks the clause as deleted.">ClauseOwner</a>& <a class="code" href="classCVC3_1_1ClauseOwner.html#ace299e519444ca160863d7d6c2fadc79" title="Assignment (keep track of refcounts)">operator=</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1ClauseOwner.html" title="Same as class Clause, but when destroyed, marks the clause as deleted.">ClauseOwner</a>& c) { <a name="l00260"></a>00260 <span class="keywordflow">if</span>(&c == <span class="keyword">this</span>) <span class="keywordflow">return</span> *<span class="keyword">this</span>; <span class="comment">// Seft-assignment</span> <a name="l00261"></a>00261 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>.countOwner() > 0, <span class="stringliteral">"in operator="</span>); <a name="l00262"></a>00262 <span class="keywordflow">if</span>(--(<a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>.countOwner()) == 0) <a name="l00263"></a>00263 <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>.markDeleted(); <a name="l00264"></a>00264 <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a> = c.<a class="code" href="classCVC3_1_1ClauseOwner.html#a173c46133b3a2c4be003eb9201e87e33">d_clause</a>; <a name="l00265"></a>00265 <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>.countOwner()++; <a name="l00266"></a>00266 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00267"></a>00267 }<span class="comment"></span> <a name="l00268"></a>00268 <span class="comment"> //! Destructor: mark the clause as deleted</span> <a name="l00269"></a><a class="code" href="classCVC3_1_1ClauseOwner.html#a9a11005a23f446711db587a2d0b2bf7d">00269</a> <span class="comment"></span> <a class="code" href="classCVC3_1_1ClauseOwner.html#a9a11005a23f446711db587a2d0b2bf7d" title="Destructor: mark the clause as deleted.">~ClauseOwner</a>() { <a name="l00270"></a>00270 <a class="code" href="debug_8h.html#a2637b2fffa22e3c9fad40cda8fcc3bce" title="If something goes horribly wrong, print a message and abort immediately with exit(1).">FatalAssert</a>(<a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>.countOwner() > 0, <span class="stringliteral">"in ~ClauseOwner"</span>); <a name="l00271"></a>00271 <span class="keywordflow">if</span>(--(<a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>.countOwner()) == 0) { <a name="l00272"></a>00272 <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>.markDeleted(); <a name="l00273"></a>00273 } <a name="l00274"></a>00274 }<span class="comment"></span> <a name="l00275"></a>00275 <span class="comment"> //! Automatic type conversion to Clause ref</span> <a name="l00276"></a><a class="code" href="classCVC3_1_1ClauseOwner.html#accd9dd34e55489489f984cd54266f6b0">00276</a> <span class="comment"></span> operator Clause& () { <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>; }<span class="comment"></span> <a name="l00277"></a>00277 <span class="comment"> //! Automatic type conversion to Clause const ref</span> <a name="l00278"></a><a class="code" href="classCVC3_1_1ClauseOwner.html#a4b46bc8e409888236bf72f189adbca15">00278</a> <span class="comment"></span> operator const Clause& ()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>; } <a name="l00279"></a>00279 }; <span class="comment">// end of class ClauseOwner</span> <a name="l00280"></a>00280 <a name="l00281"></a>00281 <a name="l00282"></a>00282 <span class="comment">// I/O Manipulators</span> <a name="l00283"></a>00283 <a name="l00284"></a>00284 <span class="comment">// Print clause in a compact form: Clause[x=-1@scope, ...], mark</span> <a name="l00285"></a>00285 <span class="comment">// watched literals by '*'</span> <a name="l00286"></a><a class="code" href="classCVC3_1_1CompactClause.html">00286</a> <span class="keyword">class </span><a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a> { <a name="l00287"></a>00287 <span class="keyword">private</span>: <a name="l00288"></a><a class="code" href="classCVC3_1_1CompactClause.html#a882f0ed8565e078ac1a1cd2c524ed059">00288</a> <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a> <a class="code" href="classCVC3_1_1CompactClause.html#a882f0ed8565e078ac1a1cd2c524ed059">d_clause</a>; <a name="l00289"></a>00289 <span class="keyword">public</span>: <a name="l00290"></a><a class="code" href="classCVC3_1_1CompactClause.html#a58c2bc6d85cc3ed950c6c722bd54e6c5">00290</a> <a class="code" href="classCVC3_1_1CompactClause.html#a58c2bc6d85cc3ed950c6c722bd54e6c5">CompactClause</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>& c): <a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>(c) { } <a name="l00291"></a>00291 <span class="keyword">friend</span> std::ostream& <a class="code" href="classCVC3_1_1Clause.html#ac9926dca26ee870cb35ae18cfd4f40d4">operator<<</a>(std::ostream& os, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>& c); <a name="l00292"></a>00292 std::string <a class="code" href="classCVC3_1_1Clause.html#a97eeb3430667cd3c05a3c977d7285102">toString</a>() <span class="keyword">const</span>; <a name="l00293"></a>00293 }; <a name="l00294"></a>00294 <a name="l00295"></a>00295 } <span class="comment">// end of namespace CVC3</span> <a name="l00296"></a>00296 <a name="l00297"></a>00297 <span class="preprocessor">#endif</span> </pre></div></div> </div> <hr class="footer"/><address class="footer"><small>Generated on Wed Sep 7 2011 for CVC3 by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address> </body> </html>