Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > c9cfbd1355daacaf3b34517a6d7b18cc > files > 96

libdap-doc-3.11.0-2.fc15.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>libdap++: DDS.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++&#160;<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&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;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&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;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('DDS_8cc.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<h1>DDS.cc</h1>  </div>
</div>
<div class="contents">
<a href="DDS_8cc.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// -*- mode: c++; c-basic-offset:4 -*-</span>
<a name="l00002"></a>00002 
<a name="l00003"></a>00003 <span class="comment">// This file is part of libdap, A C++ implementation of the OPeNDAP Data</span>
<a name="l00004"></a>00004 <span class="comment">// Access Protocol.</span>
<a name="l00005"></a>00005 
<a name="l00006"></a>00006 <span class="comment">// Copyright (c) 2002,2003 OPeNDAP, Inc.</span>
<a name="l00007"></a>00007 <span class="comment">// Author: James Gallagher &lt;jgallagher@opendap.org&gt;</span>
<a name="l00008"></a>00008 <span class="comment">//</span>
<a name="l00009"></a>00009 <span class="comment">// This library is free software; you can redistribute it and/or</span>
<a name="l00010"></a>00010 <span class="comment">// modify it under the terms of the GNU Lesser General Public</span>
<a name="l00011"></a>00011 <span class="comment">// License as published by the Free Software Foundation; either</span>
<a name="l00012"></a>00012 <span class="comment">// version 2.1 of the License, or (at your option) any later version.</span>
<a name="l00013"></a>00013 <span class="comment">//</span>
<a name="l00014"></a>00014 <span class="comment">// This library is distributed in the hope that it will be useful,</span>
<a name="l00015"></a>00015 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00016"></a>00016 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00017"></a>00017 <span class="comment">// Lesser General Public License for more details.</span>
<a name="l00018"></a>00018 <span class="comment">//</span>
<a name="l00019"></a>00019 <span class="comment">// You should have received a copy of the GNU Lesser General Public</span>
<a name="l00020"></a>00020 <span class="comment">// License along with this library; if not, write to the Free Software</span>
<a name="l00021"></a>00021 <span class="comment">// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</span>
<a name="l00022"></a>00022 <span class="comment">//</span>
<a name="l00023"></a>00023 <span class="comment">// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="comment">// (c) COPYRIGHT URI/MIT 1994-1999</span>
<a name="l00026"></a>00026 <span class="comment">// Please read the full copyright statement in the file COPYRIGHT_URI.</span>
<a name="l00027"></a>00027 <span class="comment">//</span>
<a name="l00028"></a>00028 <span class="comment">// Authors:</span>
<a name="l00029"></a>00029 <span class="comment">//      jhrg,jimg       James Gallagher &lt;jgallagher@gso.uri.edu&gt;</span>
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="comment">//</span>
<a name="l00032"></a>00032 <span class="comment">// jhrg 9/7/94</span>
<a name="l00033"></a>00033 
<a name="l00034"></a>00034 <span class="preprocessor">#include &quot;<a class="code" href="config_8h.html">config.h</a>&quot;</span>
<a name="l00035"></a>00035 
<a name="l00036"></a>00036 <span class="keyword">static</span> <span class="keywordtype">char</span> rcsid[] <a class="code" href="config_8h.html#a05e109ec893d0b12023d5b0cf4f718c4">not_used</a> =
<a name="l00037"></a>00037     {<span class="stringliteral">&quot;$Id: DDS.cc 23577 2010-09-14 22:20:18Z jimg $&quot;</span>
<a name="l00038"></a>00038     };
<a name="l00039"></a>00039 
<a name="l00040"></a>00040 <span class="preprocessor">#include &lt;cstdio&gt;</span>
<a name="l00041"></a>00041 <span class="preprocessor">#include &lt;sys/types.h&gt;</span>
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 <span class="preprocessor">#ifdef WIN32</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor">#include &lt;io.h&gt;</span>
<a name="l00045"></a>00045 <span class="preprocessor">#include &lt;process.h&gt;</span>
<a name="l00046"></a>00046 <span class="preprocessor">#include &lt;fstream&gt;</span>
<a name="l00047"></a>00047 <span class="preprocessor">#else</span>
<a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor">#include &lt;unistd.h&gt;</span>    <span class="comment">// for alarm and dup</span>
<a name="l00049"></a>00049 <span class="preprocessor">#include &lt;sys/wait.h&gt;</span>
<a name="l00050"></a>00050 <span class="preprocessor">#endif</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span>
<a name="l00052"></a>00052 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00053"></a>00053 <span class="preprocessor">#include &lt;sstream&gt;</span>
<a name="l00054"></a>00054 <span class="preprocessor">#include &lt;algorithm&gt;</span>
<a name="l00055"></a>00055 <span class="preprocessor">#include &lt;functional&gt;</span>
<a name="l00056"></a>00056 
<a name="l00057"></a>00057 <span class="comment">//#define DODS_DEBUG</span>
<a name="l00058"></a>00058 <span class="comment">//#define DODS_DEBUG2</span>
<a name="l00059"></a>00059 
<a name="l00060"></a>00060 <span class="preprocessor">#include &quot;GNURegex.h&quot;</span>
<a name="l00061"></a>00061 
<a name="l00062"></a>00062 <span class="preprocessor">#include &quot;<a class="code" href="DAS_8h.html">DAS.h</a>&quot;</span>
<a name="l00063"></a>00063 <span class="preprocessor">#include &quot;<a class="code" href="Clause_8h.html">Clause.h</a>&quot;</span>
<a name="l00064"></a>00064 <span class="preprocessor">#include &quot;<a class="code" href="Error_8h.html">Error.h</a>&quot;</span>
<a name="l00065"></a>00065 <span class="preprocessor">#include &quot;<a class="code" href="InternalErr_8h.html">InternalErr.h</a>&quot;</span>
<a name="l00066"></a>00066 
<a name="l00067"></a>00067 <span class="preprocessor">#include &quot;<a class="code" href="parser_8h.html">parser.h</a>&quot;</span>
<a name="l00068"></a>00068 <span class="preprocessor">#include &quot;<a class="code" href="debug_8h.html">debug.h</a>&quot;</span>
<a name="l00069"></a>00069 <span class="preprocessor">#include &quot;<a class="code" href="util_8h.html">util.h</a>&quot;</span>
<a name="l00070"></a>00070 
<a name="l00071"></a>00071 <span class="preprocessor">#include &quot;<a class="code" href="Byte_8h.html">Byte.h</a>&quot;</span>
<a name="l00072"></a>00072 <span class="preprocessor">#include &quot;<a class="code" href="Int16_8h.html">Int16.h</a>&quot;</span>
<a name="l00073"></a>00073 <span class="preprocessor">#include &quot;<a class="code" href="UInt16_8h.html">UInt16.h</a>&quot;</span>
<a name="l00074"></a>00074 <span class="preprocessor">#include &quot;<a class="code" href="Int32_8h.html">Int32.h</a>&quot;</span>
<a name="l00075"></a>00075 <span class="preprocessor">#include &quot;<a class="code" href="UInt32_8h.html">UInt32.h</a>&quot;</span>
<a name="l00076"></a>00076 <span class="preprocessor">#include &quot;<a class="code" href="Float32_8h.html">Float32.h</a>&quot;</span>
<a name="l00077"></a>00077 <span class="preprocessor">#include &quot;<a class="code" href="Float64_8h.html">Float64.h</a>&quot;</span>
<a name="l00078"></a>00078 <span class="preprocessor">#include &quot;<a class="code" href="Str_8h.html">Str.h</a>&quot;</span>
<a name="l00079"></a>00079 <span class="preprocessor">#include &quot;<a class="code" href="Url_8h.html">Url.h</a>&quot;</span>
<a name="l00080"></a>00080 <span class="preprocessor">#include &quot;<a class="code" href="Array_8h.html">Array.h</a>&quot;</span>
<a name="l00081"></a>00081 <span class="preprocessor">#include &quot;<a class="code" href="Structure_8h.html">Structure.h</a>&quot;</span>
<a name="l00082"></a>00082 <span class="preprocessor">#include &quot;<a class="code" href="Sequence_8h.html">Sequence.h</a>&quot;</span>
<a name="l00083"></a>00083 <span class="preprocessor">#include &quot;<a class="code" href="Grid_8h.html">Grid.h</a>&quot;</span>
<a name="l00084"></a>00084 
<a name="l00085"></a>00085 <span class="preprocessor">#include &quot;<a class="code" href="escaping_8h.html">escaping.h</a>&quot;</span>
<a name="l00086"></a>00086 
<a name="l00087"></a><a class="code" href="DDS_8cc.html#a142e6d92c13f0deeb196f0ef36ced13e">00087</a> <span class="keyword">const</span> <span class="keywordtype">string</span> <a class="code" href="DDS_8cc.html#a142e6d92c13f0deeb196f0ef36ced13e">c_default_dap20_schema_location</a> = <span class="stringliteral">&quot;http://xml.opendap.org/dap/dap2.xsd&quot;</span>;
<a name="l00088"></a><a class="code" href="DDS_8cc.html#a5435387617cf582691dd22ae63325c57">00088</a> <span class="keyword">const</span> <span class="keywordtype">string</span> <a class="code" href="DDS_8cc.html#a5435387617cf582691dd22ae63325c57">c_default_dap32_schema_location</a> = <span class="stringliteral">&quot;http://xml.opendap.org/dap/dap3.2.xsd&quot;</span>;
<a name="l00089"></a>00089 
<a name="l00090"></a><a class="code" href="DDS_8cc.html#a837d1aa1dfdd08c06cf62cdf0cf0ffef">00090</a> <span class="keyword">const</span> <span class="keywordtype">string</span> <a class="code" href="DDS_8cc.html#a837d1aa1dfdd08c06cf62cdf0cf0ffef">c_dap20_namespace</a> = <span class="stringliteral">&quot;http://xml.opendap.org/ns/DAP2&quot;</span>;
<a name="l00091"></a><a class="code" href="DDS_8cc.html#a802c262d5fa6e407025473a6f6361d24">00091</a> <span class="keyword">const</span> <span class="keywordtype">string</span> <a class="code" href="DDS_8cc.html#a802c262d5fa6e407025473a6f6361d24">c_dap32_namespace</a> = <span class="stringliteral">&quot;http://xml.opendap.org/ns/DAP/3.2#&quot;</span>;
<a name="l00092"></a>00092 
<a name="l00093"></a><a class="code" href="DDS_8cc.html#a5bfd633ea313c9ff1b3bddd7df37d86c">00093</a> <span class="keyword">const</span> <span class="keywordtype">string</span> <a class="code" href="DDS_8cc.html#a5bfd633ea313c9ff1b3bddd7df37d86c">grddl_transformation_dap32</a> = <span class="stringliteral">&quot;http://xml.opendap.org/transforms/ddxToRdfTriples.xsl&quot;</span>;
<a name="l00094"></a>00094 
<a name="l00095"></a><a class="code" href="DDS_8cc.html#add7b67faa628b4969458b8ecfb872f0e">00095</a> <span class="keyword">const</span> <span class="keywordtype">string</span> <a class="code" href="DDS_8cc.html#add7b67faa628b4969458b8ecfb872f0e">c_xml_namespace</a> = <span class="stringliteral">&quot;http://www.w3.org/XML/1998/namespace&quot;</span>;
<a name="l00096"></a>00096 
<a name="l00097"></a>00097 <span class="keyword">using namespace </span>std;
<a name="l00098"></a>00098 
<a name="l00099"></a>00099 <span class="keywordtype">void</span> <a class="code" href="DDS_8cc.html#afe08b8fc8acb23f27d135d427ee3225e">ddsrestart</a>(FILE *yyin); <span class="comment">// Defined in dds.tab.c</span>
<a name="l00100"></a>00100 <span class="keywordtype">int</span> <a class="code" href="DDS_8cc.html#af25dd46fa4d8243c7120340421ad21b2">ddsparse</a>(<span class="keywordtype">void</span> *arg);
<a name="l00101"></a>00101 
<a name="l00102"></a>00102 <span class="comment">// Glue for the DDS parser defined in dds.lex</span>
<a name="l00103"></a>00103 <span class="keywordtype">void</span> <a class="code" href="DDS_8cc.html#aacb50379a000305a2dc076e9c211f4c4">dds_switch_to_buffer</a>(<span class="keywordtype">void</span> *new_buffer);
<a name="l00104"></a>00104 <span class="keywordtype">void</span> <a class="code" href="DDS_8cc.html#ab25223d65a5db252c222f9b31c39a2ef">dds_delete_buffer</a>(<span class="keywordtype">void</span> * buffer);
<a name="l00105"></a>00105 <span class="keywordtype">void</span> *<a class="code" href="DDS_8cc.html#aff5b329f05457ec3f9389a47ad449993">dds_buffer</a>(FILE *fp);
<a name="l00106"></a>00106 
<a name="l00107"></a>00107 <span class="keyword">namespace </span>libdap {
<a name="l00108"></a>00108 
<a name="l00109"></a>00109 <span class="keywordtype">void</span>
<a name="l00110"></a><a class="code" href="classlibdap_1_1DDS.html#a88195f7e5c14124b3d70d07b290dcea4">00110</a> DDS::duplicate(<span class="keyword">const</span> <a class="code" href="classlibdap_1_1DDS.html">DDS</a> &amp;dds)
<a name="l00111"></a>00111 {
<a name="l00112"></a>00112     <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Entering DDS::duplicate... &quot;</span> &lt;&lt;endl);
<a name="l00113"></a>00113     name = dds.name;
<a name="l00114"></a>00114     d_filename = dds.d_filename;
<a name="l00115"></a>00115     d_container_name = dds.d_container_name;
<a name="l00116"></a>00116     d_timeout = dds.d_timeout;
<a name="l00117"></a>00117     d_attr = dds.d_attr;
<a name="l00118"></a>00118 
<a name="l00119"></a>00119     d_factory = dds.d_factory;
<a name="l00120"></a>00120     d_container = dds.d_container;
<a name="l00121"></a>00121     d_dap_major = dds.d_dap_major;
<a name="l00122"></a>00122     d_dap_minor = dds.d_dap_minor;
<a name="l00123"></a>00123 
<a name="l00124"></a>00124     <a class="code" href="classlibdap_1_1DDS.html">DDS</a> &amp;dds_tmp = <span class="keyword">const_cast&lt;</span><a class="code" href="classlibdap_1_1DDS.html">DDS</a> &amp;<span class="keyword">&gt;</span>(dds);
<a name="l00125"></a>00125 
<a name="l00126"></a>00126     <span class="comment">// copy the things pointed to by the list, not just the pointers</span>
<a name="l00127"></a>00127     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1DDS.html#a5140f67d8f7eecf0a260d8a5d9fc39c5">Vars_iter</a> i = dds_tmp.<a class="code" href="classlibdap_1_1DDS.html#aac98f248cd5730a8769f9d71af9788d3" title="Return an iterator to the first variable.">var_begin</a>(); i != dds_tmp.<a class="code" href="classlibdap_1_1DDS.html#ad204bbd6eed8d440fb996f41bc986058" title="Return an iterator.">var_end</a>(); i++) {
<a name="l00128"></a>00128         add_var(*i); <span class="comment">// add_var() dups the BaseType.</span>
<a name="l00129"></a>00129     }
<a name="l00130"></a>00130 }
<a name="l00131"></a>00131 
<a name="l00142"></a><a class="code" href="classlibdap_1_1DDS.html#af703f30c02e91fc883520cf79847f4ea">00142</a> DDS::DDS(<a class="code" href="classlibdap_1_1BaseTypeFactory.html">BaseTypeFactory</a> *factory, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;n)
<a name="l00143"></a>00143 
<a name="l00144"></a>00144         : d_factory(factory), name(n), d_container(0), d_dap_major(2),
<a name="l00145"></a>00145         d_dap_minor(0),
<a name="l00146"></a>00146         d_request_xml_base(<span class="stringliteral">&quot;&quot;</span>), d_timeout(0)
<a name="l00147"></a>00147 {
<a name="l00148"></a>00148     <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Building a DDS with client major/minor: &quot;</span>
<a name="l00149"></a>00149             &lt;&lt; d_dap_major &lt;&lt; <span class="stringliteral">&quot;.&quot;</span> &lt;&lt; d_dap_minor &lt;&lt; endl);
<a name="l00150"></a>00150 }
<a name="l00151"></a>00151 
<a name="l00153"></a><a class="code" href="classlibdap_1_1DDS.html#aee64217da3a62758690e62767e25168d">00153</a> <a class="code" href="classlibdap_1_1DDS.html#af703f30c02e91fc883520cf79847f4ea">DDS::DDS</a>(<span class="keyword">const</span> <a class="code" href="classlibdap_1_1DDS.html">DDS</a> &amp;rhs) : <a class="code" href="classlibdap_1_1DapObj.html" title="libdap base object for common functionality of libdap objects">DapObj</a>()
<a name="l00154"></a>00154 {
<a name="l00155"></a>00155     <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Entering DDS(const DDS &amp;rhs) ...&quot;</span> &lt;&lt; endl);
<a name="l00156"></a>00156     <a class="code" href="classlibdap_1_1DDS.html#a88195f7e5c14124b3d70d07b290dcea4">duplicate</a>(rhs);
<a name="l00157"></a>00157     <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot; bye.&quot;</span> &lt;&lt; endl);
<a name="l00158"></a>00158 }
<a name="l00159"></a>00159 
<a name="l00160"></a><a class="code" href="classlibdap_1_1DDS.html#a090d0721ce2fd39ea411646cd9ffc264">00160</a> <a class="code" href="classlibdap_1_1DDS.html#a090d0721ce2fd39ea411646cd9ffc264">DDS::~DDS</a>()
<a name="l00161"></a>00161 {
<a name="l00162"></a>00162     <span class="comment">// delete all the variables in this DDS</span>
<a name="l00163"></a>00163     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1DDS.html#a5140f67d8f7eecf0a260d8a5d9fc39c5">Vars_iter</a> i = vars.begin(); i != vars.end(); i++) {
<a name="l00164"></a>00164         <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = *i ;
<a name="l00165"></a>00165         <span class="keyword">delete</span> btp ; btp = 0;
<a name="l00166"></a>00166     }
<a name="l00167"></a>00167 }
<a name="l00168"></a>00168 
<a name="l00169"></a>00169 <a class="code" href="classlibdap_1_1DDS.html">DDS</a> &amp;
<a name="l00170"></a><a class="code" href="classlibdap_1_1DDS.html#afa02245fb564ba26b76c2fd2fd1634ed">00170</a> <a class="code" href="classlibdap_1_1DDS.html#afa02245fb564ba26b76c2fd2fd1634ed">DDS::operator=</a>(<span class="keyword">const</span> <a class="code" href="classlibdap_1_1DDS.html">DDS</a> &amp;rhs)
<a name="l00171"></a>00171 {
<a name="l00172"></a>00172     <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Entering DDS::operator= ...&quot;</span> &lt;&lt; endl);
<a name="l00173"></a>00173     <span class="keywordflow">if</span> (<span class="keyword">this</span> == &amp;rhs)
<a name="l00174"></a>00174         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00175"></a>00175 
<a name="l00176"></a>00176     <a class="code" href="classlibdap_1_1DDS.html#a88195f7e5c14124b3d70d07b290dcea4">duplicate</a>(rhs);
<a name="l00177"></a>00177 
<a name="l00178"></a>00178     <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot; bye.&quot;</span> &lt;&lt; endl);
<a name="l00179"></a>00179     <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00180"></a>00180 }
<a name="l00181"></a>00181 
<a name="l00182"></a>00182 <span class="preprocessor">#if 0</span>
<a name="l00183"></a>00183 <span class="preprocessor"></span>
<a name="l00198"></a>00198 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *
<a name="l00199"></a>00199 DDS::find_hdf4_dimension_attribute_home(<a class="code" href="structlibdap_1_1AttrTable_1_1entry.html">AttrTable::entry</a> *source)
<a name="l00200"></a>00200 {
<a name="l00201"></a>00201     <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp;
<a name="l00202"></a>00202     string::size_type i = source-&gt;<a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a36ed731e3d0e620c41157ee8bd96bc42">name</a>.find(<span class="stringliteral">&quot;_dim_&quot;</span>);
<a name="l00203"></a>00203     <span class="keywordflow">if</span> (i != string::npos &amp;&amp; (btp = <a class="code" href="classlibdap_1_1DDS.html#a74c67b99babe3317a0f76c8d8f7ba37a">var</a>(source-&gt;<a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a36ed731e3d0e620c41157ee8bd96bc42">name</a>.substr(0, i)))) {
<a name="l00204"></a>00204         <span class="keywordflow">if</span> (btp-&gt;<a class="code" href="classlibdap_1_1BaseType.html#ad1d57be80c8e89b8a9e59bed48779556" title="Returns true if the instance is a vector (i.e., array) type variable.">is_vector_type</a>()) {
<a name="l00205"></a>00205             <span class="keywordflow">return</span> btp;
<a name="l00206"></a>00206         }
<a name="l00207"></a>00207         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (btp-&gt;<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#a05ca706d4539ae7b750c3bc7066ab6e6ac41525d2e860d3bcff641eb1fdba41d2">dods_grid_c</a>) {
<a name="l00208"></a>00208             <span class="comment">// For a Grid, the hdf4 handler uses _dim_n for the n-th Map</span>
<a name="l00209"></a>00209             <span class="comment">// i+5 points to the character holding &#39;n&#39;</span>
<a name="l00210"></a>00210             <span class="keywordtype">int</span> n = atoi(source-&gt;<a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a36ed731e3d0e620c41157ee8bd96bc42">name</a>.substr(i + 5).c_str());
<a name="l00211"></a>00211             <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Found a Grid (&quot;</span> &lt;&lt; btp-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() &lt;&lt; <span class="stringliteral">&quot;) and &quot;</span>
<a name="l00212"></a>00212                 &lt;&lt; source-&gt;<a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a36ed731e3d0e620c41157ee8bd96bc42">name</a>.substr(i) &lt;&lt; <span class="stringliteral">&quot;, extracted n: &quot;</span> &lt;&lt; n &lt;&lt; endl);
<a name="l00213"></a>00213             <span class="keywordflow">return</span> *(<span class="keyword">dynamic_cast&lt;</span>Grid&amp;<span class="keyword">&gt;</span>(*btp).map_begin() + n);
<a name="l00214"></a>00214         }
<a name="l00215"></a>00215     }
<a name="l00216"></a>00216 
<a name="l00217"></a>00217     <span class="keywordflow">return</span> 0;
<a name="l00218"></a>00218 }
<a name="l00219"></a>00219 
<a name="l00225"></a>00225 AttrTable *
<a name="l00226"></a>00226 DDS::find_matching_container(AttrTable::entry *source, BaseType **dest_variable)
<a name="l00227"></a>00227 {
<a name="l00228"></a>00228     <span class="comment">// The attribute entry &#39;source&#39; must be a container</span>
<a name="l00229"></a>00229     <span class="keywordflow">if</span> (source-&gt;type != <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>)
<a name="l00230"></a>00230         <span class="keywordflow">throw</span> InternalErr(__FILE__, __LINE__, <span class="stringliteral">&quot;DDS::find_matching_container; expected &#39;source&#39; to be a container.&quot;</span>);
<a name="l00231"></a>00231 
<a name="l00232"></a>00232     <span class="comment">// Use the name of the attribute container &#39;source&#39; to figure out where</span>
<a name="l00233"></a>00233     <span class="comment">// to put its contents.</span>
<a name="l00234"></a>00234     BaseType *btp;
<a name="l00235"></a>00235     <span class="keywordflow">if</span> ((btp = <a class="code" href="classlibdap_1_1DDS.html#a74c67b99babe3317a0f76c8d8f7ba37a">var</a>(source-&gt;name))) {
<a name="l00236"></a>00236         <span class="comment">// ... matches a variable name? Use var&#39;s table</span>
<a name="l00237"></a>00237         *dest_variable = btp;
<a name="l00238"></a>00238         <span class="keywordflow">return</span> &amp;btp-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a1fcd9537c67e3bf88964b2656ff5bac1">get_attr_table</a>();
<a name="l00239"></a>00239     }
<a name="l00240"></a>00240     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((btp = find_hdf4_dimension_attribute_home(source))) {
<a name="l00241"></a>00241         <span class="comment">// ... hdf4 dimension attribute? Make a sub table and use that.</span>
<a name="l00242"></a>00242         <span class="comment">// btp can only be an Array or a Grid Map (which is an array)</span>
<a name="l00243"></a>00243         <span class="keywordflow">if</span> (btp-&gt;get_parent() &amp;&amp; btp-&gt;get_parent()-&gt;type() == <a class="code" href="namespacelibdap.html#a05ca706d4539ae7b750c3bc7066ab6e6ac41525d2e860d3bcff641eb1fdba41d2">dods_grid_c</a>) {
<a name="l00244"></a>00244             <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Found a Grid, assigning to the map&quot;</span> &lt;&lt; endl);
<a name="l00245"></a>00245             *dest_variable = btp;
<a name="l00246"></a>00246             <span class="keywordflow">return</span> &amp;btp-&gt;get_attr_table();
<a name="l00247"></a>00247         }
<a name="l00248"></a>00248         <span class="keywordflow">else</span> { <span class="comment">// must be a plain Array</span>
<a name="l00249"></a>00249             string::size_type i = source-&gt;name.find(<span class="stringliteral">&quot;_dim_&quot;</span>);
<a name="l00250"></a>00250             <span class="keywordtype">string</span> ext = source-&gt;name.substr(i + 1);
<a name="l00251"></a>00251             *dest_variable = btp;
<a name="l00252"></a>00252             <span class="keywordflow">return</span> btp-&gt;get_attr_table().append_container(ext);
<a name="l00253"></a>00253         }
<a name="l00254"></a>00254     }
<a name="l00255"></a>00255     <span class="keywordflow">else</span> {
<a name="l00256"></a>00256         <span class="comment">// ... otherwise assume it&#39;s a global attribute.</span>
<a name="l00257"></a>00257         AttrTable *at = d_attr.find_container(source-&gt;name);
<a name="l00258"></a>00258         <span class="keywordflow">if</span> (!at) {
<a name="l00259"></a>00259             at = <span class="keyword">new</span> AttrTable();       <span class="comment">// Make a new global table if needed</span>
<a name="l00260"></a>00260             d_attr.append_container(at, source-&gt;name);
<a name="l00261"></a>00261         }
<a name="l00262"></a>00262 
<a name="l00263"></a>00263         *dest_variable = 0;
<a name="l00264"></a>00264         <span class="keywordflow">return</span> at;
<a name="l00265"></a>00265     }
<a name="l00266"></a>00266 }
<a name="l00267"></a>00267 
<a name="l00289"></a>00289 <span class="keywordtype">void</span>
<a name="l00290"></a>00290 <a class="code" href="classlibdap_1_1DDS.html#a2810a944fbdc7d21b08f2d8c19022b52">DDS::transfer_attributes</a>(DAS *das)
<a name="l00291"></a>00291 {
<a name="l00292"></a>00292     <span class="comment">// If there is a container set in the DDS then get the container from</span>
<a name="l00293"></a>00293     <span class="comment">// the DAS. If they are not the same container, then throw an exception</span>
<a name="l00294"></a>00294     <span class="comment">// (should be working on the same container). If the container does not</span>
<a name="l00295"></a>00295     <span class="comment">// exist in the DAS, then throw an exception</span>
<a name="l00296"></a>00296     <span class="keywordflow">if</span>( d_container )
<a name="l00297"></a>00297     {
<a name="l00298"></a>00298         <span class="keywordflow">if</span>( das-&gt;container_name() != d_container_name )
<a name="l00299"></a>00299         {
<a name="l00300"></a>00300             <span class="keywordtype">string</span> err = (string)<span class="stringliteral">&quot;Error transferring attributes: &quot;</span>
<a name="l00301"></a>00301                          + <span class="stringliteral">&quot;working on container in dds, but not das&quot;</span> ;
<a name="l00302"></a>00302             <span class="keywordflow">throw</span> InternalErr(__FILE__, __LINE__, err ) ;
<a name="l00303"></a>00303         }
<a name="l00304"></a>00304     }
<a name="l00305"></a>00305 
<a name="l00306"></a>00306     AttrTable *top_level = das-&gt;get_top_level_attributes() ;
<a name="l00307"></a>00307 
<a name="l00308"></a>00308     <span class="comment">// foreach container at the outer level</span>
<a name="l00309"></a>00309     <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">AttrTable::Attr_iter</a> das_i = top_level-&gt;attr_begin();
<a name="l00310"></a>00310     <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">AttrTable::Attr_iter</a> das_e = top_level-&gt;attr_end();
<a name="l00311"></a>00311     <span class="keywordflow">while</span> (das_i != das_e) {
<a name="l00312"></a>00312         <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Working on the &#39;&quot;</span> &lt;&lt; (*das_i)-&gt;name &lt;&lt; <span class="stringliteral">&quot;&#39; container.&quot;</span>
<a name="l00313"></a>00313             &lt;&lt; endl);
<a name="l00314"></a>00314 
<a name="l00315"></a>00315         AttrTable *source = (*das_i)-&gt;attributes;
<a name="l00316"></a>00316         <span class="comment">// Variable that holds &#39;dest&#39;; null for a global attribute.</span>
<a name="l00317"></a>00317         BaseType *dest_variable = 0;
<a name="l00318"></a>00318         AttrTable *dest = find_matching_container(*das_i, &amp;dest_variable);
<a name="l00319"></a>00319 
<a name="l00320"></a>00320         <span class="comment">// foreach source attribute in the das_i container</span>
<a name="l00321"></a>00321         <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">AttrTable::Attr_iter</a> source_p = source-&gt;attr_begin();
<a name="l00322"></a>00322         <span class="keywordflow">while</span> (source_p != source-&gt;attr_end()) {
<a name="l00323"></a>00323             <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Working on the &#39;&quot;</span> &lt;&lt; (*source_p)-&gt;name &lt;&lt; <span class="stringliteral">&quot;&#39; attribute&quot;</span>
<a name="l00324"></a>00324                 &lt;&lt; endl);
<a name="l00325"></a>00325 
<a name="l00326"></a>00326             <span class="comment">// If this is an attribute container, we must have a container</span>
<a name="l00327"></a>00327             <span class="comment">// (this one) within a container (the &#39;source&#39;). Look and see if</span>
<a name="l00328"></a>00328             <span class="comment">// the variable is a Constructor. If so, pass that container into</span>
<a name="l00329"></a>00329             <span class="comment">// Constructor::transfer_attributes()</span>
<a name="l00330"></a>00330             <span class="keywordflow">if</span> ((*source_p)-&gt;type == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>) {
<a name="l00331"></a>00331                 <span class="keywordflow">if</span> (dest_variable &amp;&amp; dest_variable-&gt;is_constructor_type()) {
<a name="l00332"></a>00332                     <span class="keyword">dynamic_cast&lt;</span>Constructor&amp;<span class="keyword">&gt;</span>(*dest_variable).transfer_attributes(*source_p);
<a name="l00333"></a>00333                 }
<a name="l00334"></a>00334                 <span class="keywordflow">else</span> {
<a name="l00335"></a>00335                     dest-&gt;append_container(<span class="keyword">new</span> AttrTable(*(*source_p)-&gt;attributes),
<a name="l00336"></a>00336                                            (*source_p)-&gt;name);
<a name="l00337"></a>00337                 }
<a name="l00338"></a>00338             }
<a name="l00339"></a>00339             <span class="keywordflow">else</span> {
<a name="l00340"></a>00340                 dest-&gt;append_attr(source-&gt;get_name(source_p),
<a name="l00341"></a>00341                                   source-&gt;get_type(source_p),
<a name="l00342"></a>00342                                   source-&gt;get_attr_vector(source_p));
<a name="l00343"></a>00343             }
<a name="l00344"></a>00344 
<a name="l00345"></a>00345             ++source_p;
<a name="l00346"></a>00346         }
<a name="l00347"></a>00347 
<a name="l00348"></a>00348         ++das_i;
<a name="l00349"></a>00349     }
<a name="l00350"></a>00350 }
<a name="l00351"></a>00351 <span class="preprocessor">#endif</span>
<a name="l00352"></a>00352 <span class="preprocessor"></span>
<a name="l00366"></a>00366 <span class="keywordtype">void</span>
<a name="l00367"></a><a class="code" href="classlibdap_1_1DDS.html#a2810a944fbdc7d21b08f2d8c19022b52">00367</a> <a class="code" href="classlibdap_1_1DDS.html#a2810a944fbdc7d21b08f2d8c19022b52">DDS::transfer_attributes</a>(<a class="code" href="classlibdap_1_1DAS.html" title="Hold attribute data for a DAP2 dataset.">DAS</a> *das)
<a name="l00368"></a>00368 {
<a name="l00369"></a>00369     <span class="comment">// If there is a container set in the DDS then get the container from</span>
<a name="l00370"></a>00370     <span class="comment">// the DAS. If they are not the same container, then throw an exception</span>
<a name="l00371"></a>00371     <span class="comment">// (should be working on the same container). If the container does not</span>
<a name="l00372"></a>00372     <span class="comment">// exist in the DAS, then throw an exception</span>
<a name="l00373"></a>00373     <span class="keywordflow">if</span>( d_container )
<a name="l00374"></a>00374     {
<a name="l00375"></a>00375         <span class="keywordflow">if</span>( das-&gt;<a class="code" href="classlibdap_1_1DAS.html#a051d5af6203403192edbcd1a3812992e" title="Returns the name of the current attribute container when multiple files used to build this DAS...">container_name</a>() != d_container_name )
<a name="l00376"></a>00376             <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">&quot;Error transferring attributes: working on a container in dds, but not das&quot;</span> ) ;
<a name="l00377"></a>00377     }
<a name="l00378"></a>00378 
<a name="l00379"></a>00379     <span class="comment">// Give each variable a chance to claim its attributes.</span>
<a name="l00380"></a>00380     <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> *top_level = das-&gt;<a class="code" href="classlibdap_1_1DAS.html#a3bce04e836fabf8b0303e6a2dfd8664b" title="Returns the top most set of attributes.">get_top_level_attributes</a>() ;
<a name="l00381"></a>00381 
<a name="l00382"></a>00382     <a class="code" href="classlibdap_1_1DDS.html#a5140f67d8f7eecf0a260d8a5d9fc39c5">Vars_iter</a> <a class="code" href="classlibdap_1_1DDS.html#a74c67b99babe3317a0f76c8d8f7ba37a">var</a> = <a class="code" href="classlibdap_1_1DDS.html#aac98f248cd5730a8769f9d71af9788d3" title="Return an iterator to the first variable.">var_begin</a>();
<a name="l00383"></a>00383     <span class="keywordflow">while</span> (var != <a class="code" href="classlibdap_1_1DDS.html#ad204bbd6eed8d440fb996f41bc986058" title="Return an iterator.">var_end</a>()) {
<a name="l00384"></a>00384         (*var)-&gt;transfer_attributes(top_level);
<a name="l00385"></a>00385         var++;
<a name="l00386"></a>00386     }
<a name="l00387"></a>00387 
<a name="l00388"></a>00388     <span class="comment">// Now we transfer all of the attributes still marked as global to the</span>
<a name="l00389"></a>00389     <span class="comment">// global container in the DDS.</span>
<a name="l00390"></a>00390 
<a name="l00391"></a>00391     <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">AttrTable::Attr_iter</a> at_cont_p = top_level-&gt;<a class="code" href="classlibdap_1_1AttrTable.html#a8881bb7044577dae3098f4a1d8bf4f2f">attr_begin</a>();
<a name="l00392"></a>00392     <span class="keywordflow">while</span> (at_cont_p != top_level-&gt;<a class="code" href="classlibdap_1_1AttrTable.html#a543955729bad6b7a9d1d6b336596b1ba">attr_end</a>()) {
<a name="l00393"></a>00393         <span class="comment">// In truth, all of the top level attributes should be containers, but</span>
<a name="l00394"></a>00394         <span class="comment">// this test handles the abnormal case where somehow someone makes a</span>
<a name="l00395"></a>00395         <span class="comment">// top level attribute that is not a container by silently dropping it.</span>
<a name="l00396"></a>00396         <span class="keywordflow">if</span> ((*at_cont_p)-&gt;type == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>
<a name="l00397"></a>00397                 &amp;&amp; (*at_cont_p)-&gt;attributes-&gt;is_global_attribute()) {
<a name="l00398"></a>00398             <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; (*at_cont_p)-&gt;name &lt;&lt; <span class="stringliteral">&quot; is a global attribute.&quot;</span> &lt;&lt; endl);
<a name="l00399"></a>00399             <span class="comment">// copy the source container so that the DAS passed in can be</span>
<a name="l00400"></a>00400             <span class="comment">// deleted after calling htis method.</span>
<a name="l00401"></a>00401             <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> *at = <span class="keyword">new</span> <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a>(*(*at_cont_p)-&gt;attributes);
<a name="l00402"></a>00402             d_attr.<a class="code" href="classlibdap_1_1AttrTable.html#a03f3a1197f9529d4c0328830c765cfe1" title="Add a container to the attribute table.">append_container</a>(at, at-&gt;<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>());
<a name="l00403"></a>00403         }
<a name="l00404"></a>00404 
<a name="l00405"></a>00405         at_cont_p++;
<a name="l00406"></a>00406     }
<a name="l00407"></a>00407 }
<a name="l00408"></a>00408 
<a name="l00409"></a>00409 <span class="preprocessor">#if 0</span>
<a name="l00410"></a>00410 <span class="preprocessor"></span>    <span class="comment">// cruft from the above method</span>
<a name="l00411"></a>00411 
<a name="l00412"></a>00412             <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> *dest = d_attr.<a class="code" href="classlibdap_1_1AttrTable.html#ae403d070910c829f74a59fbf4648588f" title="Find an attribute with a given name.">find_container</a>(at-&gt;get_name());
<a name="l00413"></a>00413             <span class="keywordflow">if</span> (!dest) {
<a name="l00414"></a>00414                 cerr &lt;&lt; <span class="stringliteral">&quot;making a new sub containter for it&quot;</span> &lt;&lt; endl;
<a name="l00415"></a>00415                 <span class="comment">// If there&#39;s currently no top level container with this</span>
<a name="l00416"></a>00416                 <span class="comment">//container&#39;s name (the typical case) make one.</span>
<a name="l00417"></a>00417                 dest = <span class="keyword">new</span> <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a>(); <span class="comment">// Make a new global table if needed</span>
<a name="l00418"></a>00418                 d_attr.append_container(dest, at-&gt;get_name());
<a name="l00419"></a>00419             }
<a name="l00420"></a>00420 
<a name="l00421"></a>00421             cerr &lt;&lt; <span class="stringliteral">&quot;now copying its contents to the new container&quot;</span> &lt;&lt; endl;
<a name="l00422"></a>00422             <span class="comment">// Now copy all of the global attribute&#39;s stuff into the matching</span>
<a name="l00423"></a>00423             <span class="comment">// container in the DDS.</span>
<a name="l00424"></a>00424             <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">AttrTable::Attr_iter</a> at_p = at-&gt;attr_begin();
<a name="l00425"></a>00425             <span class="keywordflow">while</span> (at_p != at-&gt;attr_end()) {
<a name="l00426"></a>00426                 <span class="keywordflow">if</span> (at-&gt;get_attr_type(at_p) == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>)
<a name="l00427"></a>00427                     dest-&gt;append_container(at-&gt;get_attr_table(at_p), at-&gt;get_name(at_p));
<a name="l00428"></a>00428                 <span class="keywordflow">else</span>
<a name="l00429"></a>00429                     dest-&gt;append_attr(at-&gt;get_name(at_p), at-&gt;get_type(at_p), at-&gt;get_attr_vector(at_p));
<a name="l00430"></a>00430                 at_p++;
<a name="l00431"></a>00431             }
<a name="l00432"></a>00432 <span class="preprocessor">#endif</span>
<a name="l00433"></a>00433 <span class="preprocessor"></span>
<a name="l00441"></a>00441 
<a name="l00443"></a>00443 <span class="keywordtype">string</span>
<a name="l00444"></a><a class="code" href="classlibdap_1_1DDS.html#ac83ef5e2bc4e75da5a21ead478aeff0c">00444</a> <a class="code" href="classlibdap_1_1DDS.html#ac83ef5e2bc4e75da5a21ead478aeff0c">DDS::get_dataset_name</a>()<span class="keyword"> const</span>
<a name="l00445"></a>00445 <span class="keyword"></span>{
<a name="l00446"></a>00446     <span class="keywordflow">return</span> name;
<a name="l00447"></a>00447 }
<a name="l00448"></a>00448 
<a name="l00450"></a>00450 <span class="keywordtype">void</span>
<a name="l00451"></a><a class="code" href="classlibdap_1_1DDS.html#a0138ce1c3b26968f968a6b723ec70dfb">00451</a> <a class="code" href="classlibdap_1_1DDS.html#a0138ce1c3b26968f968a6b723ec70dfb">DDS::set_dataset_name</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;n)
<a name="l00452"></a>00452 {
<a name="l00453"></a>00453     name = n;
<a name="l00454"></a>00454 }
<a name="l00455"></a>00455 
<a name="l00457"></a>00457 
<a name="l00459"></a>00459 <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> &amp;
<a name="l00460"></a><a class="code" href="classlibdap_1_1DDS.html#a177e3df069cb0dcb3b30c0dcd236f8b3">00460</a> <a class="code" href="classlibdap_1_1DDS.html#a177e3df069cb0dcb3b30c0dcd236f8b3">DDS::get_attr_table</a>()
<a name="l00461"></a>00461 {
<a name="l00462"></a>00462     <span class="keywordflow">return</span> d_attr;
<a name="l00463"></a>00463 }
<a name="l00464"></a>00464 
<a name="l00474"></a>00474 <span class="keywordtype">string</span>
<a name="l00475"></a><a class="code" href="classlibdap_1_1DDS.html#abe8b354fd9412c3d9faed8345671076b">00475</a> <a class="code" href="classlibdap_1_1DDS.html#abe8b354fd9412c3d9faed8345671076b">DDS::filename</a>()
<a name="l00476"></a>00476 {
<a name="l00477"></a>00477     <span class="keywordflow">return</span> d_filename;
<a name="l00478"></a>00478 }
<a name="l00479"></a>00479 
<a name="l00481"></a>00481 <span class="keywordtype">void</span>
<a name="l00482"></a><a class="code" href="classlibdap_1_1DDS.html#a3dc8062cbb44db0d9b5f47b1109effd9">00482</a> <a class="code" href="classlibdap_1_1DDS.html#abe8b354fd9412c3d9faed8345671076b">DDS::filename</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;fn)
<a name="l00483"></a>00483 {
<a name="l00484"></a>00484     d_filename = fn;
<a name="l00485"></a>00485 }
<a name="l00487"></a>00487 
<a name="l00493"></a>00493 <span class="keywordtype">void</span>
<a name="l00494"></a><a class="code" href="classlibdap_1_1DDS.html#a53f79560bd6a0f60a37b99f602390631">00494</a> <a class="code" href="classlibdap_1_1DDS.html#a53f79560bd6a0f60a37b99f602390631">DDS::set_dap_version</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;version_string)
<a name="l00495"></a>00495 {
<a name="l00496"></a>00496     istringstream iss(version_string);
<a name="l00497"></a>00497 
<a name="l00498"></a>00498     <span class="keywordtype">int</span> major = -1, minor = -1;
<a name="l00499"></a>00499     <span class="keywordtype">char</span> dot;
<a name="l00500"></a>00500     iss &gt;&gt; major;
<a name="l00501"></a>00501     iss &gt;&gt; dot;
<a name="l00502"></a>00502     iss &gt;&gt; minor;
<a name="l00503"></a>00503 
<a name="l00504"></a>00504     <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Major: &quot;</span> &lt;&lt; major &lt;&lt; <span class="stringliteral">&quot;, dot: &quot;</span> &lt;&lt; dot &lt;&lt;<span class="stringliteral">&quot;, Minor: &quot;</span> &lt;&lt; minor &lt;&lt; endl);
<a name="l00505"></a>00505 
<a name="l00506"></a>00506     <span class="keywordflow">if</span> (major == -1 || minor == -1)
<a name="l00507"></a>00507         <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(<span class="stringliteral">&quot;Could not parse the client dap (XDAP-Accept header) value&quot;</span>);
<a name="l00508"></a>00508 
<a name="l00509"></a>00509     <a class="code" href="classlibdap_1_1DDS.html#a03062495c46ed3fad9fa0a5f6f6e8d00" title="Set the DAP major version (typically using info from the client)">set_dap_major</a>(major);
<a name="l00510"></a>00510     <a class="code" href="classlibdap_1_1DDS.html#a358929d8f517dcdfe439037fb402351b" title="Set the DAP minor version (typically using info from the client)">set_dap_minor</a>(minor);
<a name="l00511"></a>00511 }
<a name="l00512"></a>00512 
<a name="l00522"></a>00522 <span class="keywordtype">string</span>
<a name="l00523"></a><a class="code" href="classlibdap_1_1DDS.html#aaca262d193346e04d4a6caa7acd117e2">00523</a> <a class="code" href="classlibdap_1_1DDS.html#aaca262d193346e04d4a6caa7acd117e2">DDS::container_name</a>()
<a name="l00524"></a>00524 {
<a name="l00525"></a>00525     <span class="keywordflow">return</span> d_container_name;
<a name="l00526"></a>00526 }
<a name="l00527"></a>00527 
<a name="l00530"></a>00530 <span class="keywordtype">void</span>
<a name="l00531"></a><a class="code" href="classlibdap_1_1DDS.html#a025d5fef84ebc2d958a59e4297883d20">00531</a> <a class="code" href="classlibdap_1_1DDS.html#aaca262d193346e04d4a6caa7acd117e2">DDS::container_name</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;cn)
<a name="l00532"></a>00532 {
<a name="l00533"></a>00533     <span class="comment">// we want to search the DDS for the top level structure with the given</span>
<a name="l00534"></a>00534     <span class="comment">// name. Set the container to null so that we don&#39;t search some previous</span>
<a name="l00535"></a>00535     <span class="comment">// container.</span>
<a name="l00536"></a>00536     d_container = 0 ;
<a name="l00537"></a>00537     <span class="keywordflow">if</span>( !cn.empty() )
<a name="l00538"></a>00538     {
<a name="l00539"></a>00539         d_container = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="classlibdap_1_1Structure.html" title="Holds a structure (aggregate) type.">Structure</a> *<span class="keyword">&gt;</span>( <a class="code" href="classlibdap_1_1DDS.html#a74c67b99babe3317a0f76c8d8f7ba37a">var</a>( cn ) ) ;
<a name="l00540"></a>00540         <span class="keywordflow">if</span>( !d_container )
<a name="l00541"></a>00541         {
<a name="l00542"></a>00542             <span class="comment">// create a structure for this container. Calling add_var</span>
<a name="l00543"></a>00543             <span class="comment">// while_container is null will add the new structure to DDS and</span>
<a name="l00544"></a>00544             <span class="comment">// not some sub structure. Adding the new structure makes a copy</span>
<a name="l00545"></a>00545             <span class="comment">// of it.  So after adding it, go get it and set d_container.</span>
<a name="l00546"></a>00546             <a class="code" href="classlibdap_1_1Structure.html" title="Holds a structure (aggregate) type.">Structure</a> *s = <span class="keyword">new</span> <a class="code" href="classlibdap_1_1Structure.html" title="Holds a structure (aggregate) type.">Structure</a>( cn ) ;
<a name="l00547"></a>00547             <a class="code" href="classlibdap_1_1DDS.html#ade87418e97ee5c7efd92279cd41e421c" title="Adds a copy of the variable to the DDS. Using the ptr_duplicate() method, perform a deep copy on the ...">add_var</a>( s ) ;
<a name="l00548"></a>00548             <span class="keyword">delete</span> s ;
<a name="l00549"></a>00549             s = 0 ;
<a name="l00550"></a>00550             d_container = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="classlibdap_1_1Structure.html" title="Holds a structure (aggregate) type.">Structure</a> *<span class="keyword">&gt;</span>( <a class="code" href="classlibdap_1_1DDS.html#a74c67b99babe3317a0f76c8d8f7ba37a">var</a>( cn ) ) ;
<a name="l00551"></a>00551         }
<a name="l00552"></a>00552     }
<a name="l00553"></a>00553     d_container_name = cn;
<a name="l00554"></a>00554 
<a name="l00555"></a>00555 }
<a name="l00556"></a>00556 
<a name="l00558"></a>00558 <a class="code" href="classlibdap_1_1Structure.html" title="Holds a structure (aggregate) type.">Structure</a> *
<a name="l00559"></a><a class="code" href="classlibdap_1_1DDS.html#add7c78964a7574239e2d3dd6717a0f31">00559</a> <a class="code" href="classlibdap_1_1DDS.html#add7c78964a7574239e2d3dd6717a0f31">DDS::container</a>()
<a name="l00560"></a>00560 {
<a name="l00561"></a>00561     <span class="keywordflow">return</span> d_container ;
<a name="l00562"></a>00562 }
<a name="l00563"></a>00563 
<a name="l00565"></a>00565 
<a name="l00571"></a>00571 <span class="keywordtype">void</span>
<a name="l00572"></a><a class="code" href="classlibdap_1_1DDS.html#ade87418e97ee5c7efd92279cd41e421c">00572</a> <a class="code" href="classlibdap_1_1DDS.html#ade87418e97ee5c7efd92279cd41e421c" title="Adds a copy of the variable to the DDS. Using the ptr_duplicate() method, perform a deep copy on the ...">DDS::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 name="l00573"></a>00573 {
<a name="l00574"></a>00574     <span class="keywordflow">if</span> (!bt)
<a name="l00575"></a>00575         <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="l00576"></a>00576                           <span class="stringliteral">&quot;Trying to add a BaseType object with a NULL pointer.&quot;</span>);
<a name="l00577"></a>00577 
<a name="l00578"></a>00578     <a class="code" href="debug_8h.html#ac1f764c266c50f0050e33557004c914c">DBG2</a>(cerr &lt;&lt; <span class="stringliteral">&quot;In DDS::add_var(), bt&#39;s address is: &quot;</span> &lt;&lt; bt &lt;&lt; endl);
<a name="l00579"></a>00579 
<a name="l00580"></a>00580     <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = bt-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a0b130311c9901fb8a7ab11ea19090ef0">ptr_duplicate</a>();
<a name="l00581"></a>00581     <a class="code" href="debug_8h.html#ac1f764c266c50f0050e33557004c914c">DBG2</a>(cerr &lt;&lt; <span class="stringliteral">&quot;In DDS::add_var(), btp&#39;s address is: &quot;</span> &lt;&lt; btp &lt;&lt; endl);
<a name="l00582"></a>00582     <span class="keywordflow">if</span>( d_container )
<a name="l00583"></a>00583     {
<a name="l00584"></a>00584         <span class="comment">// Mem leak fix [mjohnson nov 2009]</span>
<a name="l00585"></a>00585         <span class="comment">// Structure::add_var() creates ANOTHER copy.</span>
<a name="l00586"></a>00586         d_container-&gt;<a class="code" href="classlibdap_1_1Structure.html#aa2e403ad2ce9b78f279a18799f61b353">add_var</a>( bt ) ;
<a name="l00587"></a>00587         <span class="comment">// So we need to delete btp or else it leaks</span>
<a name="l00588"></a>00588         <span class="keyword">delete</span> btp; btp = 0;
<a name="l00589"></a>00589     }
<a name="l00590"></a>00590     <span class="keywordflow">else</span>
<a name="l00591"></a>00591     {
<a name="l00592"></a>00592         vars.push_back(btp);
<a name="l00593"></a>00593     }
<a name="l00594"></a>00594 }
<a name="l00595"></a>00595 
<a name="l00602"></a>00602 <span class="keywordtype">void</span>
<a name="l00603"></a><a class="code" href="classlibdap_1_1DDS.html#a7030e5bf19371742219f14d6b3aeeedf">00603</a> <a class="code" href="classlibdap_1_1DDS.html#a7030e5bf19371742219f14d6b3aeeedf" title="Removes a variable from the DDS.">DDS::del_var</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;n)
<a name="l00604"></a>00604 {
<a name="l00605"></a>00605     <span class="keywordflow">if</span>( d_container )
<a name="l00606"></a>00606     {
<a name="l00607"></a>00607         d_container-&gt;<a class="code" href="classlibdap_1_1Structure.html#abd4007d70af3ca2550daea14a1da7ce1">del_var</a>( n ) ;
<a name="l00608"></a>00608         return ;
<a name="l00609"></a>00609     }
<a name="l00610"></a>00610 
<a name="l00611"></a>00611     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1DDS.html#a5140f67d8f7eecf0a260d8a5d9fc39c5">Vars_iter</a> i = vars.begin(); i != vars.end(); i++) {
<a name="l00612"></a>00612         <span class="keywordflow">if</span> ((*i)-&gt;name() == n) {
<a name="l00613"></a>00613             <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *bt = *i ;
<a name="l00614"></a>00614             vars.erase(i) ;
<a name="l00615"></a>00615             <span class="keyword">delete</span> bt ; bt = 0;
<a name="l00616"></a>00616             <span class="keywordflow">return</span>;
<a name="l00617"></a>00617         }
<a name="l00618"></a>00618     }
<a name="l00619"></a>00619 }
<a name="l00620"></a>00620 
<a name="l00625"></a>00625 <span class="keywordtype">void</span>
<a name="l00626"></a><a class="code" href="classlibdap_1_1DDS.html#ac06f060770215ad790aa5437e567a215">00626</a> <a class="code" href="classlibdap_1_1DDS.html#a7030e5bf19371742219f14d6b3aeeedf" title="Removes a variable from the DDS.">DDS::del_var</a>(<a class="code" href="classlibdap_1_1DDS.html#a5140f67d8f7eecf0a260d8a5d9fc39c5">Vars_iter</a> i)
<a name="l00627"></a>00627 {
<a name="l00628"></a>00628     <span class="keywordflow">if</span> (i != vars.end()) {
<a name="l00629"></a>00629         <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *bt = *i ;
<a name="l00630"></a>00630         vars.erase(i) ;
<a name="l00631"></a>00631         <span class="keyword">delete</span> bt ; bt = 0;
<a name="l00632"></a>00632     }
<a name="l00633"></a>00633 }
<a name="l00634"></a>00634 
<a name="l00641"></a>00641 <span class="keywordtype">void</span>
<a name="l00642"></a><a class="code" href="classlibdap_1_1DDS.html#a6ae053eca0eadcfa1368da8486bf5e06">00642</a> <a class="code" href="classlibdap_1_1DDS.html#a7030e5bf19371742219f14d6b3aeeedf" title="Removes a variable from the DDS.">DDS::del_var</a>(<a class="code" href="classlibdap_1_1DDS.html#a5140f67d8f7eecf0a260d8a5d9fc39c5">Vars_iter</a> i1, <a class="code" href="classlibdap_1_1DDS.html#a5140f67d8f7eecf0a260d8a5d9fc39c5">Vars_iter</a> i2)
<a name="l00643"></a>00643 {
<a name="l00644"></a>00644     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1DDS.html#a5140f67d8f7eecf0a260d8a5d9fc39c5">Vars_iter</a> i_tmp = i1; i_tmp != i2; i_tmp++) {
<a name="l00645"></a>00645         <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *bt = *i_tmp ;
<a name="l00646"></a>00646         <span class="keyword">delete</span> bt ; bt = 0;
<a name="l00647"></a>00647     }
<a name="l00648"></a>00648     vars.erase(i1, i2) ;
<a name="l00649"></a>00649 }
<a name="l00650"></a>00650 
<a name="l00658"></a>00658 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *
<a name="l00659"></a><a class="code" href="classlibdap_1_1DDS.html#a74c67b99babe3317a0f76c8d8f7ba37a">00659</a> <a class="code" href="classlibdap_1_1DDS.html#a74c67b99babe3317a0f76c8d8f7ba37a">DDS::var</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;n, <a class="code" href="classlibdap_1_1BaseType.html#ae9c6e71855b90a0e552713011c9ab81f">BaseType::btp_stack</a> &amp;s)
<a name="l00660"></a>00660 {
<a name="l00661"></a>00661     <span class="keywordflow">return</span> <a class="code" href="classlibdap_1_1DDS.html#a74c67b99babe3317a0f76c8d8f7ba37a">var</a>(n, &amp;s);
<a name="l00662"></a>00662 }
<a name="l00682"></a>00682 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *
<a name="l00683"></a><a class="code" href="classlibdap_1_1DDS.html#ab53f39cffc45142b4cb38117e5650487">00683</a> <a class="code" href="classlibdap_1_1DDS.html#a74c67b99babe3317a0f76c8d8f7ba37a">DDS::var</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;n, <a class="code" href="classlibdap_1_1BaseType.html#ae9c6e71855b90a0e552713011c9ab81f">BaseType::btp_stack</a> *s)
<a name="l00684"></a>00684 {
<a name="l00685"></a>00685     <span class="keywordtype">string</span> name = <a class="code" href="namespacelibdap.html#a376f9593431111a80ef78c98b8f4a0e2">www2id</a>(n);
<a name="l00686"></a>00686     <span class="keywordflow">if</span>( d_container )
<a name="l00687"></a>00687         <span class="keywordflow">return</span> d_container-&gt;<a class="code" href="classlibdap_1_1Structure.html#a049967f250fca1b3949bd2a1c8649890" title="Returns a pointer to a member of a constructor class.">var</a>( name, <span class="keyword">false</span>, s ) ;
<a name="l00688"></a>00688 
<a name="l00689"></a>00689     <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *v = <a class="code" href="classlibdap_1_1DDS.html#a6f4fb3cf9a40d44e2e154ab1c0096a5d">exact_match</a>(name, s);
<a name="l00690"></a>00690     <span class="keywordflow">if</span> (v)
<a name="l00691"></a>00691         <span class="keywordflow">return</span> v;
<a name="l00692"></a>00692 
<a name="l00693"></a>00693     <span class="keywordflow">return</span> <a class="code" href="classlibdap_1_1DDS.html#a2f60c6b71b5534d5b16c14c9c1dbed00">leaf_match</a>(name, s);
<a name="l00694"></a>00694 }
<a name="l00695"></a>00695 
<a name="l00696"></a>00696 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *
<a name="l00697"></a><a class="code" href="classlibdap_1_1DDS.html#a2f60c6b71b5534d5b16c14c9c1dbed00">00697</a> <a class="code" href="classlibdap_1_1DDS.html#a2f60c6b71b5534d5b16c14c9c1dbed00">DDS::leaf_match</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;n, <a class="code" href="classlibdap_1_1BaseType.html#ae9c6e71855b90a0e552713011c9ab81f">BaseType::btp_stack</a> *s)
<a name="l00698"></a>00698 {
<a name="l00699"></a>00699     <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;DDS::leaf_match: Looking for &quot;</span> &lt;&lt; n &lt;&lt; endl);
<a name="l00700"></a>00700 
<a name="l00701"></a>00701     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1DDS.html#a5140f67d8f7eecf0a260d8a5d9fc39c5">Vars_iter</a> i = vars.begin(); i != vars.end(); i++) {
<a name="l00702"></a>00702         <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = *i;
<a name="l00703"></a>00703         <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;DDS::leaf_match: Looking for &quot;</span> &lt;&lt; n &lt;&lt; <span class="stringliteral">&quot; in: &quot;</span> &lt;&lt; btp-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() &lt;&lt; endl);
<a name="l00704"></a>00704         <span class="comment">// Look for the name in the dataset&#39;s top-level</span>
<a name="l00705"></a>00705         <span class="keywordflow">if</span> (btp-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() == n) {
<a name="l00706"></a>00706             <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Found &quot;</span> &lt;&lt; n &lt;&lt; <span class="stringliteral">&quot; in: &quot;</span> &lt;&lt; btp-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() &lt;&lt; endl);
<a name="l00707"></a>00707             <span class="keywordflow">return</span> btp;
<a name="l00708"></a>00708         }
<a name="l00709"></a>00709 
<a name="l00710"></a>00710         <span class="keywordflow">if</span> (btp-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a9eb6cae7f3490723180131345c85cfc7" title="Returns true if the instance is a constructor (i.e., Structure, Sequence or Grid) type variable...">is_constructor_type</a>()) {
<a name="l00711"></a>00711             <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *found = btp-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a4dc4fac1bb6083f6db645f37bfd59b85" title="Returns a pointer to a member of a constructor class.">var</a>(n, <span class="keyword">false</span>, s);
<a name="l00712"></a>00712             <span class="keywordflow">if</span> (found) {
<a name="l00713"></a>00713                 <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Found &quot;</span> &lt;&lt; n &lt;&lt; <span class="stringliteral">&quot; in: &quot;</span> &lt;&lt; btp-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() &lt;&lt; endl);
<a name="l00714"></a>00714                 <span class="keywordflow">return</span> found;
<a name="l00715"></a>00715             }
<a name="l00716"></a>00716         }
<a name="l00717"></a>00717 <span class="preprocessor">#if STRUCTURE_ARRAY_SYNTAX_OLD</span>
<a name="l00718"></a>00718 <span class="preprocessor"></span>        <span class="keywordflow">if</span> (btp-&gt;<a class="code" href="classlibdap_1_1BaseType.html#ad1d57be80c8e89b8a9e59bed48779556" title="Returns true if the instance is a vector (i.e., array) type variable.">is_vector_type</a>() &amp;&amp; btp-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a4dc4fac1bb6083f6db645f37bfd59b85" title="Returns a pointer to a member of a constructor class.">var</a>()-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a9eb6cae7f3490723180131345c85cfc7" title="Returns true if the instance is a constructor (i.e., Structure, Sequence or Grid) type variable...">is_constructor_type</a>()) {
<a name="l00719"></a>00719             s-&gt;push(btp);
<a name="l00720"></a>00720             <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *found = btp-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a4dc4fac1bb6083f6db645f37bfd59b85" title="Returns a pointer to a member of a constructor class.">var</a>()-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a4dc4fac1bb6083f6db645f37bfd59b85" title="Returns a pointer to a member of a constructor class.">var</a>(n, <span class="keyword">false</span>, s);
<a name="l00721"></a>00721             <span class="keywordflow">if</span> (found) {
<a name="l00722"></a>00722                 <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Found &quot;</span> &lt;&lt; n &lt;&lt; <span class="stringliteral">&quot; in: &quot;</span> &lt;&lt; btp-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a4dc4fac1bb6083f6db645f37bfd59b85" title="Returns a pointer to a member of a constructor class.">var</a>()-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() &lt;&lt; endl);
<a name="l00723"></a>00723                 <span class="keywordflow">return</span> found;
<a name="l00724"></a>00724             }
<a name="l00725"></a>00725         }
<a name="l00726"></a>00726 <span class="preprocessor">#endif</span>
<a name="l00727"></a>00727 <span class="preprocessor"></span>    }
<a name="l00728"></a>00728 
<a name="l00729"></a>00729     <span class="keywordflow">return</span> 0;   <span class="comment">// It is not here.</span>
<a name="l00730"></a>00730 }
<a name="l00731"></a>00731 
<a name="l00732"></a>00732 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *
<a name="l00733"></a><a class="code" href="classlibdap_1_1DDS.html#a6f4fb3cf9a40d44e2e154ab1c0096a5d">00733</a> <a class="code" href="classlibdap_1_1DDS.html#a6f4fb3cf9a40d44e2e154ab1c0096a5d">DDS::exact_match</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;name, <a class="code" href="classlibdap_1_1BaseType.html#ae9c6e71855b90a0e552713011c9ab81f">BaseType::btp_stack</a> *s)
<a name="l00734"></a>00734 {
<a name="l00735"></a>00735     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1DDS.html#a5140f67d8f7eecf0a260d8a5d9fc39c5">Vars_iter</a> i = vars.begin(); i != vars.end(); i++) {
<a name="l00736"></a>00736         <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = *i;
<a name="l00737"></a>00737         <a class="code" href="debug_8h.html#ac1f764c266c50f0050e33557004c914c">DBG2</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Looking for &quot;</span> &lt;&lt; name &lt;&lt; <span class="stringliteral">&quot; in: &quot;</span> &lt;&lt; btp &lt;&lt; endl);
<a name="l00738"></a>00738         <span class="comment">// Look for the name in the current ctor type or the top level</span>
<a name="l00739"></a>00739         <span class="keywordflow">if</span> (btp-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() == name) {
<a name="l00740"></a>00740             <a class="code" href="debug_8h.html#ac1f764c266c50f0050e33557004c914c">DBG2</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Found &quot;</span> &lt;&lt; name &lt;&lt; <span class="stringliteral">&quot; in: &quot;</span> &lt;&lt; btp &lt;&lt; endl);
<a name="l00741"></a>00741             <span class="keywordflow">return</span> btp;
<a name="l00742"></a>00742         }
<a name="l00743"></a>00743     }
<a name="l00744"></a>00744 
<a name="l00745"></a>00745     string::size_type dot_pos = name.find(<span class="stringliteral">&quot;.&quot;</span>);
<a name="l00746"></a>00746     <span class="keywordflow">if</span> (dot_pos != string::npos) {
<a name="l00747"></a>00747         <span class="keywordtype">string</span> aggregate = name.substr(0, dot_pos);
<a name="l00748"></a>00748         <span class="keywordtype">string</span> field = name.substr(dot_pos + 1);
<a name="l00749"></a>00749 
<a name="l00750"></a>00750         <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *agg_ptr = <a class="code" href="classlibdap_1_1DDS.html#a74c67b99babe3317a0f76c8d8f7ba37a">var</a>(aggregate, s);
<a name="l00751"></a>00751         <span class="keywordflow">if</span> (agg_ptr) {
<a name="l00752"></a>00752             <a class="code" href="debug_8h.html#ac1f764c266c50f0050e33557004c914c">DBG2</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Descending into &quot;</span> &lt;&lt; agg_ptr-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() &lt;&lt; endl);
<a name="l00753"></a>00753             <span class="keywordflow">return</span> agg_ptr-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a4dc4fac1bb6083f6db645f37bfd59b85" title="Returns a pointer to a member of a constructor class.">var</a>(field, <span class="keyword">true</span>, s);
<a name="l00754"></a>00754         }
<a name="l00755"></a>00755         <span class="keywordflow">else</span>
<a name="l00756"></a>00756             <span class="keywordflow">return</span> 0;  <span class="comment">// qualified names must be *fully* qualified</span>
<a name="l00757"></a>00757     }
<a name="l00758"></a>00758 
<a name="l00759"></a>00759     <span class="keywordflow">return</span> 0;   <span class="comment">// It is not here.</span>
<a name="l00760"></a>00760 }
<a name="l00761"></a>00761 
<a name="l00762"></a>00762 
<a name="l00765"></a>00765 <a class="code" href="classlibdap_1_1DDS.html#a5140f67d8f7eecf0a260d8a5d9fc39c5">DDS::Vars_iter</a>
<a name="l00766"></a><a class="code" href="classlibdap_1_1DDS.html#aac98f248cd5730a8769f9d71af9788d3">00766</a> <a class="code" href="classlibdap_1_1DDS.html#aac98f248cd5730a8769f9d71af9788d3" title="Return an iterator to the first variable.">DDS::var_begin</a>()
<a name="l00767"></a>00767 {
<a name="l00768"></a>00768     <span class="keywordflow">return</span> vars.begin();
<a name="l00769"></a>00769 }
<a name="l00770"></a>00770 
<a name="l00771"></a>00771 <a class="code" href="classlibdap_1_1DDS.html#a03816194d9596596926d6c8fa1872604">DDS::Vars_riter</a>
<a name="l00772"></a><a class="code" href="classlibdap_1_1DDS.html#a395947ea7f5abab45e7bfe7541ec9dc2">00772</a> <a class="code" href="classlibdap_1_1DDS.html#a395947ea7f5abab45e7bfe7541ec9dc2" title="Return a reverse iterator.">DDS::var_rbegin</a>()
<a name="l00773"></a>00773 {
<a name="l00774"></a>00774     <span class="keywordflow">return</span> vars.rbegin();
<a name="l00775"></a>00775 }
<a name="l00776"></a>00776 
<a name="l00777"></a>00777 <a class="code" href="classlibdap_1_1DDS.html#a5140f67d8f7eecf0a260d8a5d9fc39c5">DDS::Vars_iter</a>
<a name="l00778"></a><a class="code" href="classlibdap_1_1DDS.html#ad204bbd6eed8d440fb996f41bc986058">00778</a> <a class="code" href="classlibdap_1_1DDS.html#ad204bbd6eed8d440fb996f41bc986058" title="Return an iterator.">DDS::var_end</a>()
<a name="l00779"></a>00779 {
<a name="l00780"></a>00780     <span class="keywordflow">return</span> vars.end() ;
<a name="l00781"></a>00781 }
<a name="l00782"></a>00782 
<a name="l00783"></a>00783 <a class="code" href="classlibdap_1_1DDS.html#a03816194d9596596926d6c8fa1872604">DDS::Vars_riter</a>
<a name="l00784"></a><a class="code" href="classlibdap_1_1DDS.html#a098d88f09002ad80e27acdb81a52659e">00784</a> <a class="code" href="classlibdap_1_1DDS.html#a098d88f09002ad80e27acdb81a52659e" title="Return a reverse iterator.">DDS::var_rend</a>()
<a name="l00785"></a>00785 {
<a name="l00786"></a>00786     <span class="keywordflow">return</span> vars.rend() ;
<a name="l00787"></a>00787 }
<a name="l00788"></a>00788 
<a name="l00792"></a>00792 <a class="code" href="classlibdap_1_1DDS.html#a5140f67d8f7eecf0a260d8a5d9fc39c5">DDS::Vars_iter</a>
<a name="l00793"></a><a class="code" href="classlibdap_1_1DDS.html#a415f3083d3864eb04d6508772b3c4128">00793</a> <a class="code" href="classlibdap_1_1DDS.html#a415f3083d3864eb04d6508772b3c4128" title="Get an iterator.">DDS::get_vars_iter</a>(<span class="keywordtype">int</span> i)
<a name="l00794"></a>00794 {
<a name="l00795"></a>00795     <span class="keywordflow">return</span> vars.begin() + i;
<a name="l00796"></a>00796 }
<a name="l00797"></a>00797 
<a name="l00801"></a>00801 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *
<a name="l00802"></a><a class="code" href="classlibdap_1_1DDS.html#a5161e73a84f49c759bd411c8a3c3c356">00802</a> <a class="code" href="classlibdap_1_1DDS.html#a5161e73a84f49c759bd411c8a3c3c356" title="Get a variable.">DDS::get_var_index</a>(<span class="keywordtype">int</span> i)
<a name="l00803"></a>00803 {
<a name="l00804"></a>00804     <span class="keywordflow">return</span> *(vars.begin() + i);
<a name="l00805"></a>00805 }
<a name="l00806"></a>00806 
<a name="l00808"></a>00808 <span class="keywordtype">int</span>
<a name="l00809"></a><a class="code" href="classlibdap_1_1DDS.html#a3e99a99da58051c745cc8a3ab82e3b38">00809</a> <a class="code" href="classlibdap_1_1DDS.html#a3e99a99da58051c745cc8a3ab82e3b38" title="Returns the number of variables in the DDS.">DDS::num_var</a>()
<a name="l00810"></a>00810 {
<a name="l00811"></a>00811     <span class="keywordflow">return</span> vars.size();
<a name="l00812"></a>00812 }
<a name="l00813"></a>00813 
<a name="l00814"></a>00814 <span class="keywordtype">void</span>
<a name="l00815"></a><a class="code" href="classlibdap_1_1DDS.html#a8cd9b6a34f5e1a49665de3189e141de8">00815</a> <a class="code" href="classlibdap_1_1DDS.html#a8cd9b6a34f5e1a49665de3189e141de8">DDS::timeout_on</a>()
<a name="l00816"></a>00816 {
<a name="l00817"></a>00817 <span class="preprocessor">#ifndef WIN32</span>
<a name="l00818"></a>00818 <span class="preprocessor"></span>    alarm(d_timeout);
<a name="l00819"></a>00819 <span class="preprocessor">#endif</span>
<a name="l00820"></a>00820 <span class="preprocessor"></span>}
<a name="l00821"></a>00821 
<a name="l00822"></a>00822 <span class="keywordtype">void</span>
<a name="l00823"></a><a class="code" href="classlibdap_1_1DDS.html#a6740f99a5fc64640505924c5603ace0a">00823</a> <a class="code" href="classlibdap_1_1DDS.html#a6740f99a5fc64640505924c5603ace0a">DDS::timeout_off</a>()
<a name="l00824"></a>00824 {
<a name="l00825"></a>00825 <span class="preprocessor">#ifndef WIN32</span>
<a name="l00826"></a>00826 <span class="preprocessor"></span>    d_timeout = alarm(0);
<a name="l00827"></a>00827 <span class="preprocessor">#endif</span>
<a name="l00828"></a>00828 <span class="preprocessor"></span>}
<a name="l00829"></a>00829 
<a name="l00830"></a>00830 <span class="keywordtype">void</span>
<a name="l00831"></a><a class="code" href="classlibdap_1_1DDS.html#ac97d9bc59c742b46614779f9381baf6a">00831</a> <a class="code" href="classlibdap_1_1DDS.html#ac97d9bc59c742b46614779f9381baf6a">DDS::set_timeout</a>(<span class="keywordtype">int</span> t)
<a name="l00832"></a>00832 {
<a name="l00833"></a>00833     <span class="comment">//  Has no effect under win32</span>
<a name="l00834"></a>00834     d_timeout = t;
<a name="l00835"></a>00835 }
<a name="l00836"></a>00836 
<a name="l00837"></a>00837 <span class="keywordtype">int</span>
<a name="l00838"></a><a class="code" href="classlibdap_1_1DDS.html#a24bd3f9014033dbf054b901028427c33">00838</a> <a class="code" href="classlibdap_1_1DDS.html#a24bd3f9014033dbf054b901028427c33">DDS::get_timeout</a>()
<a name="l00839"></a>00839 {
<a name="l00840"></a>00840     <span class="comment">//  Has to effect under win32</span>
<a name="l00841"></a>00841     <span class="keywordflow">return</span> d_timeout;
<a name="l00842"></a>00842 }
<a name="l00843"></a>00843 
<a name="l00845"></a>00845 <span class="keywordtype">void</span>
<a name="l00846"></a><a class="code" href="classlibdap_1_1DDS.html#a9d4421c2ccfdbc5ebd4a7d963ab53795">00846</a> <a class="code" href="classlibdap_1_1DDS.html#a9d4421c2ccfdbc5ebd4a7d963ab53795" title="Traverse DDS, set Sequence leaf nodes.">DDS::tag_nested_sequences</a>()
<a name="l00847"></a>00847 {
<a name="l00848"></a>00848     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1DDS.html#a5140f67d8f7eecf0a260d8a5d9fc39c5">Vars_iter</a> i = vars.begin(); i != vars.end(); i++) {
<a name="l00849"></a>00849         <span class="keywordflow">if</span> ((*i)-&gt;type() == <a class="code" href="namespacelibdap.html#a05ca706d4539ae7b750c3bc7066ab6e6a0b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>)
<a name="l00850"></a>00850             dynamic_cast&lt;Sequence&amp;&gt;(**i).set_leaf_sequence();
<a name="l00851"></a>00851         <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((*i)-&gt;type() == <a class="code" href="namespacelibdap.html#a05ca706d4539ae7b750c3bc7066ab6e6ad93eb0a69e67742f061966ce594b9a6c">dods_structure_c</a>)
<a name="l00852"></a>00852             dynamic_cast&lt;Structure&amp;&gt;(**i).set_leaf_sequence();
<a name="l00853"></a>00853     }
<a name="l00854"></a>00854 }
<a name="l00855"></a>00855 
<a name="l00857"></a>00857 <span class="keywordtype">void</span>
<a name="l00858"></a><a class="code" href="classlibdap_1_1DDS.html#a733c8e49ed42ab47d74afe68056340e6">00858</a> <a class="code" href="classlibdap_1_1DDS.html#a733c8e49ed42ab47d74afe68056340e6" title="Parse a DDS from a file with the given name.">DDS::parse</a>(<span class="keywordtype">string</span> fname)
<a name="l00859"></a>00859 {
<a name="l00860"></a>00860     FILE *in = fopen(fname.c_str(), <span class="stringliteral">&quot;r&quot;</span>);
<a name="l00861"></a>00861 
<a name="l00862"></a>00862     <span class="keywordflow">if</span> (!in) {
<a name="l00863"></a>00863         <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(<a class="code" href="Error_8h.html#abfb3e05b1e44bdd0f9be651a01ba464b">cannot_read_file</a>, <span class="stringliteral">&quot;Could not open: &quot;</span> + fname);
<a name="l00864"></a>00864     }
<a name="l00865"></a>00865 
<a name="l00866"></a>00866     <span class="keywordflow">try</span> {
<a name="l00867"></a>00867         <a class="code" href="classlibdap_1_1DDS.html#a733c8e49ed42ab47d74afe68056340e6" title="Parse a DDS from a file with the given name.">parse</a>(in);
<a name="l00868"></a>00868         fclose(in);
<a name="l00869"></a>00869     }
<a name="l00870"></a>00870     <span class="keywordflow">catch</span> (<a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a> &amp;e) {
<a name="l00871"></a>00871         fclose(in);
<a name="l00872"></a>00872         <span class="keywordflow">throw</span> e;
<a name="l00873"></a>00873     }
<a name="l00874"></a>00874 }
<a name="l00875"></a>00875 
<a name="l00876"></a>00876 
<a name="l00878"></a>00878 <span class="keywordtype">void</span>
<a name="l00879"></a><a class="code" href="classlibdap_1_1DDS.html#a3af2c3d3707f1a9c91d9c00937bb7325">00879</a> <a class="code" href="classlibdap_1_1DDS.html#a733c8e49ed42ab47d74afe68056340e6" title="Parse a DDS from a file with the given name.">DDS::parse</a>(<span class="keywordtype">int</span> fd)
<a name="l00880"></a>00880 {
<a name="l00881"></a>00881 <span class="preprocessor">#ifdef WIN32</span>
<a name="l00882"></a>00882 <span class="preprocessor"></span>    FILE *in = fdopen(_dup(fd), <span class="stringliteral">&quot;r&quot;</span>);
<a name="l00883"></a>00883 <span class="preprocessor">#else</span>
<a name="l00884"></a>00884 <span class="preprocessor"></span>    FILE *in = fdopen(dup(fd), <span class="stringliteral">&quot;r&quot;</span>);
<a name="l00885"></a>00885 <span class="preprocessor">#endif</span>
<a name="l00886"></a>00886 <span class="preprocessor"></span>
<a name="l00887"></a>00887     <span class="keywordflow">if</span> (!in) {
<a name="l00888"></a>00888         <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">&quot;Could not access file.&quot;</span>);
<a name="l00889"></a>00889     }
<a name="l00890"></a>00890 
<a name="l00891"></a>00891     <span class="keywordflow">try</span> {
<a name="l00892"></a>00892         <a class="code" href="classlibdap_1_1DDS.html#a733c8e49ed42ab47d74afe68056340e6" title="Parse a DDS from a file with the given name.">parse</a>(in);
<a name="l00893"></a>00893         fclose(in);
<a name="l00894"></a>00894     }
<a name="l00895"></a>00895     <span class="keywordflow">catch</span> (<a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a> &amp;e) {
<a name="l00896"></a>00896         fclose(in);
<a name="l00897"></a>00897         <span class="keywordflow">throw</span> e;
<a name="l00898"></a>00898     }
<a name="l00899"></a>00899 }
<a name="l00900"></a>00900 
<a name="l00907"></a>00907 <span class="keywordtype">void</span>
<a name="l00908"></a><a class="code" href="classlibdap_1_1DDS.html#a02857d9355cd01dec621ae0bdf453075">00908</a> <a class="code" href="classlibdap_1_1DDS.html#a733c8e49ed42ab47d74afe68056340e6" title="Parse a DDS from a file with the given name.">DDS::parse</a>(FILE *in)
<a name="l00909"></a>00909 {
<a name="l00910"></a>00910     <span class="keywordflow">if</span> (!in) {
<a name="l00911"></a>00911         <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">&quot;Null input stream.&quot;</span>);
<a name="l00912"></a>00912     }
<a name="l00913"></a>00913 
<a name="l00914"></a>00914     <span class="keywordtype">void</span> *buffer = <a class="code" href="DDS_8cc.html#aff5b329f05457ec3f9389a47ad449993">dds_buffer</a>(in);
<a name="l00915"></a>00915     <a class="code" href="DDS_8cc.html#aacb50379a000305a2dc076e9c211f4c4">dds_switch_to_buffer</a>(buffer);
<a name="l00916"></a>00916 
<a name="l00917"></a>00917     <a class="code" href="structlibdap_1_1parser__arg.html" title="Pass parameters by reference to a parser.">parser_arg</a> arg(<span class="keyword">this</span>);
<a name="l00918"></a>00918 
<a name="l00919"></a>00919     <span class="keywordtype">bool</span> status = <a class="code" href="DDS_8cc.html#af25dd46fa4d8243c7120340421ad21b2">ddsparse</a>((<span class="keywordtype">void</span> *) &amp; arg) == 0;
<a name="l00920"></a>00920 
<a name="l00921"></a>00921     <a class="code" href="DDS_8cc.html#ab25223d65a5db252c222f9b31c39a2ef">dds_delete_buffer</a>(buffer);
<a name="l00922"></a>00922 
<a name="l00923"></a>00923     <a class="code" href="debug_8h.html#ac1f764c266c50f0050e33557004c914c">DBG2</a>(cout &lt;&lt; <span class="stringliteral">&quot;Status from parser: &quot;</span> &lt;&lt; status &lt;&lt; endl);
<a name="l00924"></a>00924 
<a name="l00925"></a>00925     <span class="comment">//  STATUS is the result of the parser function; if a recoverable error</span>
<a name="l00926"></a>00926     <span class="comment">//  was found it will be true but arg.status() will be false.</span>
<a name="l00927"></a>00927     <span class="keywordflow">if</span> (!status || !arg.status()) {<span class="comment">// Check parse result</span>
<a name="l00928"></a>00928         <span class="keywordflow">if</span> (arg.error())
<a name="l00929"></a>00929             <span class="keywordflow">throw</span> *arg.error();
<a name="l00930"></a>00930     }
<a name="l00931"></a>00931 }
<a name="l00932"></a>00932 
<a name="l00933"></a>00933 <span class="preprocessor">#if FILE_METHODS</span>
<a name="l00934"></a>00934 <span class="preprocessor"></span>
<a name="l00935"></a>00935 <span class="keywordtype">void</span>
<a name="l00936"></a>00936 <a class="code" href="classlibdap_1_1DDS.html#a535b5900c31f0038061f4aef5fa1c6c1" title="Print the entire DDS to the specified ostream.">DDS::print</a>(FILE *out)
<a name="l00937"></a>00937 {
<a name="l00938"></a>00938 <span class="preprocessor">#if 0</span>
<a name="l00939"></a>00939 <span class="preprocessor"></span>    ostringstream oss;
<a name="l00940"></a>00940     <a class="code" href="classlibdap_1_1DDS.html#a535b5900c31f0038061f4aef5fa1c6c1" title="Print the entire DDS to the specified ostream.">print</a>(oss);
<a name="l00941"></a>00941 
<a name="l00942"></a>00942     fwrite(oss.str().c_str(), oss.str().length(), 1, out);
<a name="l00943"></a>00943 <span class="preprocessor">#else</span>
<a name="l00944"></a>00944 <span class="preprocessor"></span>    fprintf(out, <span class="stringliteral">&quot;Dataset {\n&quot;</span>) ;
<a name="l00945"></a>00945 
<a name="l00946"></a>00946     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1DDS.html#ae18628332086dd04361e0ba745cd91ca">Vars_citer</a> i = vars.begin(); i != vars.end(); i++) {
<a name="l00947"></a>00947         (*i)-&gt;print_decl(out) ;
<a name="l00948"></a>00948     }
<a name="l00949"></a>00949 
<a name="l00950"></a>00950     fprintf(out, <span class="stringliteral">&quot;} %s;\n&quot;</span>, <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(name).c_str()) ;
<a name="l00951"></a>00951 
<a name="l00952"></a>00952     return ;
<a name="l00953"></a>00953 <span class="preprocessor">#endif</span>
<a name="l00954"></a>00954 <span class="preprocessor"></span>}
<a name="l00955"></a>00955 <span class="preprocessor">#endif</span>
<a name="l00956"></a>00956 <span class="preprocessor"></span>
<a name="l00958"></a>00958 <span class="keywordtype">void</span>
<a name="l00959"></a><a class="code" href="classlibdap_1_1DDS.html#a535b5900c31f0038061f4aef5fa1c6c1">00959</a> <a class="code" href="classlibdap_1_1DDS.html#a535b5900c31f0038061f4aef5fa1c6c1" title="Print the entire DDS to the specified ostream.">DDS::print</a>(ostream &amp;out)
<a name="l00960"></a>00960 {
<a name="l00961"></a>00961     out &lt;&lt; <span class="stringliteral">&quot;Dataset {\n&quot;</span> ;
<a name="l00962"></a>00962 
<a name="l00963"></a>00963     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1DDS.html#ae18628332086dd04361e0ba745cd91ca">Vars_citer</a> i = vars.begin(); i != vars.end(); i++) {
<a name="l00964"></a>00964         (*i)-&gt;print_decl(out) ;
<a name="l00965"></a>00965     }
<a name="l00966"></a>00966 
<a name="l00967"></a>00967     out &lt;&lt; <span class="stringliteral">&quot;} &quot;</span> &lt;&lt; <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(name) &lt;&lt; <span class="stringliteral">&quot;;\n&quot;</span> ;
<a name="l00968"></a>00968 
<a name="l00969"></a>00969     return ;
<a name="l00970"></a>00970 }
<a name="l00971"></a>00971 
<a name="l00972"></a>00972 <span class="preprocessor">#if FILE_METHODS</span>
<a name="l00973"></a>00973 <span class="preprocessor"></span>
<a name="l00983"></a>00983 <span class="keywordtype">void</span>
<a name="l00984"></a>00984 <a class="code" href="classlibdap_1_1DDS.html#ab2e1cacd542373312d5154565b3c1571" title="Print a constrained DDS to the specified ostream.">DDS::print_constrained</a>(FILE *out)
<a name="l00985"></a>00985 {
<a name="l00986"></a>00986     fprintf(out, <span class="stringliteral">&quot;Dataset {\n&quot;</span>) ;
<a name="l00987"></a>00987 
<a name="l00988"></a>00988     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1DDS.html#ae18628332086dd04361e0ba745cd91ca">Vars_citer</a> i = vars.begin(); i != vars.end(); i++) {
<a name="l00989"></a>00989         <span class="comment">// for each variable, indent with four spaces, print a trailing</span>
<a name="l00990"></a>00990         <span class="comment">// semicolon, do not print debugging information, print only</span>
<a name="l00991"></a>00991         <span class="comment">// variables in the current projection.</span>
<a name="l00992"></a>00992         (*i)-&gt;print_decl(out, <span class="stringliteral">&quot;    &quot;</span>, <span class="keyword">true</span>, <span class="keyword">false</span>, <span class="keyword">true</span>) ;
<a name="l00993"></a>00993     }
<a name="l00994"></a>00994 
<a name="l00995"></a>00995     fprintf(out, <span class="stringliteral">&quot;} %s;\n&quot;</span>, <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(name).c_str()) ;
<a name="l00996"></a>00996 
<a name="l00997"></a>00997     <span class="keywordflow">return</span>;
<a name="l00998"></a>00998 }
<a name="l00999"></a>00999 <span class="preprocessor">#endif</span>
<a name="l01000"></a>01000 <span class="preprocessor"></span>
<a name="l01011"></a>01011 <span class="keywordtype">void</span>
<a name="l01012"></a><a class="code" href="classlibdap_1_1DDS.html#ab2e1cacd542373312d5154565b3c1571">01012</a> <a class="code" href="classlibdap_1_1DDS.html#ab2e1cacd542373312d5154565b3c1571" title="Print a constrained DDS to the specified ostream.">DDS::print_constrained</a>(ostream &amp;out)
<a name="l01013"></a>01013 {
<a name="l01014"></a>01014     out &lt;&lt; <span class="stringliteral">&quot;Dataset {\n&quot;</span> ;
<a name="l01015"></a>01015 
<a name="l01016"></a>01016     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1DDS.html#ae18628332086dd04361e0ba745cd91ca">Vars_citer</a> i = vars.begin(); i != vars.end(); i++) {
<a name="l01017"></a>01017         <span class="comment">// for each variable, indent with four spaces, print a trailing</span>
<a name="l01018"></a>01018         <span class="comment">// semicolon, do not print debugging information, print only</span>
<a name="l01019"></a>01019         <span class="comment">// variables in the current projection.</span>
<a name="l01020"></a>01020         (*i)-&gt;print_decl(out, <span class="stringliteral">&quot;    &quot;</span>, <span class="keyword">true</span>, <span class="keyword">false</span>, <span class="keyword">true</span>) ;
<a name="l01021"></a>01021     }
<a name="l01022"></a>01022 
<a name="l01023"></a>01023     out &lt;&lt; <span class="stringliteral">&quot;} &quot;</span> &lt;&lt; <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(name) &lt;&lt; <span class="stringliteral">&quot;;\n&quot;</span> ;
<a name="l01024"></a>01024 
<a name="l01025"></a>01025     <span class="keywordflow">return</span>;
<a name="l01026"></a>01026 }
<a name="l01027"></a>01027 
<a name="l01028"></a>01028 <span class="preprocessor">#if FILE_METHODS</span>
<a name="l01029"></a>01029 <span class="preprocessor"></span><span class="keyword">class </span>VariablePrintXML : <span class="keyword">public</span> unary_function&lt;BaseType *, void&gt;
<a name="l01030"></a>01030 {
<a name="l01031"></a>01031     FILE *d_out;
<a name="l01032"></a>01032     <span class="keywordtype">bool</span> d_constrained;
<a name="l01033"></a>01033 <span class="keyword">public</span>:
<a name="l01034"></a>01034     VariablePrintXML(FILE *out, <span class="keywordtype">bool</span> constrained)
<a name="l01035"></a>01035             : d_out(out), d_constrained(constrained)
<a name="l01036"></a>01036     {}
<a name="l01037"></a>01037     <span class="keywordtype">void</span> operator()(BaseType *bt)
<a name="l01038"></a>01038     {
<a name="l01039"></a>01039         bt-&gt;print_xml(d_out, <span class="stringliteral">&quot;    &quot;</span>, d_constrained);
<a name="l01040"></a>01040     }
<a name="l01041"></a>01041 };
<a name="l01042"></a>01042 
<a name="l01053"></a>01053 <span class="keywordtype">void</span>
<a name="l01054"></a>01054 <a class="code" href="classlibdap_1_1DDS.html#af319354a044d02ea89732160131004dc">DDS::print_xml</a>(FILE *out, <span class="keywordtype">bool</span> constrained, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;blob)
<a name="l01055"></a>01055 {
<a name="l01056"></a>01056     fprintf(out, <span class="stringliteral">&quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;UTF-8\&quot;?&gt;\n&quot;</span>);
<a name="l01057"></a>01057 
<a name="l01058"></a>01058     fprintf(out, <span class="stringliteral">&quot;&lt;Dataset name=\&quot;%s\&quot;\n&quot;</span>, <a class="code" href="namespacelibdap.html#a62463a13bf510db3a14c0053fea14f4d">id2xml</a>(name).c_str());
<a name="l01059"></a>01059 
<a name="l01060"></a>01060     fprintf(out, <span class="stringliteral">&quot;xmlns:xsi=\&quot;http://www.w3.org/2001/XMLSchema-instance\&quot;\n&quot;</span>);
<a name="l01061"></a>01061 
<a name="l01062"></a>01062     fprintf(out,<span class="stringliteral">&quot;method=\&quot;FILE*\&quot;\n&quot;</span>);
<a name="l01063"></a>01063     fprintf(out, <span class="stringliteral">&quot;dap_major=\&quot;%d\&quot;\n&quot;</span>, <a class="code" href="classlibdap_1_1DDS.html#ac00ec4e96b91d34bd09254005c4cbfdd" title="Get the DAP major version as sent by the client.">get_dap_major</a>());
<a name="l01064"></a>01064     fprintf(out, <span class="stringliteral">&quot;dap_minor=\&quot;%d\&quot;\n&quot;</span>, <a class="code" href="classlibdap_1_1DDS.html#a9ddd1966f1902e4856757cf552fa2b4e" title="Get the DAP minor version as sent by the client.">get_dap_minor</a>());
<a name="l01065"></a>01065 
<a name="l01066"></a>01066     <span class="comment">// Are we responding to a 3.2 or 2.0 client? We will have to improve on</span>
<a name="l01067"></a>01067     <span class="comment">// this at some point... jhrg</span>
<a name="l01068"></a>01068     <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1DDS.html#ac00ec4e96b91d34bd09254005c4cbfdd" title="Get the DAP major version as sent by the client.">get_dap_major</a>() == 3 &amp;&amp; <a class="code" href="classlibdap_1_1DDS.html#a9ddd1966f1902e4856757cf552fa2b4e" title="Get the DAP minor version as sent by the client.">get_dap_minor</a>() == 2) {
<a name="l01069"></a>01069     fprintf(out, <span class="stringliteral">&quot;xmlns=\&quot;%s\&quot;\n&quot;</span>, <a class="code" href="DDS_8cc.html#a802c262d5fa6e407025473a6f6361d24">c_dap32_namespace</a>.c_str());
<a name="l01070"></a>01070 
<a name="l01071"></a>01071     fprintf(out, <span class="stringliteral">&quot;xsi:schemaLocation=\&quot;%s  %s\&quot;&gt;\n\n&quot;</span>,
<a name="l01072"></a>01072             <a class="code" href="DDS_8cc.html#a802c262d5fa6e407025473a6f6361d24">c_dap32_namespace</a>.c_str(), <a class="code" href="DDS_8cc.html#a5435387617cf582691dd22ae63325c57">c_default_dap32_schema_location</a>.c_str());
<a name="l01073"></a>01073     }
<a name="l01074"></a>01074     <span class="keywordflow">else</span> {
<a name="l01075"></a>01075         fprintf(out, <span class="stringliteral">&quot;xmlns=\&quot;%s\&quot;\n&quot;</span>, <a class="code" href="DDS_8cc.html#a837d1aa1dfdd08c06cf62cdf0cf0ffef">c_dap20_namespace</a>.c_str());
<a name="l01076"></a>01076         fprintf(out, <span class="stringliteral">&quot;xsi:schemaLocation=\&quot;%s  %s\&quot;&gt;\n\n&quot;</span>,
<a name="l01077"></a>01077                 <a class="code" href="DDS_8cc.html#a837d1aa1dfdd08c06cf62cdf0cf0ffef">c_dap20_namespace</a>.c_str(), <a class="code" href="DDS_8cc.html#a142e6d92c13f0deeb196f0ef36ced13e">c_default_dap20_schema_location</a>.c_str());
<a name="l01078"></a>01078     }
<a name="l01079"></a>01079 
<a name="l01080"></a>01080 
<a name="l01081"></a>01081     d_attr.print_xml(out, <span class="stringliteral">&quot;    &quot;</span>, constrained);
<a name="l01082"></a>01082 
<a name="l01083"></a>01083     fprintf(out, <span class="stringliteral">&quot;\n&quot;</span>);
<a name="l01084"></a>01084 
<a name="l01085"></a>01085     for_each(<a class="code" href="classlibdap_1_1DDS.html#aac98f248cd5730a8769f9d71af9788d3" title="Return an iterator to the first variable.">var_begin</a>(), <a class="code" href="classlibdap_1_1DDS.html#ad204bbd6eed8d440fb996f41bc986058" title="Return an iterator.">var_end</a>(), VariablePrintXML(out, constrained));
<a name="l01086"></a>01086 
<a name="l01087"></a>01087     fprintf(out, <span class="stringliteral">&quot;\n&quot;</span>);
<a name="l01088"></a>01088 
<a name="l01089"></a>01089     <span class="comment">// Only print this for the 2.0, 3.0 and 3.1 versions - which are essentially</span>
<a name="l01090"></a>01090     <span class="comment">// the same. jhrg</span>
<a name="l01091"></a>01091     <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1DDS.html#ac00ec4e96b91d34bd09254005c4cbfdd" title="Get the DAP major version as sent by the client.">get_dap_major</a>() == 2 &amp;&amp; <a class="code" href="classlibdap_1_1DDS.html#a9ddd1966f1902e4856757cf552fa2b4e" title="Get the DAP minor version as sent by the client.">get_dap_minor</a>() == 0) {
<a name="l01092"></a>01092         fprintf(out, <span class="stringliteral">&quot;    &lt;dataBLOB href=\&quot;\&quot;/&gt;\n&quot;</span>);
<a name="l01093"></a>01093     }
<a name="l01094"></a>01094     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!blob.empty()
<a name="l01095"></a>01095              &amp;&amp; (<a class="code" href="classlibdap_1_1DDS.html#ac00ec4e96b91d34bd09254005c4cbfdd" title="Get the DAP major version as sent by the client.">get_dap_major</a>() == 3 &amp;&amp; <a class="code" href="classlibdap_1_1DDS.html#a9ddd1966f1902e4856757cf552fa2b4e" title="Get the DAP minor version as sent by the client.">get_dap_minor</a>() &gt;= 2)
<a name="l01096"></a>01096              || <a class="code" href="classlibdap_1_1DDS.html#ac00ec4e96b91d34bd09254005c4cbfdd" title="Get the DAP major version as sent by the client.">get_dap_major</a>() &gt;= 4) {
<a name="l01097"></a>01097         fprintf(out, <span class="stringliteral">&quot;    &lt;blob href=\&quot;cid:%s\&quot;/&gt;\n&quot;</span>, blob.c_str());
<a name="l01098"></a>01098     }
<a name="l01099"></a>01099 
<a name="l01100"></a>01100 
<a name="l01101"></a>01101     fprintf(out, <span class="stringliteral">&quot;&lt;/Dataset&gt;\n&quot;</span>);
<a name="l01102"></a>01102 }
<a name="l01103"></a>01103 <span class="preprocessor">#endif</span>
<a name="l01104"></a>01104 <span class="preprocessor"></span>
<a name="l01105"></a>01105 <span class="keyword">class </span>VariablePrintXMLStrm : <span class="keyword">public</span> unary_function&lt;BaseType *, void&gt;
<a name="l01106"></a>01106 {
<a name="l01107"></a>01107     ostream &amp;d_out;
<a name="l01108"></a>01108     <span class="keywordtype">bool</span> d_constrained;
<a name="l01109"></a>01109 <span class="keyword">public</span>:
<a name="l01110"></a>01110     VariablePrintXMLStrm(ostream &amp;out, <span class="keywordtype">bool</span> constrained)
<a name="l01111"></a>01111             : d_out(out), d_constrained(constrained)
<a name="l01112"></a>01112     {}
<a name="l01113"></a>01113     <span class="keywordtype">void</span> operator()(BaseType *bt)
<a name="l01114"></a>01114     {
<a name="l01115"></a>01115         bt-&gt;print_xml(d_out, <span class="stringliteral">&quot;    &quot;</span>, d_constrained);
<a name="l01116"></a>01116     }
<a name="l01117"></a>01117 };
<a name="l01118"></a>01118 
<a name="l01129"></a>01129 <span class="keywordtype">void</span>
<a name="l01130"></a><a class="code" href="classlibdap_1_1DDS.html#af319354a044d02ea89732160131004dc">01130</a> <a class="code" href="classlibdap_1_1DDS.html#af319354a044d02ea89732160131004dc">DDS::print_xml</a>(ostream &amp;out, <span class="keywordtype">bool</span> constrained, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;blob)
<a name="l01131"></a>01131 {
<a name="l01132"></a>01132     out &lt;&lt; <span class="stringliteral">&quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;UTF-8\&quot;?&gt;\n&quot;</span> ;
<a name="l01133"></a>01133 
<a name="l01134"></a>01134     out &lt;&lt; <span class="stringliteral">&quot;&lt;Dataset name=\&quot;&quot;</span> &lt;&lt; <a class="code" href="namespacelibdap.html#a62463a13bf510db3a14c0053fea14f4d">id2xml</a>(name) &lt;&lt; <span class="stringliteral">&quot;\&quot;\n&quot;</span> ;
<a name="l01135"></a>01135 
<a name="l01136"></a>01136     out &lt;&lt; <span class="stringliteral">&quot;xmlns:xsi=\&quot;http://www.w3.org/2001/XMLSchema-instance\&quot;\n&quot;</span> ;
<a name="l01137"></a>01137 
<a name="l01138"></a>01138     <span class="comment">// Are we responding to a 3.2 or 2.0 client? We will have to improve on</span>
<a name="l01139"></a>01139     <span class="comment">// this at some point... jhrg</span>
<a name="l01140"></a>01140     <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1DDS.html#ac00ec4e96b91d34bd09254005c4cbfdd" title="Get the DAP major version as sent by the client.">get_dap_major</a>() == 3 &amp;&amp; <a class="code" href="classlibdap_1_1DDS.html#a9ddd1966f1902e4856757cf552fa2b4e" title="Get the DAP minor version as sent by the client.">get_dap_minor</a>() == 2) {
<a name="l01141"></a>01141         out &lt;&lt; <span class="stringliteral">&quot;xsi:schemaLocation=\&quot;&quot;</span> &lt;&lt; <a class="code" href="DDS_8cc.html#a802c262d5fa6e407025473a6f6361d24">c_dap32_namespace</a>
<a name="l01142"></a>01142             &lt;&lt; <span class="stringliteral">&quot;  &quot;</span> &lt;&lt; <a class="code" href="DDS_8cc.html#a5435387617cf582691dd22ae63325c57">c_default_dap32_schema_location</a> &lt;&lt; <span class="stringliteral">&quot;\&quot;\n&quot;</span> ;
<a name="l01143"></a>01143 
<a name="l01144"></a>01144         out &lt;&lt; <span class="stringliteral">&quot;xmlns:grddl=\&quot;http://www.w3.org/2003/g/data-view#\&quot;\n&quot;</span>;
<a name="l01145"></a>01145         out &lt;&lt; <span class="stringliteral">&quot;grddl:transformation=\&quot;&quot;</span> &lt;&lt; <a class="code" href="DDS_8cc.html#a5bfd633ea313c9ff1b3bddd7df37d86c">grddl_transformation_dap32</a> &lt;&lt;<span class="stringliteral">&quot;\&quot;\n&quot;</span>;
<a name="l01146"></a>01146 
<a name="l01147"></a>01147         out &lt;&lt; <span class="stringliteral">&quot;xmlns=\&quot;&quot;</span> &lt;&lt; <a class="code" href="DDS_8cc.html#a802c262d5fa6e407025473a6f6361d24">c_dap32_namespace</a> &lt;&lt; <span class="stringliteral">&quot;\&quot;\n&quot;</span> ;
<a name="l01148"></a>01148         out &lt;&lt; <span class="stringliteral">&quot;xmlns:dap=\&quot;&quot;</span> &lt;&lt; c_dap32_namespace &lt;&lt; <span class="stringliteral">&quot;\&quot;\n&quot;</span> ;
<a name="l01149"></a>01149 
<a name="l01150"></a>01150         out &lt;&lt; <span class="stringliteral">&quot;dapVersion=\&quot;&quot;</span> &lt;&lt; <a class="code" href="classlibdap_1_1DDS.html#ac00ec4e96b91d34bd09254005c4cbfdd" title="Get the DAP major version as sent by the client.">get_dap_major</a>() &lt;&lt; <span class="stringliteral">&quot;.&quot;</span>
<a name="l01151"></a>01151             &lt;&lt; <a class="code" href="classlibdap_1_1DDS.html#a9ddd1966f1902e4856757cf552fa2b4e" title="Get the DAP minor version as sent by the client.">get_dap_minor</a>() &lt;&lt; <span class="stringliteral">&quot;\&quot;&quot;</span>;
<a name="l01152"></a>01152 
<a name="l01153"></a>01153         <span class="keywordflow">if</span> (!<a class="code" href="classlibdap_1_1DDS.html#a678cf679929468dc959adc136e727dfb" title="Get the URL that will return this DDS/DDX/DataThing.">get_request_xml_base</a>().empty()) {
<a name="l01154"></a>01154             out &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;
<a name="l01155"></a>01155             out &lt;&lt; <span class="stringliteral">&quot;xmlns:xml=\&quot;&quot;</span> &lt;&lt; <a class="code" href="DDS_8cc.html#add7b67faa628b4969458b8ecfb872f0e">c_xml_namespace</a> &lt;&lt; <span class="stringliteral">&quot;\&quot;\n&quot;</span>;
<a name="l01156"></a>01156             out &lt;&lt; <span class="stringliteral">&quot;xml:base=\&quot;&quot;</span> &lt;&lt; <a class="code" href="classlibdap_1_1DDS.html#a678cf679929468dc959adc136e727dfb" title="Get the URL that will return this DDS/DDX/DataThing.">get_request_xml_base</a>() &lt;&lt; <span class="stringliteral">&quot;\&quot;&quot;</span>;
<a name="l01157"></a>01157         }
<a name="l01158"></a>01158 
<a name="l01159"></a>01159         <span class="comment">// Close the Dataset element</span>
<a name="l01160"></a>01160         out &lt;&lt; <span class="stringliteral">&quot;&gt;\n&quot;</span>;
<a name="l01161"></a>01161     }
<a name="l01162"></a>01162     <span class="keywordflow">else</span> {
<a name="l01163"></a>01163         out &lt;&lt; <span class="stringliteral">&quot;xmlns=\&quot;&quot;</span> &lt;&lt; <a class="code" href="DDS_8cc.html#a837d1aa1dfdd08c06cf62cdf0cf0ffef">c_dap20_namespace</a> &lt;&lt; <span class="stringliteral">&quot;\&quot;\n&quot;</span> ;
<a name="l01164"></a>01164         out &lt;&lt; <span class="stringliteral">&quot;xsi:schemaLocation=\&quot;&quot;</span> &lt;&lt; c_dap20_namespace
<a name="l01165"></a>01165             &lt;&lt; <span class="stringliteral">&quot;  &quot;</span> &lt;&lt; <a class="code" href="DDS_8cc.html#a142e6d92c13f0deeb196f0ef36ced13e">c_default_dap20_schema_location</a> &lt;&lt; <span class="stringliteral">&quot;\&quot;&gt;\n\n&quot;</span> ;
<a name="l01166"></a>01166     }
<a name="l01167"></a>01167 
<a name="l01168"></a>01168     d_attr.<a class="code" href="classlibdap_1_1AttrTable.html#a5e27ea09f83831eded1b3d86de7f4534">print_xml</a>(out, <span class="stringliteral">&quot;    &quot;</span>, constrained);
<a name="l01169"></a>01169 
<a name="l01170"></a>01170     out &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span> ;
<a name="l01171"></a>01171 
<a name="l01172"></a>01172     for_each(<a class="code" href="classlibdap_1_1DDS.html#aac98f248cd5730a8769f9d71af9788d3" title="Return an iterator to the first variable.">var_begin</a>(), <a class="code" href="classlibdap_1_1DDS.html#ad204bbd6eed8d440fb996f41bc986058" title="Return an iterator.">var_end</a>(), VariablePrintXMLStrm(out, constrained));
<a name="l01173"></a>01173 
<a name="l01174"></a>01174     out &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span> ;
<a name="l01175"></a>01175 
<a name="l01176"></a>01176     <span class="comment">// Only print this for the 2.0, 3.0 and 3.1 versions - which are essentially</span>
<a name="l01177"></a>01177     <span class="comment">// the same.</span>
<a name="l01178"></a>01178     <span class="comment">// For DAP 3.2 and greater, use the new syntax and value. The &#39;blob&#39; is</span>
<a name="l01179"></a>01179     <span class="comment">// actually the CID of the MIME part that holds the data.</span>
<a name="l01180"></a>01180     <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1DDS.html#ac00ec4e96b91d34bd09254005c4cbfdd" title="Get the DAP major version as sent by the client.">get_dap_major</a>() == 2 &amp;&amp; <a class="code" href="classlibdap_1_1DDS.html#a9ddd1966f1902e4856757cf552fa2b4e" title="Get the DAP minor version as sent by the client.">get_dap_minor</a>() == 0) {
<a name="l01181"></a>01181         out &lt;&lt; <span class="stringliteral">&quot;    &lt;dataBLOB href=\&quot;\&quot;/&gt;\n&quot;</span> ;
<a name="l01182"></a>01182     }
<a name="l01183"></a>01183     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!blob.empty()
<a name="l01184"></a>01184              &amp;&amp; (<a class="code" href="classlibdap_1_1DDS.html#ac00ec4e96b91d34bd09254005c4cbfdd" title="Get the DAP major version as sent by the client.">get_dap_major</a>() == 3 &amp;&amp; <a class="code" href="classlibdap_1_1DDS.html#a9ddd1966f1902e4856757cf552fa2b4e" title="Get the DAP minor version as sent by the client.">get_dap_minor</a>() &gt;= 2)
<a name="l01185"></a>01185              || <a class="code" href="classlibdap_1_1DDS.html#ac00ec4e96b91d34bd09254005c4cbfdd" title="Get the DAP major version as sent by the client.">get_dap_major</a>() &gt;= 4) {
<a name="l01186"></a>01186         out &lt;&lt; <span class="stringliteral">&quot;    &lt;blob href=\&quot;cid:&quot;</span> &lt;&lt; blob &lt;&lt; <span class="stringliteral">&quot;\&quot;/&gt;\n&quot;</span>;
<a name="l01187"></a>01187     }
<a name="l01188"></a>01188 
<a name="l01189"></a>01189     out &lt;&lt; <span class="stringliteral">&quot;&lt;/Dataset&gt;\n&quot;</span> ;
<a name="l01190"></a>01190 }
<a name="l01191"></a>01191 
<a name="l01192"></a>01192 <span class="comment">// Used by DDS::send() when returning data from a function call.</span>
<a name="l01207"></a>01207 <span class="comment"></span><span class="keywordtype">bool</span>
<a name="l01208"></a><a class="code" href="classlibdap_1_1DDS.html#a0d1bf35c18c77a15bb266a895f99f1c6">01208</a> <a class="code" href="classlibdap_1_1DDS.html#a0d1bf35c18c77a15bb266a895f99f1c6" title="Check the semantics of each of the variables represented in the DDS.">DDS::check_semantics</a>(<span class="keywordtype">bool</span> all)
<a name="l01209"></a>01209 {
<a name="l01210"></a>01210     <span class="comment">// The dataset must have a name</span>
<a name="l01211"></a>01211     <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;&quot;</span>) {
<a name="l01212"></a>01212         cerr &lt;&lt; <span class="stringliteral">&quot;A dataset must have a name&quot;</span> &lt;&lt; endl;
<a name="l01213"></a>01213         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l01214"></a>01214     }
<a name="l01215"></a>01215 
<a name="l01216"></a>01216     <span class="keywordtype">string</span> msg;
<a name="l01217"></a>01217     <span class="keywordflow">if</span> (!<a class="code" href="namespacelibdap.html#afabf64c5d4c1900f1c05ac655895f7ee">unique_names</a>(vars, name, <span class="stringliteral">&quot;Dataset&quot;</span>, msg))
<a name="l01218"></a>01218         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l01219"></a>01219 
<a name="l01220"></a>01220     <span class="keywordflow">if</span> (all)
<a name="l01221"></a>01221         <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1DDS.html#a5140f67d8f7eecf0a260d8a5d9fc39c5">Vars_iter</a> i = vars.begin(); i != vars.end(); i++)
<a name="l01222"></a>01222             <span class="keywordflow">if</span> (!(*i)-&gt;check_semantics(msg, <span class="keyword">true</span>))
<a name="l01223"></a>01223                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l01224"></a>01224 
<a name="l01225"></a>01225     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l01226"></a>01226 }
<a name="l01227"></a>01227 
<a name="l01253"></a>01253 <span class="keywordtype">bool</span>
<a name="l01254"></a><a class="code" href="classlibdap_1_1DDS.html#a88c063f273e5aa68b38df4d8e09fb426">01254</a> <a class="code" href="classlibdap_1_1DDS.html#a88c063f273e5aa68b38df4d8e09fb426" title="Mark the send_p flag of the named variable to state.">DDS::mark</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;n, <span class="keywordtype">bool</span> state)
<a name="l01255"></a>01255 {
<a name="l01256"></a>01256     <a class="code" href="classlibdap_1_1BaseType.html#ae9c6e71855b90a0e552713011c9ab81f">BaseType::btp_stack</a> *s = <span class="keyword">new</span> <a class="code" href="classlibdap_1_1BaseType.html#ae9c6e71855b90a0e552713011c9ab81f">BaseType::btp_stack</a>;
<a name="l01257"></a>01257 
<a name="l01258"></a>01258     <a class="code" href="debug_8h.html#ac1f764c266c50f0050e33557004c914c">DBG2</a>(cerr &lt;&lt; <span class="stringliteral">&quot;DDS::mark: Looking for &quot;</span> &lt;&lt; n &lt;&lt; endl);
<a name="l01259"></a>01259 
<a name="l01260"></a>01260     <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *variable = <a class="code" href="classlibdap_1_1DDS.html#a74c67b99babe3317a0f76c8d8f7ba37a">var</a>(n, s);
<a name="l01261"></a>01261     <span class="keywordflow">if</span> (!variable) {
<a name="l01262"></a>01262         <a class="code" href="debug_8h.html#ac1f764c266c50f0050e33557004c914c">DBG2</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Could not find variable &quot;</span> &lt;&lt; n &lt;&lt; endl);
<a name="l01263"></a>01263         <span class="keyword">delete</span> s; s = 0;
<a name="l01264"></a>01264         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l01265"></a>01265     }
<a name="l01266"></a>01266     variable-&gt;<a class="code" href="classlibdap_1_1BaseType.html#aba7b27635c95b74536de18393133628e">set_send_p</a>(state);
<a name="l01267"></a>01267 
<a name="l01268"></a>01268     <a class="code" href="debug_8h.html#ac1f764c266c50f0050e33557004c914c">DBG2</a>(cerr &lt;&lt; <span class="stringliteral">&quot;DDS::mark: Set variable &quot;</span> &lt;&lt; variable-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>()
<a name="l01269"></a>01269             &lt;&lt; <span class="stringliteral">&quot; (a &quot;</span> &lt;&lt; variable-&gt;<a class="code" href="classlibdap_1_1BaseType.html#ac4461c9e287b167871acade5e5472116" title="Returns the type of the class instance as a string.">type_name</a>() &lt;&lt; <span class="stringliteral">&quot;)&quot;</span> &lt;&lt; endl);
<a name="l01270"></a>01270 
<a name="l01271"></a>01271     <span class="comment">// Now check the btp_stack and run BaseType::set_send_p for every</span>
<a name="l01272"></a>01272     <span class="comment">// BaseType pointer on the stack. Using BaseType::set_send_p() will</span>
<a name="l01273"></a>01273     <span class="comment">// set the property for a Constructor but not its contained variables</span>
<a name="l01274"></a>01274     <span class="comment">// which preserves the semantics of projecting just one field.</span>
<a name="l01275"></a>01275     <span class="keywordflow">while</span> (!s-&gt;empty()) {
<a name="l01276"></a>01276         s-&gt;top()-&gt;BaseType::set_send_p(state);
<a name="l01277"></a>01277 
<a name="l01278"></a>01278         <a class="code" href="debug_8h.html#ac1f764c266c50f0050e33557004c914c">DBG2</a>(cerr &lt;&lt; <span class="stringliteral">&quot;DDS::mark: Set variable &quot;</span> &lt;&lt; s-&gt;top()-&gt;name()
<a name="l01279"></a>01279                 &lt;&lt; <span class="stringliteral">&quot; (a &quot;</span> &lt;&lt; s-&gt;top()-&gt;type_name() &lt;&lt; <span class="stringliteral">&quot;)&quot;</span> &lt;&lt; endl);
<a name="l01280"></a>01280         <span class="keywordtype">string</span> parent_name = (s-&gt;top()-&gt;get_parent()) ? s-&gt;top()-&gt;get_parent()-&gt;name(): <span class="stringliteral">&quot;none&quot;</span>;
<a name="l01281"></a>01281         <span class="keywordtype">string</span> parent_type = (s-&gt;top()-&gt;get_parent()) ? s-&gt;top()-&gt;get_parent()-&gt;type_name(): <span class="stringliteral">&quot;none&quot;</span>;
<a name="l01282"></a>01282         <a class="code" href="debug_8h.html#ac1f764c266c50f0050e33557004c914c">DBG2</a>(cerr &lt;&lt; <span class="stringliteral">&quot;DDS::mark: Parent variable &quot;</span> &lt;&lt; parent_name &lt;&lt; <span class="stringliteral">&quot; (a &quot;</span> &lt;&lt; parent_type &lt;&lt; <span class="stringliteral">&quot;)&quot;</span> &lt;&lt; endl);
<a name="l01283"></a>01283 
<a name="l01284"></a>01284         s-&gt;pop();
<a name="l01285"></a>01285     }
<a name="l01286"></a>01286 
<a name="l01287"></a>01287     <span class="keyword">delete</span> s ; s = 0;
<a name="l01288"></a>01288 
<a name="l01289"></a>01289     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l01290"></a>01290 }
<a name="l01291"></a>01291 
<a name="l01297"></a>01297 <span class="keywordtype">void</span>
<a name="l01298"></a><a class="code" href="classlibdap_1_1DDS.html#a03c7fb8494b890e227279e70ba4b483e">01298</a> <a class="code" href="classlibdap_1_1DDS.html#a03c7fb8494b890e227279e70ba4b483e">DDS::mark_all</a>(<span class="keywordtype">bool</span> state)
<a name="l01299"></a>01299 {
<a name="l01300"></a>01300     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1DDS.html#a5140f67d8f7eecf0a260d8a5d9fc39c5">Vars_iter</a> i = vars.begin(); i != vars.end(); i++)
<a name="l01301"></a>01301         (*i)-&gt;set_send_p(state);
<a name="l01302"></a>01302 }
<a name="l01303"></a>01303 
<a name="l01311"></a>01311 <span class="keywordtype">void</span>
<a name="l01312"></a><a class="code" href="classlibdap_1_1DDS.html#aebc046a3091961db2802334ddc9280e0">01312</a> <a class="code" href="classlibdap_1_1DDS.html#aebc046a3091961db2802334ddc9280e0" title="dumps information about this object">DDS::dump</a>(ostream &amp;strm)<span class="keyword"> const</span>
<a name="l01313"></a>01313 <span class="keyword"></span>{
<a name="l01314"></a>01314     strm &lt;&lt; <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> &lt;&lt; <span class="stringliteral">&quot;DDS::dump - (&quot;</span>
<a name="l01315"></a>01315     &lt;&lt; (<span class="keywordtype">void</span> *)<span class="keyword">this</span> &lt;&lt; <span class="stringliteral">&quot;)&quot;</span> &lt;&lt; endl ;
<a name="l01316"></a>01316     <a class="code" href="classlibdap_1_1DapIndent.html#a4ed2cce66dbff9ad4320e89142103c6c">DapIndent::Indent</a>() ;
<a name="l01317"></a>01317     strm &lt;&lt; <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> &lt;&lt; <span class="stringliteral">&quot;name: &quot;</span> &lt;&lt; name &lt;&lt; endl ;
<a name="l01318"></a>01318     strm &lt;&lt; <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> &lt;&lt; <span class="stringliteral">&quot;filename: &quot;</span> &lt;&lt; d_filename &lt;&lt; endl ;
<a name="l01319"></a>01319     strm &lt;&lt; <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> &lt;&lt; <span class="stringliteral">&quot;protocol major: &quot;</span> &lt;&lt; d_dap_major &lt;&lt; endl;
<a name="l01320"></a>01320     strm &lt;&lt; <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> &lt;&lt; <span class="stringliteral">&quot;protocol minor: &quot;</span> &lt;&lt; d_dap_minor &lt;&lt; endl;
<a name="l01321"></a>01321     strm &lt;&lt; <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> &lt;&lt; <span class="stringliteral">&quot;factory: &quot;</span> &lt;&lt; (<span class="keywordtype">void</span> *)d_factory &lt;&lt; endl ;
<a name="l01322"></a>01322 
<a name="l01323"></a>01323     strm &lt;&lt; <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> &lt;&lt; <span class="stringliteral">&quot;global attributes:&quot;</span> &lt;&lt; endl ;
<a name="l01324"></a>01324     DapIndent::Indent() ;
<a name="l01325"></a>01325     d_attr.<a class="code" href="classlibdap_1_1AttrTable.html#aa83039e176ada59b990c68b6f3c2cdb7" title="dumps information about this object">dump</a>(strm) ;
<a name="l01326"></a>01326     <a class="code" href="classlibdap_1_1DapIndent.html#a65c519d0916b031bcf60ca8d26fc82f8">DapIndent::UnIndent</a>() ;
<a name="l01327"></a>01327 
<a name="l01328"></a>01328     <span class="keywordflow">if</span> (vars.size()) {
<a name="l01329"></a>01329         strm &lt;&lt; <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> &lt;&lt; <span class="stringliteral">&quot;vars:&quot;</span> &lt;&lt; endl ;
<a name="l01330"></a>01330         DapIndent::Indent() ;
<a name="l01331"></a>01331         <a class="code" href="classlibdap_1_1DDS.html#ae18628332086dd04361e0ba745cd91ca">Vars_citer</a> i = vars.begin() ;
<a name="l01332"></a>01332         <a class="code" href="classlibdap_1_1DDS.html#ae18628332086dd04361e0ba745cd91ca">Vars_citer</a> ie = vars.end() ;
<a name="l01333"></a>01333         <span class="keywordflow">for</span> (; i != ie; i++) {
<a name="l01334"></a>01334             (*i)-&gt;dump(strm) ;
<a name="l01335"></a>01335         }
<a name="l01336"></a>01336         <a class="code" href="classlibdap_1_1DapIndent.html#a65c519d0916b031bcf60ca8d26fc82f8">DapIndent::UnIndent</a>() ;
<a name="l01337"></a>01337     }
<a name="l01338"></a>01338     <span class="keywordflow">else</span> {
<a name="l01339"></a>01339         strm &lt;&lt; <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> &lt;&lt; <span class="stringliteral">&quot;vars: none&quot;</span> &lt;&lt; endl ;
<a name="l01340"></a>01340     }
<a name="l01341"></a>01341 
<a name="l01342"></a>01342     <a class="code" href="classlibdap_1_1DapIndent.html#a65c519d0916b031bcf60ca8d26fc82f8">DapIndent::UnIndent</a>() ;
<a name="l01343"></a>01343 }
<a name="l01344"></a>01344 
<a name="l01345"></a>01345 } <span class="comment">// namespace libdap</span>
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="DDS_8cc.html">DDS.cc</a>      </li>
      <li class="footer">Generated on Tue Feb 8 2011 for libdap++ by&#160;
<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>