<!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>libdap++: ConstraintEvaluator.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript"> $(document).ready(initResizable); </script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.3 --> <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">libdap++ <span id="projectnumber">Updated for version 3.8.2</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="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> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> initNavTree('ConstraintEvaluator_8h.html',''); </script> <div id="doc-content"> <div class="header"> <div class="headertitle"> <h1>ConstraintEvaluator.h</h1> </div> </div> <div class="contents"> <a href="ConstraintEvaluator_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// -*- mode: c++; c-basic-offset:4 -*-</span> <a name="l00002"></a>00002 <a name="l00003"></a>00003 <span class="comment">// This file is part of libdap, A C++ implementation of the OPeNDAP Data</span> <a name="l00004"></a>00004 <span class="comment">// Access Protocol.</span> <a name="l00005"></a>00005 <a name="l00006"></a>00006 <span class="comment">// Copyright (c) 2006 OPeNDAP, Inc.</span> <a name="l00007"></a>00007 <span class="comment">// Author: James Gallagher <jgallagher@opendap.org></span> <a name="l00008"></a>00008 <span class="comment">//</span> <a name="l00009"></a>00009 <span class="comment">// This library is free software; you can redistribute it and/or</span> <a name="l00010"></a>00010 <span class="comment">// modify it under the terms of the GNU Lesser General Public</span> <a name="l00011"></a>00011 <span class="comment">// License as published by the Free Software Foundation; either</span> <a name="l00012"></a>00012 <span class="comment">// version 2.1 of the License, or (at your option) any later version.</span> <a name="l00013"></a>00013 <span class="comment">//</span> <a name="l00014"></a>00014 <span class="comment">// This library is distributed in the hope that it will be useful,</span> <a name="l00015"></a>00015 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00016"></a>00016 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00017"></a>00017 <span class="comment">// Lesser General Public License for more details.</span> <a name="l00018"></a>00018 <span class="comment">//</span> <a name="l00019"></a>00019 <span class="comment">// You should have received a copy of the GNU Lesser General Public</span> <a name="l00020"></a>00020 <span class="comment">// License along with this library; if not, write to the Free Software</span> <a name="l00021"></a>00021 <span class="comment">// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span> <a name="l00022"></a>00022 <span class="comment">//</span> <a name="l00023"></a>00023 <span class="comment">// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.</span> <a name="l00024"></a>00024 <a name="l00025"></a>00025 <span class="preprocessor">#ifndef constraint_evaluator_h</span> <a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#define constraint_evaluator_h</span> <a name="l00027"></a>00027 <span class="preprocessor"></span> <a name="l00028"></a>00028 <span class="preprocessor">#include <list></span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="preprocessor">#ifndef _dds_h</span> <a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="DDS_8h.html">DDS.h</a>"</span> <a name="l00032"></a>00032 <span class="preprocessor">#endif</span> <a name="l00033"></a>00033 <span class="preprocessor"></span> <a name="l00034"></a>00034 <span class="preprocessor">#ifndef _datadds_h</span> <a name="l00035"></a>00035 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="DataDDS_8h.html">DataDDS.h</a>"</span> <a name="l00036"></a>00036 <span class="preprocessor">#endif</span> <a name="l00037"></a>00037 <span class="preprocessor"></span> <a name="l00038"></a>00038 <span class="preprocessor">#ifndef _clause_h</span> <a name="l00039"></a>00039 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="Clause_8h.html">Clause.h</a>"</span> <a name="l00040"></a>00040 <span class="preprocessor">#endif</span> <a name="l00041"></a>00041 <span class="preprocessor"></span> <a name="l00042"></a>00042 <span class="keyword">namespace </span>libdap <a name="l00043"></a>00043 { <a name="l00044"></a>00044 <a name="l00046"></a><a class="code" href="classlibdap_1_1ConstraintEvaluator.html">00046</a> <span class="keyword">class </span><a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> <a name="l00047"></a>00047 { <a name="l00048"></a>00048 <span class="keyword">private</span>: <a name="l00049"></a>00049 <span class="comment">// This struct is used to hold all the known `user defined' functions</span> <a name="l00050"></a>00050 <span class="comment">// (including those that are `built-in').</span> <a name="l00051"></a>00051 <span class="keyword">struct </span>function <a name="l00052"></a>00052 { <a name="l00053"></a>00053 <span class="keywordtype">string</span> name; <a name="l00054"></a>00054 bool_func b_func; <a name="l00055"></a>00055 btp_func bt_func; <a name="l00056"></a>00056 proj_func p_func; <a name="l00057"></a>00057 <a name="l00058"></a>00058 function(<span class="keyword">const</span> <span class="keywordtype">string</span> &n, <span class="keyword">const</span> bool_func f) <a name="l00059"></a>00059 : name(n), b_func(f), bt_func(0), p_func(0) <a name="l00060"></a>00060 {} <a name="l00061"></a>00061 function(<span class="keyword">const</span> <span class="keywordtype">string</span> &n, <span class="keyword">const</span> btp_func f) <a name="l00062"></a>00062 : name(n), bt_func(f), p_func(0) <a name="l00063"></a>00063 {} <a name="l00064"></a>00064 function(<span class="keyword">const</span> <span class="keywordtype">string</span> &n, <span class="keyword">const</span> proj_func f) <a name="l00065"></a>00065 : name(n), bt_func(0), p_func(f) <a name="l00066"></a>00066 {} <a name="l00067"></a>00067 function(): name(<span class="stringliteral">""</span>), bt_func(0), p_func(0) <a name="l00068"></a>00068 {} <a name="l00069"></a>00069 }; <a name="l00070"></a>00070 <a name="l00071"></a>00071 vector<Clause *> expr; <span class="comment">// List of CE Clauses</span> <a name="l00072"></a>00072 <a name="l00073"></a>00073 vector<BaseType *> constants;<span class="comment">// List of temporary objects</span> <a name="l00074"></a>00074 <a name="l00075"></a>00075 list<function> functions; <span class="comment">// Known external functions</span> <a name="l00076"></a>00076 <a name="l00077"></a>00077 <span class="comment">// The default versions of these methods will break this class. Because</span> <a name="l00078"></a>00078 <span class="comment">// Clause does not support deep copies, that class will need to be modified</span> <a name="l00079"></a>00079 <span class="comment">// before these can be properly implemented. jhrg 4/3/06</span> <a name="l00080"></a>00080 <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a61250e6c1cec9b2411a529c7fb4efd94">ConstraintEvaluator</a>(<span class="keyword">const</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> &) <a name="l00081"></a>00081 {} <a name="l00082"></a>00082 <a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> &operator=(<span class="keyword">const</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> &) <a name="l00083"></a>00083 { <a name="l00084"></a>00084 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1InternalErr.html" title="A class for software fault reporting.">InternalErr</a>(__FILE__, __LINE__, <span class="stringliteral">"Unimplemented method"</span>); <a name="l00085"></a>00085 } <a name="l00086"></a>00086 <a name="l00087"></a><a class="code" href="classlibdap_1_1ConstraintEvaluator.html#abdcdfafb252f26c4af32af89b0f699dc">00087</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classlibdap_1_1ConstraintEvaluator.html#abdcdfafb252f26c4af32af89b0f699dc">func_name_is</a>; <a name="l00088"></a>00088 <a name="l00089"></a>00089 <span class="keyword">public</span>: <a name="l00090"></a><a class="code" href="classlibdap_1_1ConstraintEvaluator.html#abffbe592e2282493954bdfe3ceac7445">00090</a> <span class="keyword">typedef</span> std::vector<Clause *>::const_iterator <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#abffbe592e2282493954bdfe3ceac7445">Clause_citer</a> ; <a name="l00091"></a><a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a369a03eac7969bb6955cfc90ababb8aa">00091</a> <span class="keyword">typedef</span> std::vector<Clause *>::iterator <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a369a03eac7969bb6955cfc90ababb8aa">Clause_iter</a> ; <a name="l00092"></a>00092 <a name="l00093"></a><a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a9702bcb82a4a27c93665490d651cf816">00093</a> <span class="keyword">typedef</span> std::vector<BaseType *>::const_iterator <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a9702bcb82a4a27c93665490d651cf816">Constants_citer</a> ; <a name="l00094"></a><a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a1c38b776ba27bc78a1e484a45bbe8747">00094</a> <span class="keyword">typedef</span> std::vector<BaseType *>::iterator <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a1c38b776ba27bc78a1e484a45bbe8747">Constants_iter</a> ; <a name="l00095"></a>00095 <a name="l00096"></a><a class="code" href="classlibdap_1_1ConstraintEvaluator.html#afabff19845fae4d5ccfcc492b33c79c2">00096</a> <span class="keyword">typedef</span> std::list<function>::const_iterator <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#afabff19845fae4d5ccfcc492b33c79c2">Functions_citer</a> ; <a name="l00097"></a><a class="code" href="classlibdap_1_1ConstraintEvaluator.html#ae80dcd9458c825dd656d223e34d8b3b2">00097</a> <span class="keyword">typedef</span> std::list<function>::iterator <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#ae80dcd9458c825dd656d223e34d8b3b2">Functions_iter</a> ; <a name="l00098"></a>00098 <a name="l00099"></a>00099 <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a61250e6c1cec9b2411a529c7fb4efd94">ConstraintEvaluator</a>(); <a name="l00100"></a>00100 <span class="keyword">virtual</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#ae46662e1cbe013a6f6ad65d2e0c24186">~ConstraintEvaluator</a>(); <a name="l00101"></a>00101 <a name="l00102"></a>00102 <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#ac42a51af20507806f1e04e24ed9cb0ac" title="Add a boolean function to the list.">add_function</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name, bool_func f); <a name="l00103"></a>00103 <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#ac42a51af20507806f1e04e24ed9cb0ac" title="Add a boolean function to the list.">add_function</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name, btp_func f); <a name="l00104"></a>00104 <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#ac42a51af20507806f1e04e24ed9cb0ac" title="Add a boolean function to the list.">add_function</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name, proj_func f); <a name="l00105"></a>00105 <a name="l00106"></a>00106 <span class="keywordtype">bool</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#ac8da439f904b56b42bab23e6d6483a5d" title="Find a Boolean function with a given name in the function list.">find_function</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name, bool_func *f) <span class="keyword">const</span>; <a name="l00107"></a>00107 <span class="keywordtype">bool</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#ac8da439f904b56b42bab23e6d6483a5d" title="Find a Boolean function with a given name in the function list.">find_function</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name, btp_func *f) <span class="keyword">const</span>; <a name="l00108"></a>00108 <span class="keywordtype">bool</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#ac8da439f904b56b42bab23e6d6483a5d" title="Find a Boolean function with a given name in the function list.">find_function</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name, proj_func *f) <span class="keyword">const</span>; <a name="l00109"></a>00109 <a name="l00110"></a>00110 <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a796b573bb1ec8bbce8c22c4caf58af2e" title="Add a clause to a constraint expression.">append_clause</a>(<span class="keywordtype">int</span> op, <a class="code" href="classlibdap_1_1rvalue.html">rvalue</a> *arg1, <a class="code" href="namespacelibdap.html#a443d3b7d9ceaa4ec25e5bfcc555ce056">rvalue_list</a> *arg2); <a name="l00111"></a>00111 <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a796b573bb1ec8bbce8c22c4caf58af2e" title="Add a clause to a constraint expression.">append_clause</a>(bool_func func, <a class="code" href="namespacelibdap.html#a443d3b7d9ceaa4ec25e5bfcc555ce056">rvalue_list</a> *args); <a name="l00112"></a>00112 <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a796b573bb1ec8bbce8c22c4caf58af2e" title="Add a clause to a constraint expression.">append_clause</a>(btp_func func, <a class="code" href="namespacelibdap.html#a443d3b7d9ceaa4ec25e5bfcc555ce056">rvalue_list</a> *args); <a name="l00113"></a>00113 <a name="l00114"></a>00114 <span class="keywordtype">bool</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#add46ce1d9ef36fa26a2913d8d7c51096" title="Does the current constraint expression return a BaseType pointer? This method does not evaluate the c...">functional_expression</a>(); <a name="l00115"></a>00115 <span class="keywordtype">bool</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a155da913af4458d96fa60ecd0ecbe377" title="Does the current constraint expression return a boolean value?">boolean_expression</a>(); <a name="l00116"></a>00116 <span class="keywordtype">bool</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#aa0066a57cf00c975f6ccbc2e90c64742" title="Evaluate a boolean-valued constraint expression. This is main method for the evaluator ans is called ...">eval_selection</a>(<a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds, <span class="keyword">const</span> <span class="keywordtype">string</span> &dataset); <a name="l00117"></a>00117 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *<a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a3d433bb6769cc95fb299249b5e5d74c4" title="Evaluate a function-valued constraint expression.">eval_function</a>(<a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds, <span class="keyword">const</span> <span class="keywordtype">string</span> &dataset); <a name="l00118"></a>00118 <a name="l00119"></a>00119 <span class="comment">// New for libdap 3.11. These methods provide a way to evaluate multiple</span> <a name="l00120"></a>00120 <span class="comment">// functions in one CE</span> <a name="l00121"></a>00121 <span class="keywordtype">bool</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a9985c6a30247ced32a4b6e764deebf45" title="Does the current constraint expression return a DDS pointer?">function_clauses</a>(); <a name="l00122"></a>00122 <a class="code" href="classlibdap_1_1DDS.html">DDS</a> *<a class="code" href="classlibdap_1_1ConstraintEvaluator.html#ab0dba1657e9aadd85b3ce713c6a4036a" title="Evaluate a function-valued constraint expression that contains several function calls.">eval_function_clauses</a>(<a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds); <a name="l00123"></a>00123 <a class="code" href="classlibdap_1_1DataDDS.html" title="Holds a DAP2 DDS.">DataDDS</a> *<a class="code" href="classlibdap_1_1ConstraintEvaluator.html#ab0dba1657e9aadd85b3ce713c6a4036a" title="Evaluate a function-valued constraint expression that contains several function calls.">eval_function_clauses</a>(<a class="code" href="classlibdap_1_1DataDDS.html" title="Holds a DAP2 DDS.">DataDDS</a> &dds); <a name="l00124"></a>00124 <a name="l00125"></a>00125 <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a369a03eac7969bb6955cfc90ababb8aa">Clause_iter</a> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a81135cc86f8bef397b59577dfa224f62">clause_begin</a>(); <a name="l00126"></a>00126 <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a369a03eac7969bb6955cfc90ababb8aa">Clause_iter</a> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#ad193b3ca4cef59d2b46c04ab08f4675f">clause_end</a>(); <a name="l00127"></a>00127 <span class="keywordtype">bool</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a5c53cfac881da05b7ed6eb6404b0c4f9">clause_value</a>(<a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a369a03eac7969bb6955cfc90ababb8aa">Clause_iter</a> &i, <a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds); <a name="l00128"></a>00128 <a name="l00129"></a>00129 <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#aaeb4a7662178b992d9e36ff1dc0fc2bc" title="Parse the constraint expression given the current DDS.">parse_constraint</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &constraint, <a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds); <a name="l00130"></a>00130 <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1ConstraintEvaluator.html#abf7511f38a4c5f8fc0cde0eca91ef338">append_constant</a>(<a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp); <a name="l00131"></a>00131 <a name="l00132"></a>00132 }; <a name="l00133"></a>00133 <a name="l00134"></a>00134 } <span class="comment">// namespace libdap</span> <a name="l00135"></a>00135 <a name="l00136"></a>00136 <span class="preprocessor">#endif // constraint_evaluator_h</span> </pre></div></div> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="ConstraintEvaluator_8h.html">ConstraintEvaluator.h</a> </li> <li class="footer">Generated on Tue Feb 8 2011 for libdap++ by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li> </ul> </div> </body> </html>