Sophie

Sophie

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

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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>libdap++: Structure.cc Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.9 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>Structure.cc</h1><a href="Structure_8cc.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00002"></a>00002 <span class="comment">// -*- mode: c++; c-basic-offset:4 -*-</span>
<a name="l00003"></a>00003 
<a name="l00004"></a>00004 <span class="comment">// This file is part of libdap, A C++ implementation of the OPeNDAP Data</span>
<a name="l00005"></a>00005 <span class="comment">// Access Protocol.</span>
<a name="l00006"></a>00006 
<a name="l00007"></a>00007 <span class="comment">// Copyright (c) 2002,2003 OPeNDAP, Inc.</span>
<a name="l00008"></a>00008 <span class="comment">// Author: James Gallagher &lt;jgallagher@opendap.org&gt;</span>
<a name="l00009"></a>00009 <span class="comment">//</span>
<a name="l00010"></a>00010 <span class="comment">// This library is free software; you can redistribute it and/or</span>
<a name="l00011"></a>00011 <span class="comment">// modify it under the terms of the GNU Lesser General Public</span>
<a name="l00012"></a>00012 <span class="comment">// License as published by the Free Software Foundation; either</span>
<a name="l00013"></a>00013 <span class="comment">// version 2.1 of the License, or (at your option) any later version.</span>
<a name="l00014"></a>00014 <span class="comment">//</span>
<a name="l00015"></a>00015 <span class="comment">// This library is distributed in the hope that it will be useful,</span>
<a name="l00016"></a>00016 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00017"></a>00017 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00018"></a>00018 <span class="comment">// Lesser General Public License for more details.</span>
<a name="l00019"></a>00019 <span class="comment">//</span>
<a name="l00020"></a>00020 <span class="comment">// You should have received a copy of the GNU Lesser General Public</span>
<a name="l00021"></a>00021 <span class="comment">// License along with this library; if not, write to the Free Software</span>
<a name="l00022"></a>00022 <span class="comment">// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</span>
<a name="l00023"></a>00023 <span class="comment">//</span>
<a name="l00024"></a>00024 <span class="comment">// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.</span>
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 <span class="comment">// (c) COPYRIGHT URI/MIT 1994-1999</span>
<a name="l00027"></a>00027 <span class="comment">// Please read the full copyright statement in the file COPYRIGHT_URI.</span>
<a name="l00028"></a>00028 <span class="comment">//</span>
<a name="l00029"></a>00029 <span class="comment">// Authors:</span>
<a name="l00030"></a>00030 <span class="comment">//      jhrg,jimg       James Gallagher &lt;jgallagher@gso.uri.edu&gt;</span>
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="comment">// Implementation for the class Structure</span>
<a name="l00033"></a>00033 <span class="comment">//</span>
<a name="l00034"></a>00034 <span class="comment">// jhrg 9/14/94</span>
<a name="l00035"></a>00035 
<a name="l00036"></a>00036 <span class="comment">//#define DODS_DEBUG</span>
<a name="l00037"></a>00037 
<a name="l00038"></a>00038 <span class="preprocessor">#include "<a class="code" href="config_8h.html">config.h</a>"</span>
<a name="l00039"></a>00039 
<a name="l00040"></a>00040 <span class="preprocessor">#include "<a class="code" href="Structure_8h.html">Structure.h</a>"</span>
<a name="l00041"></a>00041 <span class="preprocessor">#include "<a class="code" href="util_8h.html">util.h</a>"</span>
<a name="l00042"></a>00042 <span class="preprocessor">#include "<a class="code" href="debug_8h.html">debug.h</a>"</span>
<a name="l00043"></a>00043 <span class="preprocessor">#include "<a class="code" href="InternalErr_8h.html">InternalErr.h</a>"</span>
<a name="l00044"></a>00044 <span class="preprocessor">#include "<a class="code" href="escaping_8h.html">escaping.h</a>"</span>
<a name="l00045"></a>00045 
<a name="l00046"></a>00046 <span class="keyword">using</span> std::cerr;
<a name="l00047"></a>00047 <span class="keyword">using</span> std::endl;
<a name="l00048"></a>00048 
<a name="l00049"></a>00049 <span class="keyword">namespace </span>libdap {
<a name="l00050"></a>00050 
<a name="l00051"></a>00051 <span class="keywordtype">void</span>
<a name="l00052"></a><a class="code" href="classlibdap_1_1Structure.html#636999981643db72bad417ee8602dcff">00052</a> <a class="code" href="classlibdap_1_1Structure.html#636999981643db72bad417ee8602dcff">Structure::_duplicate</a>(<span class="keyword">const</span> <a class="code" href="classlibdap_1_1Structure.html" title="Holds a structure (aggregate) type.">Structure</a> &amp;s)
<a name="l00053"></a>00053 {
<a name="l00054"></a>00054     <a class="code" href="classlibdap_1_1Structure.html" title="Holds a structure (aggregate) type.">Structure</a> &amp;cs = <span class="keyword">const_cast&lt;</span><a class="code" href="classlibdap_1_1Structure.html" title="Holds a structure (aggregate) type.">Structure</a> &amp;<span class="keyword">&gt;</span>(s);
<a name="l00055"></a>00055 
<a name="l00056"></a>00056     <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">"Copying structure: "</span> &lt;&lt; <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() &lt;&lt; endl);
<a name="l00057"></a>00057 
<a name="l00058"></a>00058     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = cs.<a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != cs.<a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00059"></a>00059         <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">"Copying field: "</span> &lt;&lt; (*i)-&gt;name() &lt;&lt; endl);
<a name="l00060"></a>00060         <span class="comment">// Jose Garcia</span>
<a name="l00061"></a>00061         <span class="comment">// I think this assert here is part of a debugging</span>
<a name="l00062"></a>00062         <span class="comment">// process since it is going along with a DBG call</span>
<a name="l00063"></a>00063         <span class="comment">// I leave it here since it can be remove by defining NDEBUG.</span>
<a name="l00064"></a>00064         <span class="comment">// assert(*i);</span>
<a name="l00065"></a>00065         <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = (*i)-&gt;ptr_duplicate();
<a name="l00066"></a>00066         btp-&gt;set_parent(<span class="keyword">this</span>);
<a name="l00067"></a>00067         <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.push_back(btp);
<a name="l00068"></a>00068     }
<a name="l00069"></a>00069 }
<a name="l00070"></a>00070 
<a name="l00078"></a><a class="code" href="classlibdap_1_1Structure.html#4187f25219b1fc7ec93e761795047e0a">00078</a> <a class="code" href="classlibdap_1_1Structure.html#4187f25219b1fc7ec93e761795047e0a">Structure::Structure</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;n) : <a class="code" href="classlibdap_1_1Constructor.html">Constructor</a>(n, <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e6d93eb0a69e67742f061966ce594b9a6c">dods_structure_c</a>)
<a name="l00079"></a>00079 {}
<a name="l00080"></a>00080 
<a name="l00090"></a><a class="code" href="classlibdap_1_1Structure.html#a48289fa5979febe73ae74a90f2d246b">00090</a> <a class="code" href="classlibdap_1_1Structure.html#4187f25219b1fc7ec93e761795047e0a">Structure::Structure</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;n, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;d)
<a name="l00091"></a>00091     : <a class="code" href="classlibdap_1_1Constructor.html">Constructor</a>(n, d, <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e6d93eb0a69e67742f061966ce594b9a6c">dods_structure_c</a>)
<a name="l00092"></a>00092 {}
<a name="l00093"></a>00093 
<a name="l00095"></a><a class="code" href="classlibdap_1_1Structure.html#469f0fe441ac54689db27d7527d28748">00095</a> <a class="code" href="classlibdap_1_1Structure.html#4187f25219b1fc7ec93e761795047e0a">Structure::Structure</a>(<span class="keyword">const</span> <a class="code" href="classlibdap_1_1Structure.html" title="Holds a structure (aggregate) type.">Structure</a> &amp;rhs) : <a class="code" href="classlibdap_1_1Constructor.html">Constructor</a>(rhs)
<a name="l00096"></a>00096 {
<a name="l00097"></a>00097     <a class="code" href="classlibdap_1_1Structure.html#636999981643db72bad417ee8602dcff">_duplicate</a>(rhs);
<a name="l00098"></a>00098 }
<a name="l00099"></a>00099 
<a name="l00100"></a><a class="code" href="classlibdap_1_1Structure.html#6ed7d2f86ea9f6e59c9a97ac5de3c7ae">00100</a> <a class="code" href="classlibdap_1_1Structure.html#6ed7d2f86ea9f6e59c9a97ac5de3c7ae">Structure::~Structure</a>()
<a name="l00101"></a>00101 {
<a name="l00102"></a>00102     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00103"></a>00103         <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = *i ;
<a name="l00104"></a>00104         <span class="keyword">delete</span> btp ;  btp = 0;
<a name="l00105"></a>00105     }
<a name="l00106"></a>00106 }
<a name="l00107"></a>00107 
<a name="l00108"></a>00108 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *
<a name="l00109"></a><a class="code" href="classlibdap_1_1Structure.html#e20b384171ecded1940c3cb9780eda7e">00109</a> <a class="code" href="classlibdap_1_1Structure.html#e20b384171ecded1940c3cb9780eda7e">Structure::ptr_duplicate</a>()
<a name="l00110"></a>00110 {
<a name="l00111"></a>00111     <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classlibdap_1_1Structure.html#4187f25219b1fc7ec93e761795047e0a">Structure</a>(*<span class="keyword">this</span>);
<a name="l00112"></a>00112 }
<a name="l00113"></a>00113 
<a name="l00114"></a>00114 <a class="code" href="classlibdap_1_1Structure.html" title="Holds a structure (aggregate) type.">Structure</a> &amp;
<a name="l00115"></a><a class="code" href="classlibdap_1_1Structure.html#ebf03bb4b5ce61f556edace7b1dd8db7">00115</a> <a class="code" href="classlibdap_1_1Structure.html#ebf03bb4b5ce61f556edace7b1dd8db7">Structure::operator=</a>(<span class="keyword">const</span> <a class="code" href="classlibdap_1_1Structure.html" title="Holds a structure (aggregate) type.">Structure</a> &amp;rhs)
<a name="l00116"></a>00116 {
<a name="l00117"></a>00117     <span class="keywordflow">if</span> (<span class="keyword">this</span> == &amp;rhs)
<a name="l00118"></a>00118         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00119"></a>00119 
<a name="l00120"></a>00120     <span class="keyword">dynamic_cast&lt;</span><a class="code" href="classlibdap_1_1Constructor.html">Constructor</a> &amp;<span class="keyword">&gt;</span>(*this) = rhs; <span class="comment">// run Constructor=</span>
<a name="l00121"></a>00121 
<a name="l00122"></a>00122     <a class="code" href="classlibdap_1_1Structure.html#636999981643db72bad417ee8602dcff">_duplicate</a>(rhs);
<a name="l00123"></a>00123 
<a name="l00124"></a>00124     <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00125"></a>00125 }
<a name="l00126"></a>00126 
<a name="l00127"></a>00127 <span class="keywordtype">int</span>
<a name="l00128"></a><a class="code" href="classlibdap_1_1Structure.html#dd0e4690737cb99c6cf594b4d71d1fe9">00128</a> <a class="code" href="classlibdap_1_1Structure.html#dd0e4690737cb99c6cf594b4d71d1fe9" title="Count the members of constructor types.">Structure::element_count</a>(<span class="keywordtype">bool</span> leaves)
<a name="l00129"></a>00129 {
<a name="l00130"></a>00130     <span class="keywordflow">if</span> (!leaves)
<a name="l00131"></a>00131         <span class="keywordflow">return</span> <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.size();
<a name="l00132"></a>00132     <span class="keywordflow">else</span> {
<a name="l00133"></a>00133         <span class="keywordtype">int</span> i = 0;
<a name="l00134"></a>00134         <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> j = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); j != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); j++) {
<a name="l00135"></a>00135             j += (*j)-&gt;element_count(leaves);
<a name="l00136"></a>00136         }
<a name="l00137"></a>00137         <span class="keywordflow">return</span> i;
<a name="l00138"></a>00138     }
<a name="l00139"></a>00139 }
<a name="l00140"></a>00140 
<a name="l00141"></a>00141 <span class="keywordtype">bool</span>
<a name="l00142"></a><a class="code" href="classlibdap_1_1Structure.html#c4687a4edb60d00fd781c82de40d53a4">00142</a> <a class="code" href="classlibdap_1_1Structure.html#c4687a4edb60d00fd781c82de40d53a4" title="Check to see whether this variable can be printed simply.">Structure::is_linear</a>()
<a name="l00143"></a>00143 {
<a name="l00144"></a>00144     <span class="keywordtype">bool</span> linear = <span class="keyword">true</span>;
<a name="l00145"></a>00145     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); linear &amp;&amp; i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00146"></a>00146         <span class="keywordflow">if</span> ((*i)-&gt;type() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e6d93eb0a69e67742f061966ce594b9a6c">dods_structure_c</a>)
<a name="l00147"></a>00147             linear = linear &amp;&amp; dynamic_cast&lt;Structure*&gt;((*i))-&gt;<a class="code" href="classlibdap_1_1Structure.html#c4687a4edb60d00fd781c82de40d53a4" title="Check to see whether this variable can be printed simply.">is_linear</a>();
<a name="l00148"></a>00148         <span class="keywordflow">else</span>
<a name="l00149"></a>00149             linear = linear &amp;&amp; (*i)-&gt;is_simple_type();
<a name="l00150"></a>00150     }
<a name="l00151"></a>00151 
<a name="l00152"></a>00152     <span class="keywordflow">return</span> linear;
<a name="l00153"></a>00153 }
<a name="l00154"></a>00154 
<a name="l00155"></a>00155 <span class="keywordtype">void</span>
<a name="l00156"></a><a class="code" href="classlibdap_1_1Structure.html#3b8c155448a06407a36cfb76a27fdcbc">00156</a> <a class="code" href="classlibdap_1_1Structure.html#3b8c155448a06407a36cfb76a27fdcbc">Structure::set_send_p</a>(<span class="keywordtype">bool</span> state)
<a name="l00157"></a>00157 {
<a name="l00158"></a>00158     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00159"></a>00159         (*i)-&gt;set_send_p(state);
<a name="l00160"></a>00160     }
<a name="l00161"></a>00161 
<a name="l00162"></a>00162     <a class="code" href="classlibdap_1_1Structure.html#3b8c155448a06407a36cfb76a27fdcbc">BaseType::set_send_p</a>(state);
<a name="l00163"></a>00163 }
<a name="l00164"></a>00164 
<a name="l00165"></a>00165 <span class="keywordtype">void</span>
<a name="l00166"></a><a class="code" href="classlibdap_1_1Structure.html#61dd97e239b8abf740b03bec7f302b18">00166</a> <a class="code" href="classlibdap_1_1Structure.html#61dd97e239b8abf740b03bec7f302b18" title="Sets the value of the read_p property.">Structure::set_read_p</a>(<span class="keywordtype">bool</span> state)
<a name="l00167"></a>00167 {
<a name="l00168"></a>00168     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00169"></a>00169         (*i)-&gt;set_read_p(state);
<a name="l00170"></a>00170     }
<a name="l00171"></a>00171 
<a name="l00172"></a>00172     <a class="code" href="classlibdap_1_1Structure.html#61dd97e239b8abf740b03bec7f302b18" title="Sets the value of the read_p property.">BaseType::set_read_p</a>(state);
<a name="l00173"></a>00173 }
<a name="l00174"></a>00174 
<a name="l00180"></a>00180 <span class="keywordtype">void</span>
<a name="l00181"></a><a class="code" href="classlibdap_1_1Structure.html#d0d08ebc3100995977dcae0d7f086a9c">00181</a> <a class="code" href="classlibdap_1_1Structure.html#d0d08ebc3100995977dcae0d7f086a9c" title="Set the in_selection property.">Structure::set_in_selection</a>(<span class="keywordtype">bool</span> state)
<a name="l00182"></a>00182 {
<a name="l00183"></a>00183     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00184"></a>00184         (*i)-&gt;set_in_selection(state);
<a name="l00185"></a>00185     }
<a name="l00186"></a>00186 
<a name="l00187"></a>00187     <a class="code" href="classlibdap_1_1Structure.html#d0d08ebc3100995977dcae0d7f086a9c" title="Set the in_selection property.">BaseType::set_in_selection</a>(state);
<a name="l00188"></a>00188 }
<a name="l00189"></a>00189 
<a name="l00191"></a>00191 <span class="keywordtype">void</span>
<a name="l00192"></a><a class="code" href="classlibdap_1_1Structure.html#69851299078fd4bfc39d722c8cdc3cb9">00192</a> <a class="code" href="classlibdap_1_1Structure.html#69851299078fd4bfc39d722c8cdc3cb9" title="Traverse Structure, set Sequence leaf nodes.">Structure::set_leaf_sequence</a>(<span class="keywordtype">int</span> level)
<a name="l00193"></a>00193 {
<a name="l00194"></a>00194     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#deafe3d6c82d07b456a598a7b446c2c6">var_begin</a>(); i != <a class="code" href="classlibdap_1_1Constructor.html#936b38c7c35ffb4fe17c5b8e85bdaaa2">var_end</a>(); i++) {
<a name="l00195"></a>00195         <span class="keywordflow">if</span> ((*i)-&gt;type() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>)
<a name="l00196"></a>00196             dynamic_cast&lt;Sequence&amp;&gt;(**i).set_leaf_sequence(++level);
<a name="l00197"></a>00197         <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((*i)-&gt;type() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e6d93eb0a69e67742f061966ce594b9a6c">dods_structure_c</a>)
<a name="l00198"></a>00198             dynamic_cast&lt;Structure&amp;&gt;(**i).set_leaf_sequence(level);
<a name="l00199"></a>00199     }
<a name="l00200"></a>00200 }
<a name="l00201"></a>00201 
<a name="l00206"></a>00206 <span class="keywordtype">void</span>
<a name="l00207"></a><a class="code" href="classlibdap_1_1Structure.html#a2e403ad2ce9b78f279a18799f61b353">00207</a> <a class="code" href="classlibdap_1_1Structure.html#a2e403ad2ce9b78f279a18799f61b353">Structure::add_var</a>(<a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *bt, <a class="code" href="namespacelibdap.html#ddcb1d714cdecb877c65ff6d2fde0695" title="Names the parts of multi-section constructor data types.">Part</a>)
<a name="l00208"></a>00208 {
<a name="l00209"></a>00209     <span class="comment">// Jose Garcia</span>
<a name="l00210"></a>00210     <span class="comment">// Passing and invalid pointer to an object is a developer's error.</span>
<a name="l00211"></a>00211     <span class="keywordflow">if</span> (!bt)
<a name="l00212"></a>00212         <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="l00213"></a>00213                           <span class="stringliteral">"The BaseType parameter cannot be null."</span>);
<a name="l00214"></a>00214 
<a name="l00215"></a>00215     <span class="comment">// Jose Garcia</span>
<a name="l00216"></a>00216     <span class="comment">// Now we add a copy of bt so the external user is able to destroy bt as</span>
<a name="l00217"></a>00217     <span class="comment">// he/she wishes. The policy is: "If it is allocated outside, it is</span>
<a name="l00218"></a>00218     <span class="comment">// deallocated outside, if it is allocated inside, it is deallocated</span>
<a name="l00219"></a>00219     <span class="comment">// inside"</span>
<a name="l00220"></a>00220     <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#0b130311c9901fb8a7ab11ea19090ef0">ptr_duplicate</a>();
<a name="l00221"></a>00221     btp-&gt;<a class="code" href="classlibdap_1_1BaseType.html#5b6a39f6ce6594fa74f3fc899ac9a966">set_parent</a>(<span class="keyword">this</span>);
<a name="l00222"></a>00222     <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.push_back(btp);
<a name="l00223"></a>00223 }
<a name="l00224"></a>00224 
<a name="l00228"></a>00228 <span class="keywordtype">void</span>
<a name="l00229"></a><a class="code" href="classlibdap_1_1Structure.html#bd4007d70af3ca2550daea14a1da7ce1">00229</a> <a class="code" href="classlibdap_1_1Structure.html#bd4007d70af3ca2550daea14a1da7ce1">Structure::del_var</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;n)
<a name="l00230"></a>00230 {
<a name="l00231"></a>00231     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00232"></a>00232         <span class="keywordflow">if</span> ((*i)-&gt;name() == n) {
<a name="l00233"></a>00233             <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *bt = *i ;
<a name="l00234"></a>00234             <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.erase(i) ;
<a name="l00235"></a>00235             <span class="keyword">delete</span> bt ; bt = 0;
<a name="l00236"></a>00236             <span class="keywordflow">return</span>;
<a name="l00237"></a>00237         }
<a name="l00238"></a>00238     }
<a name="l00239"></a>00239 }
<a name="l00240"></a>00240 
<a name="l00246"></a>00246 <span class="keywordtype">bool</span>
<a name="l00247"></a><a class="code" href="classlibdap_1_1Structure.html#b49e61a5cf9dc60c5c8510b1ad1e7ef1">00247</a> <a class="code" href="classlibdap_1_1Structure.html#b49e61a5cf9dc60c5c8510b1ad1e7ef1" title="simple implementation of reat that iterates through vars and calls read on them">Structure::read</a>()
<a name="l00248"></a>00248 {
<a name="l00249"></a>00249     <span class="keywordflow">if</span>( !<a class="code" href="classlibdap_1_1BaseType.html#38ff819a432217c55db2e9071928d20c" title="Has this variable been read?">read_p</a>() )
<a name="l00250"></a>00250     {
<a name="l00251"></a>00251         <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00252"></a>00252             (*i)-&gt;read() ;
<a name="l00253"></a>00253         }
<a name="l00254"></a>00254         <a class="code" href="classlibdap_1_1Structure.html#61dd97e239b8abf740b03bec7f302b18" title="Sets the value of the read_p property.">set_read_p</a>(<span class="keyword">true</span>) ;
<a name="l00255"></a>00255     }
<a name="l00256"></a>00256 
<a name="l00257"></a>00257     <span class="keywordflow">return</span> false ;
<a name="l00258"></a>00258 }
<a name="l00259"></a>00259 
<a name="l00260"></a>00260 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>
<a name="l00261"></a><a class="code" href="classlibdap_1_1Structure.html#913b94ec0a92ceb3dedb93c8b21a9845">00261</a> <a class="code" href="classlibdap_1_1Structure.html#913b94ec0a92ceb3dedb93c8b21a9845" title="Returns the size of the class instance data.">Structure::width</a>()
<a name="l00262"></a>00262 {
<a name="l00263"></a>00263     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sz = 0;
<a name="l00264"></a>00264 
<a name="l00265"></a>00265     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00266"></a>00266         sz += (*i)-&gt;width();
<a name="l00267"></a>00267     }
<a name="l00268"></a>00268 
<a name="l00269"></a>00269     <span class="keywordflow">return</span> sz;
<a name="l00270"></a>00270 }
<a name="l00271"></a>00271 
<a name="l00272"></a>00272 <span class="keywordtype">void</span>
<a name="l00273"></a><a class="code" href="classlibdap_1_1Structure.html#22c9ae6a09a40c9f8e44d2a25d6464a4">00273</a> <a class="code" href="classlibdap_1_1Structure.html#22c9ae6a09a40c9f8e44d2a25d6464a4">Structure::intern_data</a>(<a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> &amp; eval, <a class="code" href="classlibdap_1_1DDS.html">DDS</a> &amp; dds)
<a name="l00274"></a>00274 {
<a name="l00275"></a>00275     <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">"Structure::intern_data: "</span> &lt;&lt; <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() &lt;&lt; endl);
<a name="l00276"></a>00276     <span class="keywordflow">if</span> (!<a class="code" href="classlibdap_1_1BaseType.html#38ff819a432217c55db2e9071928d20c" title="Has this variable been read?">read_p</a>())
<a name="l00277"></a>00277         <a class="code" href="classlibdap_1_1Structure.html#b49e61a5cf9dc60c5c8510b1ad1e7ef1" title="simple implementation of reat that iterates through vars and calls read on them">read</a>();          <span class="comment">// read() throws Error and InternalErr</span>
<a name="l00278"></a>00278 
<a name="l00279"></a>00279     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00280"></a>00280         <span class="keywordflow">if</span> ((*i)-&gt;send_p()) {
<a name="l00281"></a>00281             (*i)-&gt;intern_data(eval, dds);
<a name="l00282"></a>00282         }
<a name="l00283"></a>00283     }
<a name="l00284"></a>00284 }
<a name="l00285"></a>00285 
<a name="l00286"></a>00286 <span class="keywordtype">bool</span>
<a name="l00287"></a><a class="code" href="classlibdap_1_1Structure.html#751397fbb6334d1a6b8f424036ecd979">00287</a> <a class="code" href="classlibdap_1_1Structure.html#751397fbb6334d1a6b8f424036ecd979" title="Move data to the net.">Structure::serialize</a>(<a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> &amp;eval, <a class="code" href="classlibdap_1_1DDS.html">DDS</a> &amp;dds,
<a name="l00288"></a>00288                      <a class="code" href="classlibdap_1_1Marshaller.html" title="abstract base class used to marshall/serialize dap data objects">Marshaller</a> &amp;m, <span class="keywordtype">bool</span> ce_eval)
<a name="l00289"></a>00289 {
<a name="l00290"></a>00290     dds.<a class="code" href="classlibdap_1_1DDS.html#8cd9b6a34f5e1a49665de3189e141de8">timeout_on</a>();
<a name="l00291"></a>00291 
<a name="l00292"></a>00292     <span class="keywordflow">if</span> (!<a class="code" href="classlibdap_1_1BaseType.html#38ff819a432217c55db2e9071928d20c" title="Has this variable been read?">read_p</a>())
<a name="l00293"></a>00293         <a class="code" href="classlibdap_1_1Structure.html#b49e61a5cf9dc60c5c8510b1ad1e7ef1" title="simple implementation of reat that iterates through vars and calls read on them">read</a>();  <span class="comment">// read() throws Error and InternalErr</span>
<a name="l00294"></a>00294 
<a name="l00295"></a>00295 <span class="preprocessor">#if EVAL</span>
<a name="l00296"></a>00296 <span class="preprocessor"></span>    <span class="keywordflow">if</span> (ce_eval &amp;&amp; !eval.<a class="code" href="classlibdap_1_1ConstraintEvaluator.html#a0066a57cf00c975f6ccbc2e90c64742" title="Evaluate a boolean-valued constraint expression. This is main method for the evaluator...">eval_selection</a>(dds, <a class="code" href="classlibdap_1_1BaseType.html#9f102f5cc17ac7d2d80f9921e10d3baf" title="Returns the name of the dataset used to create this instance.">dataset</a>()))
<a name="l00297"></a>00297         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00298"></a>00298 <span class="preprocessor">#endif</span>
<a name="l00299"></a>00299 <span class="preprocessor"></span>
<a name="l00300"></a>00300     dds.<a class="code" href="classlibdap_1_1DDS.html#6740f99a5fc64640505924c5603ace0a">timeout_off</a>();
<a name="l00301"></a>00301 
<a name="l00302"></a>00302     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00303"></a>00303         <span class="keywordflow">if</span> ((*i)-&gt;send_p()) {
<a name="l00304"></a>00304             (*i)-&gt;serialize(eval, dds, m, <span class="keyword">false</span>);
<a name="l00305"></a>00305         }
<a name="l00306"></a>00306     }
<a name="l00307"></a>00307 
<a name="l00308"></a>00308     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00309"></a>00309 }
<a name="l00310"></a>00310 
<a name="l00311"></a>00311 <span class="keywordtype">bool</span>
<a name="l00312"></a><a class="code" href="classlibdap_1_1Structure.html#0bfa72d262ac4f1d798dda8a696c712f">00312</a> <a class="code" href="classlibdap_1_1Structure.html#0bfa72d262ac4f1d798dda8a696c712f" title="Receive data from the net.">Structure::deserialize</a>(<a class="code" href="classlibdap_1_1UnMarshaller.html" title="abstract base class used to unmarshall/deserialize dap data objects">UnMarshaller</a> &amp;um, <a class="code" href="classlibdap_1_1DDS.html">DDS</a> *dds, <span class="keywordtype">bool</span> reuse)
<a name="l00313"></a>00313 {
<a name="l00314"></a>00314     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00315"></a>00315         (*i)-&gt;deserialize(um, dds, reuse);
<a name="l00316"></a>00316     }
<a name="l00317"></a>00317 
<a name="l00318"></a>00318     <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00319"></a>00319 }
<a name="l00320"></a>00320 
<a name="l00330"></a>00330 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>
<a name="l00331"></a><a class="code" href="classlibdap_1_1Structure.html#01d94322cbae3e64becac5dcfd90936c">00331</a> <a class="code" href="classlibdap_1_1Structure.html#01d94322cbae3e64becac5dcfd90936c" title="Never call this.">Structure::val2buf</a>(<span class="keywordtype">void</span> *, <span class="keywordtype">bool</span>)
<a name="l00332"></a>00332 {
<a name="l00333"></a>00333     <span class="keywordflow">return</span> <span class="keyword">sizeof</span>(<a class="code" href="classlibdap_1_1Structure.html" title="Holds a structure (aggregate) type.">Structure</a>);
<a name="l00334"></a>00334 }
<a name="l00335"></a>00335 
<a name="l00339"></a>00339 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>
<a name="l00340"></a><a class="code" href="classlibdap_1_1Structure.html#8bab11f73a37413415203aefb6fb41dc">00340</a> <a class="code" href="classlibdap_1_1Structure.html#8bab11f73a37413415203aefb6fb41dc" title="Never call this.">Structure::buf2val</a>(<span class="keywordtype">void</span> **)
<a name="l00341"></a>00341 {
<a name="l00342"></a>00342     <span class="keywordflow">return</span> <span class="keyword">sizeof</span>(<a class="code" href="classlibdap_1_1Structure.html" title="Holds a structure (aggregate) type.">Structure</a>);
<a name="l00343"></a>00343 }
<a name="l00344"></a>00344 
<a name="l00345"></a>00345 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *
<a name="l00346"></a><a class="code" href="classlibdap_1_1Structure.html#049967f250fca1b3949bd2a1c8649890">00346</a> <a class="code" href="classlibdap_1_1Structure.html#049967f250fca1b3949bd2a1c8649890" title="Returns a pointer to a member of a constructor class.">Structure::var</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;name, <span class="keywordtype">bool</span> exact_match, <a class="code" href="classlibdap_1_1BaseType.html#e9c6e71855b90a0e552713011c9ab81f">btp_stack</a> *s)
<a name="l00347"></a>00347 {
<a name="l00348"></a>00348     <span class="keywordtype">string</span> n = <a class="code" href="namespacelibdap.html#376f9593431111a80ef78c98b8f4a0e2">www2id</a>(name);
<a name="l00349"></a>00349 
<a name="l00350"></a>00350     <span class="keywordflow">if</span> (exact_match)
<a name="l00351"></a>00351         <span class="keywordflow">return</span> m_exact_match(n, s);
<a name="l00352"></a>00352     <span class="keywordflow">else</span>
<a name="l00353"></a>00353         <span class="keywordflow">return</span> m_leaf_match(n, s);
<a name="l00354"></a>00354 }
<a name="l00355"></a>00355 
<a name="l00357"></a>00357 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *
<a name="l00358"></a><a class="code" href="classlibdap_1_1Structure.html#cfeeb97a574cedb90fd8ec2cadefbd0c">00358</a> <a class="code" href="classlibdap_1_1Structure.html#049967f250fca1b3949bd2a1c8649890" title="Returns a pointer to a member of a constructor class.">Structure::var</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;n, <a class="code" href="classlibdap_1_1BaseType.html#e9c6e71855b90a0e552713011c9ab81f">btp_stack</a> &amp;s)
<a name="l00359"></a>00359 {
<a name="l00360"></a>00360     <span class="keywordtype">string</span> <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a> = <a class="code" href="namespacelibdap.html#376f9593431111a80ef78c98b8f4a0e2">www2id</a>(n);
<a name="l00361"></a>00361 
<a name="l00362"></a>00362     <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = m_exact_match(name, &amp;s);
<a name="l00363"></a>00363     <span class="keywordflow">if</span> (btp)
<a name="l00364"></a>00364         <span class="keywordflow">return</span> btp;
<a name="l00365"></a>00365 
<a name="l00366"></a>00366     <span class="keywordflow">return</span> m_leaf_match(name, &amp;s);
<a name="l00367"></a>00367 }
<a name="l00368"></a>00368 
<a name="l00369"></a>00369 <span class="comment">// Private method to find a variable using the shorthand name. This</span>
<a name="l00370"></a>00370 <span class="comment">// should be moved to Constructor.</span>
<a name="l00371"></a>00371 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *
<a name="l00372"></a>00372 Structure::m_leaf_match(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;name, btp_stack *s)
<a name="l00373"></a>00373 {
<a name="l00374"></a>00374     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00375"></a>00375         <span class="keywordflow">if</span> ((*i)-&gt;name() == name) {
<a name="l00376"></a>00376             <span class="keywordflow">if</span> (s) {
<a name="l00377"></a>00377                 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">"Pushing "</span> &lt;&lt; this-&gt;<a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() &lt;&lt; endl);
<a name="l00378"></a>00378                 s-&gt;push(static_cast&lt;BaseType *&gt;(<span class="keyword">this</span>));
<a name="l00379"></a>00379             }
<a name="l00380"></a>00380             <span class="keywordflow">return</span> *i;
<a name="l00381"></a>00381         }
<a name="l00382"></a>00382         <span class="keywordflow">if</span> ((*i)-&gt;is_constructor_type()) {
<a name="l00383"></a>00383             <a class="code" href="classlibdap_1_1BaseType.html#85729dec5e1c563a06bff3f3ec660822" title="The BaseType constructor.">BaseType</a> *btp = (*i)-&gt;var(name, <span class="keyword">false</span>, s);
<a name="l00384"></a>00384             <span class="keywordflow">if</span> (btp) {
<a name="l00385"></a>00385                 <span class="keywordflow">if</span> (s) {
<a name="l00386"></a>00386                     <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">"Pushing "</span> &lt;&lt; this-&gt;<a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() &lt;&lt; endl);
<a name="l00387"></a>00387                     s-&gt;push(static_cast&lt;BaseType *&gt;(<span class="keyword">this</span>));
<a name="l00388"></a>00388                 }
<a name="l00389"></a>00389                 <span class="keywordflow">return</span> btp;
<a name="l00390"></a>00390             }
<a name="l00391"></a>00391         }
<a name="l00392"></a>00392     }
<a name="l00393"></a>00393 
<a name="l00394"></a>00394     <span class="keywordflow">return</span> 0;
<a name="l00395"></a>00395 }
<a name="l00396"></a>00396 
<a name="l00397"></a>00397 <span class="comment">// Breadth-first search for NAME. If NAME contains one or more dots (.)</span>
<a name="l00398"></a>00398 BaseType *
<a name="l00399"></a>00399 Structure::m_exact_match(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;name, btp_stack *s)
<a name="l00400"></a>00400 {
<a name="l00401"></a>00401     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00402"></a>00402         <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">"Looking at "</span> &lt;&lt; (*i)-&gt;name() &lt;&lt; <span class="stringliteral">" in: "</span> &lt;&lt; *i
<a name="l00403"></a>00403             &lt;&lt; endl);
<a name="l00404"></a>00404         <span class="keywordflow">if</span> ((*i)-&gt;name() == name) {
<a name="l00405"></a>00405             <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">"Found "</span> &lt;&lt; (*i)-&gt;name() &lt;&lt; <span class="stringliteral">" in: "</span>
<a name="l00406"></a>00406                 &lt;&lt; *i &lt;&lt; endl);
<a name="l00407"></a>00407             <span class="keywordflow">if</span> (s) {
<a name="l00408"></a>00408                 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">"Pushing "</span> &lt;&lt; this-&gt;<a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() &lt;&lt; endl);
<a name="l00409"></a>00409                 s-&gt;push(static_cast&lt;BaseType *&gt;(<span class="keyword">this</span>));
<a name="l00410"></a>00410             }
<a name="l00411"></a>00411             <span class="keywordflow">return</span> *i;
<a name="l00412"></a>00412         }
<a name="l00413"></a>00413     }
<a name="l00414"></a>00414 
<a name="l00415"></a>00415     string::size_type dot_pos = name.find(<span class="stringliteral">"."</span>); <span class="comment">// zero-based index of `.'</span>
<a name="l00416"></a>00416     <span class="keywordflow">if</span> (dot_pos != string::npos) {
<a name="l00417"></a>00417         <span class="keywordtype">string</span> aggregate = name.substr(0, dot_pos);
<a name="l00418"></a>00418         <span class="keywordtype">string</span> field = name.substr(dot_pos + 1);
<a name="l00419"></a>00419 
<a name="l00420"></a>00420         <a class="code" href="classlibdap_1_1BaseType.html#85729dec5e1c563a06bff3f3ec660822" title="The BaseType constructor.">BaseType</a> *agg_ptr = <a class="code" href="classlibdap_1_1Structure.html#049967f250fca1b3949bd2a1c8649890" title="Returns a pointer to a member of a constructor class.">var</a>(aggregate);
<a name="l00421"></a>00421         <span class="keywordflow">if</span> (agg_ptr) {
<a name="l00422"></a>00422             <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">"Descending into "</span> &lt;&lt; agg_ptr-&gt;name() &lt;&lt; endl);
<a name="l00423"></a>00423             <span class="keywordflow">if</span> (s) {
<a name="l00424"></a>00424                 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">"Pushing "</span> &lt;&lt; this-&gt;<a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() &lt;&lt; endl);
<a name="l00425"></a>00425                 s-&gt;push(static_cast&lt;BaseType *&gt;(<span class="keyword">this</span>));
<a name="l00426"></a>00426             }
<a name="l00427"></a>00427             <span class="keywordflow">return</span> agg_ptr-&gt;var(field, <span class="keyword">true</span>, s); <span class="comment">// recurse</span>
<a name="l00428"></a>00428         }
<a name="l00429"></a>00429         <span class="keywordflow">else</span>
<a name="l00430"></a>00430             <span class="keywordflow">return</span> 0;  <span class="comment">// qualified names must be *fully* qualified</span>
<a name="l00431"></a>00431     }
<a name="l00432"></a>00432 
<a name="l00433"></a>00433     <span class="keywordflow">return</span> 0;
<a name="l00434"></a>00434 }
<a name="l00435"></a>00435 <span class="comment">//#if FILE_METHODS</span>
<a name="l00436"></a>00436 <span class="keywordtype">void</span>
<a name="l00437"></a><a class="code" href="classlibdap_1_1Structure.html#b548188b75ca631c5670d13742194423">00437</a> <a class="code" href="classlibdap_1_1Structure.html#b548188b75ca631c5670d13742194423" title="Prints the value of the variable.">Structure::print_val</a>(FILE *out, <span class="keywordtype">string</span> space, <span class="keywordtype">bool</span> print_decl_p)
<a name="l00438"></a>00438 {
<a name="l00439"></a>00439     <span class="keywordflow">if</span> (print_decl_p) {
<a name="l00440"></a>00440         <a class="code" href="classlibdap_1_1Constructor.html#b7fb094be8da2a9f80f6d3b85e452934" title="Print an ASCII representation of the variable structure.">print_decl</a>(out, space, <span class="keyword">false</span>);
<a name="l00441"></a>00441         fprintf(out, <span class="stringliteral">" = "</span>) ;
<a name="l00442"></a>00442     }
<a name="l00443"></a>00443 
<a name="l00444"></a>00444     fprintf(out, <span class="stringliteral">"{ "</span>) ;
<a name="l00445"></a>00445     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#5a585c58a099833c4ca26561963e0f83">Vars_citer</a> i = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end();
<a name="l00446"></a>00446          i++, (void)(i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end() &amp;&amp; fprintf(out, <span class="stringliteral">", "</span>))) {
<a name="l00447"></a>00447         (*i)-&gt;print_val(out, <span class="stringliteral">""</span>, <span class="keyword">false</span>);
<a name="l00448"></a>00448     }
<a name="l00449"></a>00449 
<a name="l00450"></a>00450     fprintf(out, <span class="stringliteral">" }"</span>) ;
<a name="l00451"></a>00451 
<a name="l00452"></a>00452     <span class="keywordflow">if</span> (print_decl_p)
<a name="l00453"></a>00453         fprintf(out, <span class="stringliteral">";\n"</span>) ;
<a name="l00454"></a>00454 }
<a name="l00455"></a>00455 <span class="comment">//#endif</span>
<a name="l00456"></a>00456 <span class="keywordtype">void</span>
<a name="l00457"></a><a class="code" href="classlibdap_1_1Structure.html#f1652b61251339b9199d080504de453f">00457</a> <a class="code" href="classlibdap_1_1Structure.html#b548188b75ca631c5670d13742194423" title="Prints the value of the variable.">Structure::print_val</a>(ostream &amp;out, <span class="keywordtype">string</span> space, <span class="keywordtype">bool</span> print_decl_p)
<a name="l00458"></a>00458 {
<a name="l00459"></a>00459     <span class="keywordflow">if</span> (print_decl_p) {
<a name="l00460"></a>00460         <a class="code" href="classlibdap_1_1Constructor.html#b7fb094be8da2a9f80f6d3b85e452934" title="Print an ASCII representation of the variable structure.">print_decl</a>(out, space, <span class="keyword">false</span>);
<a name="l00461"></a>00461         out &lt;&lt; <span class="stringliteral">" = "</span> ;
<a name="l00462"></a>00462     }
<a name="l00463"></a>00463 
<a name="l00464"></a>00464     out &lt;&lt; <span class="stringliteral">"{ "</span> ;
<a name="l00465"></a>00465     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#5a585c58a099833c4ca26561963e0f83">Vars_citer</a> i = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end();
<a name="l00466"></a>00466          i++, (void)(i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end() &amp;&amp; out &lt;&lt; <span class="stringliteral">", "</span>)) {
<a name="l00467"></a>00467         (*i)-&gt;print_val(out, <span class="stringliteral">""</span>, <span class="keyword">false</span>);
<a name="l00468"></a>00468     }
<a name="l00469"></a>00469 
<a name="l00470"></a>00470     out &lt;&lt; <span class="stringliteral">" }"</span> ;
<a name="l00471"></a>00471 
<a name="l00472"></a>00472     <span class="keywordflow">if</span> (print_decl_p)
<a name="l00473"></a>00473         out &lt;&lt; <span class="stringliteral">";\n"</span> ;
<a name="l00474"></a>00474 }
<a name="l00475"></a>00475 
<a name="l00476"></a>00476 <span class="keywordtype">bool</span>
<a name="l00477"></a><a class="code" href="classlibdap_1_1Structure.html#e1437dd52b168306b96858e1072f59e2">00477</a> <a class="code" href="classlibdap_1_1Structure.html#e1437dd52b168306b96858e1072f59e2" title="Compare an object&amp;#39;s current state with the semantics of its type.">Structure::check_semantics</a>(<span class="keywordtype">string</span> &amp;msg, <span class="keywordtype">bool</span> all)
<a name="l00478"></a>00478 {
<a name="l00479"></a>00479     <span class="keywordflow">if</span> (!<a class="code" href="classlibdap_1_1BaseType.html#ec503abec2fd3090e7738c0a575491f8" title="Compare an object&amp;#39;s current state with the semantics of its type.">BaseType::check_semantics</a>(msg))
<a name="l00480"></a>00480         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00481"></a>00481 
<a name="l00482"></a>00482     <span class="keywordtype">bool</span> status = <span class="keyword">true</span>;
<a name="l00483"></a>00483 
<a name="l00484"></a>00484     <span class="keywordflow">if</span> (!<a class="code" href="namespacelibdap.html#fabf64c5d4c1900f1c05ac655895f7ee">unique_names</a>(<a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>, <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>(), <a class="code" href="classlibdap_1_1BaseType.html#c4461c9e287b167871acade5e5472116" title="Returns the type of the class instance as a string.">type_name</a>(), msg))
<a name="l00485"></a>00485         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00486"></a>00486 
<a name="l00487"></a>00487     <span class="keywordflow">if</span> (all) {
<a name="l00488"></a>00488         <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00489"></a>00489             <span class="comment">//assert(*i);</span>
<a name="l00490"></a>00490             <span class="keywordflow">if</span> (!(*i)-&gt;check_semantics(msg, <span class="keyword">true</span>)) {
<a name="l00491"></a>00491                 status = <span class="keyword">false</span>;
<a name="l00492"></a>00492                 <span class="keywordflow">goto</span> exit;
<a name="l00493"></a>00493             }
<a name="l00494"></a>00494         }
<a name="l00495"></a>00495     }
<a name="l00496"></a>00496 
<a name="l00497"></a>00497 exit:
<a name="l00498"></a>00498     <span class="keywordflow">return</span> status;
<a name="l00499"></a>00499 }
<a name="l00500"></a>00500 
<a name="l00509"></a>00509 <span class="keywordtype">void</span>
<a name="l00510"></a><a class="code" href="classlibdap_1_1Structure.html#d7aacbec3d542618fa6ba4f42e3dde9a">00510</a> <a class="code" href="classlibdap_1_1Structure.html#d7aacbec3d542618fa6ba4f42e3dde9a" title="dumps information about this object">Structure::dump</a>(ostream &amp;strm)<span class="keyword"> const</span>
<a name="l00511"></a>00511 <span class="keyword"></span>{
<a name="l00512"></a>00512     strm &lt;&lt; <a class="code" href="classlibdap_1_1DapIndent.html#45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> &lt;&lt; <span class="stringliteral">"Structure::dump - ("</span>
<a name="l00513"></a>00513     &lt;&lt; (<span class="keywordtype">void</span> *)<span class="keyword">this</span> &lt;&lt; <span class="stringliteral">")"</span> &lt;&lt; endl ;
<a name="l00514"></a>00514     <a class="code" href="classlibdap_1_1DapIndent.html#4ed2cce66dbff9ad4320e89142103c6c">DapIndent::Indent</a>() ;
<a name="l00515"></a>00515     <a class="code" href="classlibdap_1_1Structure.html#d7aacbec3d542618fa6ba4f42e3dde9a" title="dumps information about this object">Constructor::dump</a>(strm) ;
<a name="l00516"></a>00516     <a class="code" href="classlibdap_1_1DapIndent.html#65c519d0916b031bcf60ca8d26fc82f8">DapIndent::UnIndent</a>() ;
<a name="l00517"></a>00517 }
<a name="l00518"></a>00518 
<a name="l00519"></a>00519 } <span class="comment">// namespace libdap</span>
<a name="l00520"></a>00520 
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Wed Oct 7 19:57:08 2009 for libdap++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address>
</body>
</html>