<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>libdap++: Clause.cc 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.5.9 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="main.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 class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <h1>Clause.cc</h1><a href="Clause_8cc.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <a name="l00002"></a>00002 <span class="comment">// -*- mode: c++; c-basic-offset:4 -*-</span> <a name="l00003"></a>00003 <a name="l00004"></a>00004 <span class="comment">// This file is part of libdap, A C++ implementation of the OPeNDAP Data</span> <a name="l00005"></a>00005 <span class="comment">// Access Protocol.</span> <a name="l00006"></a>00006 <a name="l00007"></a>00007 <span class="comment">// Copyright (c) 2002,2003 OPeNDAP, Inc.</span> <a name="l00008"></a>00008 <span class="comment">// Author: James Gallagher <jgallagher@opendap.org></span> <a name="l00009"></a>00009 <span class="comment">//</span> <a name="l00010"></a>00010 <span class="comment">// This library is free software; you can redistribute it and/or</span> <a name="l00011"></a>00011 <span class="comment">// modify it under the terms of the GNU Lesser General Public</span> <a name="l00012"></a>00012 <span class="comment">// License as published by the Free Software Foundation; either</span> <a name="l00013"></a>00013 <span class="comment">// version 2.1 of the License, or (at your option) any later version.</span> <a name="l00014"></a>00014 <span class="comment">//</span> <a name="l00015"></a>00015 <span class="comment">// This library is distributed in the hope that it will be useful,</span> <a name="l00016"></a>00016 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00017"></a>00017 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00018"></a>00018 <span class="comment">// Lesser General Public License for more details.</span> <a name="l00019"></a>00019 <span class="comment">//</span> <a name="l00020"></a>00020 <span class="comment">// You should have received a copy of the GNU Lesser General Public</span> <a name="l00021"></a>00021 <span class="comment">// License along with this library; if not, write to the Free Software</span> <a name="l00022"></a>00022 <span class="comment">// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span> <a name="l00023"></a>00023 <span class="comment">//</span> <a name="l00024"></a>00024 <span class="comment">// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.</span> <a name="l00025"></a>00025 <a name="l00026"></a>00026 <span class="comment">// (c) COPYRIGHT URI/MIT 1996,1998,1999</span> <a name="l00027"></a>00027 <span class="comment">// Please first read the full copyright statement in the file COPYRIGHT_URI.</span> <a name="l00028"></a>00028 <span class="comment">//</span> <a name="l00029"></a>00029 <span class="comment">// Authors:</span> <a name="l00030"></a>00030 <span class="comment">// jhrg,jimg James Gallagher <jgallagher@gso.uri.edu></span> <a name="l00031"></a>00031 <a name="l00032"></a>00032 <span class="comment">// Implementation for the CE Clause class.</span> <a name="l00033"></a>00033 <a name="l00034"></a>00034 <a name="l00035"></a>00035 <span class="preprocessor">#include "<a class="code" href="config_8h.html">config.h</a>"</span> <a name="l00036"></a>00036 <a name="l00037"></a>00037 <span class="preprocessor">#include <cassert></span> <a name="l00038"></a>00038 <span class="preprocessor">#include <algorithm></span> <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="preprocessor">#include "expr.h"</span> <a name="l00041"></a>00041 <span class="preprocessor">#include "<a class="code" href="Byte_8h.html">Byte.h</a>"</span> <a name="l00042"></a>00042 <span class="preprocessor">#include "<a class="code" href="Int16_8h.html">Int16.h</a>"</span> <a name="l00043"></a>00043 <span class="preprocessor">#include "<a class="code" href="UInt16_8h.html">UInt16.h</a>"</span> <a name="l00044"></a>00044 <span class="preprocessor">#include "<a class="code" href="Int32_8h.html">Int32.h</a>"</span> <a name="l00045"></a>00045 <span class="preprocessor">#include "<a class="code" href="UInt32_8h.html">UInt32.h</a>"</span> <a name="l00046"></a>00046 <span class="preprocessor">#include "<a class="code" href="DDS_8h.html">DDS.h</a>"</span> <a name="l00047"></a>00047 <span class="preprocessor">#include "<a class="code" href="Clause_8h.html">Clause.h</a>"</span> <a name="l00048"></a>00048 <a name="l00049"></a>00049 <span class="keyword">using</span> std::cerr; <a name="l00050"></a>00050 <span class="keyword">using</span> std::endl; <a name="l00051"></a>00051 <a name="l00052"></a>00052 <span class="keyword">namespace </span>libdap { <a name="l00053"></a>00053 <a name="l00054"></a><a class="code" href="structlibdap_1_1Clause.html#f59809927231f35f29eae3ab972bf8ce">00054</a> <a class="code" href="structlibdap_1_1Clause.html#86f7ce9fd2b9db982268cc2b121989f3">Clause::Clause</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> oper, <a class="code" href="classlibdap_1_1rvalue.html">rvalue</a> *a1, <a class="code" href="namespacelibdap.html#443d3b7d9ceaa4ec25e5bfcc555ce056">rvalue_list</a> *rv) <a name="l00055"></a>00055 : _op(oper), _b_func(0), _bt_func(0), _arg1(a1), _args(rv) <a name="l00056"></a>00056 { <a name="l00057"></a>00057 assert(<a class="code" href="structlibdap_1_1Clause.html#eaccc72688521a8b08aeae970d983473" title="Checks the &quot;representation invariant&quot; of a clause.">OK</a>()); <a name="l00058"></a>00058 } <a name="l00059"></a>00059 <span class="preprocessor">#if 1</span> <a name="l00060"></a><a class="code" href="structlibdap_1_1Clause.html#e932a2f99ee42df567e1b5581040d643">00060</a> <span class="preprocessor"></span><a class="code" href="structlibdap_1_1Clause.html#86f7ce9fd2b9db982268cc2b121989f3">Clause::Clause</a>(bool_func func, <a class="code" href="namespacelibdap.html#443d3b7d9ceaa4ec25e5bfcc555ce056">rvalue_list</a> *rv) <a name="l00061"></a>00061 : _op(0), _b_func(func), _bt_func(0), _arg1(0), _args(rv) <a name="l00062"></a>00062 { <a name="l00063"></a>00063 assert(<a class="code" href="structlibdap_1_1Clause.html#eaccc72688521a8b08aeae970d983473" title="Checks the &quot;representation invariant&quot; of a clause.">OK</a>()); <a name="l00064"></a>00064 <a name="l00065"></a>00065 <span class="keywordflow">if</span> (_args) <span class="comment">// account for null arg list</span> <a name="l00066"></a>00066 _argc = _args->size(); <a name="l00067"></a>00067 <span class="keywordflow">else</span> <a name="l00068"></a>00068 _argc = 0; <a name="l00069"></a>00069 } <a name="l00070"></a>00070 <span class="preprocessor">#endif</span> <a name="l00071"></a><a class="code" href="structlibdap_1_1Clause.html#c8c43eee6cceb5613379d8b2917b1641">00071</a> <span class="preprocessor"></span><a class="code" href="structlibdap_1_1Clause.html#86f7ce9fd2b9db982268cc2b121989f3">Clause::Clause</a>(btp_func func, <a class="code" href="namespacelibdap.html#443d3b7d9ceaa4ec25e5bfcc555ce056">rvalue_list</a> *rv) <a name="l00072"></a>00072 : _op(0), _b_func(0), _bt_func(func), _arg1(0), _args(rv) <a name="l00073"></a>00073 { <a name="l00074"></a>00074 assert(<a class="code" href="structlibdap_1_1Clause.html#eaccc72688521a8b08aeae970d983473" title="Checks the &quot;representation invariant&quot; of a clause.">OK</a>()); <a name="l00075"></a>00075 <a name="l00076"></a>00076 <span class="keywordflow">if</span> (_args) <a name="l00077"></a>00077 _argc = _args->size(); <a name="l00078"></a>00078 <span class="keywordflow">else</span> <a name="l00079"></a>00079 _argc = 0; <a name="l00080"></a>00080 } <a name="l00081"></a>00081 <a name="l00082"></a><a class="code" href="structlibdap_1_1Clause.html#86f7ce9fd2b9db982268cc2b121989f3">00082</a> <a class="code" href="structlibdap_1_1Clause.html#86f7ce9fd2b9db982268cc2b121989f3">Clause::Clause</a>() : _op(0), _b_func(0), _bt_func(0), _arg1(0), _args(0) <a name="l00083"></a>00083 {} <a name="l00084"></a>00084 <a name="l00085"></a>00085 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a name="l00086"></a>00086 delete_rvalue(<a class="code" href="classlibdap_1_1rvalue.html">rvalue</a> *rv) <a name="l00087"></a>00087 { <a name="l00088"></a>00088 <span class="keyword">delete</span> rv; rv = 0; <a name="l00089"></a>00089 } <a name="l00090"></a>00090 <a name="l00091"></a><a class="code" href="structlibdap_1_1Clause.html#aaeec48bcba4c7a9608c1bb3ef72983a">00091</a> <a class="code" href="structlibdap_1_1Clause.html#aaeec48bcba4c7a9608c1bb3ef72983a">Clause::~Clause</a>() <a name="l00092"></a>00092 { <a name="l00093"></a>00093 <span class="keywordflow">if</span> (_arg1) { <a name="l00094"></a>00094 <span class="keyword">delete</span> _arg1; _arg1 = 0; <a name="l00095"></a>00095 } <a name="l00096"></a>00096 <a name="l00097"></a>00097 <span class="keywordflow">if</span> (_args) { <a name="l00098"></a>00098 <span class="comment">// _args is a pointer to a vector<rvalue*> and we must must delete</span> <a name="l00099"></a>00099 <span class="comment">// each rvalue pointer here explicitly. 02/03/04 jhrg</span> <a name="l00100"></a>00100 for_each(_args->begin(), _args->end(), delete_rvalue); <a name="l00101"></a>00101 <span class="keyword">delete</span> _args; _args = 0; <a name="l00102"></a>00102 } <a name="l00103"></a>00103 } <a name="l00104"></a>00104 <a name="l00106"></a>00106 <span class="keywordtype">bool</span> <a name="l00107"></a><a class="code" href="structlibdap_1_1Clause.html#eaccc72688521a8b08aeae970d983473">00107</a> <a class="code" href="structlibdap_1_1Clause.html#eaccc72688521a8b08aeae970d983473" title="Checks the &quot;representation invariant&quot; of a clause.">Clause::OK</a>() <a name="l00108"></a>00108 { <a name="l00109"></a>00109 <span class="comment">// Each clause object can contain one of: a relational clause, a boolean</span> <a name="l00110"></a>00110 <span class="comment">// function clause or a BaseType pointer function clause. It must have a</span> <a name="l00111"></a>00111 <span class="comment">// valid argument list.</span> <a name="l00112"></a>00112 <span class="comment">//</span> <a name="l00113"></a>00113 <span class="comment">// But, a valid arg list might contain zero arguments! 10/16/98 jhrg</span> <a name="l00114"></a>00114 <span class="keywordtype">bool</span> relational = (_op && !_b_func && !_bt_func); <a name="l00115"></a>00115 <span class="preprocessor">#if 1</span> <a name="l00116"></a>00116 <span class="preprocessor"></span> <span class="keywordtype">bool</span> <span class="keywordtype">boolean</span> = (!_op && _b_func && !_bt_func); <a name="l00117"></a>00117 <span class="preprocessor">#endif</span> <a name="l00118"></a>00118 <span class="preprocessor"></span> <span class="keywordtype">bool</span> basetype = (!_op && !_b_func && _bt_func); <a name="l00119"></a>00119 <a name="l00120"></a>00120 <span class="keywordflow">if</span> (relational) <a name="l00121"></a>00121 <span class="keywordflow">return</span> _arg1 && _args; <a name="l00122"></a>00122 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<span class="keywordtype">boolean</span> || basetype) <a name="l00123"></a>00123 <span class="keywordflow">return</span> <span class="keyword">true</span>; <span class="comment">// Until we check arguments...10/16/98 jhrg</span> <a name="l00124"></a>00124 <span class="keywordflow">else</span> <a name="l00125"></a>00125 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00126"></a>00126 } <a name="l00127"></a>00127 <a name="l00129"></a>00129 <span class="keywordtype">bool</span> <a name="l00130"></a><a class="code" href="structlibdap_1_1Clause.html#80d81003665b96012ee3ba175d80e608">00130</a> <a class="code" href="structlibdap_1_1Clause.html#80d81003665b96012ee3ba175d80e608" title="Return true if the clause returns a boolean value.">Clause::boolean_clause</a>() <a name="l00131"></a>00131 { <a name="l00132"></a>00132 assert(<a class="code" href="structlibdap_1_1Clause.html#eaccc72688521a8b08aeae970d983473" title="Checks the &quot;representation invariant&quot; of a clause.">OK</a>()); <a name="l00133"></a>00133 <a name="l00134"></a>00134 <span class="keywordflow">return</span> _op || _b_func; <a name="l00135"></a>00135 } <a name="l00136"></a>00136 <a name="l00138"></a>00138 <span class="keywordtype">bool</span> <a name="l00139"></a><a class="code" href="structlibdap_1_1Clause.html#7bd5122be1851f0bf32ec1c58b46eaa9">00139</a> <a class="code" href="structlibdap_1_1Clause.html#7bd5122be1851f0bf32ec1c58b46eaa9" title="Return true if the clause returns a value in a BaseType pointer.">Clause::value_clause</a>() <a name="l00140"></a>00140 { <a name="l00141"></a>00141 assert(<a class="code" href="structlibdap_1_1Clause.html#eaccc72688521a8b08aeae970d983473" title="Checks the &quot;representation invariant&quot; of a clause.">OK</a>()); <a name="l00142"></a>00142 <a name="l00143"></a>00143 <span class="keywordflow">return</span> (_bt_func != 0); <a name="l00144"></a>00144 } <a name="l00145"></a>00145 <a name="l00146"></a>00146 <span class="preprocessor">#if 0</span> <a name="l00147"></a>00147 <span class="preprocessor"></span><span class="keyword">static</span> <span class="keywordtype">bool</span> <a name="l00148"></a>00148 boolean_value(<a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp) <a name="l00149"></a>00149 { <a name="l00150"></a>00150 <span class="keywordflow">switch</span> (btp-><a class="code" href="classlibdap_1_1BaseType.html#bc6b2d7099f00bb5f324ec129bff2a17" title="Returns the type of the class instance.">type</a>()) { <a name="l00151"></a>00151 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e64124790aeab42dbcd3d5303dea15b200">dods_byte_c</a>: <a name="l00152"></a>00152 <span class="keywordflow">return</span> !<span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Byte.html" title="Holds a single byte.">Byte</a>&<span class="keyword">></span>(*btp).value(); <a name="l00153"></a>00153 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e637d71c620b71be06fbe667e7cb0e80e4">dods_int16_c</a>: <a name="l00154"></a>00154 <span class="keywordflow">return</span> !<span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Int16.html" title="Holds a 16-bit signed integer value.">Int16</a>&<span class="keyword">></span>(*btp).value(); <a name="l00155"></a>00155 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e684188f64695716d84cefe910704ca094">dods_uint16_c</a>: <a name="l00156"></a>00156 <span class="keywordflow">return</span> !<span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1UInt16.html" title="Holds an unsigned 16-bit integer.">UInt16</a>&<span class="keyword">></span>(*btp).value(); <a name="l00157"></a>00157 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e6524bfec434d0a8f82e06bfcc02c9a6b1">dods_int32_c</a>: <a name="l00158"></a>00158 <span class="keywordflow">return</span> !<span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Int32.html" title="Holds a 32-bit signed integer.">Int32</a>&<span class="keyword">></span>(*btp).value(); <a name="l00159"></a>00159 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e61bdeca4f415a3372b83448efd87bff83">dods_uint32_c</a>: <a name="l00160"></a>00160 <span class="keywordflow">return</span> !<span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1UInt32.html" title="Holds a 32-bit unsigned integer.">UInt32</a>&<span class="keyword">></span>(*btp).value(); <a name="l00161"></a>00161 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e66aff4fd17f027d0f0c41423e2f74a68c">dods_float32_c</a>: <a name="l00162"></a>00162 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e68661c9f9c227fe59b7f5563f20e145d6">dods_float64_c</a>: <a name="l00163"></a>00163 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e6d620cef0bf41edebd4ee802071192a79">dods_str_c</a>: <a name="l00164"></a>00164 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e664d653d09a50d6d17537c43ed217f665">dods_url_c</a>: <a name="l00165"></a>00165 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e6da8f5df7bb2bc72327fcd16af811562f">dods_array_c</a>: <a name="l00166"></a>00166 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e6d93eb0a69e67742f061966ce594b9a6c">dods_structure_c</a>: <a name="l00167"></a>00167 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>: <a name="l00168"></a>00168 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e6c41525d2e860d3bcff641eb1fdba41d2">dods_grid_c</a>: <a name="l00169"></a>00169 <span class="keywordflow">default</span>: <a name="l00170"></a>00170 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(<a class="code" href="Error_8h.html#5806d25bc779e86c285438e687669803">malformed_expr</a>, <span class="stringliteral">"A Function returning something other than an integer was used in a boolean context."</span>); <a name="l00171"></a>00171 } <a name="l00172"></a>00172 } <a name="l00173"></a>00173 <span class="preprocessor">#endif</span> <a name="l00174"></a>00174 <span class="preprocessor"></span> <a name="l00184"></a>00184 <span class="keywordtype">bool</span> <a name="l00185"></a><a class="code" href="structlibdap_1_1Clause.html#bfff44c4db49ad7462d14665b2458588">00185</a> <a class="code" href="structlibdap_1_1Clause.html#bfff44c4db49ad7462d14665b2458588" title="Evaluate a clause which returns a boolean value This method must only be evaluated...">Clause::value</a>(<a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds) <a name="l00186"></a>00186 { <a name="l00187"></a>00187 assert(<a class="code" href="structlibdap_1_1Clause.html#eaccc72688521a8b08aeae970d983473" title="Checks the &quot;representation invariant&quot; of a clause.">OK</a>()); <a name="l00188"></a>00188 assert(_op || _b_func); <a name="l00189"></a>00189 <a name="l00190"></a>00190 <span class="keywordflow">if</span> (_op) { <span class="comment">// Is it a relational clause?</span> <a name="l00191"></a>00191 <span class="comment">// rvalue::bvalue(...) returns the rvalue encapsulated in a</span> <a name="l00192"></a>00192 <span class="comment">// BaseType *.</span> <a name="l00193"></a>00193 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = _arg1-><a class="code" href="classlibdap_1_1rvalue.html#5ec1d2d66b162aa9ad82b658e70ce7de">bvalue</a>(dds); <a name="l00194"></a>00194 <span class="comment">// The list of rvalues is an implicit logical OR, so assume</span> <a name="l00195"></a>00195 <span class="comment">// FALSE and return TRUE for the first TRUE subclause.</span> <a name="l00196"></a>00196 <span class="keywordtype">bool</span> result = <span class="keyword">false</span>; <a name="l00197"></a>00197 <span class="keywordflow">for</span> (<a class="code" href="namespacelibdap.html#72bbbdd2885cd9b1105e8f9d25af0b79">rvalue_list_iter</a> i = _args->begin(); <a name="l00198"></a>00198 i != _args->end() && !result; <a name="l00199"></a>00199 i++) { <a name="l00200"></a>00200 result = result || btp-><a class="code" href="classlibdap_1_1BaseType.html#8a0000be2a244e3e07abda3020af8800" title="Evaluate relational operators.">ops</a>((*i)->bvalue(dds), _op); <a name="l00201"></a>00201 } <a name="l00202"></a>00202 <a name="l00203"></a>00203 <span class="keywordflow">return</span> result; <a name="l00204"></a>00204 } <a name="l00205"></a>00205 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (_b_func) { <span class="comment">// ...A bool function?</span> <a name="l00206"></a>00206 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> **argv = <a class="code" href="namespacelibdap.html#928b16257bc714971a2a3c91cb42d882">build_btp_args</a>(_args, dds); <a name="l00207"></a>00207 <a name="l00208"></a>00208 <span class="keywordtype">bool</span> result = <span class="keyword">false</span>; <a name="l00209"></a>00209 (*_b_func)(_argc, argv, dds, &result); <a name="l00210"></a>00210 <span class="keyword">delete</span>[] argv; <span class="comment">// Cache me!</span> <a name="l00211"></a>00211 argv = 0; <a name="l00212"></a>00212 <a name="l00213"></a>00213 <span class="keywordflow">return</span> result; <a name="l00214"></a>00214 } <a name="l00215"></a>00215 <span class="keywordflow">else</span> { <a name="l00216"></a>00216 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1InternalErr.html" title="A class for software fault reporting.">InternalErr</a>(__FILE__, __LINE__, <a name="l00217"></a>00217 <span class="stringliteral">"A selection expression must contain only boolean clauses."</span>); <a name="l00218"></a>00218 } <a name="l00219"></a>00219 } <a name="l00220"></a>00220 <a name="l00233"></a>00233 <span class="keywordtype">bool</span> <a name="l00234"></a><a class="code" href="structlibdap_1_1Clause.html#7b124a939247dce1320c494a3b18f6a1">00234</a> <a class="code" href="structlibdap_1_1Clause.html#bfff44c4db49ad7462d14665b2458588" title="Evaluate a clause which returns a boolean value This method must only be evaluated...">Clause::value</a>(<a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds, <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> **value) <a name="l00235"></a>00235 { <a name="l00236"></a>00236 assert(<a class="code" href="structlibdap_1_1Clause.html#eaccc72688521a8b08aeae970d983473" title="Checks the &quot;representation invariant&quot; of a clause.">OK</a>()); <a name="l00237"></a>00237 assert(_bt_func); <a name="l00238"></a>00238 <a name="l00239"></a>00239 <span class="keywordflow">if</span> (_bt_func) { <a name="l00240"></a>00240 <span class="comment">// build_btp_args() is a function defined in RValue.cc. It no longer</span> <a name="l00241"></a>00241 <span class="comment">// reads the values as it builds the arguments, that is now left up</span> <a name="l00242"></a>00242 <span class="comment">// to the functions themselves. 9/25/06 jhrg</span> <a name="l00243"></a>00243 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> **argv = <a class="code" href="namespacelibdap.html#928b16257bc714971a2a3c91cb42d882">build_btp_args</a>(_args, dds); <a name="l00244"></a>00244 <a name="l00245"></a>00245 <span class="preprocessor">#if 0</span> <a name="l00246"></a>00246 <span class="preprocessor"></span> *value = (*_bt_func)(_argc, argv, dds); <a name="l00247"></a>00247 <span class="preprocessor">#endif</span> <a name="l00248"></a>00248 <span class="preprocessor"></span> (*_bt_func)(_argc, argv, dds, value); <a name="l00249"></a>00249 <span class="keyword">delete</span>[] argv; <span class="comment">// Cache me!</span> <a name="l00250"></a>00250 argv = 0; <a name="l00251"></a>00251 <a name="l00252"></a>00252 <span class="keywordflow">if</span> (*value) { <a name="l00253"></a>00253 (*value)-><a class="code" href="classlibdap_1_1BaseType.html#ba7b27635c95b74536de18393133628e">set_send_p</a>(<span class="keyword">true</span>); <a name="l00254"></a>00254 (*value)->set_read_p(<span class="keyword">true</span>); <a name="l00255"></a>00255 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00256"></a>00256 } <a name="l00257"></a>00257 <span class="keywordflow">else</span> { <a name="l00258"></a>00258 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00259"></a>00259 } <a name="l00260"></a>00260 } <a name="l00261"></a>00261 <span class="keywordflow">else</span> { <a name="l00262"></a>00262 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1InternalErr.html" title="A class for software fault reporting.">InternalErr</a>(__FILE__, __LINE__, <a name="l00263"></a>00263 <span class="stringliteral">"Claue::value() was called in a context expecting a BaseType pointer return, but the Clause was boolean-valued instead."</span>); <a name="l00264"></a>00264 } <a name="l00265"></a>00265 } <a name="l00266"></a>00266 <a name="l00267"></a>00267 } <span class="comment">// namespace libdap</span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Wed Oct 7 19:57:07 2009 for libdap++ by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address> </body> </html>