Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > f149f58f4a75af135bdb24f5dfe94165 > files > 197

libdap-doc-3.9.3-3mdv2010.0.i586.rpm

<!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++: GSEClause.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&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;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&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>GSEClause.cc</h1><a href="GSEClause_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 &lt;jgallagher@opendap.org&gt;</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 1999</span>
<a name="l00027"></a>00027 <span class="comment">// Please 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 &lt;jgallagher@gso.uri.edu&gt;</span>
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="comment">// The Grid Selection Expression 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="keyword">static</span> <span class="keywordtype">char</span> <span class="keywordtype">id</span>[] <a class="code" href="config_8h.html#05e109ec893d0b12023d5b0cf4f718c4">not_used</a> =
<a name="l00038"></a>00038     {<span class="stringliteral">"$Id: GSEClause.cc 18282 2008-03-01 01:36:12Z jimg $"</span>
<a name="l00039"></a>00039     };
<a name="l00040"></a>00040 
<a name="l00041"></a>00041 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00042"></a>00042 <span class="preprocessor">#include &lt;sstream&gt;</span>
<a name="l00043"></a>00043 
<a name="l00044"></a>00044 <span class="preprocessor">#include "<a class="code" href="dods-datatypes_8h.html">dods-datatypes.h</a>"</span>
<a name="l00045"></a>00045 <span class="preprocessor">#include "<a class="code" href="Error_8h.html">Error.h</a>"</span>
<a name="l00046"></a>00046 <span class="preprocessor">#include "<a class="code" href="InternalErr_8h.html">InternalErr.h</a>"</span>
<a name="l00047"></a>00047 
<a name="l00048"></a>00048 <span class="preprocessor">#include "<a class="code" href="debug_8h.html">debug.h</a>"</span>
<a name="l00049"></a>00049 <span class="preprocessor">#include "<a class="code" href="GSEClause_8h.html">GSEClause.h</a>"</span>
<a name="l00050"></a>00050 <span class="preprocessor">#include "<a class="code" href="parser_8h.html">parser.h</a>"</span>
<a name="l00051"></a>00051 <span class="preprocessor">#include "gse.tab.hh"</span>
<a name="l00052"></a>00052 
<a name="l00053"></a>00053 <span class="keyword">using namespace </span>std;
<a name="l00054"></a>00054 
<a name="l00055"></a>00055 <span class="keywordtype">int</span> <a class="code" href="ce__functions_8cc.html#504da9793f63a21e40595b1f63ae26e0">gse_parse</a>(<span class="keywordtype">void</span> *arg);
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="ce__functions_8cc.html#c5920db2a87cb7ceb844e9086cfc50a6">gse_restart</a>(FILE *in);
<a name="l00057"></a>00057 
<a name="l00058"></a>00058 <span class="comment">// Glue routines declared in gse.lex</span>
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="ce__functions_8cc.html#5d32622eac5582fdf39183af4b9e01ef">gse_switch_to_buffer</a>(<span class="keywordtype">void</span> *new_buffer);
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="ce__functions_8cc.html#98d472c04ecf1e180f0f81df7e688a8e">gse_delete_buffer</a>(<span class="keywordtype">void</span> * buffer);
<a name="l00061"></a>00061 <span class="keywordtype">void</span> *<a class="code" href="ce__functions_8cc.html#0f1967b84ee5e7c8ab88368e3a769b26">gse_string</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *yy_str);
<a name="l00062"></a>00062 
<a name="l00063"></a>00063 <span class="keyword">namespace </span>libdap {
<a name="l00064"></a>00064 
<a name="l00065"></a>00065 <span class="comment">// Private methods</span>
<a name="l00066"></a>00066 
<a name="l00067"></a>00067 GSEClause::GSEClause()
<a name="l00068"></a>00068 {
<a name="l00069"></a>00069     <span class="keywordflow">throw</span> InternalErr(__FILE__, __LINE__, <span class="stringliteral">"default ctor called for GSEClause"</span>);
<a name="l00070"></a>00070 }
<a name="l00071"></a>00071 
<a name="l00072"></a>00072 GSEClause::GSEClause(<span class="keyword">const</span> GSEClause &amp;)
<a name="l00073"></a>00073 {
<a name="l00074"></a>00074     <span class="keywordflow">throw</span> InternalErr(__FILE__, __LINE__, <span class="stringliteral">"copy ctor called for GSEClause"</span>);
<a name="l00075"></a>00075 }
<a name="l00076"></a>00076 
<a name="l00077"></a>00077 GSEClause &amp;GSEClause::operator=(GSEClause &amp;)
<a name="l00078"></a>00078 {
<a name="l00079"></a>00079     <span class="keywordflow">throw</span> InternalErr(__FILE__, __LINE__, <span class="stringliteral">"assigment called for GSEClause"</span>);
<a name="l00080"></a>00080 }
<a name="l00081"></a>00081 
<a name="l00082"></a>00082 <span class="comment">// For the comparisions here, we should use an epsilon to catch issues</span>
<a name="l00083"></a>00083 <span class="comment">// with floating point values. jhrg 01/12/06</span>
<a name="l00084"></a>00084 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
<a name="l00085"></a>00085 <span class="keyword">static</span> <span class="keywordtype">bool</span>
<a name="l00086"></a>00086 compare(T elem, <a class="code" href="namespacelibdap.html#43ed56cf2d346b9ca13adf3829fb6757">relop</a> op, <span class="keywordtype">double</span> value)
<a name="l00087"></a>00087 {
<a name="l00088"></a>00088     <span class="keywordflow">switch</span> (op) {
<a name="l00089"></a>00089     <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#43ed56cf2d346b9ca13adf3829fb67578b4b62ef08f2e543f461ef4f519b4ff7">dods_greater_op</a>:
<a name="l00090"></a>00090         <span class="keywordflow">return</span> elem &gt; value;
<a name="l00091"></a>00091     <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#43ed56cf2d346b9ca13adf3829fb675778e7d0a03e0a6f15a5335fb85c08a327">dods_greater_equal_op</a>:
<a name="l00092"></a>00092         <span class="keywordflow">return</span> elem &gt;= value;
<a name="l00093"></a>00093     <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#43ed56cf2d346b9ca13adf3829fb67578028088cfd3ffa11f219a78c5155d263">dods_less_op</a>:
<a name="l00094"></a>00094         <span class="keywordflow">return</span> elem &lt; value;
<a name="l00095"></a>00095     <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#43ed56cf2d346b9ca13adf3829fb67576d8294078c5da7fd4aab6350b55f5dae">dods_less_equal_op</a>:
<a name="l00096"></a>00096         <span class="keywordflow">return</span> elem &lt;= value;
<a name="l00097"></a>00097     <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#43ed56cf2d346b9ca13adf3829fb67576e5b83098bae549deb95a22af4ef3354">dods_equal_op</a>:
<a name="l00098"></a>00098         <span class="keywordflow">return</span> elem == value;
<a name="l00099"></a>00099     <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#43ed56cf2d346b9ca13adf3829fb6757cb9f92535c4670fa5d97c4334b5764d2">dods_not_equal_op</a>:
<a name="l00100"></a>00100         <span class="keywordflow">return</span> elem != value;
<a name="l00101"></a>00101     <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#43ed56cf2d346b9ca13adf3829fb6757a8e5c4916f3c340f2bd4f22d272cb164">dods_nop_op</a>:
<a name="l00102"></a>00102         <span class="keywordflow">throw</span> Error(<a class="code" href="Error_8h.html#5806d25bc779e86c285438e687669803">malformed_expr</a>, <span class="stringliteral">"Attempt to use NOP in Grid selection."</span>);
<a name="l00103"></a>00103     <span class="keywordflow">default</span>:
<a name="l00104"></a>00104         <span class="keywordflow">throw</span> Error(<a class="code" href="Error_8h.html#5806d25bc779e86c285438e687669803">malformed_expr</a>, <span class="stringliteral">"Unknown relational operator in Grid selection."</span>);
<a name="l00105"></a>00105     }
<a name="l00106"></a>00106 }
<a name="l00107"></a>00107 
<a name="l00108"></a>00108 <span class="comment">// These values are used in error messages, hence the strings.</span>
<a name="l00109"></a>00109 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
<a name="l00110"></a>00110 <span class="keywordtype">void</span>
<a name="l00111"></a>00111 GSEClause::set_map_min_max_value(T min, T max)
<a name="l00112"></a>00112 {
<a name="l00113"></a>00113     <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">"Inside set map min max value "</span> &lt;&lt; min &lt;&lt; <span class="stringliteral">", "</span> &lt;&lt; max &lt;&lt; endl);
<a name="l00114"></a>00114     std::ostringstream oss1;
<a name="l00115"></a>00115     oss1 &lt;&lt; min;
<a name="l00116"></a>00116     d_map_min_value = oss1.str();
<a name="l00117"></a>00117 
<a name="l00118"></a>00118     std::ostringstream oss2;
<a name="l00119"></a>00119     oss2 &lt;&lt; max;
<a name="l00120"></a>00120     d_map_max_value = oss2.str();
<a name="l00121"></a>00121 }
<a name="l00122"></a>00122 
<a name="l00123"></a>00123 <span class="comment">// Read the map array, scan, set start and stop.</span>
<a name="l00124"></a>00124 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
<a name="l00125"></a>00125 <span class="keywordtype">void</span>
<a name="l00126"></a>00126 GSEClause::set_start_stop()
<a name="l00127"></a>00127 {
<a name="l00128"></a>00128     T *vals = <span class="keyword">new</span> T[d_map-&gt;length()];
<a name="l00129"></a>00129     d_map-&gt;value(vals);
<a name="l00130"></a>00130 
<a name="l00131"></a>00131     <span class="comment">// Set the map's max and min values for use in error messages (it's a lot</span>
<a name="l00132"></a>00132     <span class="comment">// easier to do here, now, than later... 9/20/2001 jhrg)</span>
<a name="l00133"></a>00133     set_map_min_max_value&lt;T&gt;(vals[d_start], vals[d_stop]);
<a name="l00134"></a>00134 
<a name="l00135"></a>00135     <span class="comment">// Starting at the current start point in the map (initially index position</span>
<a name="l00136"></a>00136     <span class="comment">// zero), scan forward until the comparison is true. Set the new value</span>
<a name="l00137"></a>00137     <span class="comment">// of d_start to that location. Note that each clause applies to exactly</span>
<a name="l00138"></a>00138     <span class="comment">// one map. The 'i &lt;= end' test keeps us from setting start _past_ the</span>
<a name="l00139"></a>00139     <span class="comment">// end ;-)</span>
<a name="l00140"></a>00140     <span class="keywordtype">int</span> i = d_start;
<a name="l00141"></a>00141     <span class="keywordtype">int</span> end = d_stop;
<a name="l00142"></a>00142     <span class="keywordflow">while</span> (i &lt;= end &amp;&amp; !compare&lt;T&gt;(vals[i], d_op1, d_value1))
<a name="l00143"></a>00143         i++;
<a name="l00144"></a>00144 
<a name="l00145"></a>00145     d_start = i;
<a name="l00146"></a>00146 
<a name="l00147"></a>00147     <span class="comment">// Now scan backward from the end. We scan all the way to the actual start</span>
<a name="l00148"></a>00148     <span class="comment">// although it would probably work to stop at 'i &gt;= d_start'.</span>
<a name="l00149"></a>00149     i = end;
<a name="l00150"></a>00150     <span class="keywordflow">while</span> (i &gt;= 0 &amp;&amp; !compare&lt;T&gt;(vals[i], d_op1, d_value1))
<a name="l00151"></a>00151         i--;
<a name="l00152"></a>00152     d_stop = i;
<a name="l00153"></a>00153 
<a name="l00154"></a>00154     <span class="comment">// Every clause must have one operator but the second is optional since</span>
<a name="l00155"></a>00155     <span class="comment">// the more complex form of a clause is optional. That is, the above two</span>
<a name="l00156"></a>00156     <span class="comment">// loops took care of constraints like 'x &lt; 7' but we need the following</span>
<a name="l00157"></a>00157     <span class="comment">// for ones like '3 &lt; x &lt; 7'.</span>
<a name="l00158"></a>00158     <span class="keywordflow">if</span> (d_op2 != <a class="code" href="namespacelibdap.html#43ed56cf2d346b9ca13adf3829fb6757a8e5c4916f3c340f2bd4f22d272cb164">dods_nop_op</a>) {
<a name="l00159"></a>00159         <span class="keywordtype">int</span> i = d_start;
<a name="l00160"></a>00160         <span class="keywordtype">int</span> end = d_stop;
<a name="l00161"></a>00161         <span class="keywordflow">while</span> (i &lt;= end &amp;&amp; !compare&lt;T&gt;(vals[i], d_op2, d_value2))
<a name="l00162"></a>00162             i++;
<a name="l00163"></a>00163 
<a name="l00164"></a>00164         d_start = i;
<a name="l00165"></a>00165 
<a name="l00166"></a>00166         i = end;
<a name="l00167"></a>00167         <span class="keywordflow">while</span> (i &gt;= 0 &amp;&amp; !compare&lt;T&gt;(vals[i], d_op2, d_value2))
<a name="l00168"></a>00168             i--;
<a name="l00169"></a>00169 
<a name="l00170"></a>00170         d_stop = i;
<a name="l00171"></a>00171     }
<a name="l00172"></a>00172 }
<a name="l00173"></a>00173 
<a name="l00174"></a>00174 <span class="keywordtype">void</span>
<a name="l00175"></a>00175 GSEClause::compute_indices()
<a name="l00176"></a>00176 {
<a name="l00177"></a>00177     <span class="keywordflow">switch</span> (d_map-&gt;var()-&gt;type()) {
<a name="l00178"></a>00178     <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e64124790aeab42dbcd3d5303dea15b200">dods_byte_c</a>:
<a name="l00179"></a>00179         set_start_stop&lt;dods_byte&gt;();
<a name="l00180"></a>00180         <span class="keywordflow">break</span>;
<a name="l00181"></a>00181     <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e637d71c620b71be06fbe667e7cb0e80e4">dods_int16_c</a>:
<a name="l00182"></a>00182         set_start_stop&lt;dods_int16&gt;();
<a name="l00183"></a>00183         <span class="keywordflow">break</span>;
<a name="l00184"></a>00184     <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e684188f64695716d84cefe910704ca094">dods_uint16_c</a>:
<a name="l00185"></a>00185         set_start_stop&lt;dods_uint16&gt;();
<a name="l00186"></a>00186         <span class="keywordflow">break</span>;
<a name="l00187"></a>00187     <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e6524bfec434d0a8f82e06bfcc02c9a6b1">dods_int32_c</a>:
<a name="l00188"></a>00188         set_start_stop&lt;dods_int32&gt;();
<a name="l00189"></a>00189         <span class="keywordflow">break</span>;
<a name="l00190"></a>00190     <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e61bdeca4f415a3372b83448efd87bff83">dods_uint32_c</a>:
<a name="l00191"></a>00191         set_start_stop&lt;dods_uint32&gt;();
<a name="l00192"></a>00192         <span class="keywordflow">break</span>;
<a name="l00193"></a>00193     <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e66aff4fd17f027d0f0c41423e2f74a68c">dods_float32_c</a>:
<a name="l00194"></a>00194         set_start_stop&lt;dods_float32&gt;();
<a name="l00195"></a>00195         <span class="keywordflow">break</span>;
<a name="l00196"></a>00196     <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e68661c9f9c227fe59b7f5563f20e145d6">dods_float64_c</a>:
<a name="l00197"></a>00197         set_start_stop&lt;dods_float64&gt;();
<a name="l00198"></a>00198         <span class="keywordflow">break</span>;
<a name="l00199"></a>00199     <span class="keywordflow">default</span>:
<a name="l00200"></a>00200         <span class="keywordflow">throw</span> Error(<a class="code" href="Error_8h.html#5806d25bc779e86c285438e687669803">malformed_expr</a>,
<a name="l00201"></a>00201                     <span class="stringliteral">"Grid selection using non-numeric map vectors is not supported"</span>);
<a name="l00202"></a>00202     }
<a name="l00203"></a>00203 
<a name="l00204"></a>00204 }
<a name="l00205"></a>00205 
<a name="l00206"></a>00206 <span class="comment">// Public methods</span>
<a name="l00207"></a>00207 
<a name="l00209"></a><a class="code" href="classlibdap_1_1GSEClause.html#1ccf0f79f6448b5ba7d7db66082243ca">00209</a> GSEClause::GSEClause(<a class="code" href="classlibdap_1_1Grid.html" title="Holds the Grid data type.">Grid</a> *grid, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;map, <span class="keyword">const</span> <span class="keywordtype">double</span> value,
<a name="l00210"></a>00210                      <span class="keyword">const</span> <a class="code" href="namespacelibdap.html#43ed56cf2d346b9ca13adf3829fb6757">relop</a> op)
<a name="l00211"></a>00211         : d_map(0),
<a name="l00212"></a>00212         d_value1(value), d_value2(0), d_op1(op), d_op2(<a class="code" href="namespacelibdap.html#43ed56cf2d346b9ca13adf3829fb6757a8e5c4916f3c340f2bd4f22d272cb164">dods_nop_op</a>),
<a name="l00213"></a>00213         d_map_min_value(<span class="stringliteral">""</span>), d_map_max_value(<span class="stringliteral">""</span>)
<a name="l00214"></a>00214 {
<a name="l00215"></a>00215     d_map = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a> *<span class="keyword">&gt;</span>(grid-&gt;<a class="code" href="classlibdap_1_1Grid.html#d75c8aca61d68cc4a65430bc937ba3fc">var</a>(map));
<a name="l00216"></a>00216     <span class="keywordflow">if</span> (!d_map)
<a name="l00217"></a>00217         <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(<span class="keywordtype">string</span>(<span class="stringliteral">"The map variable '"</span>) + map
<a name="l00218"></a>00218                     + <span class="keywordtype">string</span>(<span class="stringliteral">"' does not exist in the grid '"</span>)
<a name="l00219"></a>00219                     + grid-&gt;<a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() + string(<span class="stringliteral">"'."</span>));
<a name="l00220"></a>00220 
<a name="l00221"></a>00221     <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; d_map-&gt;<a class="code" href="classlibdap_1_1BaseType.html#701eb3361f5b5628329ece019cd34519">toString</a>());
<a name="l00222"></a>00222 
<a name="l00223"></a>00223     <span class="comment">// Initialize the start and stop indices.</span>
<a name="l00224"></a>00224     <a class="code" href="classlibdap_1_1Array.html#7a557c05085a83d1501dbfa249d3cc52">Array::Dim_iter</a> iter = d_map-&gt;<a class="code" href="classlibdap_1_1Array.html#e6e6943cd895fa8dc1c58621ffad42a0">dim_begin</a>();
<a name="l00225"></a>00225     d_start = d_map-&gt;<a class="code" href="classlibdap_1_1Array.html#12084880777d27d782b0e1f2f4d5ae01" title="Return the start index of a dimension.">dimension_start</a>(iter);
<a name="l00226"></a>00226     d_stop = d_map-&gt;<a class="code" href="classlibdap_1_1Array.html#446f239be3ef678a4476058c8041552a" title="Return the stop index of the constraint.">dimension_stop</a>(iter);
<a name="l00227"></a>00227 
<a name="l00228"></a>00228     compute_indices();
<a name="l00229"></a>00229 }
<a name="l00230"></a>00230 
<a name="l00232"></a><a class="code" href="classlibdap_1_1GSEClause.html#18fd1bad99d31d1c30fa96a86c413ecc">00232</a> GSEClause::GSEClause(<a class="code" href="classlibdap_1_1Grid.html" title="Holds the Grid data type.">Grid</a> *grid, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;map, <span class="keyword">const</span> <span class="keywordtype">double</span> value1,
<a name="l00233"></a>00233                      <span class="keyword">const</span> <a class="code" href="namespacelibdap.html#43ed56cf2d346b9ca13adf3829fb6757">relop</a> op1, <span class="keyword">const</span> <span class="keywordtype">double</span> value2, <span class="keyword">const</span> <a class="code" href="namespacelibdap.html#43ed56cf2d346b9ca13adf3829fb6757">relop</a> op2)
<a name="l00234"></a>00234         : d_map(0),
<a name="l00235"></a>00235         d_value1(value1), d_value2(value2), d_op1(op1), d_op2(op2),
<a name="l00236"></a>00236         d_map_min_value(<span class="stringliteral">""</span>), d_map_max_value(<span class="stringliteral">""</span>)
<a name="l00237"></a>00237 {
<a name="l00238"></a>00238     d_map = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a> *<span class="keyword">&gt;</span>(grid-&gt;<a class="code" href="classlibdap_1_1Grid.html#d75c8aca61d68cc4a65430bc937ba3fc">var</a>(map));
<a name="l00239"></a>00239     <span class="keywordflow">if</span> (!d_map)
<a name="l00240"></a>00240         <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(<span class="keywordtype">string</span>(<span class="stringliteral">"The map variable '"</span>) + map
<a name="l00241"></a>00241                     + <span class="keywordtype">string</span>(<span class="stringliteral">"' does not exist in the grid '"</span>)
<a name="l00242"></a>00242                     + grid-&gt;<a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() + string(<span class="stringliteral">"'."</span>));
<a name="l00243"></a>00243 
<a name="l00244"></a>00244     <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; d_map-&gt;<a class="code" href="classlibdap_1_1BaseType.html#701eb3361f5b5628329ece019cd34519">toString</a>());
<a name="l00245"></a>00245 
<a name="l00246"></a>00246     <span class="comment">// Initialize the start and stop indices.</span>
<a name="l00247"></a>00247     <a class="code" href="classlibdap_1_1Array.html#7a557c05085a83d1501dbfa249d3cc52">Array::Dim_iter</a> iter = d_map-&gt;<a class="code" href="classlibdap_1_1Array.html#e6e6943cd895fa8dc1c58621ffad42a0">dim_begin</a>();
<a name="l00248"></a>00248     d_start = d_map-&gt;<a class="code" href="classlibdap_1_1Array.html#12084880777d27d782b0e1f2f4d5ae01" title="Return the start index of a dimension.">dimension_start</a>(iter);
<a name="l00249"></a>00249     d_stop = d_map-&gt;<a class="code" href="classlibdap_1_1Array.html#446f239be3ef678a4476058c8041552a" title="Return the stop index of the constraint.">dimension_stop</a>(iter);
<a name="l00250"></a>00250 
<a name="l00251"></a>00251     compute_indices();
<a name="l00252"></a>00252 }
<a name="l00253"></a>00253 
<a name="l00256"></a>00256 <span class="keywordtype">bool</span>
<a name="l00257"></a><a class="code" href="classlibdap_1_1GSEClause.html#a5dfaf92c387f6778b03868c98d5a9a8">00257</a> <a class="code" href="classlibdap_1_1GSEClause.html#a5dfaf92c387f6778b03868c98d5a9a8">GSEClause::OK</a>()<span class="keyword"> const</span>
<a name="l00258"></a>00258 <span class="keyword"></span>{
<a name="l00259"></a>00259     <span class="keywordflow">if</span> (!d_map)
<a name="l00260"></a>00260         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00261"></a>00261 
<a name="l00262"></a>00262     <span class="comment">// More ...</span>
<a name="l00263"></a>00263 
<a name="l00264"></a>00264     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00265"></a>00265 }
<a name="l00266"></a>00266 
<a name="l00269"></a>00269 <a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a> *
<a name="l00270"></a><a class="code" href="classlibdap_1_1GSEClause.html#c51bc07a76af93ddc9d5fcac4e01f0e4">00270</a> <a class="code" href="classlibdap_1_1GSEClause.html#c51bc07a76af93ddc9d5fcac4e01f0e4" title="Get a pointer to the map variable constrained by this clause.">GSEClause::get_map</a>()<span class="keyword"> const</span>
<a name="l00271"></a>00271 <span class="keyword"></span>{
<a name="l00272"></a>00272     <span class="keywordflow">return</span> d_map;
<a name="l00273"></a>00273 }
<a name="l00274"></a>00274 
<a name="l00279"></a>00279 <span class="keywordtype">void</span>
<a name="l00280"></a><a class="code" href="classlibdap_1_1GSEClause.html#71a7e297255ebbee794713fc7620379c">00280</a> <a class="code" href="classlibdap_1_1GSEClause.html#71a7e297255ebbee794713fc7620379c" title="Set the pointer to the map vector contrained by this clause.">GSEClause::set_map</a>(<a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a> *map)
<a name="l00281"></a>00281 {
<a name="l00282"></a>00282     d_map = map;
<a name="l00283"></a>00283 }
<a name="l00284"></a>00284 
<a name="l00287"></a>00287 <span class="keywordtype">string</span>
<a name="l00288"></a><a class="code" href="classlibdap_1_1GSEClause.html#70fec6657c42ebb5002188d12bd33301">00288</a> <a class="code" href="classlibdap_1_1GSEClause.html#70fec6657c42ebb5002188d12bd33301" title="Get the name of the map variable constrained by this clause.">GSEClause::get_map_name</a>()<span class="keyword"> const</span>
<a name="l00289"></a>00289 <span class="keyword"></span>{
<a name="l00290"></a>00290     <span class="keywordflow">return</span> d_map-&gt;<a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>();
<a name="l00291"></a>00291 }
<a name="l00292"></a>00292 
<a name="l00296"></a>00296 <span class="keywordtype">int</span>
<a name="l00297"></a><a class="code" href="classlibdap_1_1GSEClause.html#306a6b0fbf600fa4b8844186a2d78452">00297</a> <a class="code" href="classlibdap_1_1GSEClause.html#306a6b0fbf600fa4b8844186a2d78452" title="Get the starting index of the clause&amp;#39;s map variable as constrained by this clause...">GSEClause::get_start</a>()<span class="keyword"> const</span>
<a name="l00298"></a>00298 <span class="keyword"></span>{
<a name="l00299"></a>00299     <span class="keywordflow">return</span> d_start;
<a name="l00300"></a>00300 }
<a name="l00301"></a>00301 
<a name="l00304"></a>00304 <span class="keywordtype">void</span>
<a name="l00305"></a><a class="code" href="classlibdap_1_1GSEClause.html#259e52b1a1754bca9a9a6758b4dadbf4">00305</a> <a class="code" href="classlibdap_1_1GSEClause.html#259e52b1a1754bca9a9a6758b4dadbf4" title="Set the starting index.">GSEClause::set_start</a>(<span class="keywordtype">int</span> start)
<a name="l00306"></a>00306 {
<a name="l00307"></a>00307     d_start = start;
<a name="l00308"></a>00308 }
<a name="l00309"></a>00309 
<a name="l00313"></a>00313 <span class="keywordtype">int</span>
<a name="l00314"></a><a class="code" href="classlibdap_1_1GSEClause.html#0fb441e3d3ab032c94ac940ae64f5dbf">00314</a> <a class="code" href="classlibdap_1_1GSEClause.html#0fb441e3d3ab032c94ac940ae64f5dbf" title="Get the stopping index of the clause&amp;#39;s map variable as constrained by this clause...">GSEClause::get_stop</a>()<span class="keyword"> const</span>
<a name="l00315"></a>00315 <span class="keyword"></span>{
<a name="l00316"></a>00316     <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">"Returning stop index value of: "</span> &lt;&lt; d_stop &lt;&lt; endl);
<a name="l00317"></a>00317     <span class="keywordflow">return</span> d_stop;
<a name="l00318"></a>00318 }
<a name="l00319"></a>00319 
<a name="l00322"></a>00322 <span class="keywordtype">void</span>
<a name="l00323"></a><a class="code" href="classlibdap_1_1GSEClause.html#9abbfd7a52404a933c15e1e342a14ae5">00323</a> <a class="code" href="classlibdap_1_1GSEClause.html#9abbfd7a52404a933c15e1e342a14ae5" title="Set the stopping index.">GSEClause::set_stop</a>(<span class="keywordtype">int</span> stop)
<a name="l00324"></a>00324 {
<a name="l00325"></a>00325     d_stop = stop;
<a name="l00326"></a>00326 }
<a name="l00327"></a>00327 
<a name="l00332"></a>00332 <span class="keywordtype">string</span>
<a name="l00333"></a><a class="code" href="classlibdap_1_1GSEClause.html#72c2807550fd5876d2d4d68d9c8842ad">00333</a> <a class="code" href="classlibdap_1_1GSEClause.html#72c2807550fd5876d2d4d68d9c8842ad" title="Get the minimum map vector value.">GSEClause::get_map_min_value</a>()<span class="keyword"> const</span>
<a name="l00334"></a>00334 <span class="keyword"></span>{
<a name="l00335"></a>00335     <span class="keywordflow">return</span> d_map_min_value;
<a name="l00336"></a>00336 }
<a name="l00337"></a>00337 
<a name="l00342"></a>00342 <span class="keywordtype">string</span>
<a name="l00343"></a><a class="code" href="classlibdap_1_1GSEClause.html#cff9c4b09e339a075a0f4ab57600ee0f">00343</a> <a class="code" href="classlibdap_1_1GSEClause.html#cff9c4b09e339a075a0f4ab57600ee0f" title="Get the maximum map vector value.">GSEClause::get_map_max_value</a>()<span class="keyword"> const</span>
<a name="l00344"></a>00344 <span class="keyword"></span>{
<a name="l00345"></a>00345     <span class="keywordflow">return</span> d_map_max_value;
<a name="l00346"></a>00346 }
<a name="l00347"></a>00347 
<a name="l00348"></a>00348 } <span class="comment">// namespace libdap</span>
<a name="l00349"></a>00349 
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Wed Oct 7 19:57:07 2009 for libdap++ by&nbsp;
<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>