Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 583ffa4ba069126c3ba0bc565dc0485a > files > 1714

cvc3-doc-2.4.1-1.fc15.noarch.rpm

<!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: type.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&#160;<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&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;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&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">type.h</div>  </div>
</div>
<div class="contents">
<a href="type_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 type.h</span>
<a name="l00004"></a>00004 <span class="comment"> * </span>
<a name="l00005"></a>00005 <span class="comment"> * Author: Clark Barrett</span>
<a name="l00006"></a>00006 <span class="comment"> * </span>
<a name="l00007"></a>00007 <span class="comment"> * Created: Thu Dec 12 12:53:28 2002</span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> * &lt;hr&gt;</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"> * &lt;hr&gt;</span>
<a name="l00017"></a>00017 <span class="comment"> * </span>
<a name="l00018"></a>00018 <span class="comment"> */</span>
<a name="l00019"></a>00019 <span class="comment">/*****************************************************************************/</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="comment">// expr.h Has to be included outside of #ifndef, since it sources us</span>
<a name="l00022"></a>00022 <span class="comment">// recursively (read comments in expr_value.h).</span>
<a name="l00023"></a>00023 <span class="preprocessor">#ifndef _cvc3__expr_h_</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="expr_8h.html" title="Definition of the API to expression package. See class Expr for details.">expr.h</a>&quot;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#endif</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span>
<a name="l00027"></a>00027 <span class="preprocessor">#ifndef _cvc3__include__type_h_</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span><span class="preprocessor">#define _cvc3__include__type_h_</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span>
<a name="l00030"></a>00030 <span class="keyword">namespace </span>CVC3 {
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="preprocessor">#include &quot;<a class="code" href="os_8h.html" title="Abstraction over different operating systems.">os.h</a>&quot;</span>
<a name="l00033"></a>00033 <span class="comment"></span>
<a name="l00034"></a>00034 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00035"></a>00035 <span class="comment"></span><span class="comment">//                                                                           //</span>
<a name="l00036"></a>00036 <span class="comment">// Class: Type                     //</span>
<a name="l00037"></a>00037 <span class="comment">// Author: Clark Barrett                                                     //</span>
<a name="l00038"></a>00038 <span class="comment">// Created: Thu Dec 12 12:53:34 2002               //</span>
<a name="l00039"></a>00039 <span class="comment">// Description: Wrapper around expr for api                                  //</span>
<a name="l00040"></a>00040 <span class="comment">//                                                                           //</span><span class="comment"></span>
<a name="l00041"></a>00041 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00042"></a><a class="code" href="classCVC3_1_1Type.html">00042</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="os_8h.html#a0035aac6379df39aa69feba98b2751ba">CVC_DLL</a> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> {
<a name="l00043"></a><a class="code" href="os_8h.html#a0035aac6379df39aa69feba98b2751ba">00043</a>   Expr d_expr;
<a name="l00044"></a>00044 
<a name="l00045"></a>00045 <span class="keyword">public</span>:
<a name="l00046"></a><a class="code" href="classCVC3_1_1Type.html#a0c0779105402ab3486650cfac3c97fd1">00046</a>   <a class="code" href="classCVC3_1_1Type.html#a0c0779105402ab3486650cfac3c97fd1">Type</a>() {}
<a name="l00047"></a>00047   <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>(<a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> expr);<span class="comment"></span>
<a name="l00048"></a>00048 <span class="comment">  //! Special constructor that doesn&#39;t check if expr is a type</span>
<a name="l00049"></a>00049 <span class="comment"></span>  <span class="comment">//TODO: make this private</span>
<a name="l00050"></a><a class="code" href="classCVC3_1_1Type.html#a199a98692c61cd04ce289db78a4815f5">00050</a>   <a class="code" href="classCVC3_1_1Type.html#a199a98692c61cd04ce289db78a4815f5" title="Special constructor that doesn&#39;t check if expr is a type.">Type</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>&amp; type) :d_expr(type.d_expr) {}
<a name="l00051"></a><a class="code" href="classCVC3_1_1Type.html#a3f51087d6da0a2120ed542390fc52996">00051</a>   <a class="code" href="classCVC3_1_1Type.html#a3f51087d6da0a2120ed542390fc52996">Type</a>(<a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> expr, <span class="keywordtype">bool</span> dummy) :d_expr(expr) {}
<a name="l00052"></a><a class="code" href="classCVC3_1_1Type.html#a0bc1eebf8dbd9d2880e1f18d7804e5c2">00052</a>   <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; <a class="code" href="classCVC3_1_1Type.html#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> d_expr; }
<a name="l00053"></a>00053 
<a name="l00054"></a>00054   <span class="comment">// Reasoning about children</span>
<a name="l00055"></a><a class="code" href="classCVC3_1_1Type.html#abd7ab3fcb112e27aa05da8981b56e02c">00055</a>   <span class="keywordtype">int</span> <a class="code" href="classCVC3_1_1Type.html#abd7ab3fcb112e27aa05da8981b56e02c">arity</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> d_expr.arity(); }
<a name="l00056"></a><a class="code" href="classCVC3_1_1Type.html#a2842ab1445c09508fcf85ada98d474e5">00056</a>   <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> <a class="code" href="classCVC3_1_1Type.html#a2842ab1445c09508fcf85ada98d474e5">operator[]</a>(<span class="keywordtype">int</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>(d_expr[i]); }
<a name="l00057"></a>00057 
<a name="l00058"></a>00058   <span class="comment">// Core testers</span>
<a name="l00059"></a><a class="code" href="classCVC3_1_1Type.html#ab5fe00c99ee91f369e3339b26bab0bf7">00059</a>   <span class="keywordtype">bool</span> <a class="code" href="classCVC3_1_1Type.html#ab5fe00c99ee91f369e3339b26bab0bf7">isNull</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> d_expr.isNull(); }
<a name="l00060"></a><a class="code" href="classCVC3_1_1Type.html#a38bba404056eadf3c283a67ab2347e02">00060</a>   <span class="keywordtype">bool</span> <a class="code" href="classCVC3_1_1Type.html#a38bba404056eadf3c283a67ab2347e02">isBool</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> d_expr.getKind() == <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba8a583f16e8d237a423c8c1d9087a4c72">BOOLEAN</a>; }
<a name="l00061"></a><a class="code" href="classCVC3_1_1Type.html#a6b7881db7856a8403553f4f2f3833c74">00061</a>   <span class="keywordtype">bool</span> <a class="code" href="classCVC3_1_1Type.html#a6b7881db7856a8403553f4f2f3833c74">isSubtype</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> d_expr.getKind() == <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba9ae776fb49b0eb32dd93f866492000b5">SUBTYPE</a>; }
<a name="l00062"></a><a class="code" href="classCVC3_1_1Type.html#a9c3be568546a63fb424e4cb49391dfa6">00062</a>   <span class="keywordtype">bool</span> <a class="code" href="classCVC3_1_1Type.html#a9c3be568546a63fb424e4cb49391dfa6">isFunction</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> d_expr.getKind() == <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba546eccfedc4dcc8623ed0668f77ef982">ARROW</a>; }<span class="comment"></span>
<a name="l00063"></a>00063 <span class="comment">  //! Return cardinality of type</span>
<a name="l00064"></a><a class="code" href="classCVC3_1_1Type.html#a79df1e87774d07af2e0f1e63ef9a5898">00064</a> <span class="comment"></span>  <a class="code" href="namespaceCVC3.html#af969e724f8b7016909f5804e8cea3e54" title="Enum for cardinality of types.">Cardinality</a> <a class="code" href="classCVC3_1_1Type.html#a79df1e87774d07af2e0f1e63ef9a5898" title="Return cardinality of type.">card</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> d_expr.typeCard(); }<span class="comment"></span>
<a name="l00065"></a>00065 <span class="comment">  //! Return nth (starting with 0) element in a finite type</span>
<a name="l00066"></a>00066 <span class="comment"></span><span class="comment">  /*! Returns NULL Expr if unable to compute nth element</span>
<a name="l00067"></a>00067 <span class="comment">   */</span>
<a name="l00068"></a><a class="code" href="classCVC3_1_1Type.html#aaf312d59704ec785b26661aeba90b7bc">00068</a>   <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> <a class="code" href="classCVC3_1_1Type.html#aaf312d59704ec785b26661aeba90b7bc" title="Return nth (starting with 0) element in a finite type.">enumerateFinite</a>(<a class="code" href="classCVC3_1_1Unsigned.html">Unsigned</a> n)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> d_expr.<a class="code" href="group__ExprPkg.html#ga9abac5907964bb1ca7d6ad7d1280791c" title="Return nth (starting with 0) element in a finite type.">typeEnumerateFinite</a>(n); }<span class="comment"></span>
<a name="l00069"></a>00069 <span class="comment">  //! Return size of a finite type; returns 0 if size cannot be determined</span>
<a name="l00070"></a><a class="code" href="classCVC3_1_1Type.html#a139b7b4132051557791bcbaea66bd377">00070</a> <span class="comment"></span>  <a class="code" href="classCVC3_1_1Unsigned.html">Unsigned</a> <a class="code" href="classCVC3_1_1Type.html#a139b7b4132051557791bcbaea66bd377" title="Return size of a finite type; returns 0 if size cannot be determined.">sizeFinite</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> d_expr.typeSizeFinite(); }
<a name="l00071"></a>00071 
<a name="l00072"></a>00072   <span class="comment">// Core constructors</span>
<a name="l00073"></a><a class="code" href="classCVC3_1_1Type.html#a20b55d497b79ffc60b68ffe512dc2b56">00073</a>   <span class="keyword">static</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> <a class="code" href="classCVC3_1_1Type.html#a20b55d497b79ffc60b68ffe512dc2b56">typeBool</a>(<a class="code" href="classCVC3_1_1ExprManager.html">ExprManager</a>* em) { <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>(em-&gt;<a class="code" href="group__EM__Priv.html#gab01fe102500e6b4e266299bf4bbb8a20" title="BOOLEAN Expr.">boolExpr</a>(), <span class="keyword">true</span>); }
<a name="l00074"></a><a class="code" href="classCVC3_1_1Type.html#ae3477d8de1425fc5f278a8fbc76e56a0">00074</a>   <span class="keyword">static</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> <a class="code" href="classCVC3_1_1Type.html#ae3477d8de1425fc5f278a8fbc76e56a0">anyType</a>(<a class="code" href="classCVC3_1_1ExprManager.html">ExprManager</a>* em) { <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>(em-&gt;<a class="code" href="group__EM__Priv.html#gacd77df1dbcc429e06a75047e2f609822">newLeafExpr</a>(<a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba6245843ec0c376adc7b587ad82459846">ANY_TYPE</a>)); }
<a name="l00075"></a>00075   <span class="keyword">static</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> funType(<span class="keyword">const</span> std::vector&lt;Type&gt;&amp; typeDom, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>&amp; typeRan);
<a name="l00076"></a><a class="code" href="classCVC3_1_1Type.html#a2c8b5f5720002766f6fab19157c3f6c0">00076</a>   <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> funType(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>&amp; typeRan)<span class="keyword"> const</span>
<a name="l00077"></a>00077 <span class="keyword">  </span>{ <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>(<a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>(<a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba546eccfedc4dcc8623ed0668f77ef982">ARROW</a>, d_expr, typeRan.<a class="code" href="classCVC3_1_1Type.html#aa2fd6d88b18d9e9135cb2b9d59bdf20a">d_expr</a>)); }
<a name="l00078"></a>00078 
<a name="l00079"></a>00079   <span class="comment">// Printing</span>
<a name="l00080"></a><a class="code" href="classCVC3_1_1Type.html#a2f5ce4b1973ec02b2f2b2eba8ce3cc50">00080</a>   std::string <a class="code" href="classCVC3_1_1Type.html#a2f5ce4b1973ec02b2f2b2eba8ce3cc50">toString</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> getExpr().toString(); }
<a name="l00081"></a>00081 };
<a name="l00082"></a>00082 
<a name="l00083"></a><a class="code" href="namespaceCVC3.html#af0345417eb63be5de31f182643c38642">00083</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespaceCVC3.html#a8e164436388f2d87c971d9bbde973c58">operator==</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>&amp; t1, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>&amp; t2)
<a name="l00084"></a>00084 { <span class="keywordflow">return</span> t1.<a class="code" href="classCVC3_1_1Type.html#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>() == t2.<a class="code" href="classCVC3_1_1Type.html#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>(); }
<a name="l00085"></a>00085 
<a name="l00086"></a><a class="code" href="namespaceCVC3.html#a23041b40cbe08b39af0bf6f2a480db7c">00086</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespaceCVC3.html#a5aa953c549c2e103f3834c48bf6cb9a1">operator!=</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>&amp; t1, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>&amp; t2)
<a name="l00087"></a>00087 { <span class="keywordflow">return</span> t1.<a class="code" href="classCVC3_1_1Type.html#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>() != t2.<a class="code" href="classCVC3_1_1Type.html#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>(); }
<a name="l00088"></a>00088 
<a name="l00089"></a>00089 <span class="comment">// Printing</span>
<a name="l00090"></a><a class="code" href="namespaceCVC3.html#a1342ebc477671331e8d550c13db1ddb2">00090</a> <span class="keyword">inline</span> std::ostream&amp; <a class="code" href="namespaceCVC3.html#a6b7e38d3c97da1e91e12a6c9555b8163">operator&lt;&lt;</a>(std::ostream&amp; os, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>&amp; t) {
<a name="l00091"></a>00091   <span class="keywordflow">return</span> os &lt;&lt; t.<a class="code" href="classCVC3_1_1Type.html#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>();
<a name="l00092"></a>00092 }
<a name="l00093"></a>00093 
<a name="l00094"></a>00094 }
<a name="l00095"></a>00095 
<a name="l00096"></a>00096 <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&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>