Sophie

Sophie

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

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++: Structure.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('Structure_8cc.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<h1>Structure.cc</h1>  </div>
</div>
<div class="contents">
<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 &quot;<a class="code" href="config_8h.html">config.h</a>&quot;</span>
<a name="l00039"></a>00039 
<a name="l00040"></a>00040 <span class="preprocessor">#include &quot;<a class="code" href="Byte_8h.html">Byte.h</a>&quot;</span>
<a name="l00041"></a>00041 <span class="preprocessor">#include &quot;<a class="code" href="Int16_8h.html">Int16.h</a>&quot;</span>
<a name="l00042"></a>00042 <span class="preprocessor">#include &quot;<a class="code" href="UInt16_8h.html">UInt16.h</a>&quot;</span>
<a name="l00043"></a>00043 <span class="preprocessor">#include &quot;<a class="code" href="Int32_8h.html">Int32.h</a>&quot;</span>
<a name="l00044"></a>00044 <span class="preprocessor">#include &quot;<a class="code" href="UInt32_8h.html">UInt32.h</a>&quot;</span>
<a name="l00045"></a>00045 <span class="preprocessor">#include &quot;<a class="code" href="Float32_8h.html">Float32.h</a>&quot;</span>
<a name="l00046"></a>00046 <span class="preprocessor">#include &quot;<a class="code" href="Float64_8h.html">Float64.h</a>&quot;</span>
<a name="l00047"></a>00047 <span class="preprocessor">#include &quot;<a class="code" href="Str_8h.html">Str.h</a>&quot;</span>
<a name="l00048"></a>00048 <span class="preprocessor">#include &quot;<a class="code" href="Url_8h.html">Url.h</a>&quot;</span>
<a name="l00049"></a>00049 <span class="preprocessor">#include &quot;<a class="code" href="Array_8h.html">Array.h</a>&quot;</span>
<a name="l00050"></a>00050 <span class="preprocessor">#include &quot;<a class="code" href="Structure_8h.html">Structure.h</a>&quot;</span>
<a name="l00051"></a>00051 <span class="preprocessor">#include &quot;<a class="code" href="Sequence_8h.html">Sequence.h</a>&quot;</span>
<a name="l00052"></a>00052 <span class="preprocessor">#include &quot;<a class="code" href="Grid_8h.html">Grid.h</a>&quot;</span>
<a name="l00053"></a>00053 
<a name="l00054"></a>00054 <span class="preprocessor">#include &quot;<a class="code" href="util_8h.html">util.h</a>&quot;</span>
<a name="l00055"></a>00055 <span class="preprocessor">#include &quot;<a class="code" href="debug_8h.html">debug.h</a>&quot;</span>
<a name="l00056"></a>00056 <span class="preprocessor">#include &quot;<a class="code" href="InternalErr_8h.html">InternalErr.h</a>&quot;</span>
<a name="l00057"></a>00057 <span class="preprocessor">#include &quot;<a class="code" href="escaping_8h.html">escaping.h</a>&quot;</span>
<a name="l00058"></a>00058 
<a name="l00059"></a>00059 <span class="keyword">using</span> std::cerr;
<a name="l00060"></a>00060 <span class="keyword">using</span> std::endl;
<a name="l00061"></a>00061 
<a name="l00062"></a>00062 <span class="keyword">namespace </span>libdap {
<a name="l00063"></a>00063 
<a name="l00064"></a>00064 <span class="keywordtype">void</span>
<a name="l00065"></a><a class="code" href="classlibdap_1_1Structure.html#a636999981643db72bad417ee8602dcff">00065</a> <a class="code" href="classlibdap_1_1Structure.html#a636999981643db72bad417ee8602dcff">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="l00066"></a>00066 {
<a name="l00067"></a>00067     <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="l00068"></a>00068 
<a name="l00069"></a>00069     <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Copying structure: &quot;</span> &lt;&lt; <a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() &lt;&lt; endl);
<a name="l00070"></a>00070 
<a name="l00071"></a>00071     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = cs.<a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != cs.<a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00072"></a>00072         <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Copying field: &quot;</span> &lt;&lt; (*i)-&gt;name() &lt;&lt; endl);
<a name="l00073"></a>00073         <span class="comment">// Jose Garcia</span>
<a name="l00074"></a>00074         <span class="comment">// I think this assert here is part of a debugging</span>
<a name="l00075"></a>00075         <span class="comment">// process since it is going along with a DBG call</span>
<a name="l00076"></a>00076         <span class="comment">// I leave it here since it can be remove by defining NDEBUG.</span>
<a name="l00077"></a>00077         <span class="comment">// assert(*i);</span>
<a name="l00078"></a>00078         <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = (*i)-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a0b130311c9901fb8a7ab11ea19090ef0">ptr_duplicate</a>();
<a name="l00079"></a>00079         btp-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a5b6a39f6ce6594fa74f3fc899ac9a966">set_parent</a>(<span class="keyword">this</span>);
<a name="l00080"></a>00080         <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.push_back(btp);
<a name="l00081"></a>00081     }
<a name="l00082"></a>00082 }
<a name="l00083"></a>00083 
<a name="l00091"></a><a class="code" href="classlibdap_1_1Structure.html#a4187f25219b1fc7ec93e761795047e0a">00091</a> <a class="code" href="classlibdap_1_1Structure.html#a4187f25219b1fc7ec93e761795047e0a">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#a05ca706d4539ae7b750c3bc7066ab6e6ad93eb0a69e67742f061966ce594b9a6c">dods_structure_c</a>)
<a name="l00092"></a>00092 {}
<a name="l00093"></a>00093 
<a name="l00103"></a><a class="code" href="classlibdap_1_1Structure.html#aa48289fa5979febe73ae74a90f2d246b">00103</a> <a class="code" href="classlibdap_1_1Structure.html#a4187f25219b1fc7ec93e761795047e0a">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="l00104"></a>00104     : <a class="code" href="classlibdap_1_1Constructor.html">Constructor</a>(n, d, <a class="code" href="namespacelibdap.html#a05ca706d4539ae7b750c3bc7066ab6e6ad93eb0a69e67742f061966ce594b9a6c">dods_structure_c</a>)
<a name="l00105"></a>00105 {}
<a name="l00106"></a>00106 
<a name="l00108"></a><a class="code" href="classlibdap_1_1Structure.html#a469f0fe441ac54689db27d7527d28748">00108</a> <a class="code" href="classlibdap_1_1Structure.html#a4187f25219b1fc7ec93e761795047e0a">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="l00109"></a>00109 {
<a name="l00110"></a>00110     <a class="code" href="classlibdap_1_1Structure.html#a636999981643db72bad417ee8602dcff">_duplicate</a>(rhs);
<a name="l00111"></a>00111 }
<a name="l00112"></a>00112 
<a name="l00113"></a><a class="code" href="classlibdap_1_1Structure.html#a6ed7d2f86ea9f6e59c9a97ac5de3c7ae">00113</a> <a class="code" href="classlibdap_1_1Structure.html#a6ed7d2f86ea9f6e59c9a97ac5de3c7ae">Structure::~Structure</a>()
<a name="l00114"></a>00114 {
<a name="l00115"></a>00115     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00116"></a>00116         <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = *i ;
<a name="l00117"></a>00117         <span class="keyword">delete</span> btp ;  btp = 0;
<a name="l00118"></a>00118     }
<a name="l00119"></a>00119 }
<a name="l00120"></a>00120 
<a name="l00121"></a>00121 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *
<a name="l00122"></a><a class="code" href="classlibdap_1_1Structure.html#ae20b384171ecded1940c3cb9780eda7e">00122</a> <a class="code" href="classlibdap_1_1Structure.html#ae20b384171ecded1940c3cb9780eda7e">Structure::ptr_duplicate</a>()
<a name="l00123"></a>00123 {
<a name="l00124"></a>00124     <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classlibdap_1_1Structure.html#a4187f25219b1fc7ec93e761795047e0a">Structure</a>(*<span class="keyword">this</span>);
<a name="l00125"></a>00125 }
<a name="l00126"></a>00126 
<a name="l00127"></a>00127 <a class="code" href="classlibdap_1_1Structure.html" title="Holds a structure (aggregate) type.">Structure</a> &amp;
<a name="l00128"></a><a class="code" href="classlibdap_1_1Structure.html#aebf03bb4b5ce61f556edace7b1dd8db7">00128</a> <a class="code" href="classlibdap_1_1Structure.html#aebf03bb4b5ce61f556edace7b1dd8db7">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="l00129"></a>00129 {
<a name="l00130"></a>00130     <span class="keywordflow">if</span> (<span class="keyword">this</span> == &amp;rhs)
<a name="l00131"></a>00131         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00132"></a>00132 
<a name="l00133"></a>00133     <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="l00134"></a>00134 
<a name="l00135"></a>00135     <a class="code" href="classlibdap_1_1Structure.html#a636999981643db72bad417ee8602dcff">_duplicate</a>(rhs);
<a name="l00136"></a>00136 
<a name="l00137"></a>00137     <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00138"></a>00138 }
<a name="l00139"></a>00139 
<a name="l00140"></a>00140 <span class="keywordtype">int</span>
<a name="l00141"></a><a class="code" href="classlibdap_1_1Structure.html#add0e4690737cb99c6cf594b4d71d1fe9">00141</a> <a class="code" href="classlibdap_1_1Structure.html#add0e4690737cb99c6cf594b4d71d1fe9" title="Count the members of constructor types.">Structure::element_count</a>(<span class="keywordtype">bool</span> leaves)
<a name="l00142"></a>00142 {
<a name="l00143"></a>00143     <span class="keywordflow">if</span> (!leaves)
<a name="l00144"></a>00144         <span class="keywordflow">return</span> <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.size();
<a name="l00145"></a>00145     <span class="keywordflow">else</span> {
<a name="l00146"></a>00146         <span class="keywordtype">int</span> i = 0;
<a name="l00147"></a>00147         <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> j = <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); j != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end(); j++) {
<a name="l00148"></a>00148             j += (*j)-&gt;element_count(leaves);
<a name="l00149"></a>00149         }
<a name="l00150"></a>00150         <span class="keywordflow">return</span> i;
<a name="l00151"></a>00151     }
<a name="l00152"></a>00152 }
<a name="l00153"></a>00153 
<a name="l00154"></a>00154 <span class="keywordtype">bool</span>
<a name="l00155"></a><a class="code" href="classlibdap_1_1Structure.html#ac4687a4edb60d00fd781c82de40d53a4">00155</a> <a class="code" href="classlibdap_1_1Structure.html#ac4687a4edb60d00fd781c82de40d53a4" title="Check to see whether this variable can be printed simply.">Structure::is_linear</a>()
<a name="l00156"></a>00156 {
<a name="l00157"></a>00157     <span class="keywordtype">bool</span> linear = <span class="keyword">true</span>;
<a name="l00158"></a>00158     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); linear &amp;&amp; i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00159"></a>00159         <span class="keywordflow">if</span> ((*i)-&gt;type() == <a class="code" href="namespacelibdap.html#a05ca706d4539ae7b750c3bc7066ab6e6ad93eb0a69e67742f061966ce594b9a6c">dods_structure_c</a>)
<a name="l00160"></a>00160             linear = linear &amp;&amp; dynamic_cast&lt;Structure*&gt;((*i))-&gt;<a class="code" href="classlibdap_1_1Structure.html#ac4687a4edb60d00fd781c82de40d53a4" title="Check to see whether this variable can be printed simply.">is_linear</a>();
<a name="l00161"></a>00161         <span class="keywordflow">else</span>
<a name="l00162"></a>00162             linear = linear &amp;&amp; (*i)-&gt;is_simple_type();
<a name="l00163"></a>00163     }
<a name="l00164"></a>00164 
<a name="l00165"></a>00165     <span class="keywordflow">return</span> linear;
<a name="l00166"></a>00166 }
<a name="l00167"></a>00167 
<a name="l00168"></a>00168 <span class="keywordtype">void</span>
<a name="l00169"></a><a class="code" href="classlibdap_1_1Structure.html#a3b8c155448a06407a36cfb76a27fdcbc">00169</a> <a class="code" href="classlibdap_1_1Structure.html#a3b8c155448a06407a36cfb76a27fdcbc">Structure::set_send_p</a>(<span class="keywordtype">bool</span> state)
<a name="l00170"></a>00170 {
<a name="l00171"></a>00171     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00172"></a>00172         (*i)-&gt;set_send_p(state);
<a name="l00173"></a>00173     }
<a name="l00174"></a>00174 
<a name="l00175"></a>00175     <a class="code" href="classlibdap_1_1Structure.html#a3b8c155448a06407a36cfb76a27fdcbc">BaseType::set_send_p</a>(state);
<a name="l00176"></a>00176 }
<a name="l00177"></a>00177 
<a name="l00178"></a>00178 <span class="keywordtype">void</span>
<a name="l00179"></a><a class="code" href="classlibdap_1_1Structure.html#a61dd97e239b8abf740b03bec7f302b18">00179</a> <a class="code" href="classlibdap_1_1Structure.html#a61dd97e239b8abf740b03bec7f302b18" title="Sets the value of the read_p property.">Structure::set_read_p</a>(<span class="keywordtype">bool</span> state)
<a name="l00180"></a>00180 {
<a name="l00181"></a>00181     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00182"></a>00182         (*i)-&gt;set_read_p(state);
<a name="l00183"></a>00183     }
<a name="l00184"></a>00184 
<a name="l00185"></a>00185     <a class="code" href="classlibdap_1_1Structure.html#a61dd97e239b8abf740b03bec7f302b18" title="Sets the value of the read_p property.">BaseType::set_read_p</a>(state);
<a name="l00186"></a>00186 }
<a name="l00187"></a>00187 
<a name="l00193"></a>00193 <span class="keywordtype">void</span>
<a name="l00194"></a><a class="code" href="classlibdap_1_1Structure.html#ad0d08ebc3100995977dcae0d7f086a9c">00194</a> <a class="code" href="classlibdap_1_1Structure.html#ad0d08ebc3100995977dcae0d7f086a9c" title="Set the in_selection property.">Structure::set_in_selection</a>(<span class="keywordtype">bool</span> state)
<a name="l00195"></a>00195 {
<a name="l00196"></a>00196     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00197"></a>00197         (*i)-&gt;set_in_selection(state);
<a name="l00198"></a>00198     }
<a name="l00199"></a>00199 
<a name="l00200"></a>00200     <a class="code" href="classlibdap_1_1Structure.html#ad0d08ebc3100995977dcae0d7f086a9c" title="Set the in_selection property.">BaseType::set_in_selection</a>(state);
<a name="l00201"></a>00201 }
<a name="l00202"></a>00202 
<a name="l00204"></a>00204 <span class="keywordtype">void</span>
<a name="l00205"></a><a class="code" href="classlibdap_1_1Structure.html#a69851299078fd4bfc39d722c8cdc3cb9">00205</a> <a class="code" href="classlibdap_1_1Structure.html#a69851299078fd4bfc39d722c8cdc3cb9" title="Traverse Structure, set Sequence leaf nodes.">Structure::set_leaf_sequence</a>(<span class="keywordtype">int</span> level)
<a name="l00206"></a>00206 {
<a name="l00207"></a>00207     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#adeafe3d6c82d07b456a598a7b446c2c6">var_begin</a>(); i != <a class="code" href="classlibdap_1_1Constructor.html#a936b38c7c35ffb4fe17c5b8e85bdaaa2">var_end</a>(); i++) {
<a name="l00208"></a>00208         <span class="keywordflow">if</span> ((*i)-&gt;type() == <a class="code" href="namespacelibdap.html#a05ca706d4539ae7b750c3bc7066ab6e6a0b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>)
<a name="l00209"></a>00209             dynamic_cast&lt;Sequence&amp;&gt;(**i).set_leaf_sequence(++level);
<a name="l00210"></a>00210         <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="l00211"></a>00211             dynamic_cast&lt;Structure&amp;&gt;(**i).set_leaf_sequence(level);
<a name="l00212"></a>00212     }
<a name="l00213"></a>00213 }
<a name="l00214"></a>00214 
<a name="l00219"></a>00219 <span class="keywordtype">void</span>
<a name="l00220"></a><a class="code" href="classlibdap_1_1Structure.html#aa2e403ad2ce9b78f279a18799f61b353">00220</a> <a class="code" href="classlibdap_1_1Structure.html#aa2e403ad2ce9b78f279a18799f61b353">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#addcb1d714cdecb877c65ff6d2fde0695" title="Names the parts of multi-section constructor data types.">Part</a>)
<a name="l00221"></a>00221 {
<a name="l00222"></a>00222     <span class="comment">// Jose Garcia</span>
<a name="l00223"></a>00223     <span class="comment">// Passing and invalid pointer to an object is a developer&#39;s error.</span>
<a name="l00224"></a>00224     <span class="keywordflow">if</span> (!bt)
<a name="l00225"></a>00225         <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="l00226"></a>00226                           <span class="stringliteral">&quot;The BaseType parameter cannot be null.&quot;</span>);
<a name="l00227"></a>00227 
<a name="l00228"></a>00228     <span class="comment">// Jose Garcia</span>
<a name="l00229"></a>00229     <span class="comment">// Now we add a copy of bt so the external user is able to destroy bt as</span>
<a name="l00230"></a>00230     <span class="comment">// he/she wishes. The policy is: &quot;If it is allocated outside, it is</span>
<a name="l00231"></a>00231     <span class="comment">// deallocated outside, if it is allocated inside, it is deallocated</span>
<a name="l00232"></a>00232     <span class="comment">// inside&quot;</span>
<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> *btp = bt-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a0b130311c9901fb8a7ab11ea19090ef0">ptr_duplicate</a>();
<a name="l00234"></a>00234     btp-&gt;<a class="code" href="classlibdap_1_1BaseType.html#a5b6a39f6ce6594fa74f3fc899ac9a966">set_parent</a>(<span class="keyword">this</span>);
<a name="l00235"></a>00235     <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.push_back(btp);
<a name="l00236"></a>00236 }
<a name="l00237"></a>00237 
<a name="l00241"></a>00241 <span class="keywordtype">void</span>
<a name="l00242"></a><a class="code" href="classlibdap_1_1Structure.html#abd4007d70af3ca2550daea14a1da7ce1">00242</a> <a class="code" href="classlibdap_1_1Structure.html#abd4007d70af3ca2550daea14a1da7ce1">Structure::del_var</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;n)
<a name="l00243"></a>00243 {
<a name="l00244"></a>00244     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00245"></a>00245         <span class="keywordflow">if</span> ((*i)-&gt;name() == n) {
<a name="l00246"></a>00246             <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *bt = *i ;
<a name="l00247"></a>00247             <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.erase(i) ;
<a name="l00248"></a>00248             <span class="keyword">delete</span> bt ; bt = 0;
<a name="l00249"></a>00249             <span class="keywordflow">return</span>;
<a name="l00250"></a>00250         }
<a name="l00251"></a>00251     }
<a name="l00252"></a>00252 }
<a name="l00253"></a>00253 
<a name="l00259"></a>00259 <span class="keywordtype">bool</span>
<a name="l00260"></a><a class="code" href="classlibdap_1_1Structure.html#ab49e61a5cf9dc60c5c8510b1ad1e7ef1">00260</a> <a class="code" href="classlibdap_1_1Structure.html#ab49e61a5cf9dc60c5c8510b1ad1e7ef1" title="simple implementation of reat that iterates through vars and calls read on them">Structure::read</a>()
<a name="l00261"></a>00261 {
<a name="l00262"></a>00262     <span class="keywordflow">if</span>( !<a class="code" href="classlibdap_1_1BaseType.html#a38ff819a432217c55db2e9071928d20c" title="Has this variable been read?">read_p</a>() )
<a name="l00263"></a>00263     {
<a name="l00264"></a>00264         <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00265"></a>00265             (*i)-&gt;read() ;
<a name="l00266"></a>00266         }
<a name="l00267"></a>00267         <a class="code" href="classlibdap_1_1Structure.html#a61dd97e239b8abf740b03bec7f302b18" title="Sets the value of the read_p property.">set_read_p</a>(<span class="keyword">true</span>) ;
<a name="l00268"></a>00268     }
<a name="l00269"></a>00269 
<a name="l00270"></a>00270     <span class="keywordflow">return</span> false ;
<a name="l00271"></a>00271 }
<a name="l00272"></a>00272 
<a name="l00273"></a>00273 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>
<a name="l00274"></a><a class="code" href="classlibdap_1_1Structure.html#a913b94ec0a92ceb3dedb93c8b21a9845">00274</a> <a class="code" href="classlibdap_1_1Structure.html#a913b94ec0a92ceb3dedb93c8b21a9845" title="Returns the size of the class instance data.">Structure::width</a>()
<a name="l00275"></a>00275 {
<a name="l00276"></a>00276     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sz = 0;
<a name="l00277"></a>00277 
<a name="l00278"></a>00278     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00279"></a>00279         sz += (*i)-&gt;width();
<a name="l00280"></a>00280     }
<a name="l00281"></a>00281 
<a name="l00282"></a>00282     <span class="keywordflow">return</span> sz;
<a name="l00283"></a>00283 }
<a name="l00284"></a>00284 
<a name="l00285"></a>00285 <span class="keywordtype">void</span>
<a name="l00286"></a><a class="code" href="classlibdap_1_1Structure.html#a22c9ae6a09a40c9f8e44d2a25d6464a4">00286</a> <a class="code" href="classlibdap_1_1Structure.html#a22c9ae6a09a40c9f8e44d2a25d6464a4">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="l00287"></a>00287 {
<a name="l00288"></a>00288     <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Structure::intern_data: &quot;</span> &lt;&lt; <a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() &lt;&lt; endl);
<a name="l00289"></a>00289     <span class="keywordflow">if</span> (!<a class="code" href="classlibdap_1_1BaseType.html#a38ff819a432217c55db2e9071928d20c" title="Has this variable been read?">read_p</a>())
<a name="l00290"></a>00290         <a class="code" href="classlibdap_1_1Structure.html#ab49e61a5cf9dc60c5c8510b1ad1e7ef1" 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="l00291"></a>00291 
<a name="l00292"></a>00292     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00293"></a>00293         <span class="keywordflow">if</span> ((*i)-&gt;send_p()) {
<a name="l00294"></a>00294             (*i)-&gt;intern_data(eval, dds);
<a name="l00295"></a>00295         }
<a name="l00296"></a>00296     }
<a name="l00297"></a>00297 }
<a name="l00298"></a>00298 
<a name="l00299"></a>00299 <span class="keywordtype">bool</span>
<a name="l00300"></a><a class="code" href="classlibdap_1_1Structure.html#a751397fbb6334d1a6b8f424036ecd979">00300</a> <a class="code" href="classlibdap_1_1Structure.html#a751397fbb6334d1a6b8f424036ecd979" 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="l00301"></a>00301                      <a class="code" href="classlibdap_1_1Marshaller.html" title="abstract base class used to marshal/serialize dap data objects">Marshaller</a> &amp;m, <span class="keywordtype">bool</span> ce_eval)
<a name="l00302"></a>00302 {
<a name="l00303"></a>00303     dds.<a class="code" href="classlibdap_1_1DDS.html#a8cd9b6a34f5e1a49665de3189e141de8">timeout_on</a>();
<a name="l00304"></a>00304 
<a name="l00305"></a>00305     <span class="keywordflow">if</span> (!<a class="code" href="classlibdap_1_1BaseType.html#a38ff819a432217c55db2e9071928d20c" title="Has this variable been read?">read_p</a>())
<a name="l00306"></a>00306         <a class="code" href="classlibdap_1_1Structure.html#ab49e61a5cf9dc60c5c8510b1ad1e7ef1" 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="l00307"></a>00307 
<a name="l00308"></a>00308 <span class="preprocessor">#if EVAL</span>
<a name="l00309"></a>00309 <span class="preprocessor"></span>    <span class="keywordflow">if</span> (ce_eval &amp;&amp; !eval.<a class="code" href="classlibdap_1_1ConstraintEvaluator.html#aa0066a57cf00c975f6ccbc2e90c64742" title="Evaluate a boolean-valued constraint expression. This is main method for the evaluator ans is called ...">eval_selection</a>(dds, <a class="code" href="classlibdap_1_1BaseType.html#a9f102f5cc17ac7d2d80f9921e10d3baf" title="Returns the name of the dataset used to create this instance.">dataset</a>()))
<a name="l00310"></a>00310         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00311"></a>00311 <span class="preprocessor">#endif</span>
<a name="l00312"></a>00312 <span class="preprocessor"></span>
<a name="l00313"></a>00313     dds.<a class="code" href="classlibdap_1_1DDS.html#a6740f99a5fc64640505924c5603ace0a">timeout_off</a>();
<a name="l00314"></a>00314 
<a name="l00315"></a>00315     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00316"></a>00316         <span class="keywordflow">if</span> ((*i)-&gt;send_p()) {
<a name="l00317"></a>00317             (*i)-&gt;serialize(eval, dds, m, <span class="keyword">false</span>);
<a name="l00318"></a>00318         }
<a name="l00319"></a>00319     }
<a name="l00320"></a>00320 
<a name="l00321"></a>00321     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00322"></a>00322 }
<a name="l00323"></a>00323 
<a name="l00324"></a>00324 <span class="keywordtype">bool</span>
<a name="l00325"></a><a class="code" href="classlibdap_1_1Structure.html#a0bfa72d262ac4f1d798dda8a696c712f">00325</a> <a class="code" href="classlibdap_1_1Structure.html#a0bfa72d262ac4f1d798dda8a696c712f" 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="l00326"></a>00326 {
<a name="l00327"></a>00327     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00328"></a>00328         (*i)-&gt;deserialize(um, dds, reuse);
<a name="l00329"></a>00329     }
<a name="l00330"></a>00330 
<a name="l00331"></a>00331     <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00332"></a>00332 }
<a name="l00333"></a>00333 
<a name="l00343"></a>00343 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>
<a name="l00344"></a><a class="code" href="classlibdap_1_1Structure.html#a01d94322cbae3e64becac5dcfd90936c">00344</a> <a class="code" href="classlibdap_1_1Structure.html#a01d94322cbae3e64becac5dcfd90936c" title="Never call this.">Structure::val2buf</a>(<span class="keywordtype">void</span> *, <span class="keywordtype">bool</span>)
<a name="l00345"></a>00345 {
<a name="l00346"></a>00346     <span class="keywordflow">return</span> <span class="keyword">sizeof</span>(<a class="code" href="classlibdap_1_1Structure.html#a4187f25219b1fc7ec93e761795047e0a">Structure</a>);
<a name="l00347"></a>00347 }
<a name="l00348"></a>00348 
<a name="l00352"></a>00352 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>
<a name="l00353"></a><a class="code" href="classlibdap_1_1Structure.html#a8bab11f73a37413415203aefb6fb41dc">00353</a> <a class="code" href="classlibdap_1_1Structure.html#a8bab11f73a37413415203aefb6fb41dc" title="Never call this.">Structure::buf2val</a>(<span class="keywordtype">void</span> **)
<a name="l00354"></a>00354 {
<a name="l00355"></a>00355     <span class="keywordflow">return</span> <span class="keyword">sizeof</span>(<a class="code" href="classlibdap_1_1Structure.html#a4187f25219b1fc7ec93e761795047e0a">Structure</a>);
<a name="l00356"></a>00356 }
<a name="l00357"></a>00357 
<a name="l00358"></a>00358 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *
<a name="l00359"></a><a class="code" href="classlibdap_1_1Structure.html#a049967f250fca1b3949bd2a1c8649890">00359</a> <a class="code" href="classlibdap_1_1Structure.html#a049967f250fca1b3949bd2a1c8649890" 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#ae9c6e71855b90a0e552713011c9ab81f">btp_stack</a> *s)
<a name="l00360"></a>00360 {
<a name="l00361"></a>00361     <span class="keywordtype">string</span> n = <a class="code" href="namespacelibdap.html#a376f9593431111a80ef78c98b8f4a0e2">www2id</a>(name);
<a name="l00362"></a>00362 
<a name="l00363"></a>00363     <span class="keywordflow">if</span> (exact_match)
<a name="l00364"></a>00364         <span class="keywordflow">return</span> m_exact_match(n, s);
<a name="l00365"></a>00365     <span class="keywordflow">else</span>
<a name="l00366"></a>00366         <span class="keywordflow">return</span> m_leaf_match(n, s);
<a name="l00367"></a>00367 }
<a name="l00368"></a>00368 
<a name="l00370"></a>00370 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *
<a name="l00371"></a><a class="code" href="classlibdap_1_1Structure.html#acfeeb97a574cedb90fd8ec2cadefbd0c">00371</a> <a class="code" href="classlibdap_1_1Structure.html#a049967f250fca1b3949bd2a1c8649890" 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#ae9c6e71855b90a0e552713011c9ab81f">btp_stack</a> &amp;s)
<a name="l00372"></a>00372 {
<a name="l00373"></a>00373     <span class="keywordtype">string</span> <a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a> = <a class="code" href="namespacelibdap.html#a376f9593431111a80ef78c98b8f4a0e2">www2id</a>(n);
<a name="l00374"></a>00374 
<a name="l00375"></a>00375     <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="l00376"></a>00376     <span class="keywordflow">if</span> (btp)
<a name="l00377"></a>00377         <span class="keywordflow">return</span> btp;
<a name="l00378"></a>00378 
<a name="l00379"></a>00379     <span class="keywordflow">return</span> m_leaf_match(name, &amp;s);
<a name="l00380"></a>00380 }
<a name="l00381"></a>00381 
<a name="l00382"></a>00382 <span class="comment">// Private method to find a variable using the shorthand name. This</span>
<a name="l00383"></a>00383 <span class="comment">// should be moved to Constructor.</span>
<a name="l00384"></a>00384 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *
<a name="l00385"></a>00385 Structure::m_leaf_match(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;name, btp_stack *s)
<a name="l00386"></a>00386 {
<a name="l00387"></a>00387     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00388"></a>00388         <span class="keywordflow">if</span> ((*i)-&gt;name() == <a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>) {
<a name="l00389"></a>00389             <span class="keywordflow">if</span> (s) {
<a name="l00390"></a>00390                 <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Pushing &quot;</span> &lt;&lt; this-&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="l00391"></a>00391                 s-&gt;push(static_cast&lt;BaseType *&gt;(<span class="keyword">this</span>));
<a name="l00392"></a>00392             }
<a name="l00393"></a>00393             <span class="keywordflow">return</span> *i;
<a name="l00394"></a>00394         }
<a name="l00395"></a>00395         <span class="keywordflow">if</span> ((*i)-&gt;is_constructor_type()) {
<a name="l00396"></a>00396             <a class="code" href="classlibdap_1_1BaseType.html#a85729dec5e1c563a06bff3f3ec660822" title="The BaseType constructor.">BaseType</a> *btp = (*i)-&gt;var(name, <span class="keyword">false</span>, s);
<a name="l00397"></a>00397             <span class="keywordflow">if</span> (btp) {
<a name="l00398"></a>00398                 <span class="keywordflow">if</span> (s) {
<a name="l00399"></a>00399                     <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Pushing &quot;</span> &lt;&lt; this-&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="l00400"></a>00400                     s-&gt;push(static_cast&lt;BaseType *&gt;(<span class="keyword">this</span>));
<a name="l00401"></a>00401                 }
<a name="l00402"></a>00402                 <span class="keywordflow">return</span> btp;
<a name="l00403"></a>00403             }
<a name="l00404"></a>00404         }
<a name="l00405"></a>00405     }
<a name="l00406"></a>00406 
<a name="l00407"></a>00407     <span class="keywordflow">return</span> 0;
<a name="l00408"></a>00408 }
<a name="l00409"></a>00409 
<a name="l00410"></a>00410 <span class="comment">// Breadth-first search for NAME. If NAME contains one or more dots (.)</span>
<a name="l00411"></a>00411 BaseType *
<a name="l00412"></a>00412 Structure::m_exact_match(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;name, btp_stack *s)
<a name="l00413"></a>00413 {
<a name="l00414"></a>00414     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00415"></a>00415         <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Looking at &quot;</span> &lt;&lt; (*i)-&gt;name() &lt;&lt; <span class="stringliteral">&quot; in: &quot;</span> &lt;&lt; *i
<a name="l00416"></a>00416             &lt;&lt; endl);
<a name="l00417"></a>00417         <span class="keywordflow">if</span> ((*i)-&gt;name() == <a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>) {
<a name="l00418"></a>00418             <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Found &quot;</span> &lt;&lt; (*i)-&gt;name() &lt;&lt; <span class="stringliteral">&quot; in: &quot;</span>
<a name="l00419"></a>00419                 &lt;&lt; *i &lt;&lt; endl);
<a name="l00420"></a>00420             <span class="keywordflow">if</span> (s) {
<a name="l00421"></a>00421                 <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Pushing &quot;</span> &lt;&lt; this-&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="l00422"></a>00422                 s-&gt;push(static_cast&lt;BaseType *&gt;(<span class="keyword">this</span>));
<a name="l00423"></a>00423             }
<a name="l00424"></a>00424             <span class="keywordflow">return</span> *i;
<a name="l00425"></a>00425         }
<a name="l00426"></a>00426     }
<a name="l00427"></a>00427 
<a name="l00428"></a>00428     string::size_type dot_pos = name.find(<span class="stringliteral">&quot;.&quot;</span>); <span class="comment">// zero-based index of `.&#39;</span>
<a name="l00429"></a>00429     <span class="keywordflow">if</span> (dot_pos != string::npos) {
<a name="l00430"></a>00430         <span class="keywordtype">string</span> aggregate = name.substr(0, dot_pos);
<a name="l00431"></a>00431         <span class="keywordtype">string</span> field = name.substr(dot_pos + 1);
<a name="l00432"></a>00432 
<a name="l00433"></a>00433         <a class="code" href="classlibdap_1_1BaseType.html#a85729dec5e1c563a06bff3f3ec660822" title="The BaseType constructor.">BaseType</a> *agg_ptr = <a class="code" href="classlibdap_1_1Structure.html#a049967f250fca1b3949bd2a1c8649890" title="Returns a pointer to a member of a constructor class.">var</a>(aggregate);
<a name="l00434"></a>00434         <span class="keywordflow">if</span> (agg_ptr) {
<a name="l00435"></a>00435             <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Descending into &quot;</span> &lt;&lt; agg_ptr-&gt;name() &lt;&lt; endl);
<a name="l00436"></a>00436             <span class="keywordflow">if</span> (s) {
<a name="l00437"></a>00437                 <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Pushing &quot;</span> &lt;&lt; this-&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="l00438"></a>00438                 s-&gt;push(static_cast&lt;BaseType *&gt;(<span class="keyword">this</span>));
<a name="l00439"></a>00439             }
<a name="l00440"></a>00440             <span class="keywordflow">return</span> agg_ptr-&gt;var(field, <span class="keyword">true</span>, s); <span class="comment">// recurse</span>
<a name="l00441"></a>00441         }
<a name="l00442"></a>00442         <span class="keywordflow">else</span>
<a name="l00443"></a>00443             <span class="keywordflow">return</span> 0;  <span class="comment">// qualified names must be *fully* qualified</span>
<a name="l00444"></a>00444     }
<a name="l00445"></a>00445 
<a name="l00446"></a>00446     <span class="keywordflow">return</span> 0;
<a name="l00447"></a>00447 }
<a name="l00448"></a>00448 
<a name="l00449"></a>00449 <span class="preprocessor">#if FILE_METHODS</span>
<a name="l00450"></a>00450 <span class="preprocessor"></span><span class="keywordtype">void</span>
<a name="l00451"></a>00451 <a class="code" href="classlibdap_1_1Structure.html#af1652b61251339b9199d080504de453f" 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="l00452"></a>00452 {
<a name="l00453"></a>00453     <span class="keywordflow">if</span> (print_decl_p) {
<a name="l00454"></a>00454         <a class="code" href="classlibdap_1_1Constructor.html#ab7fb094be8da2a9f80f6d3b85e452934" title="Print an ASCII representation of the variable structure.">print_decl</a>(out, space, <span class="keyword">false</span>);
<a name="l00455"></a>00455         fprintf(out, <span class="stringliteral">&quot; = &quot;</span>) ;
<a name="l00456"></a>00456     }
<a name="l00457"></a>00457 
<a name="l00458"></a>00458     fprintf(out, <span class="stringliteral">&quot;{ &quot;</span>) ;
<a name="l00459"></a>00459     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a5a585c58a099833c4ca26561963e0f83">Vars_citer</a> i = <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end();
<a name="l00460"></a>00460          i++, (void)(i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end() &amp;&amp; fprintf(out, <span class="stringliteral">&quot;, &quot;</span>))) {
<a name="l00461"></a>00461         (*i)-&gt;print_val(out, <span class="stringliteral">&quot;&quot;</span>, <span class="keyword">false</span>);
<a name="l00462"></a>00462     }
<a name="l00463"></a>00463 
<a name="l00464"></a>00464     fprintf(out, <span class="stringliteral">&quot; }&quot;</span>) ;
<a name="l00465"></a>00465 
<a name="l00466"></a>00466     <span class="keywordflow">if</span> (print_decl_p)
<a name="l00467"></a>00467         fprintf(out, <span class="stringliteral">&quot;;\n&quot;</span>) ;
<a name="l00468"></a>00468 }
<a name="l00469"></a>00469 <span class="preprocessor">#endif</span>
<a name="l00470"></a>00470 <span class="preprocessor"></span>
<a name="l00471"></a>00471 <span class="keywordtype">void</span>
<a name="l00472"></a><a class="code" href="classlibdap_1_1Structure.html#af1652b61251339b9199d080504de453f">00472</a> <a class="code" href="classlibdap_1_1Structure.html#af1652b61251339b9199d080504de453f" 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="l00473"></a>00473 {
<a name="l00474"></a>00474     <span class="keywordflow">if</span> (print_decl_p) {
<a name="l00475"></a>00475         <a class="code" href="classlibdap_1_1Constructor.html#ab7fb094be8da2a9f80f6d3b85e452934" title="Print an ASCII representation of the variable structure.">print_decl</a>(out, space, <span class="keyword">false</span>);
<a name="l00476"></a>00476         out &lt;&lt; <span class="stringliteral">&quot; = &quot;</span> ;
<a name="l00477"></a>00477     }
<a name="l00478"></a>00478 
<a name="l00479"></a>00479     out &lt;&lt; <span class="stringliteral">&quot;{ &quot;</span> ;
<a name="l00480"></a>00480     <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a5a585c58a099833c4ca26561963e0f83">Vars_citer</a> i = <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end();
<a name="l00481"></a>00481          i++, (void)(i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end() &amp;&amp; out &lt;&lt; <span class="stringliteral">&quot;, &quot;</span>)) {
<a name="l00482"></a>00482         (*i)-&gt;print_val(out, <span class="stringliteral">&quot;&quot;</span>, <span class="keyword">false</span>);
<a name="l00483"></a>00483     }
<a name="l00484"></a>00484 
<a name="l00485"></a>00485     out &lt;&lt; <span class="stringliteral">&quot; }&quot;</span> ;
<a name="l00486"></a>00486 
<a name="l00487"></a>00487     <span class="keywordflow">if</span> (print_decl_p)
<a name="l00488"></a>00488         out &lt;&lt; <span class="stringliteral">&quot;;\n&quot;</span> ;
<a name="l00489"></a>00489 }
<a name="l00490"></a>00490 
<a name="l00491"></a>00491 <span class="keywordtype">bool</span>
<a name="l00492"></a><a class="code" href="classlibdap_1_1Structure.html#ae1437dd52b168306b96858e1072f59e2">00492</a> <a class="code" href="classlibdap_1_1Structure.html#ae1437dd52b168306b96858e1072f59e2" 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="l00493"></a>00493 {
<a name="l00494"></a>00494     <span class="keywordflow">if</span> (!<a class="code" href="classlibdap_1_1BaseType.html#aec503abec2fd3090e7738c0a575491f8" title="Compare an object&amp;#39;s current state with the semantics of its type.">BaseType::check_semantics</a>(msg))
<a name="l00495"></a>00495         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00496"></a>00496 
<a name="l00497"></a>00497     <span class="keywordtype">bool</span> status = <span class="keyword">true</span>;
<a name="l00498"></a>00498 
<a name="l00499"></a>00499     <span class="keywordflow">if</span> (!<a class="code" href="namespacelibdap.html#afabf64c5d4c1900f1c05ac655895f7ee">unique_names</a>(<a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>, <a class="code" href="classlibdap_1_1BaseType.html#a0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>(), <a class="code" href="classlibdap_1_1BaseType.html#ac4461c9e287b167871acade5e5472116" title="Returns the type of the class instance as a string.">type_name</a>(), msg))
<a name="l00500"></a>00500         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00501"></a>00501 
<a name="l00502"></a>00502     <span class="keywordflow">if</span> (all) {
<a name="l00503"></a>00503         <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#a2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); i != <a class="code" href="classlibdap_1_1Constructor.html#ac9830d0abf882c915fe714e127b48b55">_vars</a>.end(); i++) {
<a name="l00504"></a>00504             <span class="comment">//assert(*i);</span>
<a name="l00505"></a>00505             <span class="keywordflow">if</span> (!(*i)-&gt;check_semantics(msg, <span class="keyword">true</span>)) {
<a name="l00506"></a>00506                 status = <span class="keyword">false</span>;
<a name="l00507"></a>00507                 <span class="keywordflow">goto</span> exit;
<a name="l00508"></a>00508             }
<a name="l00509"></a>00509         }
<a name="l00510"></a>00510     }
<a name="l00511"></a>00511 
<a name="l00512"></a>00512 exit:
<a name="l00513"></a>00513     <span class="keywordflow">return</span> status;
<a name="l00514"></a>00514 }
<a name="l00515"></a>00515 
<a name="l00524"></a>00524 <span class="keywordtype">void</span>
<a name="l00525"></a><a class="code" href="classlibdap_1_1Structure.html#ad7aacbec3d542618fa6ba4f42e3dde9a">00525</a> <a class="code" href="classlibdap_1_1Structure.html#ad7aacbec3d542618fa6ba4f42e3dde9a" title="dumps information about this object">Structure::dump</a>(ostream &amp;strm)<span class="keyword"> const</span>
<a name="l00526"></a>00526 <span class="keyword"></span>{
<a name="l00527"></a>00527     strm &lt;&lt; <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> &lt;&lt; <span class="stringliteral">&quot;Structure::dump - (&quot;</span>
<a name="l00528"></a>00528     &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="l00529"></a>00529     <a class="code" href="classlibdap_1_1DapIndent.html#a4ed2cce66dbff9ad4320e89142103c6c">DapIndent::Indent</a>() ;
<a name="l00530"></a>00530     <a class="code" href="classlibdap_1_1Structure.html#ad7aacbec3d542618fa6ba4f42e3dde9a" title="dumps information about this object">Constructor::dump</a>(strm) ;
<a name="l00531"></a>00531     <a class="code" href="classlibdap_1_1DapIndent.html#a65c519d0916b031bcf60ca8d26fc82f8">DapIndent::UnIndent</a>() ;
<a name="l00532"></a>00532 }
<a name="l00533"></a>00533 
<a name="l00534"></a>00534 } <span class="comment">// namespace libdap</span>
<a name="l00535"></a>00535 
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="Structure_8cc.html">Structure.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>