<!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++: Grid.cc 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('Grid_8cc.html',''); </script> <div id="doc-content"> <div class="header"> <div class="headertitle"> <h1>Grid.cc</h1> </div> </div> <div class="contents"> <a href="Grid_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 1994-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 <jgallagher@gso.uri.edu></span> <a name="l00031"></a>00031 <a name="l00032"></a>00032 <span class="comment">// implementation for Grid.</span> <a name="l00033"></a>00033 <span class="comment">//</span> <a name="l00034"></a>00034 <span class="comment">// jhrg 9/15/94</span> <a name="l00035"></a>00035 <a name="l00036"></a>00036 <span class="preprocessor">#include "<a class="code" href="config_8h.html">config.h</a>"</span> <a name="l00037"></a>00037 <a name="l00038"></a>00038 <span class="comment">// #define DODS_DEBUG</span> <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="preprocessor">#include <functional></span> <a name="l00041"></a>00041 <span class="preprocessor">#include <algorithm></span> <a name="l00042"></a>00042 <a name="l00043"></a>00043 <span class="preprocessor">#include "<a class="code" href="Grid_8h.html">Grid.h</a>"</span> <a name="l00044"></a>00044 <span class="preprocessor">#include "<a class="code" href="DDS_8h.html">DDS.h</a>"</span> <a name="l00045"></a>00045 <span class="preprocessor">#include "<a class="code" href="Array_8h.html">Array.h</a>"</span> <span class="comment">// for downcasts</span> <a name="l00046"></a>00046 <span class="preprocessor">#include "<a class="code" href="util_8h.html">util.h</a>"</span> <a name="l00047"></a>00047 <span class="preprocessor">#include "<a class="code" href="InternalErr_8h.html">InternalErr.h</a>"</span> <a name="l00048"></a>00048 <span class="preprocessor">#include "<a class="code" href="escaping_8h.html">escaping.h</a>"</span> <a name="l00049"></a>00049 <a name="l00050"></a>00050 <span class="preprocessor">#include "<a class="code" href="debug_8h.html">debug.h</a>"</span> <a name="l00051"></a>00051 <a name="l00052"></a>00052 <span class="keyword">using namespace </span>std; <a name="l00053"></a>00053 <a name="l00054"></a>00054 <span class="keyword">namespace </span>libdap { <a name="l00055"></a>00055 <a name="l00056"></a>00056 <span class="keywordtype">void</span> <a name="l00057"></a><a class="code" href="classlibdap_1_1Grid.html#a0e7e17a398a612297c983364f7584018">00057</a> Grid::_duplicate(<span class="keyword">const</span> <a class="code" href="classlibdap_1_1Grid.html" title="Holds the Grid data type.">Grid</a> &s) <a name="l00058"></a>00058 { <a name="l00059"></a>00059 <span class="comment">// Clear out any spurious vars in Constructor::_vars</span> <a name="l00060"></a>00060 _vars.clear(); <span class="comment">// [mjohnson 10 Sep 2009]</span> <a name="l00061"></a>00061 <a name="l00062"></a>00062 _array_var = s._array_var-><a class="code" href="classlibdap_1_1BaseType.html#a0b130311c9901fb8a7ab11ea19090ef0">ptr_duplicate</a>(); <a name="l00063"></a>00063 _array_var-><a class="code" href="classlibdap_1_1BaseType.html#a5b6a39f6ce6594fa74f3fc899ac9a966">set_parent</a>(<span class="keyword">this</span>); <a name="l00064"></a>00064 _vars.push_back(_array_var); <span class="comment">// so the Constructor::Vars_Iter sees it [mjohnson 10 Sep 2009]</span> <a name="l00065"></a>00065 <a name="l00066"></a>00066 <a class="code" href="classlibdap_1_1Grid.html" title="Holds the Grid data type.">Grid</a> &cs = <span class="keyword">const_cast<</span><a class="code" href="classlibdap_1_1Grid.html" title="Holds the Grid data type.">Grid</a> &<span class="keyword">></span>(s); <a name="l00067"></a>00067 <a name="l00068"></a>00068 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> i = cs._map_vars.begin(); i != cs._map_vars.end(); i++) { <a name="l00069"></a>00069 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = (*i)-><a class="code" href="classlibdap_1_1BaseType.html#a0b130311c9901fb8a7ab11ea19090ef0">ptr_duplicate</a>(); <a name="l00070"></a>00070 btp-><a class="code" href="classlibdap_1_1BaseType.html#a5b6a39f6ce6594fa74f3fc899ac9a966">set_parent</a>(<span class="keyword">this</span>); <a name="l00071"></a>00071 _map_vars.push_back(btp); <a name="l00072"></a>00072 _vars.push_back(btp); <span class="comment">// push all map vectors as weak refs into super::_vars which won't delete them [mjohnson 10 Sep 2009]</span> <a name="l00073"></a>00073 } <a name="l00074"></a>00074 <a name="l00075"></a>00075 } <a name="l00076"></a>00076 <a name="l00086"></a><a class="code" href="classlibdap_1_1Grid.html#a75774a8fe1c7c7ec9a1e48a7d6d2cbc0">00086</a> Grid::Grid(<span class="keyword">const</span> <span class="keywordtype">string</span> &n) : <a class="code" href="classlibdap_1_1Constructor.html">Constructor</a>(n, <a class="code" href="namespacelibdap.html#a05ca706d4539ae7b750c3bc7066ab6e6ac41525d2e860d3bcff641eb1fdba41d2">dods_grid_c</a>), _array_var(0) <a name="l00087"></a>00087 {} <a name="l00088"></a>00088 <a name="l00100"></a><a class="code" href="classlibdap_1_1Grid.html#adec10faa3280dde1bee9c1bf2eda9038">00100</a> <a class="code" href="classlibdap_1_1Grid.html#a75774a8fe1c7c7ec9a1e48a7d6d2cbc0" title="The Grid constructor.">Grid::Grid</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &n, <span class="keyword">const</span> <span class="keywordtype">string</span> &d) <a name="l00101"></a>00101 : <a class="code" href="classlibdap_1_1Constructor.html">Constructor</a>(n, d, <a class="code" href="namespacelibdap.html#a05ca706d4539ae7b750c3bc7066ab6e6ac41525d2e860d3bcff641eb1fdba41d2">dods_grid_c</a>), _array_var(0) <a name="l00102"></a>00102 {} <a name="l00103"></a>00103 <a name="l00105"></a><a class="code" href="classlibdap_1_1Grid.html#ad9c190d610f40faee6165467f554fb9a">00105</a> <a class="code" href="classlibdap_1_1Grid.html#a75774a8fe1c7c7ec9a1e48a7d6d2cbc0" title="The Grid constructor.">Grid::Grid</a>(<span class="keyword">const</span> <a class="code" href="classlibdap_1_1Grid.html" title="Holds the Grid data type.">Grid</a> &rhs) : <a class="code" href="classlibdap_1_1Constructor.html">Constructor</a>(rhs) <a name="l00106"></a>00106 { <a name="l00107"></a>00107 <a class="code" href="classlibdap_1_1Grid.html#a0e7e17a398a612297c983364f7584018">_duplicate</a>(rhs); <a name="l00108"></a>00108 } <a name="l00109"></a>00109 <a name="l00110"></a><a class="code" href="classlibdap_1_1Grid.html#a6a81c2fe6689b4159d7ea9e6eb8f5e78">00110</a> <a class="code" href="classlibdap_1_1Grid.html#a6a81c2fe6689b4159d7ea9e6eb8f5e78">Grid::~Grid</a>() <a name="l00111"></a>00111 { <a name="l00112"></a>00112 <span class="keyword">delete</span> _array_var; _array_var = 0; <a name="l00113"></a>00113 <a name="l00114"></a>00114 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> i = _map_vars.begin(); i != _map_vars.end(); i++) { <a name="l00115"></a>00115 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = *i ; <a name="l00116"></a>00116 <span class="keyword">delete</span> btp ; btp = 0; <a name="l00117"></a>00117 } <a name="l00118"></a>00118 } <a name="l00119"></a>00119 <a name="l00120"></a>00120 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> * <a name="l00121"></a><a class="code" href="classlibdap_1_1Grid.html#a0c4a5aefa252d3eab94b8a0ce5232dc6">00121</a> <a class="code" href="classlibdap_1_1Grid.html#a0c4a5aefa252d3eab94b8a0ce5232dc6">Grid::ptr_duplicate</a>() <a name="l00122"></a>00122 { <a name="l00123"></a>00123 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classlibdap_1_1Grid.html#a75774a8fe1c7c7ec9a1e48a7d6d2cbc0" title="The Grid constructor.">Grid</a>(*<span class="keyword">this</span>); <a name="l00124"></a>00124 } <a name="l00125"></a>00125 <a name="l00126"></a>00126 <a class="code" href="classlibdap_1_1Grid.html" title="Holds the Grid data type.">Grid</a> & <a name="l00127"></a><a class="code" href="classlibdap_1_1Grid.html#aecf55730764a11b15858bb94b5a56988">00127</a> <a class="code" href="classlibdap_1_1Grid.html#aecf55730764a11b15858bb94b5a56988">Grid::operator=</a>(<span class="keyword">const</span> <a class="code" href="classlibdap_1_1Grid.html" title="Holds the Grid data type.">Grid</a> &rhs) <a name="l00128"></a>00128 { <a name="l00129"></a>00129 <span class="keywordflow">if</span> (<span class="keyword">this</span> == &rhs) <a name="l00130"></a>00130 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00131"></a>00131 <a name="l00132"></a>00132 <span class="keyword">delete</span> _array_var; _array_var = 0; <a name="l00133"></a>00133 <a name="l00134"></a>00134 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> i = _map_vars.begin(); i != _map_vars.end(); i++) { <a name="l00135"></a>00135 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = *i ; <a name="l00136"></a>00136 <span class="keyword">delete</span> btp ; <a name="l00137"></a>00137 } <a name="l00138"></a>00138 <a name="l00139"></a>00139 <span class="comment">// this doesn't copy Constructor::_vars so...</span> <a name="l00140"></a>00140 <span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Constructor.html">Constructor</a> &<span class="keyword">></span>(*this) = rhs; <a name="l00141"></a>00141 <a name="l00142"></a>00142 <span class="comment">// we do it in here...</span> <a name="l00143"></a>00143 <a class="code" href="classlibdap_1_1Grid.html#a0e7e17a398a612297c983364f7584018">_duplicate</a>(rhs); <a name="l00144"></a>00144 <a name="l00145"></a>00145 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00146"></a>00146 } <a name="l00147"></a>00147 <a name="l00148"></a>00148 <span class="keywordtype">int</span> <a name="l00149"></a><a class="code" href="classlibdap_1_1Grid.html#aaf8208db18a1ce7ddfeabed691815a3f">00149</a> <a class="code" href="classlibdap_1_1Grid.html#aaf8208db18a1ce7ddfeabed691815a3f" title="Count the members of constructor types.">Grid::element_count</a>(<span class="keywordtype">bool</span> leaves) <a name="l00150"></a>00150 { <a name="l00151"></a>00151 <span class="keywordflow">if</span> (!leaves) <a name="l00152"></a>00152 <span class="keywordflow">return</span> _map_vars.size() + 1; <a name="l00153"></a>00153 <span class="keywordflow">else</span> { <a name="l00154"></a>00154 <span class="keywordtype">int</span> i = 0; <a name="l00155"></a>00155 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> j = _map_vars.begin(); j != _map_vars.end(); j++) { <a name="l00156"></a>00156 j += (*j)->element_count(leaves); <a name="l00157"></a>00157 } <a name="l00158"></a>00158 <a name="l00159"></a>00159 <span class="keywordflow">if</span> (!<a class="code" href="classlibdap_1_1Grid.html#a905ac86a44a9d8ce576056ba244cf558" title="Returns the Grid Array. This method returns the array using an Array*, so no cast is required...">get_array</a>()) <a name="l00160"></a>00160 <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">"No Grid arry!"</span>); <a name="l00161"></a>00161 <a name="l00162"></a>00162 i += <a class="code" href="classlibdap_1_1Grid.html#a905ac86a44a9d8ce576056ba244cf558" title="Returns the Grid Array. This method returns the array using an Array*, so no cast is required...">get_array</a>()-><a class="code" href="classlibdap_1_1Vector.html#ab78981c9e05e7d1dc24f913dbd2021d7" title="Count the members of constructor types.">element_count</a>(leaves); <a name="l00163"></a>00163 <span class="keywordflow">return</span> i; <a name="l00164"></a>00164 } <a name="l00165"></a>00165 } <a name="l00166"></a>00166 <a name="l00167"></a>00167 <span class="keywordtype">void</span> <a name="l00168"></a><a class="code" href="classlibdap_1_1Grid.html#a20be3f6a4e09af668821f3f21fefcac6">00168</a> <a class="code" href="classlibdap_1_1Grid.html#a20be3f6a4e09af668821f3f21fefcac6">Grid::set_send_p</a>(<span class="keywordtype">bool</span> state) <a name="l00169"></a>00169 { <a name="l00170"></a>00170 _array_var-><a class="code" href="classlibdap_1_1BaseType.html#aba7b27635c95b74536de18393133628e">set_send_p</a>(state); <a name="l00171"></a>00171 <a name="l00172"></a>00172 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> i = _map_vars.begin(); i != _map_vars.end(); i++) { <a name="l00173"></a>00173 (*i)->set_send_p(state); <a name="l00174"></a>00174 } <a name="l00175"></a>00175 <a name="l00176"></a>00176 <a class="code" href="classlibdap_1_1Grid.html#a20be3f6a4e09af668821f3f21fefcac6">BaseType::set_send_p</a>(state); <a name="l00177"></a>00177 } <a name="l00178"></a>00178 <a name="l00179"></a>00179 <span class="keywordtype">void</span> <a name="l00180"></a><a class="code" href="classlibdap_1_1Grid.html#adaa3661e737987979357f5e10f208640">00180</a> <a class="code" href="classlibdap_1_1Grid.html#adaa3661e737987979357f5e10f208640" title="Sets the value of the read_p property.">Grid::set_read_p</a>(<span class="keywordtype">bool</span> state) <a name="l00181"></a>00181 { <a name="l00182"></a>00182 _array_var-><a class="code" href="classlibdap_1_1BaseType.html#a4533905a450d2a7af32e7d5acd557676" title="Sets the value of the read_p property.">set_read_p</a>(state); <a name="l00183"></a>00183 <a name="l00184"></a>00184 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> i = _map_vars.begin(); i != _map_vars.end(); i++) { <a name="l00185"></a>00185 (*i)->set_read_p(state); <a name="l00186"></a>00186 } <a name="l00187"></a>00187 <a name="l00188"></a>00188 <a class="code" href="classlibdap_1_1Grid.html#adaa3661e737987979357f5e10f208640" title="Sets the value of the read_p property.">BaseType::set_read_p</a>(state); <a name="l00189"></a>00189 } <a name="l00190"></a>00190 <a name="l00191"></a>00191 <span class="keywordtype">void</span> <a name="l00192"></a><a class="code" href="classlibdap_1_1Grid.html#a35856e4d5f554daf96b465ba30661a50">00192</a> <a class="code" href="classlibdap_1_1Grid.html#a35856e4d5f554daf96b465ba30661a50">Grid::set_in_selection</a>(<span class="keywordtype">bool</span> state) <a name="l00193"></a>00193 { <a name="l00194"></a>00194 _array_var-><a class="code" href="classlibdap_1_1BaseType.html#a2bc036248cdaf1affac464170f32ad30">set_in_selection</a>(state); <a name="l00195"></a>00195 <a name="l00196"></a>00196 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> i = _map_vars.begin(); i != _map_vars.end(); i++) { <a name="l00197"></a>00197 (*i)->set_in_selection(state); <a name="l00198"></a>00198 } <a name="l00199"></a>00199 <a name="l00200"></a>00200 <a class="code" href="classlibdap_1_1Grid.html#a35856e4d5f554daf96b465ba30661a50">BaseType::set_in_selection</a>(state); <a name="l00201"></a>00201 } <a name="l00202"></a>00202 <a name="l00203"></a>00203 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a name="l00204"></a><a class="code" href="classlibdap_1_1Grid.html#af9984d996046137c078e7fbce7dc25a6">00204</a> <a class="code" href="classlibdap_1_1Grid.html#af9984d996046137c078e7fbce7dc25a6" title="Returns the size of the class instance data.">Grid::width</a>() <a name="l00205"></a>00205 { <a name="l00206"></a>00206 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sz = _array_var-><a class="code" href="classlibdap_1_1BaseType.html#a3058467f1e80a41f3cf1068ec9ec68ed" title="Returns the size of the class instance data.">width</a>(); <a name="l00207"></a>00207 <a name="l00208"></a>00208 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> i = _map_vars.begin(); i != _map_vars.end(); i++) { <a name="l00209"></a>00209 sz += (*i)->width(); <a name="l00210"></a>00210 } <a name="l00211"></a>00211 <a name="l00212"></a>00212 <span class="keywordflow">return</span> sz; <a name="l00213"></a>00213 } <a name="l00214"></a>00214 <a name="l00215"></a>00215 <span class="keywordtype">void</span> <a name="l00216"></a><a class="code" href="classlibdap_1_1Grid.html#ab3ee0a326a9dc7dc4528275601acbcd6">00216</a> <a class="code" href="classlibdap_1_1Grid.html#ab3ee0a326a9dc7dc4528275601acbcd6">Grid::intern_data</a>(<a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> &eval, <a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds) <a name="l00217"></a>00217 { <a name="l00218"></a>00218 dds.<a class="code" href="classlibdap_1_1DDS.html#a8cd9b6a34f5e1a49665de3189e141de8">timeout_on</a>(); <a name="l00219"></a>00219 <a name="l00220"></a>00220 <span class="keywordflow">if</span> (!<a class="code" href="classlibdap_1_1BaseType.html#a38ff819a432217c55db2e9071928d20c" title="Has this variable been read?">read_p</a>()) <a name="l00221"></a>00221 <a class="code" href="classlibdap_1_1BaseType.html#a1da003c53f2e663223f603ab3fbd7c8e" title="Read data into a local buffer.">read</a>(); <span class="comment">// read() throws Error and InternalErr</span> <a name="l00222"></a>00222 <a name="l00223"></a>00223 dds.<a class="code" href="classlibdap_1_1DDS.html#a6740f99a5fc64640505924c5603ace0a">timeout_off</a>(); <a name="l00224"></a>00224 <a name="l00225"></a>00225 <span class="keywordflow">if</span> (_array_var-><a class="code" href="classlibdap_1_1BaseType.html#a980c0013817836aa77ef74aeec7fb192" title="Should this variable be sent?">send_p</a>()) <a name="l00226"></a>00226 _array_var-><a class="code" href="classlibdap_1_1BaseType.html#a722d33783aa0272d339b0301a4f77e59">intern_data</a>(eval, dds); <a name="l00227"></a>00227 <a name="l00228"></a>00228 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> i = _map_vars.begin(); i != _map_vars.end(); i++) { <a name="l00229"></a>00229 <span class="keywordflow">if</span> ((*i)->send_p()) { <a name="l00230"></a>00230 (*i)->intern_data(eval, dds); <a name="l00231"></a>00231 } <a name="l00232"></a>00232 } <a name="l00233"></a>00233 } <a name="l00234"></a>00234 <a name="l00235"></a>00235 <span class="keywordtype">bool</span> <a name="l00236"></a><a class="code" href="classlibdap_1_1Grid.html#a76fd548ab588e78f0dd08871631cde5e">00236</a> <a class="code" href="classlibdap_1_1Grid.html#a76fd548ab588e78f0dd08871631cde5e" title="Move data to the net.">Grid::serialize</a>(<a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> &eval, <a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds, <a name="l00237"></a>00237 <a class="code" href="classlibdap_1_1Marshaller.html" title="abstract base class used to marshal/serialize dap data objects">Marshaller</a> &m, <span class="keywordtype">bool</span> ce_eval) <a name="l00238"></a>00238 { <a name="l00239"></a>00239 dds.<a class="code" href="classlibdap_1_1DDS.html#a8cd9b6a34f5e1a49665de3189e141de8">timeout_on</a>(); <a name="l00240"></a>00240 <a name="l00241"></a>00241 <span class="comment">// Re ticket 560: Get an object from eval that describes how to sample</span> <a name="l00242"></a>00242 <span class="comment">// and rearrange the data, then perform those actions. Alternative:</span> <a name="l00243"></a>00243 <span class="comment">// implement this as a selection function.</span> <a name="l00244"></a>00244 <a name="l00245"></a>00245 <span class="keywordflow">if</span> (!<a class="code" href="classlibdap_1_1BaseType.html#a38ff819a432217c55db2e9071928d20c" title="Has this variable been read?">read_p</a>()) <a name="l00246"></a>00246 <a class="code" href="classlibdap_1_1BaseType.html#a1da003c53f2e663223f603ab3fbd7c8e" title="Read data into a local buffer.">read</a>(); <span class="comment">// read() throws Error and InternalErr</span> <a name="l00247"></a>00247 <a name="l00248"></a>00248 <span class="preprocessor">#if EVAL</span> <a name="l00249"></a>00249 <span class="preprocessor"></span> <span class="keywordflow">if</span> (ce_eval && !eval.<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>(dds, <a class="code" href="classlibdap_1_1BaseType.html#a9f102f5cc17ac7d2d80f9921e10d3baf" title="Returns the name of the dataset used to create this instance.">dataset</a>())) <a name="l00250"></a>00250 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00251"></a>00251 <span class="preprocessor">#endif</span> <a name="l00252"></a>00252 <span class="preprocessor"></span> <a name="l00253"></a>00253 dds.<a class="code" href="classlibdap_1_1DDS.html#a6740f99a5fc64640505924c5603ace0a">timeout_off</a>(); <a name="l00254"></a>00254 <a name="l00255"></a>00255 <span class="keywordflow">if</span> (_array_var-><a class="code" href="classlibdap_1_1BaseType.html#a980c0013817836aa77ef74aeec7fb192" title="Should this variable be sent?">send_p</a>()) <a name="l00256"></a>00256 _array_var-><a class="code" href="classlibdap_1_1BaseType.html#a1f45893684a69b50b37817b88230de9f" title="Move data to the net.">serialize</a>(eval, dds, m, <span class="keyword">false</span>); <a name="l00257"></a>00257 <a name="l00258"></a>00258 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> i = _map_vars.begin(); i != _map_vars.end(); i++) { <a name="l00259"></a>00259 <span class="keywordflow">if</span> ((*i)->send_p()) { <a name="l00260"></a>00260 (*i)->serialize(eval, dds, m, <span class="keyword">false</span>); <a name="l00261"></a>00261 } <a name="l00262"></a>00262 } <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="l00267"></a>00267 <span class="keywordtype">bool</span> <a name="l00268"></a><a class="code" href="classlibdap_1_1Grid.html#a5cfc24c934f487fe8c7f18c4c24666f5">00268</a> <a class="code" href="classlibdap_1_1Grid.html#a5cfc24c934f487fe8c7f18c4c24666f5" title="Receive data from the net.">Grid::deserialize</a>(<a class="code" href="classlibdap_1_1UnMarshaller.html" title="abstract base class used to unmarshall/deserialize dap data objects">UnMarshaller</a> &um, <a class="code" href="classlibdap_1_1DDS.html">DDS</a> *dds, <span class="keywordtype">bool</span> reuse) <a name="l00269"></a>00269 { <a name="l00270"></a>00270 _array_var-><a class="code" href="classlibdap_1_1BaseType.html#aa14891b5342c1ce06399343de8b716d0" title="Receive data from the net.">deserialize</a>(um, dds, reuse); <a name="l00271"></a>00271 <a name="l00272"></a>00272 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> i = _map_vars.begin(); i != _map_vars.end(); i++) { <a name="l00273"></a>00273 (*i)->deserialize(um, dds, reuse); <a name="l00274"></a>00274 } <a name="l00275"></a>00275 <a name="l00276"></a>00276 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00277"></a>00277 } <a name="l00278"></a>00278 <a name="l00286"></a>00286 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a name="l00287"></a><a class="code" href="classlibdap_1_1Grid.html#ad18e0142c959b4103d8e4e2f87c89552">00287</a> <a class="code" href="classlibdap_1_1Grid.html#ad18e0142c959b4103d8e4e2f87c89552" title="Returns the size of the Grid type.">Grid::val2buf</a>(<span class="keywordtype">void</span> *, <span class="keywordtype">bool</span>) <a name="l00288"></a>00288 { <a name="l00289"></a>00289 <span class="keywordflow">return</span> <span class="keyword">sizeof</span>(<a class="code" href="classlibdap_1_1Grid.html#a75774a8fe1c7c7ec9a1e48a7d6d2cbc0" title="The Grid constructor.">Grid</a>); <a name="l00290"></a>00290 } <a name="l00291"></a>00291 <a name="l00295"></a>00295 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a name="l00296"></a><a class="code" href="classlibdap_1_1Grid.html#a4b2053395c19b4e52cf75bb919aa8eae">00296</a> <a class="code" href="classlibdap_1_1Grid.html#a4b2053395c19b4e52cf75bb919aa8eae">Grid::buf2val</a>(<span class="keywordtype">void</span> **) <a name="l00297"></a>00297 { <a name="l00298"></a>00298 <span class="keywordflow">return</span> <span class="keyword">sizeof</span>(<a class="code" href="classlibdap_1_1Grid.html#a75774a8fe1c7c7ec9a1e48a7d6d2cbc0" title="The Grid constructor.">Grid</a>); <a name="l00299"></a>00299 } <a name="l00300"></a>00300 <a name="l00301"></a>00301 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> * <a name="l00302"></a><a class="code" href="classlibdap_1_1Grid.html#ad9615a69ebc80b621658d466154bb1e6">00302</a> <a class="code" href="classlibdap_1_1Grid.html#ad75c8aca61d68cc4a65430bc937ba3fc">Grid::var</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &n, <a class="code" href="classlibdap_1_1BaseType.html#ae9c6e71855b90a0e552713011c9ab81f">btp_stack</a> &s) <a name="l00303"></a>00303 { <a name="l00304"></a>00304 <span class="keywordflow">return</span> <a class="code" href="classlibdap_1_1Grid.html#ad75c8aca61d68cc4a65430bc937ba3fc">var</a>(n, <span class="keyword">true</span>, &s); <a name="l00305"></a>00305 } <a name="l00306"></a>00306 <a name="l00311"></a>00311 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> * <a name="l00312"></a><a class="code" href="classlibdap_1_1Grid.html#ad75c8aca61d68cc4a65430bc937ba3fc">00312</a> <a class="code" href="classlibdap_1_1Grid.html#ad75c8aca61d68cc4a65430bc937ba3fc">Grid::var</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &n, <span class="keywordtype">bool</span>, <a class="code" href="classlibdap_1_1BaseType.html#ae9c6e71855b90a0e552713011c9ab81f">btp_stack</a> *s) <a name="l00313"></a>00313 { <a name="l00314"></a>00314 <span class="keywordtype">string</span> <a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a> = <a class="code" href="namespacelibdap.html#a376f9593431111a80ef78c98b8f4a0e2">www2id</a>(n); <a name="l00315"></a>00315 <a name="l00316"></a>00316 <span class="keywordflow">if</span> (_array_var-><a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() == <a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>) { <a name="l00317"></a>00317 <span class="keywordflow">if</span> (s) <a name="l00318"></a>00318 s->push(static_cast<BaseType *>(<span class="keyword">this</span>)); <a name="l00319"></a>00319 <span class="keywordflow">return</span> _array_var; <a name="l00320"></a>00320 } <a name="l00321"></a>00321 <a name="l00322"></a>00322 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> i = _map_vars.begin(); i != _map_vars.end(); i++) { <a name="l00323"></a>00323 <span class="keywordflow">if</span> ((*i)->name() == <a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>) { <a name="l00324"></a>00324 <span class="keywordflow">if</span> (s) <a name="l00325"></a>00325 s->push(static_cast<BaseType *>(<span class="keyword">this</span>)); <a name="l00326"></a>00326 <span class="keywordflow">return</span> *i; <a name="l00327"></a>00327 } <a name="l00328"></a>00328 } <a name="l00329"></a>00329 <a name="l00330"></a>00330 <span class="keywordflow">return</span> 0; <a name="l00331"></a>00331 } <a name="l00332"></a>00332 <a name="l00345"></a>00345 <span class="keywordtype">void</span> <a name="l00346"></a><a class="code" href="classlibdap_1_1Grid.html#ae8356b6e1b8c6c67718bb9bfefd9f7e8">00346</a> <a class="code" href="classlibdap_1_1Grid.html#ae8356b6e1b8c6c67718bb9bfefd9f7e8">Grid::add_var</a>(<a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *bt, <a class="code" href="namespacelibdap.html#addcb1d714cdecb877c65ff6d2fde0695" title="Names the parts of multi-section constructor data types.">Part</a> part) <a name="l00347"></a>00347 { <a name="l00348"></a>00348 <span class="keywordflow">if</span> (!bt) { <a name="l00349"></a>00349 <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="l00350"></a>00350 <span class="stringliteral">"Passing NULL pointer as variable to be added."</span>); <a name="l00351"></a>00351 } <a name="l00352"></a>00352 <a name="l00353"></a>00353 <span class="keywordflow">if</span> (part == <a class="code" href="namespacelibdap.html#addcb1d714cdecb877c65ff6d2fde0695aed5453774cf1a62b2f92c0c70b989247">array</a> && _array_var) { <a name="l00354"></a>00354 <span class="comment">// Avoid leaking memory... Function is add, not set, so it is an error to call again for the array part.</span> <a name="l00355"></a>00355 <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">"Error: Grid::add_var called with part==Array, but the array was already set!"</span>); <a name="l00356"></a>00356 } <a name="l00357"></a>00357 <a name="l00358"></a>00358 <span class="comment">// Set to the clone of bt if we get that far.</span> <a name="l00359"></a>00359 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a>* bt_clone = 0; <a name="l00360"></a>00360 <a name="l00361"></a>00361 <span class="keywordflow">switch</span> (part) { <a name="l00362"></a>00362 <a name="l00363"></a>00363 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#addcb1d714cdecb877c65ff6d2fde0695aed5453774cf1a62b2f92c0c70b989247">array</a>: { <a name="l00364"></a>00364 <span class="comment">// Refactored to use new set_array ([mjohnson 11 nov 2009])</span> <a name="l00365"></a>00365 <a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a>* p_arr = <span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a>*<span class="keyword">></span>(bt); <a name="l00366"></a>00366 <span class="comment">// avoid obvious broken semantics</span> <a name="l00367"></a>00367 <span class="keywordflow">if</span> (!p_arr) { <a name="l00368"></a>00368 <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="l00369"></a>00369 <span class="stringliteral">"Grid::add_var(): with Part==array: object is not an Array!"</span>); <a name="l00370"></a>00370 } <a name="l00371"></a>00371 <span class="comment">// Add it as a copy to preserve old semantics. This sets parent too.</span> <a name="l00372"></a>00372 bt_clone = p_arr-><a class="code" href="classlibdap_1_1Array.html#a31dc321bd9314239474f30d290e0599a">ptr_duplicate</a>(); <a name="l00373"></a>00373 <a class="code" href="classlibdap_1_1Grid.html#a35412b1401ff8795504af40be6d09aa1">set_array</a>(static_cast<Array*>(bt_clone)); <a name="l00374"></a>00374 } <a name="l00375"></a>00375 <span class="keywordflow">break</span>; <a name="l00376"></a>00376 <a name="l00377"></a>00377 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#addcb1d714cdecb877c65ff6d2fde0695aaa7dc708bd26f663a00ecf52a673da1b">maps</a>: { <a name="l00378"></a>00378 bt_clone = bt-><a class="code" href="classlibdap_1_1BaseType.html#a0b130311c9901fb8a7ab11ea19090ef0">ptr_duplicate</a>(); <a name="l00379"></a>00379 bt_clone-><a class="code" href="classlibdap_1_1BaseType.html#a5b6a39f6ce6594fa74f3fc899ac9a966">set_parent</a>(<span class="keyword">this</span>); <a name="l00380"></a>00380 _map_vars.push_back(bt_clone); <a name="l00381"></a>00381 } <a name="l00382"></a>00382 <span class="keywordflow">break</span>; <a name="l00383"></a>00383 <a name="l00384"></a>00384 <span class="keywordflow">default</span>: { <a name="l00385"></a>00385 <span class="keywordflow">if</span> (!_array_var) { <a name="l00386"></a>00386 <span class="comment">// Refactored to use new set_array ([mjohnson 11 nov 2009])</span> <a name="l00387"></a>00387 <a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a>* p_arr = <span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a>*<span class="keyword">></span>(bt); <a name="l00388"></a>00388 <span class="comment">// avoid obvious broken semantics</span> <a name="l00389"></a>00389 <span class="keywordflow">if</span> (!p_arr) { <a name="l00390"></a>00390 <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="l00391"></a>00391 <span class="stringliteral">"Grid::add_var(): with Part==array: object is not an Array!"</span>); <a name="l00392"></a>00392 } <a name="l00393"></a>00393 <span class="comment">// Add it as a copy to preserve old semantics. This sets parent too.</span> <a name="l00394"></a>00394 bt_clone = p_arr-><a class="code" href="classlibdap_1_1Array.html#a31dc321bd9314239474f30d290e0599a">ptr_duplicate</a>(); <a name="l00395"></a>00395 <a class="code" href="classlibdap_1_1Grid.html#a35412b1401ff8795504af40be6d09aa1">set_array</a>(static_cast<Array*>(bt_clone)); <a name="l00396"></a>00396 } <a name="l00397"></a>00397 <span class="keywordflow">else</span> { <a name="l00398"></a>00398 bt_clone = bt-><a class="code" href="classlibdap_1_1BaseType.html#a0b130311c9901fb8a7ab11ea19090ef0">ptr_duplicate</a>(); <a name="l00399"></a>00399 bt_clone-><a class="code" href="classlibdap_1_1BaseType.html#a5b6a39f6ce6594fa74f3fc899ac9a966">set_parent</a>(<span class="keyword">this</span>); <a name="l00400"></a>00400 _map_vars.push_back(bt_clone); <a name="l00401"></a>00401 } <a name="l00402"></a>00402 } <a name="l00403"></a>00403 <span class="keywordflow">break</span>; <a name="l00404"></a>00404 }<span class="comment">// switch</span> <a name="l00405"></a>00405 <a name="l00406"></a>00406 <span class="comment">// if we get ehre without exception, add the cloned object to the superclass variable iterator</span> <a name="l00407"></a>00407 <span class="comment">// mjohnson 10 Sep 2009</span> <a name="l00408"></a>00408 <span class="comment">// Add it to the superclass _vars list so we can iterate on superclass vars</span> <a name="l00409"></a>00409 <span class="keywordflow">if</span> (bt_clone) { <a name="l00410"></a>00410 <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.push_back(bt_clone); <a name="l00411"></a>00411 } <a name="l00412"></a>00412 } <a name="l00413"></a>00413 <a name="l00423"></a>00423 <span class="keywordtype">void</span> <a name="l00424"></a><a class="code" href="classlibdap_1_1Grid.html#a35412b1401ff8795504af40be6d09aa1">00424</a> <a class="code" href="classlibdap_1_1Grid.html#a35412b1401ff8795504af40be6d09aa1">Grid::set_array</a>(<a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a>* p_new_arr) <a name="l00425"></a>00425 { <a name="l00426"></a>00426 <span class="keywordflow">if</span> (!p_new_arr) { <a name="l00427"></a>00427 <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="l00428"></a>00428 <span class="stringliteral">"Grid::set_array(): Cannot set to null!"</span>); <a name="l00429"></a>00429 } <a name="l00430"></a>00430 <span class="comment">// Make sure not same memory, this would be evil.</span> <a name="l00431"></a>00431 <span class="keywordflow">if</span> (p_new_arr == _array_var) { <a name="l00432"></a>00432 <span class="keywordflow">return</span>; <a name="l00433"></a>00433 } <a name="l00434"></a>00434 <span class="comment">// clean out any old array</span> <a name="l00435"></a>00435 <span class="keyword">delete</span> _array_var; _array_var = 0; <a name="l00436"></a>00436 <span class="comment">// Set the new, with parent</span> <a name="l00437"></a>00437 _array_var = p_new_arr; <a name="l00438"></a>00438 _array_var-><a class="code" href="classlibdap_1_1BaseType.html#a5b6a39f6ce6594fa74f3fc899ac9a966">set_parent</a>(<span class="keyword">this</span>); <a name="l00439"></a>00439 } <a name="l00440"></a>00440 <a name="l00467"></a>00467 <a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a>* <a name="l00468"></a><a class="code" href="classlibdap_1_1Grid.html#ad24067d02100d7ad77053d2fd9cac680">00468</a> <a class="code" href="classlibdap_1_1Grid.html#ad24067d02100d7ad77053d2fd9cac680">Grid::add_map</a>(<a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a>* p_new_map, <span class="keywordtype">bool</span> add_as_copy) <a name="l00469"></a>00469 { <a name="l00470"></a>00470 <span class="keywordflow">if</span> (!p_new_map) { <a name="l00471"></a>00471 <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="l00472"></a>00472 <span class="stringliteral">"Grid::add_map(): cannot have p_new_map null!"</span>); <a name="l00473"></a>00473 } <a name="l00474"></a>00474 <a name="l00475"></a>00475 <span class="keywordflow">if</span> (add_as_copy) { <a name="l00476"></a>00476 p_new_map = <span class="keyword">static_cast<</span><a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a>*<span class="keyword">></span>(p_new_map-><a class="code" href="classlibdap_1_1Array.html#a31dc321bd9314239474f30d290e0599a">ptr_duplicate</a>()); <a name="l00477"></a>00477 } <a name="l00478"></a>00478 <a name="l00479"></a>00479 p_new_map-><a class="code" href="classlibdap_1_1BaseType.html#a5b6a39f6ce6594fa74f3fc899ac9a966">set_parent</a>(<span class="keyword">this</span>); <a name="l00480"></a>00480 _map_vars.push_back(p_new_map); <a name="l00481"></a>00481 <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.push_back(p_new_map); <span class="comment">// allow superclass iter to work as well.</span> <a name="l00482"></a>00482 <a name="l00483"></a>00483 <span class="comment">// return the one that got put into the Grid.</span> <a name="l00484"></a>00484 <span class="keywordflow">return</span> p_new_map; <a name="l00485"></a>00485 } <a name="l00486"></a>00486 <a name="l00499"></a>00499 <a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a>* <a name="l00500"></a><a class="code" href="classlibdap_1_1Grid.html#a5a39d31cad6c5a9437bc07b696bb8db4">00500</a> <a class="code" href="classlibdap_1_1Grid.html#a5a39d31cad6c5a9437bc07b696bb8db4">Grid::prepend_map</a>(<a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a>* p_new_map, <span class="keywordtype">bool</span> add_copy) <a name="l00501"></a>00501 { <a name="l00502"></a>00502 <span class="keywordflow">if</span> (add_copy) <a name="l00503"></a>00503 { <a name="l00504"></a>00504 p_new_map = <span class="keyword">static_cast<</span><a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a>*<span class="keyword">></span>(p_new_map-><a class="code" href="classlibdap_1_1Array.html#a31dc321bd9314239474f30d290e0599a">ptr_duplicate</a>()); <a name="l00505"></a>00505 } <a name="l00506"></a>00506 <a name="l00507"></a>00507 p_new_map-><a class="code" href="classlibdap_1_1BaseType.html#a5b6a39f6ce6594fa74f3fc899ac9a966">set_parent</a>(<span class="keyword">this</span>); <a name="l00508"></a>00508 _map_vars.insert(_map_vars.begin(), p_new_map); <a name="l00509"></a>00509 <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.insert(<a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(), p_new_map); <span class="comment">// allow superclass iter to work as well.</span> <a name="l00510"></a>00510 <a name="l00511"></a>00511 <span class="comment">// return the one that got put into the Grid.</span> <a name="l00512"></a>00512 <span class="keywordflow">return</span> p_new_map; <a name="l00513"></a>00513 } <a name="l00514"></a>00514 <a name="l00518"></a>00518 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> * <a name="l00519"></a><a class="code" href="classlibdap_1_1Grid.html#a13f73ec1242460db6be3b7a818c8328f">00519</a> <a class="code" href="classlibdap_1_1Grid.html#a13f73ec1242460db6be3b7a818c8328f" title="Returns the Grid Array.">Grid::array_var</a>() <a name="l00520"></a>00520 { <a name="l00521"></a>00521 <span class="keywordflow">return</span> _array_var; <a name="l00522"></a>00522 } <a name="l00523"></a>00523 <a name="l00527"></a>00527 <a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a> * <a name="l00528"></a><a class="code" href="classlibdap_1_1Grid.html#a905ac86a44a9d8ce576056ba244cf558">00528</a> <a class="code" href="classlibdap_1_1Grid.html#a905ac86a44a9d8ce576056ba244cf558" title="Returns the Grid Array. This method returns the array using an Array*, so no cast is required...">Grid::get_array</a>() <a name="l00529"></a>00529 { <a name="l00530"></a>00530 <a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a> *a = <span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a>*<span class="keyword">></span>(_array_var); <a name="l00531"></a>00531 <span class="keywordflow">if</span> (a) <a name="l00532"></a>00532 <span class="keywordflow">return</span> a; <a name="l00533"></a>00533 <span class="keywordflow">else</span> <a name="l00534"></a>00534 <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">"bad Cast"</span>); <a name="l00535"></a>00535 } <a name="l00536"></a>00536 <a name="l00538"></a>00538 <a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Grid::Map_iter</a> <a name="l00539"></a><a class="code" href="classlibdap_1_1Grid.html#a2e9d2e436c0ff138a977dbba54c018eb">00539</a> <a class="code" href="classlibdap_1_1Grid.html#a2e9d2e436c0ff138a977dbba54c018eb" title="Returns an iterator referencing the first Map vector.">Grid::map_begin</a>() <a name="l00540"></a>00540 { <a name="l00541"></a>00541 <span class="keywordflow">return</span> _map_vars.begin() ; <a name="l00542"></a>00542 } <a name="l00543"></a>00543 <a name="l00546"></a>00546 <a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Grid::Map_iter</a> <a name="l00547"></a><a class="code" href="classlibdap_1_1Grid.html#aaebbf2a5329ec01b6527b4bafde87837">00547</a> <a class="code" href="classlibdap_1_1Grid.html#aaebbf2a5329ec01b6527b4bafde87837">Grid::map_end</a>() <a name="l00548"></a>00548 { <a name="l00549"></a>00549 <span class="keywordflow">return</span> _map_vars.end() ; <a name="l00550"></a>00550 } <a name="l00551"></a>00551 <a name="l00553"></a>00553 <a class="code" href="classlibdap_1_1Grid.html#a1c1791bdfac09f6ec42a71089fdccc75">Grid::Map_riter</a> <a name="l00554"></a><a class="code" href="classlibdap_1_1Grid.html#afdddc12f67c7f4f6bb6c78d55a2f75b2">00554</a> <a class="code" href="classlibdap_1_1Grid.html#afdddc12f67c7f4f6bb6c78d55a2f75b2" title="Returns an iterator referencing the first Map vector.">Grid::map_rbegin</a>() <a name="l00555"></a>00555 { <a name="l00556"></a>00556 <span class="keywordflow">return</span> _map_vars.rbegin() ; <a name="l00557"></a>00557 } <a name="l00558"></a>00558 <a name="l00561"></a>00561 <a class="code" href="classlibdap_1_1Grid.html#a1c1791bdfac09f6ec42a71089fdccc75">Grid::Map_riter</a> <a name="l00562"></a><a class="code" href="classlibdap_1_1Grid.html#ab821c8beb7c653ce38842fcb27d644ca">00562</a> <a class="code" href="classlibdap_1_1Grid.html#ab821c8beb7c653ce38842fcb27d644ca">Grid::map_rend</a>() <a name="l00563"></a>00563 { <a name="l00564"></a>00564 <span class="keywordflow">return</span> _map_vars.rend() ; <a name="l00565"></a>00565 } <a name="l00566"></a>00566 <a name="l00570"></a>00570 <a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Grid::Map_iter</a> <a name="l00571"></a><a class="code" href="classlibdap_1_1Grid.html#a30dd7f9fa8a28b4bf6ccd6e94a12b62c">00571</a> <a class="code" href="classlibdap_1_1Grid.html#a30dd7f9fa8a28b4bf6ccd6e94a12b62c">Grid::get_map_iter</a>(<span class="keywordtype">int</span> i) <a name="l00572"></a>00572 { <a name="l00573"></a>00573 <span class="keywordflow">return</span> _map_vars.begin() + i; <a name="l00574"></a>00574 } <a name="l00575"></a>00575 <a name="l00591"></a>00591 <span class="keywordtype">int</span> <a name="l00592"></a><a class="code" href="classlibdap_1_1Grid.html#ad26dc472b37af0abeb540a43fb04d8dc">00592</a> <a class="code" href="classlibdap_1_1Grid.html#ad26dc472b37af0abeb540a43fb04d8dc" title="Returns the number of components in the Grid object.">Grid::components</a>(<span class="keywordtype">bool</span> constrained) <a name="l00593"></a>00593 { <a name="l00594"></a>00594 <span class="keywordtype">int</span> comp; <a name="l00595"></a>00595 <a name="l00596"></a>00596 <span class="keywordflow">if</span> (constrained) { <a name="l00597"></a>00597 comp = _array_var-><a class="code" href="classlibdap_1_1BaseType.html#a980c0013817836aa77ef74aeec7fb192" title="Should this variable be sent?">send_p</a>() ? 1 : 0; <a name="l00598"></a>00598 <a name="l00599"></a>00599 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> i = _map_vars.begin(); i != _map_vars.end(); i++) { <a name="l00600"></a>00600 <span class="keywordflow">if</span> ((*i)->send_p()) { <a name="l00601"></a>00601 comp++; <a name="l00602"></a>00602 } <a name="l00603"></a>00603 } <a name="l00604"></a>00604 } <a name="l00605"></a>00605 <span class="keywordflow">else</span> { <a name="l00606"></a>00606 comp = 1 + _map_vars.size(); <a name="l00607"></a>00607 } <a name="l00608"></a>00608 <a name="l00609"></a>00609 <span class="keywordflow">return</span> comp; <a name="l00610"></a>00610 } <a name="l00611"></a>00611 <a name="l00612"></a><a class="code" href="classlibdap_1_1Grid.html#a9483bb65505c86e3fc44a9b856a55323">00612</a> <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1Grid.html#a9483bb65505c86e3fc44a9b856a55323">Grid::transfer_attributes</a>(<a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> *at_container) <a name="l00613"></a>00613 { <a name="l00614"></a>00614 <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> *at = at_container-><a class="code" href="classlibdap_1_1AttrTable.html#a4010172de5c41cd88f2422d5e1975522" title="Get an attribute container.">get_attr_table</a>(<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>()); <a name="l00615"></a>00615 <a name="l00616"></a>00616 <span class="keywordflow">if</span> (at) { <a name="l00617"></a>00617 at-><a class="code" href="classlibdap_1_1AttrTable.html#aadba23c830a02aa19c24c2a6f442dfd2">set_is_global_attribute</a>(<span class="keyword">false</span>); <a name="l00618"></a>00618 <a name="l00619"></a>00619 <a class="code" href="classlibdap_1_1Grid.html#a13f73ec1242460db6be3b7a818c8328f" title="Returns the Grid Array.">array_var</a>()-><a class="code" href="classlibdap_1_1BaseType.html#add8e836c622042a339152a6c31e5bdfb">transfer_attributes</a>(at); <a name="l00620"></a>00620 <a name="l00621"></a>00621 <a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> map = <a class="code" href="classlibdap_1_1Grid.html#a2e9d2e436c0ff138a977dbba54c018eb" title="Returns an iterator referencing the first Map vector.">map_begin</a>(); <a name="l00622"></a>00622 <span class="keywordflow">while</span> (map != <a class="code" href="classlibdap_1_1Grid.html#aaebbf2a5329ec01b6527b4bafde87837">map_end</a>()) { <a name="l00623"></a>00623 (*map)->transfer_attributes(at); <a name="l00624"></a>00624 map++; <a name="l00625"></a>00625 } <a name="l00626"></a>00626 <a name="l00627"></a>00627 <span class="comment">// Trick: If an attribute that's within the container 'at' still has its</span> <a name="l00628"></a>00628 <span class="comment">// is_global_attribute property set, then it's not really a global attr</span> <a name="l00629"></a>00629 <span class="comment">// but instead an attribute that belongs to this Grid.</span> <a name="l00630"></a>00630 <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">AttrTable::Attr_iter</a> at_p = at-><a class="code" href="classlibdap_1_1AttrTable.html#a8881bb7044577dae3098f4a1d8bf4f2f">attr_begin</a>(); <a name="l00631"></a>00631 <span class="keywordflow">while</span> (at_p != at-><a class="code" href="classlibdap_1_1AttrTable.html#a543955729bad6b7a9d1d6b336596b1ba">attr_end</a>()) { <a name="l00632"></a>00632 <span class="keywordflow">if</span> (at-><a class="code" href="classlibdap_1_1AttrTable.html#a2906fea416b22dcdf96df9eb5e21258a">is_global_attribute</a>(at_p)) { <a name="l00633"></a>00633 <span class="keywordflow">if</span> (at-><a class="code" href="classlibdap_1_1AttrTable.html#aefcd82370930ba94a288f135d9417a93" title="Get the type of an attribute.">get_attr_type</a>(at_p) == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>) <a name="l00634"></a>00634 <a class="code" href="classlibdap_1_1BaseType.html#a1fcd9537c67e3bf88964b2656ff5bac1">get_attr_table</a>().<a class="code" href="classlibdap_1_1AttrTable.html#a03f3a1197f9529d4c0328830c765cfe1" title="Add a container to the attribute table.">append_container</a>(<span class="keyword">new</span> <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a>( <a name="l00635"></a>00635 *at-><a class="code" href="classlibdap_1_1AttrTable.html#a4010172de5c41cd88f2422d5e1975522" title="Get an attribute container.">get_attr_table</a>(at_p)), at-><a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(at_p)); <a name="l00636"></a>00636 <span class="keywordflow">else</span> <a name="l00637"></a>00637 <a class="code" href="classlibdap_1_1BaseType.html#a1fcd9537c67e3bf88964b2656ff5bac1">get_attr_table</a>().<a class="code" href="classlibdap_1_1AttrTable.html#a7a526505d174c7a2f33e6b57761f8bc4" title="Add an attribute to the table.">append_attr</a>(at-><a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(at_p), <a name="l00638"></a>00638 at-><a class="code" href="classlibdap_1_1AttrTable.html#a689563c3beb8e6f571387c5105821f27" title="Get the type name of an attribute within this attribute table.">get_type</a>(at_p), at-><a class="code" href="classlibdap_1_1AttrTable.html#a7352d886789e9e38d530fc44c6cbef30" title="Get a vector-valued attribute.">get_attr_vector</a>(at_p)); <a name="l00639"></a>00639 } <a name="l00640"></a>00640 <a name="l00641"></a>00641 at_p++; <a name="l00642"></a>00642 } <a name="l00643"></a>00643 } <a name="l00644"></a>00644 } <a name="l00645"></a>00645 <a name="l00646"></a>00646 <span class="comment">// When projected (using whatever the current constraint provides in the way</span> <a name="l00647"></a>00647 <span class="comment">// of a projection), is the object still a Grid?</span> <a name="l00648"></a>00648 <a name="l00665"></a>00665 <span class="keywordtype">bool</span> <a name="l00666"></a><a class="code" href="classlibdap_1_1Grid.html#aa737cef63a1b9c8b8b0952fcb22a621b">00666</a> <a class="code" href="classlibdap_1_1Grid.html#aa737cef63a1b9c8b8b0952fcb22a621b">Grid::projection_yields_grid</a>() <a name="l00667"></a>00667 { <a name="l00668"></a>00668 <span class="comment">// For each dimension in the Array part, check the corresponding Map</span> <a name="l00669"></a>00669 <span class="comment">// vector to make sure it is present in the projected Grid. If for each</span> <a name="l00670"></a>00670 <span class="comment">// projected dimension in the Array component, there is a matching Map</span> <a name="l00671"></a>00671 <span class="comment">// vector, then the Grid is valid.</span> <a name="l00672"></a>00672 <span class="keywordtype">bool</span> valid = <span class="keyword">true</span>; <a name="l00673"></a>00673 <a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a> *a = (<a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a> *)_array_var; <a name="l00674"></a>00674 <a name="l00675"></a>00675 <span class="comment">// Don't bother checking if the Array component is not included.</span> <a name="l00676"></a>00676 <span class="keywordflow">if</span> (!a-><a class="code" href="classlibdap_1_1BaseType.html#a980c0013817836aa77ef74aeec7fb192" title="Should this variable be sent?">send_p</a>()) <a name="l00677"></a>00677 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00678"></a>00678 <a name="l00679"></a>00679 <span class="comment">// If only one part is being sent, it's clearly not a grid (it must be</span> <a name="l00680"></a>00680 <span class="comment">// the array part of the Grid that's being sent (given that the above</span> <a name="l00681"></a>00681 <span class="comment">// test passed and the array is being sent).</span> <a name="l00682"></a>00682 <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1Grid.html#ad26dc472b37af0abeb540a43fb04d8dc" title="Returns the number of components in the Grid object.">components</a>(<span class="keyword">true</span>) == 1) <a name="l00683"></a>00683 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00684"></a>00684 <a name="l00685"></a>00685 <a class="code" href="classlibdap_1_1Array.html#a7a557c05085a83d1501dbfa249d3cc52">Array::Dim_iter</a> d = a-><a class="code" href="classlibdap_1_1Array.html#ae6e6943cd895fa8dc1c58621ffad42a0">dim_begin</a>() ; <a name="l00686"></a>00686 <a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> m = <a class="code" href="classlibdap_1_1Grid.html#a2e9d2e436c0ff138a977dbba54c018eb" title="Returns an iterator referencing the first Map vector.">map_begin</a>() ; <a name="l00687"></a>00687 <a name="l00688"></a>00688 <span class="keywordflow">while</span> (valid && d != a-><a class="code" href="classlibdap_1_1Array.html#a1e6b13c4a5d3e825df7ebae3a9dc300d">dim_end</a>() && m != <a class="code" href="classlibdap_1_1Grid.html#aaebbf2a5329ec01b6527b4bafde87837">map_end</a>()) { <a name="l00689"></a>00689 <a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a> &map = <span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a>&<span class="keyword">></span>(**m); <a name="l00690"></a>00690 <span class="keywordflow">if</span> (a-><a class="code" href="classlibdap_1_1Array.html#a8f29497af9c33c0d66939d5f9a16d92a" title="Returns the size of the dimension.">dimension_size</a>(d, <span class="keyword">true</span>) && map.<a class="code" href="classlibdap_1_1BaseType.html#a980c0013817836aa77ef74aeec7fb192" title="Should this variable be sent?">send_p</a>()) { <a name="l00691"></a>00691 <span class="comment">// Check the matching Map vector; the Map projection must equal</span> <a name="l00692"></a>00692 <span class="comment">// the Array dimension projection</span> <a name="l00693"></a>00693 <a class="code" href="classlibdap_1_1Array.html#a7a557c05085a83d1501dbfa249d3cc52">Array::Dim_iter</a> fd = map.<a class="code" href="classlibdap_1_1Array.html#ae6e6943cd895fa8dc1c58621ffad42a0">dim_begin</a>(); <span class="comment">// Maps have only one dim!</span> <a name="l00694"></a>00694 valid = map.<a class="code" href="classlibdap_1_1Array.html#a12084880777d27d782b0e1f2f4d5ae01" title="Return the start index of a dimension.">dimension_start</a>(fd, <span class="keyword">true</span>) == a-><a class="code" href="classlibdap_1_1Array.html#a12084880777d27d782b0e1f2f4d5ae01" title="Return the start index of a dimension.">dimension_start</a>(d, <span class="keyword">true</span>) <a name="l00695"></a>00695 && map.<a class="code" href="classlibdap_1_1Array.html#a446f239be3ef678a4476058c8041552a" title="Return the stop index of the constraint.">dimension_stop</a>(fd, <span class="keyword">true</span>) == a-><a class="code" href="classlibdap_1_1Array.html#a446f239be3ef678a4476058c8041552a" title="Return the stop index of the constraint.">dimension_stop</a>(d, <span class="keyword">true</span>) <a name="l00696"></a>00696 && map.<a class="code" href="classlibdap_1_1Array.html#afc530e71ace953992a5b314a6f885d31" title="Returns the stride value of the constraint.">dimension_stride</a>(fd, <span class="keyword">true</span>) == a-><a class="code" href="classlibdap_1_1Array.html#afc530e71ace953992a5b314a6f885d31" title="Returns the stride value of the constraint.">dimension_stride</a>(d, <span class="keyword">true</span>); <a name="l00697"></a>00697 } <a name="l00698"></a>00698 <span class="keywordflow">else</span> { <a name="l00699"></a>00699 valid = <span class="keyword">false</span>; <a name="l00700"></a>00700 } <a name="l00701"></a>00701 <a name="l00702"></a>00702 d++, m++; <a name="l00703"></a>00703 } <a name="l00704"></a>00704 <a name="l00705"></a>00705 <span class="keywordflow">return</span> valid; <a name="l00706"></a>00706 } <a name="l00707"></a>00707 <a name="l00709"></a>00709 <span class="keywordtype">void</span> <a name="l00710"></a><a class="code" href="classlibdap_1_1Grid.html#a3b7ce41c5ab7b86bdb30508d39127600">00710</a> <a class="code" href="classlibdap_1_1Grid.html#a3b7ce41c5ab7b86bdb30508d39127600">Grid::clear_constraint</a>() <a name="l00711"></a>00711 { <a name="l00712"></a>00712 <span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a>&<span class="keyword">></span>(*_array_var).<a class="code" href="classlibdap_1_1Array.html#a151f9eaea5f7b22980b1ef86c75723ce" title="Clears the projection; add each projected dimension explicitly using add_constraint.">clear_constraint</a>(); <a name="l00713"></a>00713 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> m = <a class="code" href="classlibdap_1_1Grid.html#a2e9d2e436c0ff138a977dbba54c018eb" title="Returns an iterator referencing the first Map vector.">map_begin</a>(); m != <a class="code" href="classlibdap_1_1Grid.html#aaebbf2a5329ec01b6527b4bafde87837">map_end</a>(); ++m) <a name="l00714"></a>00714 dynamic_cast<Array&>(*(*m)).<a class="code" href="classlibdap_1_1Grid.html#a3b7ce41c5ab7b86bdb30508d39127600">clear_constraint</a>(); <a name="l00715"></a>00715 } <a name="l00716"></a>00716 <a name="l00717"></a>00717 <span class="preprocessor">#if FILE_METHODS</span> <a name="l00718"></a>00718 <span class="preprocessor"></span><span class="keywordtype">void</span> <a name="l00719"></a>00719 <a class="code" href="classlibdap_1_1Grid.html#a5a239b053928636e13e3a478faf8e334" title="Print an ASCII representation of the variable structure.">Grid::print_decl</a>(FILE *out, <span class="keywordtype">string</span> space, <span class="keywordtype">bool</span> print_semi, <a name="l00720"></a>00720 <span class="keywordtype">bool</span> constraint_info, <span class="keywordtype">bool</span> constrained) <a name="l00721"></a>00721 { <a name="l00722"></a>00722 <span class="keywordflow">if</span> (constrained && !<a class="code" href="classlibdap_1_1BaseType.html#a980c0013817836aa77ef74aeec7fb192" title="Should this variable be sent?">send_p</a>()) <a name="l00723"></a>00723 <span class="keywordflow">return</span>; <a name="l00724"></a>00724 <a name="l00725"></a>00725 <span class="comment">// The problem with the above is that if two Grids are projected and each</span> <a name="l00726"></a>00726 <span class="comment">// contain one variable, say a map, and it happens to have the same name</span> <a name="l00727"></a>00727 <span class="comment">// in each Grid, then without the enclosing Structures, the returned dataset</span> <a name="l00728"></a>00728 <span class="comment">// has two variables with the same name at the same lexical level. So I'm</span> <a name="l00729"></a>00729 <span class="comment">// removing the code above.</span> <a name="l00730"></a>00730 <span class="keywordflow">if</span> (constrained && !<a class="code" href="classlibdap_1_1Grid.html#aa737cef63a1b9c8b8b0952fcb22a621b">projection_yields_grid</a>()) { <a name="l00731"></a>00731 fprintf(out, <span class="stringliteral">"%sStructure {\n"</span>, space.c_str()) ; <a name="l00732"></a>00732 <a name="l00733"></a>00733 _array_var-><a class="code" href="classlibdap_1_1BaseType.html#afd744b0ddeb04e7b173c9e83423ec572" title="Print an ASCII representation of the variable structure.">print_decl</a>(out, space + <span class="stringliteral">" "</span>, <span class="keyword">true</span>, constraint_info, <a name="l00734"></a>00734 constrained); <a name="l00735"></a>00735 <a name="l00736"></a>00736 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#ad147322e168c6750893b6913d7f3edc5">Map_citer</a> i = _map_vars.begin(); i != _map_vars.end(); i++) { <a name="l00737"></a>00737 (*i)->print_decl(out, space + <span class="stringliteral">" "</span>, <span class="keyword">true</span>, <a name="l00738"></a>00738 constraint_info, constrained); <a name="l00739"></a>00739 } <a name="l00740"></a>00740 <a name="l00741"></a>00741 fprintf(out, <span class="stringliteral">"%s} %s"</span>, space.c_str(), <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>()).c_str()) ; <a name="l00742"></a>00742 } <a name="l00743"></a>00743 <span class="keywordflow">else</span> { <a name="l00744"></a>00744 <span class="comment">// The number of elements in the (projected) Grid must be such that</span> <a name="l00745"></a>00745 <span class="comment">// we have a valid Grid object; send it as such.</span> <a name="l00746"></a>00746 fprintf(out, <span class="stringliteral">"%s%s {\n"</span>, space.c_str(), <a class="code" href="classlibdap_1_1BaseType.html#ac4461c9e287b167871acade5e5472116" title="Returns the type of the class instance as a string.">type_name</a>().c_str()) ; <a name="l00747"></a>00747 <a name="l00748"></a>00748 fprintf(out, <span class="stringliteral">"%s Array:\n"</span>, space.c_str()) ; <a name="l00749"></a>00749 _array_var->print_decl(out, space + <span class="stringliteral">" "</span>, <span class="keyword">true</span>, constraint_info, <a name="l00750"></a>00750 constrained); <a name="l00751"></a>00751 <a name="l00752"></a>00752 fprintf(out, <span class="stringliteral">"%s Maps:\n"</span>, space.c_str()) ; <a name="l00753"></a>00753 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#ad147322e168c6750893b6913d7f3edc5">Map_citer</a> i = _map_vars.begin(); i != _map_vars.end(); i++) { <a name="l00754"></a>00754 (*i)->print_decl(out, space + <span class="stringliteral">" "</span>, <span class="keyword">true</span>, <a name="l00755"></a>00755 constraint_info, constrained); <a name="l00756"></a>00756 } <a name="l00757"></a>00757 <a name="l00758"></a>00758 fprintf(out, <span class="stringliteral">"%s} %s"</span>, space.c_str(), <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>()).c_str()) ; <a name="l00759"></a>00759 } <a name="l00760"></a>00760 <a name="l00761"></a>00761 <span class="keywordflow">if</span> (constraint_info) { <a name="l00762"></a>00762 <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1BaseType.html#a980c0013817836aa77ef74aeec7fb192" title="Should this variable be sent?">send_p</a>()) <a name="l00763"></a>00763 fprintf( out, <span class="stringliteral">": Send True"</span>); <a name="l00764"></a>00764 <span class="keywordflow">else</span> <a name="l00765"></a>00765 fprintf( out, <span class="stringliteral">": Send False"</span>); <a name="l00766"></a>00766 } <a name="l00767"></a>00767 <a name="l00768"></a>00768 <span class="keywordflow">if</span> (print_semi) <a name="l00769"></a>00769 fprintf(out, <span class="stringliteral">";\n"</span>) ; <a name="l00770"></a>00770 <a name="l00771"></a>00771 <span class="keywordflow">return</span>; <a name="l00772"></a>00772 } <a name="l00773"></a>00773 <span class="preprocessor">#endif</span> <a name="l00774"></a>00774 <span class="preprocessor"></span> <a name="l00775"></a>00775 <span class="keywordtype">void</span> <a name="l00776"></a><a class="code" href="classlibdap_1_1Grid.html#a5a239b053928636e13e3a478faf8e334">00776</a> <a class="code" href="classlibdap_1_1Grid.html#a5a239b053928636e13e3a478faf8e334" title="Print an ASCII representation of the variable structure.">Grid::print_decl</a>(ostream &out, <span class="keywordtype">string</span> space, <span class="keywordtype">bool</span> print_semi, <a name="l00777"></a>00777 <span class="keywordtype">bool</span> constraint_info, <span class="keywordtype">bool</span> constrained) <a name="l00778"></a>00778 { <a name="l00779"></a>00779 <span class="keywordflow">if</span> (constrained && !<a class="code" href="classlibdap_1_1BaseType.html#a980c0013817836aa77ef74aeec7fb192" title="Should this variable be sent?">send_p</a>()) <a name="l00780"></a>00780 <span class="keywordflow">return</span>; <a name="l00781"></a>00781 <a name="l00782"></a>00782 <span class="comment">// See comment for the FILE* version of this method.</span> <a name="l00783"></a>00783 <span class="keywordflow">if</span> (constrained && !<a class="code" href="classlibdap_1_1Grid.html#aa737cef63a1b9c8b8b0952fcb22a621b">projection_yields_grid</a>()) { <a name="l00784"></a>00784 out << space << <span class="stringliteral">"Structure {\n"</span> ; <a name="l00785"></a>00785 <a name="l00786"></a>00786 _array_var-><a class="code" href="classlibdap_1_1BaseType.html#afd744b0ddeb04e7b173c9e83423ec572" title="Print an ASCII representation of the variable structure.">print_decl</a>(out, space + <span class="stringliteral">" "</span>, <span class="keyword">true</span>, constraint_info, <a name="l00787"></a>00787 constrained); <a name="l00788"></a>00788 <a name="l00789"></a>00789 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#ad147322e168c6750893b6913d7f3edc5">Map_citer</a> i = _map_vars.begin(); i != _map_vars.end(); i++) { <a name="l00790"></a>00790 (*i)->print_decl(out, space + <span class="stringliteral">" "</span>, <span class="keyword">true</span>, <a name="l00791"></a>00791 constraint_info, constrained); <a name="l00792"></a>00792 } <a name="l00793"></a>00793 <a name="l00794"></a>00794 out << space << <span class="stringliteral">"} "</span> << <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>()) ; <a name="l00795"></a>00795 } <a name="l00796"></a>00796 <span class="keywordflow">else</span> { <a name="l00797"></a>00797 <span class="comment">// The number of elements in the (projected) Grid must be such that</span> <a name="l00798"></a>00798 <span class="comment">// we have a valid Grid object; send it as such.</span> <a name="l00799"></a>00799 out << space << <a class="code" href="classlibdap_1_1BaseType.html#ac4461c9e287b167871acade5e5472116" title="Returns the type of the class instance as a string.">type_name</a>() << <span class="stringliteral">" {\n"</span> ; <a name="l00800"></a>00800 <a name="l00801"></a>00801 out << space << <span class="stringliteral">" Array:\n"</span> ; <a name="l00802"></a>00802 _array_var-><a class="code" href="classlibdap_1_1BaseType.html#afd744b0ddeb04e7b173c9e83423ec572" title="Print an ASCII representation of the variable structure.">print_decl</a>(out, space + <span class="stringliteral">" "</span>, <span class="keyword">true</span>, constraint_info, <a name="l00803"></a>00803 constrained); <a name="l00804"></a>00804 <a name="l00805"></a>00805 out << space << <span class="stringliteral">" Maps:\n"</span> ; <a name="l00806"></a>00806 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#ad147322e168c6750893b6913d7f3edc5">Map_citer</a> i = _map_vars.begin(); i != _map_vars.end(); i++) { <a name="l00807"></a>00807 (*i)->print_decl(out, space + <span class="stringliteral">" "</span>, <span class="keyword">true</span>, <a name="l00808"></a>00808 constraint_info, constrained); <a name="l00809"></a>00809 } <a name="l00810"></a>00810 <a name="l00811"></a>00811 out << space << <span class="stringliteral">"} "</span> << <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>()) ; <a name="l00812"></a>00812 } <a name="l00813"></a>00813 <a name="l00814"></a>00814 <span class="keywordflow">if</span> (constraint_info) { <a name="l00815"></a>00815 <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1BaseType.html#a980c0013817836aa77ef74aeec7fb192" title="Should this variable be sent?">send_p</a>()) <a name="l00816"></a>00816 out << <span class="stringliteral">": Send True"</span>; <a name="l00817"></a>00817 <span class="keywordflow">else</span> <a name="l00818"></a>00818 out << <span class="stringliteral">": Send False"</span>; <a name="l00819"></a>00819 } <a name="l00820"></a>00820 <a name="l00821"></a>00821 <span class="keywordflow">if</span> (print_semi) <a name="l00822"></a>00822 out << <span class="stringliteral">";\n"</span> ; <a name="l00823"></a>00823 <a name="l00824"></a>00824 <span class="keywordflow">return</span>; <a name="l00825"></a>00825 } <a name="l00826"></a>00826 <a name="l00827"></a>00827 <span class="preprocessor">#if FILE_METHODS</span> <a name="l00828"></a>00828 <span class="preprocessor"></span><span class="keyword">class </span>PrintMapField : <span class="keyword">public</span> unary_function<BaseType *, void> <a name="l00829"></a>00829 { <a name="l00830"></a>00830 FILE *d_out; <a name="l00831"></a>00831 <span class="keywordtype">string</span> d_space; <a name="l00832"></a>00832 <span class="keywordtype">bool</span> d_constrained; <a name="l00833"></a>00833 <span class="keywordtype">string</span> d_tag; <a name="l00834"></a>00834 <span class="keyword">public</span>: <a name="l00835"></a>00835 PrintMapField(FILE *o, <span class="keywordtype">string</span> s, <span class="keywordtype">bool</span> c, <span class="keyword">const</span> <span class="keywordtype">string</span> &t = <span class="stringliteral">"Map"</span>) <a name="l00836"></a>00836 : d_out(o), d_space(s), d_constrained(c), d_tag(t) <a name="l00837"></a>00837 {} <a name="l00838"></a>00838 <a name="l00839"></a>00839 <span class="keywordtype">void</span> operator()(BaseType *btp) <a name="l00840"></a>00840 { <a name="l00841"></a>00841 Array *a = <span class="keyword">dynamic_cast<</span>Array*<span class="keyword">></span>(btp); <a name="l00842"></a>00842 <span class="keywordflow">if</span> (!a) <a name="l00843"></a>00843 <span class="keywordflow">throw</span> InternalErr(__FILE__, __LINE__, <span class="stringliteral">"Expected an Array."</span>); <a name="l00844"></a>00844 a->print_xml_core(d_out, d_space, d_constrained, d_tag); <a name="l00845"></a>00845 } <a name="l00846"></a>00846 }; <a name="l00847"></a>00847 <a name="l00848"></a>00848 <span class="keywordtype">void</span> <a name="l00849"></a>00849 <a class="code" href="classlibdap_1_1Grid.html#a29d53347639f843c164f19e3a3f19b7d">Grid::print_xml</a>(FILE *out, <span class="keywordtype">string</span> space, <span class="keywordtype">bool</span> constrained) <a name="l00850"></a>00850 { <a name="l00851"></a>00851 <span class="keywordflow">if</span> (constrained && !<a class="code" href="classlibdap_1_1BaseType.html#a980c0013817836aa77ef74aeec7fb192" title="Should this variable be sent?">send_p</a>()) <a name="l00852"></a>00852 <span class="keywordflow">return</span>; <a name="l00853"></a>00853 <a name="l00854"></a>00854 <span class="keywordflow">if</span> (constrained && !<a class="code" href="classlibdap_1_1Grid.html#aa737cef63a1b9c8b8b0952fcb22a621b">projection_yields_grid</a>()) { <a name="l00855"></a>00855 fprintf(out, <span class="stringliteral">"%s<Structure"</span>, space.c_str()); <a name="l00856"></a>00856 <span class="keywordflow">if</span> (!<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>().empty()) <a name="l00857"></a>00857 fprintf(out, <span class="stringliteral">" name=\"%s\""</span>, <a class="code" href="namespacelibdap.html#a62463a13bf510db3a14c0053fea14f4d">id2xml</a>(<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>()).c_str()); <a name="l00858"></a>00858 <a name="l00859"></a>00859 fprintf(out, <span class="stringliteral">">\n"</span>); <a name="l00860"></a>00860 <a name="l00861"></a>00861 <a class="code" href="classlibdap_1_1BaseType.html#a1fcd9537c67e3bf88964b2656ff5bac1">get_attr_table</a>().print_xml(out, space + <span class="stringliteral">" "</span>, constrained); <a name="l00862"></a>00862 <a name="l00863"></a>00863 <a class="code" href="classlibdap_1_1Grid.html#a905ac86a44a9d8ce576056ba244cf558" title="Returns the Grid Array. This method returns the array using an Array*, so no cast is required...">get_array</a>()->print_xml(out, space + <span class="stringliteral">" "</span>, constrained); <a name="l00864"></a>00864 <a name="l00865"></a>00865 for_each(<a class="code" href="classlibdap_1_1Grid.html#a2e9d2e436c0ff138a977dbba54c018eb" title="Returns an iterator referencing the first Map vector.">map_begin</a>(), <a class="code" href="classlibdap_1_1Grid.html#aaebbf2a5329ec01b6527b4bafde87837">map_end</a>(), <a name="l00866"></a>00866 PrintMapField(out, space + <span class="stringliteral">" "</span>, constrained, <span class="stringliteral">"Array"</span>)); <a name="l00867"></a>00867 <a name="l00868"></a>00868 fprintf(out, <span class="stringliteral">"%s</Structure>\n"</span>, space.c_str()); <a name="l00869"></a>00869 } <a name="l00870"></a>00870 <span class="keywordflow">else</span> { <a name="l00871"></a>00871 <span class="comment">// The number of elements in the (projected) Grid must be such that</span> <a name="l00872"></a>00872 <span class="comment">// we have a valid Grid object; send it as such.</span> <a name="l00873"></a>00873 fprintf(out, <span class="stringliteral">"%s<Grid"</span>, space.c_str()); <a name="l00874"></a>00874 <span class="keywordflow">if</span> (!<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>().empty()) <a name="l00875"></a>00875 fprintf(out, <span class="stringliteral">" name=\"%s\""</span>, <a class="code" href="namespacelibdap.html#a62463a13bf510db3a14c0053fea14f4d">id2xml</a>(<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>()).c_str()); <a name="l00876"></a>00876 <a name="l00877"></a>00877 fprintf(out, <span class="stringliteral">">\n"</span>); <a name="l00878"></a>00878 <a name="l00879"></a>00879 <a class="code" href="classlibdap_1_1BaseType.html#a1fcd9537c67e3bf88964b2656ff5bac1">get_attr_table</a>().print_xml(out, space + <span class="stringliteral">" "</span>, constrained); <a name="l00880"></a>00880 <a name="l00881"></a>00881 <a class="code" href="classlibdap_1_1Grid.html#a905ac86a44a9d8ce576056ba244cf558" title="Returns the Grid Array. This method returns the array using an Array*, so no cast is required...">get_array</a>()->print_xml(out, space + <span class="stringliteral">" "</span>, constrained); <a name="l00882"></a>00882 <a name="l00883"></a>00883 for_each(<a class="code" href="classlibdap_1_1Grid.html#a2e9d2e436c0ff138a977dbba54c018eb" title="Returns an iterator referencing the first Map vector.">map_begin</a>(), <a class="code" href="classlibdap_1_1Grid.html#aaebbf2a5329ec01b6527b4bafde87837">map_end</a>(), <a name="l00884"></a>00884 PrintMapField(out, space + <span class="stringliteral">" "</span>, constrained)); <a name="l00885"></a>00885 <a name="l00886"></a>00886 fprintf(out, <span class="stringliteral">"%s</Grid>\n"</span>, space.c_str()); <a name="l00887"></a>00887 } <a name="l00888"></a>00888 } <a name="l00889"></a>00889 <span class="preprocessor">#endif</span> <a name="l00890"></a>00890 <span class="preprocessor"></span> <a name="l00891"></a>00891 <span class="keyword">class </span>PrintMapFieldStrm : <span class="keyword">public</span> unary_function<BaseType *, void> <a name="l00892"></a>00892 { <a name="l00893"></a>00893 ostream &d_out; <a name="l00894"></a>00894 <span class="keywordtype">string</span> d_space; <a name="l00895"></a>00895 <span class="keywordtype">bool</span> d_constrained; <a name="l00896"></a>00896 <span class="keywordtype">string</span> d_tag; <a name="l00897"></a>00897 <span class="keyword">public</span>: <a name="l00898"></a>00898 PrintMapFieldStrm(ostream &o, <span class="keywordtype">string</span> s, <span class="keywordtype">bool</span> c, <span class="keyword">const</span> <span class="keywordtype">string</span> &t = <span class="stringliteral">"Map"</span>) <a name="l00899"></a>00899 : d_out(o), d_space(s), d_constrained(c), d_tag(t) <a name="l00900"></a>00900 {} <a name="l00901"></a>00901 <a name="l00902"></a>00902 <span class="keywordtype">void</span> operator()(BaseType *btp) <a name="l00903"></a>00903 { <a name="l00904"></a>00904 Array *a = <span class="keyword">dynamic_cast<</span>Array*<span class="keyword">></span>(btp); <a name="l00905"></a>00905 <span class="keywordflow">if</span> (!a) <a name="l00906"></a>00906 <span class="keywordflow">throw</span> InternalErr(__FILE__, __LINE__, <span class="stringliteral">"Expected an Array."</span>); <a name="l00907"></a>00907 a->print_xml_core(d_out, d_space, d_constrained, d_tag); <a name="l00908"></a>00908 } <a name="l00909"></a>00909 }; <a name="l00910"></a>00910 <a name="l00911"></a>00911 <span class="keywordtype">void</span> <a name="l00912"></a><a class="code" href="classlibdap_1_1Grid.html#a29d53347639f843c164f19e3a3f19b7d">00912</a> <a class="code" href="classlibdap_1_1Grid.html#a29d53347639f843c164f19e3a3f19b7d">Grid::print_xml</a>(ostream &out, <span class="keywordtype">string</span> space, <span class="keywordtype">bool</span> constrained) <a name="l00913"></a>00913 { <a name="l00914"></a>00914 <span class="keywordflow">if</span> (constrained && !<a class="code" href="classlibdap_1_1BaseType.html#a980c0013817836aa77ef74aeec7fb192" title="Should this variable be sent?">send_p</a>()) <a name="l00915"></a>00915 <span class="keywordflow">return</span>; <a name="l00916"></a>00916 <a name="l00917"></a>00917 <span class="keywordflow">if</span> (constrained && !<a class="code" href="classlibdap_1_1Grid.html#aa737cef63a1b9c8b8b0952fcb22a621b">projection_yields_grid</a>()) { <a name="l00918"></a>00918 out << space << <span class="stringliteral">"<Structure"</span> ; <a name="l00919"></a>00919 <span class="keywordflow">if</span> (!<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>().empty()) <a name="l00920"></a>00920 out << <span class="stringliteral">" name=\""</span> << <a class="code" href="namespacelibdap.html#a62463a13bf510db3a14c0053fea14f4d">id2xml</a>(<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>()) << <span class="stringliteral">"\""</span> ; <a name="l00921"></a>00921 <a name="l00922"></a>00922 out << <span class="stringliteral">">\n"</span> ; <a name="l00923"></a>00923 <a name="l00924"></a>00924 <a class="code" href="classlibdap_1_1BaseType.html#a1fcd9537c67e3bf88964b2656ff5bac1">get_attr_table</a>().<a class="code" href="classlibdap_1_1AttrTable.html#a5e27ea09f83831eded1b3d86de7f4534">print_xml</a>(out, space + <span class="stringliteral">" "</span>, constrained); <a name="l00925"></a>00925 <a name="l00926"></a>00926 <a class="code" href="classlibdap_1_1Grid.html#a905ac86a44a9d8ce576056ba244cf558" title="Returns the Grid Array. This method returns the array using an Array*, so no cast is required...">get_array</a>()-><a class="code" href="classlibdap_1_1Array.html#a3ce1bd161426e6950dc97511f33b2845">print_xml</a>(out, space + <span class="stringliteral">" "</span>, constrained); <a name="l00927"></a>00927 <a name="l00928"></a>00928 for_each(<a class="code" href="classlibdap_1_1Grid.html#a2e9d2e436c0ff138a977dbba54c018eb" title="Returns an iterator referencing the first Map vector.">map_begin</a>(), <a class="code" href="classlibdap_1_1Grid.html#aaebbf2a5329ec01b6527b4bafde87837">map_end</a>(), <a name="l00929"></a>00929 PrintMapFieldStrm(out, space + <span class="stringliteral">" "</span>, constrained, <span class="stringliteral">"Array"</span>)); <a name="l00930"></a>00930 <a name="l00931"></a>00931 out << space << <span class="stringliteral">"</Structure>\n"</span> ; <a name="l00932"></a>00932 } <a name="l00933"></a>00933 <span class="keywordflow">else</span> { <a name="l00934"></a>00934 <span class="comment">// The number of elements in the (projected) Grid must be such that</span> <a name="l00935"></a>00935 <span class="comment">// we have a valid Grid object; send it as such.</span> <a name="l00936"></a>00936 out << space << <span class="stringliteral">"<Grid"</span> ; <a name="l00937"></a>00937 <span class="keywordflow">if</span> (!<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>().empty()) <a name="l00938"></a>00938 out << <span class="stringliteral">" name=\""</span> << <a class="code" href="namespacelibdap.html#a62463a13bf510db3a14c0053fea14f4d">id2xml</a>(<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>()) << <span class="stringliteral">"\""</span> ; <a name="l00939"></a>00939 <a name="l00940"></a>00940 out << <span class="stringliteral">">\n"</span> ; <a name="l00941"></a>00941 <a name="l00942"></a>00942 <a class="code" href="classlibdap_1_1BaseType.html#a1fcd9537c67e3bf88964b2656ff5bac1">get_attr_table</a>().<a class="code" href="classlibdap_1_1AttrTable.html#a5e27ea09f83831eded1b3d86de7f4534">print_xml</a>(out, space + <span class="stringliteral">" "</span>, constrained); <a name="l00943"></a>00943 <a name="l00944"></a>00944 <a class="code" href="classlibdap_1_1Grid.html#a905ac86a44a9d8ce576056ba244cf558" title="Returns the Grid Array. This method returns the array using an Array*, so no cast is required...">get_array</a>()-><a class="code" href="classlibdap_1_1Array.html#a3ce1bd161426e6950dc97511f33b2845">print_xml</a>(out, space + <span class="stringliteral">" "</span>, constrained); <a name="l00945"></a>00945 <a name="l00946"></a>00946 for_each(<a class="code" href="classlibdap_1_1Grid.html#a2e9d2e436c0ff138a977dbba54c018eb" title="Returns an iterator referencing the first Map vector.">map_begin</a>(), <a class="code" href="classlibdap_1_1Grid.html#aaebbf2a5329ec01b6527b4bafde87837">map_end</a>(), <a name="l00947"></a>00947 PrintMapFieldStrm(out, space + <span class="stringliteral">" "</span>, constrained)); <a name="l00948"></a>00948 <a name="l00949"></a>00949 out << space << <span class="stringliteral">"</Grid>\n"</span> ; <a name="l00950"></a>00950 } <a name="l00951"></a>00951 } <a name="l00952"></a>00952 <a name="l00953"></a>00953 <span class="preprocessor">#if FILE_METHODS</span> <a name="l00954"></a>00954 <span class="preprocessor"></span><span class="keywordtype">void</span> <a name="l00955"></a>00955 <a class="code" href="classlibdap_1_1Grid.html#a5322f6b5ce04e5d00347bf50b341f4e6" title="Prints the value of the variable.">Grid::print_val</a>(FILE *out, <span class="keywordtype">string</span> space, <span class="keywordtype">bool</span> print_decl_p) <a name="l00956"></a>00956 { <a name="l00957"></a>00957 <span class="keywordflow">if</span> (print_decl_p) { <a name="l00958"></a>00958 <a class="code" href="classlibdap_1_1Grid.html#a5a239b053928636e13e3a478faf8e334" title="Print an ASCII representation of the variable structure.">print_decl</a>(out, space, <span class="keyword">false</span>); <a name="l00959"></a>00959 fprintf(out, <span class="stringliteral">" = "</span>) ; <a name="l00960"></a>00960 } <a name="l00961"></a>00961 <a name="l00962"></a>00962 <span class="comment">// If we are printing a value on the client-side, projection_yields_grid</span> <a name="l00963"></a>00963 <span class="comment">// should not be called since we don't *have* a projection without a</span> <a name="l00964"></a>00964 <span class="comment">// contraint. I think that if we are here and send_p() is not true, then</span> <a name="l00965"></a>00965 <span class="comment">// the value of this function should be ignored. 4/6/2000 jhrg</span> <a name="l00966"></a>00966 <span class="keywordtype">bool</span> pyg = <a class="code" href="classlibdap_1_1Grid.html#aa737cef63a1b9c8b8b0952fcb22a621b">projection_yields_grid</a>(); <span class="comment">// hack 12/1/99 jhrg</span> <a name="l00967"></a>00967 <span class="keywordflow">if</span> (pyg || !<a class="code" href="classlibdap_1_1BaseType.html#a980c0013817836aa77ef74aeec7fb192" title="Should this variable be sent?">send_p</a>()) <a name="l00968"></a>00968 fprintf(out, <span class="stringliteral">"{ Array: "</span>) ; <a name="l00969"></a>00969 <span class="keywordflow">else</span> <a name="l00970"></a>00970 fprintf(out, <span class="stringliteral">"{"</span>) ; <a name="l00971"></a>00971 _array_var->print_val(out, <span class="stringliteral">""</span>, <span class="keyword">false</span>); <a name="l00972"></a>00972 <span class="keywordflow">if</span> (pyg || !<a class="code" href="classlibdap_1_1BaseType.html#a980c0013817836aa77ef74aeec7fb192" title="Should this variable be sent?">send_p</a>()) <a name="l00973"></a>00973 fprintf(out, <span class="stringliteral">" Maps: "</span>) ; <a name="l00974"></a>00974 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#ad147322e168c6750893b6913d7f3edc5">Map_citer</a> i = _map_vars.begin(); i != _map_vars.end(); <a name="l00975"></a>00975 i++, (void)(i != _map_vars.end() && fprintf(out, <span class="stringliteral">", "</span>))) { <a name="l00976"></a>00976 (*i)->print_val(out, <span class="stringliteral">""</span>, <span class="keyword">false</span>); <a name="l00977"></a>00977 } <a name="l00978"></a>00978 fprintf(out, <span class="stringliteral">" }"</span>) ; <a name="l00979"></a>00979 <a name="l00980"></a>00980 <span class="keywordflow">if</span> (print_decl_p) <a name="l00981"></a>00981 fprintf(out, <span class="stringliteral">";\n"</span>) ; <a name="l00982"></a>00982 } <a name="l00983"></a>00983 <span class="preprocessor">#endif</span> <a name="l00984"></a>00984 <span class="preprocessor"></span> <a name="l00985"></a>00985 <span class="keywordtype">void</span> <a name="l00986"></a><a class="code" href="classlibdap_1_1Grid.html#a5322f6b5ce04e5d00347bf50b341f4e6">00986</a> <a class="code" href="classlibdap_1_1Grid.html#a5322f6b5ce04e5d00347bf50b341f4e6" title="Prints the value of the variable.">Grid::print_val</a>(ostream &out, <span class="keywordtype">string</span> space, <span class="keywordtype">bool</span> print_decl_p) <a name="l00987"></a>00987 { <a name="l00988"></a>00988 <span class="keywordflow">if</span> (print_decl_p) { <a name="l00989"></a>00989 <a class="code" href="classlibdap_1_1Grid.html#a5a239b053928636e13e3a478faf8e334" title="Print an ASCII representation of the variable structure.">print_decl</a>(out, space, <span class="keyword">false</span>); <a name="l00990"></a>00990 out << <span class="stringliteral">" = "</span> ; <a name="l00991"></a>00991 } <a name="l00992"></a>00992 <a name="l00993"></a>00993 <span class="comment">// If we are printing a value on the client-side, projection_yields_grid</span> <a name="l00994"></a>00994 <span class="comment">// should not be called since we don't *have* a projection without a</span> <a name="l00995"></a>00995 <span class="comment">// Constraint. I think that if we are here and send_p() is not true, then</span> <a name="l00996"></a>00996 <span class="comment">// the value of this function should be ignored. 4/6/2000 jhrg</span> <a name="l00997"></a>00997 <span class="keywordtype">bool</span> pyg = <a class="code" href="classlibdap_1_1Grid.html#aa737cef63a1b9c8b8b0952fcb22a621b">projection_yields_grid</a>(); <span class="comment">// hack 12/1/99 jhrg</span> <a name="l00998"></a>00998 <span class="keywordflow">if</span> (pyg || !<a class="code" href="classlibdap_1_1BaseType.html#a980c0013817836aa77ef74aeec7fb192" title="Should this variable be sent?">send_p</a>()) <a name="l00999"></a>00999 out << <span class="stringliteral">"{ Array: "</span> ; <a name="l01000"></a>01000 <span class="keywordflow">else</span> <a name="l01001"></a>01001 out << <span class="stringliteral">"{"</span> ; <a name="l01002"></a>01002 _array_var-><a class="code" href="classlibdap_1_1BaseType.html#a94edd5b610afb1432144158740710488" title="Prints the value of the variable.">print_val</a>(out, <span class="stringliteral">""</span>, <span class="keyword">false</span>); <a name="l01003"></a>01003 <span class="keywordflow">if</span> (pyg || !<a class="code" href="classlibdap_1_1BaseType.html#a980c0013817836aa77ef74aeec7fb192" title="Should this variable be sent?">send_p</a>()) <a name="l01004"></a>01004 out << <span class="stringliteral">" Maps: "</span> ; <a name="l01005"></a>01005 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#ad147322e168c6750893b6913d7f3edc5">Map_citer</a> i = _map_vars.begin(); i != _map_vars.end(); <a name="l01006"></a>01006 i++, (void)(i != _map_vars.end() && out << <span class="stringliteral">", "</span>)) { <a name="l01007"></a>01007 (*i)->print_val(out, <span class="stringliteral">""</span>, <span class="keyword">false</span>); <a name="l01008"></a>01008 } <a name="l01009"></a>01009 out << <span class="stringliteral">" }"</span> ; <a name="l01010"></a>01010 <a name="l01011"></a>01011 <span class="keywordflow">if</span> (print_decl_p) <a name="l01012"></a>01012 out << <span class="stringliteral">";\n"</span> ; <a name="l01013"></a>01013 } <a name="l01014"></a>01014 <a name="l01015"></a>01015 <span class="comment">// Grids have ugly semantics.</span> <a name="l01016"></a>01016 <a name="l01021"></a>01021 <span class="keywordtype">bool</span> <a name="l01022"></a><a class="code" href="classlibdap_1_1Grid.html#ae66a262518b81ff354061528654fae75">01022</a> <a class="code" href="classlibdap_1_1Grid.html#ae66a262518b81ff354061528654fae75" title="Return true if this Grid is well formed.">Grid::check_semantics</a>(<span class="keywordtype">string</span> &msg, <span class="keywordtype">bool</span> all) <a name="l01023"></a>01023 { <a name="l01024"></a>01024 <span class="keywordflow">if</span> (!<a class="code" href="classlibdap_1_1BaseType.html#aec503abec2fd3090e7738c0a575491f8" title="Compare an object&#39;s current state with the semantics of its type.">BaseType::check_semantics</a>(msg)) <a name="l01025"></a>01025 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01026"></a>01026 <a name="l01027"></a>01027 msg = <span class="stringliteral">""</span>; <a name="l01028"></a>01028 <a name="l01029"></a>01029 <span class="keywordflow">if</span> (!_array_var) { <a name="l01030"></a>01030 msg += <span class="stringliteral">"Null grid base array in `"</span> + <a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() + <span class="stringliteral">"'\n"</span>; <a name="l01031"></a>01031 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01032"></a>01032 } <a name="l01033"></a>01033 <a name="l01034"></a>01034 <span class="comment">// Is it an array?</span> <a name="l01035"></a>01035 <span class="keywordflow">if</span> (_array_var-><a class="code" href="classlibdap_1_1BaseType.html#abc6b2d7099f00bb5f324ec129bff2a17" title="Returns the type of the class instance.">type</a>() != <a class="code" href="namespacelibdap.html#a05ca706d4539ae7b750c3bc7066ab6e6ada8f5df7bb2bc72327fcd16af811562f">dods_array_c</a>) { <a name="l01036"></a>01036 msg += <span class="stringliteral">"Grid `"</span> + <a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() + <span class="stringliteral">"'s' member `"</span> + _array_var-><a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() + <span class="stringliteral">"' must be an array\n"</span>; <a name="l01037"></a>01037 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01038"></a>01038 } <a name="l01039"></a>01039 <a name="l01040"></a>01040 <a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a> *av = (<a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a> *)_array_var; <span class="comment">// past test above, must be an array</span> <a name="l01041"></a>01041 <a name="l01042"></a>01042 <span class="comment">// Array must be of a simple_type.</span> <a name="l01043"></a>01043 <span class="keywordflow">if</span> (!av-><a class="code" href="classlibdap_1_1Vector.html#aa5ccb30d1f27ae587f35216b859feec7">var</a>()-><a class="code" href="classlibdap_1_1BaseType.html#a614ce462dc6236791630f373bf75ad49" title="Returns true if the instance is a numeric, string or URL type variable.">is_simple_type</a>()) { <a name="l01044"></a>01044 msg += <span class="stringliteral">"The field variable `"</span> + this-><a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() + <span class="stringliteral">"' must be an array of simple type elements (e.g., int32, String)\n"</span>; <a name="l01045"></a>01045 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01046"></a>01046 } <a name="l01047"></a>01047 <a name="l01048"></a>01048 <span class="comment">// enough maps?</span> <a name="l01049"></a>01049 <span class="keywordflow">if</span> ((<span class="keywordtype">unsigned</span>)_map_vars.size() != av-><a class="code" href="classlibdap_1_1Array.html#afa75d1ff3c75b8359d03b3f382bfd179" title="Return the total number of dimensions in the array.">dimensions</a>()) { <a name="l01050"></a>01050 msg += <span class="stringliteral">"The number of map variables for grid `"</span> + this-><a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() + <span class="stringliteral">"' does not match the number of dimensions of `"</span>; <a name="l01051"></a>01051 msg += av-><a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() + <span class="stringliteral">"'\n"</span>; <a name="l01052"></a>01052 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01053"></a>01053 } <a name="l01054"></a>01054 <a name="l01055"></a>01055 <span class="keyword">const</span> <span class="keywordtype">string</span> array_var_name = av-><a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>(); <a name="l01056"></a>01056 <a class="code" href="classlibdap_1_1Array.html#a7a557c05085a83d1501dbfa249d3cc52">Array::Dim_iter</a> asi = av-><a class="code" href="classlibdap_1_1Array.html#ae6e6943cd895fa8dc1c58621ffad42a0">dim_begin</a>() ; <a name="l01057"></a>01057 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> mvi = _map_vars.begin(); <a name="l01058"></a>01058 mvi != _map_vars.end(); mvi++, asi++) { <a name="l01059"></a>01059 <a name="l01060"></a>01060 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *mv = *mvi; <a name="l01061"></a>01061 <a name="l01062"></a>01062 <span class="comment">// check names</span> <a name="l01063"></a>01063 <span class="keywordflow">if</span> (array_var_name == mv-><a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>()) { <a name="l01064"></a>01064 msg += <span class="stringliteral">"Grid map variable `"</span> + mv-><a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() + <span class="stringliteral">"' conflicts with the grid array name in grid `"</span> + <a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() + <span class="stringliteral">"'\n"</span>; <a name="l01065"></a>01065 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01066"></a>01066 } <a name="l01067"></a>01067 <span class="comment">// check types</span> <a name="l01068"></a>01068 <span class="keywordflow">if</span> (mv-><a class="code" href="classlibdap_1_1BaseType.html#abc6b2d7099f00bb5f324ec129bff2a17" title="Returns the type of the class instance.">type</a>() != <a class="code" href="namespacelibdap.html#a05ca706d4539ae7b750c3bc7066ab6e6ada8f5df7bb2bc72327fcd16af811562f">dods_array_c</a>) { <a name="l01069"></a>01069 msg += <span class="stringliteral">"Grid map variable `"</span> + mv-><a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() + <span class="stringliteral">"' is not an array\n"</span>; <a name="l01070"></a>01070 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01071"></a>01071 } <a name="l01072"></a>01072 <a name="l01073"></a>01073 <a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a> *mv_a = (<a class="code" href="classlibdap_1_1Array.html" title="A multidimensional array of identical data types.">Array</a> *)mv; <span class="comment">// downcast to (Array *)</span> <a name="l01074"></a>01074 <a name="l01075"></a>01075 <span class="comment">// Array must be of a simple_type.</span> <a name="l01076"></a>01076 <span class="keywordflow">if</span> (!mv_a-><a class="code" href="classlibdap_1_1Vector.html#aa5ccb30d1f27ae587f35216b859feec7">var</a>()-><a class="code" href="classlibdap_1_1BaseType.html#a614ce462dc6236791630f373bf75ad49" title="Returns true if the instance is a numeric, string or URL type variable.">is_simple_type</a>()) { <a name="l01077"></a>01077 msg += <span class="stringliteral">"The field variable `"</span> + this-><a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() + <span class="stringliteral">"' must be an array of simple type elements (e.g., int32, String)\n"</span>; <a name="l01078"></a>01078 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01079"></a>01079 } <a name="l01080"></a>01080 <a name="l01081"></a>01081 <span class="comment">// check shape</span> <a name="l01082"></a>01082 <span class="keywordflow">if</span> (mv_a-><a class="code" href="classlibdap_1_1Array.html#afa75d1ff3c75b8359d03b3f382bfd179" title="Return the total number of dimensions in the array.">dimensions</a>() != 1) {<span class="comment">// maps must have one dimension</span> <a name="l01083"></a>01083 msg += <span class="stringliteral">"Grid map variable `"</span> + mv_a-><a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() + <span class="stringliteral">"' must be only one dimension\n"</span>; <a name="l01084"></a>01084 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01085"></a>01085 } <a name="l01086"></a>01086 <span class="comment">// size of map must match corresponding array dimension</span> <a name="l01087"></a>01087 <a class="code" href="classlibdap_1_1Array.html#a7a557c05085a83d1501dbfa249d3cc52">Array::Dim_iter</a> mv_asi = mv_a-><a class="code" href="classlibdap_1_1Array.html#ae6e6943cd895fa8dc1c58621ffad42a0">dim_begin</a>() ; <a name="l01088"></a>01088 <span class="keywordtype">int</span> mv_a_size = mv_a-><a class="code" href="classlibdap_1_1Array.html#a8f29497af9c33c0d66939d5f9a16d92a" title="Returns the size of the dimension.">dimension_size</a>(mv_asi) ; <a name="l01089"></a>01089 <span class="keywordtype">int</span> av_size = av-><a class="code" href="classlibdap_1_1Array.html#a8f29497af9c33c0d66939d5f9a16d92a" title="Returns the size of the dimension.">dimension_size</a>(asi) ; <a name="l01090"></a>01090 <span class="keywordflow">if</span> (mv_a_size != av_size) { <a name="l01091"></a>01091 msg += <span class="stringliteral">"Grid map variable `"</span> + mv_a-><a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() + <span class="stringliteral">"'s' size does not match the size of array variable '"</span>; <a name="l01092"></a>01092 msg += _array_var-><a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() + <span class="stringliteral">"'s' cooresponding dimension\n"</span>; <a name="l01093"></a>01093 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01094"></a>01094 } <a name="l01095"></a>01095 } <a name="l01096"></a>01096 <a name="l01097"></a>01097 <span class="keywordflow">if</span> (all) { <a name="l01098"></a>01098 <span class="keywordflow">if</span> (!_array_var-><a class="code" href="classlibdap_1_1BaseType.html#aec503abec2fd3090e7738c0a575491f8" title="Compare an object&#39;s current state with the semantics of its type.">check_semantics</a>(msg, <span class="keyword">true</span>)) <a name="l01099"></a>01099 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01100"></a>01100 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Grid.html#a69ee284e8087d1482373989f3256f95d">Map_iter</a> mvi = _map_vars.begin(); mvi != _map_vars.end(); mvi++) { <a name="l01101"></a>01101 <span class="keywordflow">if</span> (!(*mvi)->check_semantics(msg, <span class="keyword">true</span>)) { <a name="l01102"></a>01102 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01103"></a>01103 } <a name="l01104"></a>01104 } <a name="l01105"></a>01105 } <a name="l01106"></a>01106 <a name="l01107"></a>01107 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l01108"></a>01108 } <a name="l01109"></a>01109 <a name="l01118"></a>01118 <span class="keywordtype">void</span> <a name="l01119"></a><a class="code" href="classlibdap_1_1Grid.html#a1ebdcb9b7a3844582c543acaf20cc07c">01119</a> <a class="code" href="classlibdap_1_1Grid.html#a1ebdcb9b7a3844582c543acaf20cc07c" title="dumps information about this object">Grid::dump</a>(ostream &strm)<span class="keyword"> const</span> <a name="l01120"></a>01120 <span class="keyword"></span>{ <a name="l01121"></a>01121 strm << <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"Grid::dump - ("</span> <a name="l01122"></a>01122 << (<span class="keywordtype">void</span> *)<span class="keyword">this</span> << <span class="stringliteral">")"</span> << endl ; <a name="l01123"></a>01123 <a class="code" href="classlibdap_1_1DapIndent.html#a4ed2cce66dbff9ad4320e89142103c6c">DapIndent::Indent</a>() ; <a name="l01124"></a>01124 <a class="code" href="classlibdap_1_1Grid.html#a1ebdcb9b7a3844582c543acaf20cc07c" title="dumps information about this object">Constructor::dump</a>(strm) ; <a name="l01125"></a>01125 <span class="keywordflow">if</span> (_array_var) { <a name="l01126"></a>01126 strm << <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"array var: "</span> << endl ; <a name="l01127"></a>01127 DapIndent::Indent() ; <a name="l01128"></a>01128 _array_var-><a class="code" href="classlibdap_1_1BaseType.html#a1ecd80ca994b950bd19b5f525fa4c7a2" title="dumps information about this object">dump</a>(strm) ; <a name="l01129"></a>01129 <a class="code" href="classlibdap_1_1DapIndent.html#a65c519d0916b031bcf60ca8d26fc82f8">DapIndent::UnIndent</a>() ; <a name="l01130"></a>01130 } <a name="l01131"></a>01131 <span class="keywordflow">else</span> { <a name="l01132"></a>01132 strm << <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"array var: null"</span> << endl ; <a name="l01133"></a>01133 } <a name="l01134"></a>01134 strm << <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"map var: "</span> << endl ; <a name="l01135"></a>01135 DapIndent::Indent() ; <a name="l01136"></a>01136 <a class="code" href="classlibdap_1_1Grid.html#ad147322e168c6750893b6913d7f3edc5">Map_citer</a> i = _map_vars.begin() ; <a name="l01137"></a>01137 <a class="code" href="classlibdap_1_1Grid.html#ad147322e168c6750893b6913d7f3edc5">Map_citer</a> ie = _map_vars.end() ; <a name="l01138"></a>01138 <span class="keywordflow">for</span> (; i != ie; i++) { <a name="l01139"></a>01139 (*i)->dump(strm) ; <a name="l01140"></a>01140 } <a name="l01141"></a>01141 <a class="code" href="classlibdap_1_1DapIndent.html#a65c519d0916b031bcf60ca8d26fc82f8">DapIndent::UnIndent</a>() ; <a name="l01142"></a>01142 <a class="code" href="classlibdap_1_1DapIndent.html#a65c519d0916b031bcf60ca8d26fc82f8">DapIndent::UnIndent</a>() ; <a name="l01143"></a>01143 } <a name="l01144"></a>01144 <a name="l01145"></a>01145 } <span class="comment">// namespace libdap</span> <a name="l01146"></a>01146 </pre></div></div> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="Grid_8cc.html">Grid.cc</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>