<!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: bitvector_expr_value.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">bitvector_expr_value.h</div> </div> </div> <div class="contents"> <a href="bitvector__expr__value_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 bitvector_expr_value.h</span> <a name="l00004"></a>00004 <span class="comment"> *\brief Subclasses of ExprValue for bit-vector expressions</span> <a name="l00005"></a>00005 <span class="comment"> *</span> <a name="l00006"></a>00006 <span class="comment"> * Author: Sergey Berezin, Vijay Ganesh</span> <a name="l00007"></a>00007 <span class="comment"> *</span> <a name="l00008"></a>00008 <span class="comment"> * Created: Wed Jun 23 14:36:59 2004</span> <a name="l00009"></a>00009 <span class="comment"> *</span> <a name="l00010"></a>00010 <span class="comment"> * <hr></span> <a name="l00011"></a>00011 <span class="comment"> *</span> <a name="l00012"></a>00012 <span class="comment"> * License to use, copy, modify, sell and/or distribute this software</span> <a name="l00013"></a>00013 <span class="comment"> * and its documentation for any purpose is hereby granted without</span> <a name="l00014"></a>00014 <span class="comment"> * royalty, subject to the terms and conditions defined in the \ref</span> <a name="l00015"></a>00015 <span class="comment"> * LICENSE file provided with this distribution.</span> <a name="l00016"></a>00016 <span class="comment"> * </span> <a name="l00017"></a>00017 <span class="comment"> * <hr></span> <a name="l00018"></a>00018 <span class="comment"> * </span> <a name="l00019"></a>00019 <span class="comment"> */</span> <a name="l00020"></a>00020 <span class="comment">/*****************************************************************************/</span> <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="preprocessor">#ifndef _cvc3__theory_bitvector__bitvector_expr_value_h_</span> <a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define _cvc3__theory_bitvector__bitvector_expr_value_h_</span> <a name="l00024"></a>00024 <span class="preprocessor"></span> <a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="theory__bitvector_8h.html">theory_bitvector.h</a>"</span> <a name="l00026"></a>00026 <a name="l00027"></a>00027 <span class="keyword">namespace </span>CVC3 { <a name="l00028"></a>00028 <span class="comment"></span> <a name="l00029"></a>00029 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span> <a name="l00030"></a>00030 <span class="comment"></span><span class="comment">//class BVConstExpr</span><span class="comment"></span> <a name="l00031"></a>00031 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span> <a name="l00032"></a>00032 <span class="comment">//! An expression subclass for bitvector constants.</span> <a name="l00033"></a><a class="code" href="classCVC3_1_1BVConstExpr.html">00033</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="classCVC3_1_1BVConstExpr.html">BVConstExpr</a> : <span class="keyword">public</span> <a class="code" href="classCVC3_1_1ExprValue.html" title="The base class for holding the actual data in expressions.">ExprValue</a> { <a name="l00034"></a>00034 <span class="keyword">private</span>: <a name="l00035"></a><a class="code" href="classCVC3_1_1BVConstExpr.html#a1f03d8a52caf2691900803ee08df9d10">00035</a> std::vector<bool> <a class="code" href="classCVC3_1_1BVConstExpr.html#a1f03d8a52caf2691900803ee08df9d10" title="value of bitvector constant">d_bvconst</a>; <span class="comment">//!< value of bitvector constant</span> <a name="l00036"></a><a class="code" href="classCVC3_1_1BVConstExpr.html#a5ef246111d8fcee01c512ad17b1bff4f">00036</a> <span class="comment"></span> <span class="keywordtype">size_t</span> <a class="code" href="classCVC3_1_1BVConstExpr.html#a5ef246111d8fcee01c512ad17b1bff4f" title="The registration index for ExprManager.">d_MMIndex</a>; <span class="comment">//!< The registration index for ExprManager</span> <a name="l00037"></a>00037 <span class="comment"></span> <span class="keyword">public</span>:<span class="comment"></span> <a name="l00038"></a>00038 <span class="comment"> //! Constructor</span> <a name="l00039"></a>00039 <span class="comment"></span> <a class="code" href="classCVC3_1_1BVConstExpr.html#a2c0fdfe3a9755c5b23f0bb73cf67840e" title="Constructor.">BVConstExpr</a>(<a class="code" href="classCVC3_1_1ExprManager.html">ExprManager</a>* em, std::string bvconst, <a name="l00040"></a>00040 <span class="keywordtype">size_t</span> mmIndex, <a class="code" href="namespaceCVC3.html#a4233916514848331ee104548acbab912" title="Expression index type.">ExprIndex</a> idx = 0); <a name="l00041"></a>00041 <span class="comment"></span> <a name="l00042"></a>00042 <span class="comment"> //! Constructor</span> <a name="l00043"></a>00043 <span class="comment"></span> <a class="code" href="classCVC3_1_1BVConstExpr.html#a2c0fdfe3a9755c5b23f0bb73cf67840e" title="Constructor.">BVConstExpr</a>(<a class="code" href="classCVC3_1_1ExprManager.html">ExprManager</a>* em, std::vector<bool> bvconst, <a name="l00044"></a>00044 <span class="keywordtype">size_t</span> mmIndex, <a class="code" href="namespaceCVC3.html#a4233916514848331ee104548acbab912" title="Expression index type.">ExprIndex</a> idx = 0); <a name="l00045"></a>00045 <a name="l00046"></a><a class="code" href="classCVC3_1_1BVConstExpr.html#adb36c6734696301ef1733c3454a2db14">00046</a> <a class="code" href="classCVC3_1_1ExprValue.html" title="The base class for holding the actual data in expressions.">ExprValue</a>* <a class="code" href="classCVC3_1_1BVConstExpr.html#adb36c6734696301ef1733c3454a2db14" title="Make a clean copy of itself using the given ExprManager.">copy</a>(<a class="code" href="classCVC3_1_1ExprManager.html">ExprManager</a>* em, <a class="code" href="namespaceCVC3.html#a4233916514848331ee104548acbab912" title="Expression index type.">ExprIndex</a> idx = 0)<span class="keyword"> const </span>{ <a name="l00047"></a>00047 <span class="keywordflow">return</span> <span class="keyword">new</span>(em-><a class="code" href="group__EM__Priv.html#ga721fc26fe37460f80e6d614cfe0d6fd8" title="Return a MemoryManager for the given ExprValue type.">getMM</a>(<a class="code" href="classCVC3_1_1BVConstExpr.html#ad3a0ddfb37958c36b453243ce3320996" title="Get unique memory manager ID.">getMMIndex</a>())) <a name="l00048"></a>00048 <a class="code" href="classCVC3_1_1BVConstExpr.html#a2c0fdfe3a9755c5b23f0bb73cf67840e" title="Constructor.">BVConstExpr</a>(em, <a class="code" href="classCVC3_1_1BVConstExpr.html#a1f03d8a52caf2691900803ee08df9d10" title="value of bitvector constant">d_bvconst</a>, <a class="code" href="classCVC3_1_1BVConstExpr.html#a5ef246111d8fcee01c512ad17b1bff4f" title="The registration index for ExprManager.">d_MMIndex</a>, idx); <a name="l00049"></a>00049 } <a name="l00050"></a>00050 <a name="l00051"></a>00051 <span class="keywordtype">size_t</span> <a class="code" href="classCVC3_1_1BVConstExpr.html#ad1cf9149b25bf814fe4ae4a6b84a758b" title="Non-caching hash function which actually computes the hash.">computeHash</a>() <span class="keyword">const</span>; <a name="l00052"></a><a class="code" href="classCVC3_1_1BVConstExpr.html#ad3a0ddfb37958c36b453243ce3320996">00052</a> <span class="keywordtype">size_t</span> <a class="code" href="classCVC3_1_1BVConstExpr.html#ad3a0ddfb37958c36b453243ce3320996" title="Get unique memory manager ID.">getMMIndex</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1BVConstExpr.html#a5ef246111d8fcee01c512ad17b1bff4f" title="The registration index for ExprManager.">d_MMIndex</a>; } <a name="l00053"></a>00053 <a name="l00054"></a><a class="code" href="classCVC3_1_1BVConstExpr.html#adcb98b161f0433b1d5cac71d9e14450c">00054</a> <span class="keyword">const</span> <a class="code" href="classCVC3_1_1ExprValue.html" title="The base class for holding the actual data in expressions.">ExprValue</a>* <a class="code" href="classCVC3_1_1BVConstExpr.html#adcb98b161f0433b1d5cac71d9e14450c" title="Test whether the expression is a generic subclass.">getExprValue</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <span class="keyword">this</span>; } <a name="l00055"></a>00055 <span class="comment"></span> <a name="l00056"></a>00056 <span class="comment"> //! Only compare the bitvector constant, not the integer attribute</span> <a name="l00057"></a><a class="code" href="classCVC3_1_1BVConstExpr.html#aa66418f8824a594e9570b036950feeb2">00057</a> <span class="comment"></span> <span class="keywordtype">bool</span> <a class="code" href="classCVC3_1_1BVConstExpr.html#aa66418f8824a594e9570b036950feeb2" title="Only compare the bitvector constant, not the integer attribute.">operator==</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1ExprValue.html" title="The base class for holding the actual data in expressions.">ExprValue</a>& ev2)<span class="keyword"> const </span>{ <a name="l00058"></a>00058 <span class="keywordflow">if</span>(ev2.<a class="code" href="classCVC3_1_1ExprValue.html#af4280c2539ba1dd4a089f0537f7ef3d4" title="Get unique memory manager ID.">getMMIndex</a>() != <a class="code" href="classCVC3_1_1BVConstExpr.html#a5ef246111d8fcee01c512ad17b1bff4f" title="The registration index for ExprManager.">d_MMIndex</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00059"></a>00059 <span class="keywordflow">return</span> (<a class="code" href="classCVC3_1_1BVConstExpr.html#a1f03d8a52caf2691900803ee08df9d10" title="value of bitvector constant">d_bvconst</a> == ((<span class="keyword">const</span> <a class="code" href="classCVC3_1_1BVConstExpr.html">BVConstExpr</a>&)ev2).d_bvconst); <a name="l00060"></a>00060 } <a name="l00061"></a>00061 <a name="l00062"></a><a class="code" href="classCVC3_1_1BVConstExpr.html#a6e708b4f44336fe04622985541e44e1d">00062</a> <span class="keywordtype">void</span>* <a class="code" href="classCVC3_1_1BVConstExpr.html#a6e708b4f44336fe04622985541e44e1d" title="Overload operator new.">operator new</a>(<span class="keywordtype">size_t</span> <a class="code" href="classCVC3_1_1BVConstExpr.html#abd7d889109e631cf0c9bff9f77cd5e12">size</a>, <a class="code" href="classCVC3_1_1MemoryManager.html">MemoryManager</a>* mm) { <a name="l00063"></a>00063 <span class="keywordflow">return</span> mm-><a class="code" href="classCVC3_1_1MemoryManager.html#a3db7efbc4b956bd423a73e1157d70ce0">newData</a>(size); <a name="l00064"></a>00064 } <a name="l00065"></a><a class="code" href="classCVC3_1_1BVConstExpr.html#aa2a8f22fc482000bdb9f4156a440320b">00065</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1BVConstExpr.html#aa2a8f22fc482000bdb9f4156a440320b">operator delete</a>(<span class="keywordtype">void</span>* pMem, <a class="code" href="classCVC3_1_1MemoryManager.html">MemoryManager</a>* mm) { <a name="l00066"></a>00066 mm-><a class="code" href="classCVC3_1_1MemoryManager.html#ad29fac88d3a07566d9a8f9dc8d8e059c">deleteData</a>(pMem); <a name="l00067"></a>00067 } <a name="l00068"></a>00068 <a name="l00069"></a><a class="code" href="classCVC3_1_1BVConstExpr.html#a85812e60f793879ebc7885231878a548">00069</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1BVConstExpr.html#a85812e60f793879ebc7885231878a548" title="Overload operator delete.">operator delete</a>(<span class="keywordtype">void</span>*) { } <a name="l00070"></a>00070 <a name="l00071"></a><a class="code" href="classCVC3_1_1BVConstExpr.html#abd7d889109e631cf0c9bff9f77cd5e12">00071</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCVC3_1_1BVConstExpr.html#abd7d889109e631cf0c9bff9f77cd5e12">size</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1BVConstExpr.html#a1f03d8a52caf2691900803ee08df9d10" title="value of bitvector constant">d_bvconst</a>.size(); } <a name="l00072"></a><a class="code" href="classCVC3_1_1BVConstExpr.html#af73f615ba21d3614f77a81636c538528">00072</a> <span class="keywordtype">bool</span> <a class="code" href="classCVC3_1_1BVConstExpr.html#af73f615ba21d3614f77a81636c538528">getValue</a>(<span class="keywordtype">int</span> i)<span class="keyword"> const</span> <a name="l00073"></a>00073 <span class="keyword"> </span>{ <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(0 <= i && (<span class="keywordtype">unsigned</span>)i < <a class="code" href="classCVC3_1_1BVConstExpr.html#abd7d889109e631cf0c9bff9f77cd5e12">size</a>(), <span class="stringliteral">"out of bounds"</span>); <a name="l00074"></a>00074 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1BVConstExpr.html#a1f03d8a52caf2691900803ee08df9d10" title="value of bitvector constant">d_bvconst</a>[i]; } <a name="l00075"></a>00075 <a name="l00076"></a>00076 }; <span class="comment">//end of BVConstExpr</span> <a name="l00077"></a>00077 <a name="l00078"></a>00078 } <span class="comment">// end of namespace CVC3</span> <a name="l00079"></a>00079 <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>