<!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++: Sequence.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 Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <h1>Sequence.cc</h1><a href="Sequence_8cc.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// -*- mode: c++; c-basic-offset:4 -*-</span> <a name="l00002"></a>00002 <a name="l00003"></a>00003 <span class="comment">// This file is part of libdap, A C++ implementation of the OPeNDAP Data</span> <a name="l00004"></a>00004 <span class="comment">// Access Protocol.</span> <a name="l00005"></a>00005 <a name="l00006"></a>00006 <span class="comment">// Copyright (c) 2002,2003 OPeNDAP, Inc.</span> <a name="l00007"></a>00007 <span class="comment">// Author: James Gallagher <jgallagher@opendap.org></span> <a name="l00008"></a>00008 <span class="comment">//</span> <a name="l00009"></a>00009 <span class="comment">// This library is free software; you can redistribute it and/or</span> <a name="l00010"></a>00010 <span class="comment">// modify it under the terms of the GNU Lesser General Public</span> <a name="l00011"></a>00011 <span class="comment">// License as published by the Free Software Foundation; either</span> <a name="l00012"></a>00012 <span class="comment">// version 2.1 of the License, or (at your option) any later version.</span> <a name="l00013"></a>00013 <span class="comment">//</span> <a name="l00014"></a>00014 <span class="comment">// This library is distributed in the hope that it will be useful,</span> <a name="l00015"></a>00015 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00016"></a>00016 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00017"></a>00017 <span class="comment">// Lesser General Public License for more details.</span> <a name="l00018"></a>00018 <span class="comment">//</span> <a name="l00019"></a>00019 <span class="comment">// You should have received a copy of the GNU Lesser General Public</span> <a name="l00020"></a>00020 <span class="comment">// License along with this library; if not, write to the Free Software</span> <a name="l00021"></a>00021 <span class="comment">// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span> <a name="l00022"></a>00022 <span class="comment">//</span> <a name="l00023"></a>00023 <span class="comment">// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.</span> <a name="l00024"></a>00024 <a name="l00025"></a>00025 <span class="comment">// (c) COPYRIGHT URI/MIT 1994-1999</span> <a name="l00026"></a>00026 <span class="comment">// Please read the full copyright statement in the file COPYRIGHT_URI.</span> <a name="l00027"></a>00027 <span class="comment">//</span> <a name="l00028"></a>00028 <span class="comment">// Authors:</span> <a name="l00029"></a>00029 <span class="comment">// jhrg,jimg James Gallagher <jgallagher@gso.uri.edu></span> <a name="l00030"></a>00030 <a name="l00031"></a>00031 <span class="comment">// Implementation for the class Structure</span> <a name="l00032"></a>00032 <span class="comment">//</span> <a name="l00033"></a>00033 <span class="comment">// jhrg 9/14/94</span> <a name="l00034"></a>00034 <a name="l00035"></a>00035 <a name="l00036"></a>00036 <span class="preprocessor">#include "<a class="code" href="config_8h.html">config.h</a>"</span> <a name="l00037"></a>00037 <a name="l00038"></a>00038 <span class="preprocessor">#include <algorithm></span> <a name="l00039"></a>00039 <span class="preprocessor">#include <string></span> <a name="l00040"></a>00040 <span class="preprocessor">#include <sstream></span> <a name="l00041"></a>00041 <a name="l00042"></a>00042 <span class="comment">//#define DODS_DEBUG</span> <a name="l00043"></a>00043 <span class="comment">//#define DODS_DEBUG2</span> <a name="l00044"></a>00044 <a name="l00045"></a>00045 <span class="preprocessor">#include "<a class="code" href="debug_8h.html">debug.h</a>"</span> <a name="l00046"></a>00046 <span class="preprocessor">#include "<a class="code" href="Error_8h.html">Error.h</a>"</span> <a name="l00047"></a>00047 <span class="preprocessor">#include "<a class="code" href="InternalErr_8h.html">InternalErr.h</a>"</span> <a name="l00048"></a>00048 <span class="preprocessor">#include "<a class="code" href="Sequence_8h.html">Sequence.h</a>"</span> <a name="l00049"></a>00049 <span class="preprocessor">#include "<a class="code" href="DDS_8h.html">DDS.h</a>"</span> <a name="l00050"></a>00050 <span class="preprocessor">#include "<a class="code" href="DataDDS_8h.html">DataDDS.h</a>"</span> <a name="l00051"></a>00051 <span class="preprocessor">#include "<a class="code" href="util_8h.html">util.h</a>"</span> <a name="l00052"></a>00052 <span class="preprocessor">#include "<a class="code" href="InternalErr_8h.html">InternalErr.h</a>"</span> <a name="l00053"></a>00053 <span class="preprocessor">#include "<a class="code" href="escaping_8h.html">escaping.h</a>"</span> <a name="l00054"></a>00054 <a name="l00055"></a>00055 <span class="keyword">using namespace </span>std; <a name="l00056"></a>00056 <a name="l00057"></a>00057 <span class="keyword">namespace </span>libdap { <a name="l00058"></a>00058 <a name="l00059"></a>00059 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> end_of_sequence = 0xA5; <span class="comment">// binary pattern 1010 0101</span> <a name="l00060"></a>00060 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> start_of_instance = 0x5A; <span class="comment">// binary pattern 0101 1010</span> <a name="l00061"></a>00061 <a name="l00062"></a>00062 <span class="comment">// Private member functions</span> <a name="l00063"></a>00063 <a name="l00064"></a>00064 <span class="keywordtype">void</span> <a name="l00065"></a>00065 Sequence::_duplicate(<span class="keyword">const</span> Sequence &s) <a name="l00066"></a>00066 { <a name="l00067"></a>00067 d_row_number = s.d_row_number; <a name="l00068"></a>00068 d_starting_row_number = s.d_starting_row_number; <a name="l00069"></a>00069 d_ending_row_number = s.d_ending_row_number; <a name="l00070"></a>00070 d_row_stride = s.d_row_stride; <a name="l00071"></a>00071 d_leaf_sequence = s.d_leaf_sequence; <a name="l00072"></a>00072 d_unsent_data = s.d_unsent_data; <a name="l00073"></a>00073 d_wrote_soi = s.d_wrote_soi; <a name="l00074"></a>00074 d_top_most = s.d_top_most; <a name="l00075"></a>00075 <a name="l00076"></a>00076 <a class="code" href="classlibdap_1_1Sequence.html#92b97c9d8c1431fd7e619186a557d875" title="The Sequence constructor.">Sequence</a> &cs = <span class="keyword">const_cast<</span><a class="code" href="classlibdap_1_1Sequence.html#92b97c9d8c1431fd7e619186a557d875" title="The Sequence constructor.">Sequence</a> &<span class="keyword">></span>(s); <a name="l00077"></a>00077 <a name="l00078"></a>00078 <span class="comment">// Copy the template BaseType objects.</span> <a name="l00079"></a>00079 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> i = cs.var_begin(); i != cs.var_end(); i++) { <a name="l00080"></a>00080 <a class="code" href="classlibdap_1_1Sequence.html#c0108a453693288fe51e813a80a94198" title="Adds a variable to the Sequence.">add_var</a>((*i)) ; <a name="l00081"></a>00081 } <a name="l00082"></a>00082 <a name="l00083"></a>00083 <span class="comment">// Copy the BaseType objects used to hold values.</span> <a name="l00084"></a>00084 <span class="keywordflow">for</span> (vector<BaseTypeRow *>::iterator rows_iter = cs.d_values.begin(); <a name="l00085"></a>00085 rows_iter != cs.d_values.end(); <a name="l00086"></a>00086 rows_iter++) { <a name="l00087"></a>00087 <span class="comment">// Get the current BaseType Row</span> <a name="l00088"></a>00088 <a class="code" href="namespacelibdap.html#cf78ec36b2d70d02d8eea5cd50253922">BaseTypeRow</a> *src_bt_row_ptr = *rows_iter; <a name="l00089"></a>00089 <span class="comment">// Create a new row.</span> <a name="l00090"></a>00090 <a class="code" href="namespacelibdap.html#cf78ec36b2d70d02d8eea5cd50253922">BaseTypeRow</a> *dest_bt_row_ptr = <span class="keyword">new</span> <a class="code" href="namespacelibdap.html#cf78ec36b2d70d02d8eea5cd50253922">BaseTypeRow</a>; <a name="l00091"></a>00091 <span class="comment">// Copy the BaseType objects from a row to new BaseType objects.</span> <a name="l00092"></a>00092 <span class="comment">// Push new BaseType objects onto new row.</span> <a name="l00093"></a>00093 <span class="keywordflow">for</span> (BaseTypeRow::iterator bt_row_iter = src_bt_row_ptr->begin(); <a name="l00094"></a>00094 bt_row_iter != src_bt_row_ptr->end(); <a name="l00095"></a>00095 bt_row_iter++) { <a name="l00096"></a>00096 <a class="code" href="classlibdap_1_1BaseType.html#85729dec5e1c563a06bff3f3ec660822" title="The BaseType constructor.">BaseType</a> *src_bt_ptr = *bt_row_iter; <a name="l00097"></a>00097 <a class="code" href="classlibdap_1_1BaseType.html#85729dec5e1c563a06bff3f3ec660822" title="The BaseType constructor.">BaseType</a> *dest_bt_ptr = src_bt_ptr->ptr_duplicate(); <a name="l00098"></a>00098 dest_bt_row_ptr->push_back(dest_bt_ptr); <a name="l00099"></a>00099 } <a name="l00100"></a>00100 <span class="comment">// Push new row onto d_values.</span> <a name="l00101"></a>00101 d_values.push_back(dest_bt_row_ptr); <a name="l00102"></a>00102 } <a name="l00103"></a>00103 } <a name="l00104"></a>00104 <a name="l00105"></a>00105 <span class="keyword">static</span> <span class="keywordtype">void</span> <a name="l00106"></a>00106 write_end_of_sequence(Marshaller &m) <a name="l00107"></a>00107 { <a name="l00108"></a>00108 m.put_opaque( (<span class="keywordtype">char</span> *)&end_of_sequence, 1 ) ; <a name="l00109"></a>00109 } <a name="l00110"></a>00110 <a name="l00111"></a>00111 <span class="keyword">static</span> <span class="keywordtype">void</span> <a name="l00112"></a>00112 write_start_of_instance(Marshaller &m) <a name="l00113"></a>00113 { <a name="l00114"></a>00114 m.put_opaque( (<span class="keywordtype">char</span> *)&start_of_instance, 1 ) ; <a name="l00115"></a>00115 } <a name="l00116"></a>00116 <a name="l00117"></a>00117 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a name="l00118"></a>00118 read_marker(UnMarshaller &um) <a name="l00119"></a>00119 { <a name="l00120"></a>00120 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> marker; <a name="l00121"></a>00121 um.get_opaque( (<span class="keywordtype">char</span> *)&marker, 1 ) ; <a name="l00122"></a>00122 <a name="l00123"></a>00123 <span class="keywordflow">return</span> marker; <a name="l00124"></a>00124 } <a name="l00125"></a>00125 <a name="l00126"></a>00126 <span class="keyword">static</span> <span class="keywordtype">bool</span> <a name="l00127"></a>00127 is_start_of_instance(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> marker) <a name="l00128"></a>00128 { <a name="l00129"></a>00129 <span class="keywordflow">return</span> (marker == start_of_instance); <a name="l00130"></a>00130 } <a name="l00131"></a>00131 <a name="l00132"></a>00132 <span class="keyword">static</span> <span class="keywordtype">bool</span> <a name="l00133"></a>00133 is_end_of_sequence(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> marker) <a name="l00134"></a>00134 { <a name="l00135"></a>00135 <span class="keywordflow">return</span> (marker == end_of_sequence); <a name="l00136"></a>00136 } <a name="l00137"></a>00137 <a name="l00138"></a>00138 <span class="comment">// Public member functions</span> <a name="l00139"></a>00139 <a name="l00148"></a><a class="code" href="classlibdap_1_1Sequence.html#92b97c9d8c1431fd7e619186a557d875">00148</a> <a class="code" href="classlibdap_1_1Sequence.html#92b97c9d8c1431fd7e619186a557d875" title="The Sequence constructor.">Sequence::Sequence</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &n) : <a class="code" href="classlibdap_1_1Constructor.html">Constructor</a>(n, <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>), <a name="l00149"></a>00149 d_row_number(-1), d_starting_row_number(-1), <a name="l00150"></a>00150 d_row_stride(1), d_ending_row_number(-1), <a name="l00151"></a>00151 d_unsent_data(false), d_wrote_soi(false), <a name="l00152"></a>00152 d_leaf_sequence(false), d_top_most(false) <a name="l00153"></a>00153 {} <a name="l00154"></a>00154 <a name="l00165"></a><a class="code" href="classlibdap_1_1Sequence.html#b5a772197dc7c62037cca19b27bacba6">00165</a> <a class="code" href="classlibdap_1_1Sequence.html#92b97c9d8c1431fd7e619186a557d875" title="The Sequence constructor.">Sequence::Sequence</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &n, <span class="keyword">const</span> <span class="keywordtype">string</span> &d) <a name="l00166"></a>00166 : <a class="code" href="classlibdap_1_1Constructor.html">Constructor</a>(n, d, <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>), <a name="l00167"></a>00167 d_row_number(-1), d_starting_row_number(-1), <a name="l00168"></a>00168 d_row_stride(1), d_ending_row_number(-1), <a name="l00169"></a>00169 d_unsent_data(false), d_wrote_soi(false), <a name="l00170"></a>00170 d_leaf_sequence(false), d_top_most(false) <a name="l00171"></a>00171 {} <a name="l00172"></a>00172 <a name="l00174"></a><a class="code" href="classlibdap_1_1Sequence.html#26c7416d7314d45aee035d09ef3db49c">00174</a> <a class="code" href="classlibdap_1_1Sequence.html#92b97c9d8c1431fd7e619186a557d875" title="The Sequence constructor.">Sequence::Sequence</a>(<span class="keyword">const</span> <a class="code" href="classlibdap_1_1Sequence.html" title="Holds a sequence.">Sequence</a> &rhs) : <a class="code" href="classlibdap_1_1Constructor.html">Constructor</a>(rhs) <a name="l00175"></a>00175 { <a name="l00176"></a>00176 _duplicate(rhs); <a name="l00177"></a>00177 } <a name="l00178"></a>00178 <a name="l00179"></a>00179 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> * <a name="l00180"></a><a class="code" href="classlibdap_1_1Sequence.html#acf58704fe079b65130800589e59fa9e">00180</a> <a class="code" href="classlibdap_1_1Sequence.html#acf58704fe079b65130800589e59fa9e">Sequence::ptr_duplicate</a>() <a name="l00181"></a>00181 { <a name="l00182"></a>00182 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classlibdap_1_1Sequence.html#92b97c9d8c1431fd7e619186a557d875" title="The Sequence constructor.">Sequence</a>(*<span class="keyword">this</span>); <a name="l00183"></a>00183 } <a name="l00184"></a>00184 <a name="l00185"></a>00185 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a name="l00186"></a>00186 delete_bt(<a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *bt_ptr) <a name="l00187"></a>00187 { <a name="l00188"></a>00188 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">"In delete_bt: "</span> << bt_ptr << endl); <a name="l00189"></a>00189 <span class="keyword">delete</span> bt_ptr; bt_ptr = 0; <a name="l00190"></a>00190 } <a name="l00191"></a>00191 <a name="l00192"></a>00192 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a name="l00193"></a>00193 delete_rows(<a class="code" href="namespacelibdap.html#cf78ec36b2d70d02d8eea5cd50253922">BaseTypeRow</a> *bt_row_ptr) <a name="l00194"></a>00194 { <a name="l00195"></a>00195 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">"In delete_rows: "</span> << bt_row_ptr << endl); <a name="l00196"></a>00196 <a name="l00197"></a>00197 for_each(bt_row_ptr->begin(), bt_row_ptr->end(), delete_bt); <a name="l00198"></a>00198 <a name="l00199"></a>00199 <span class="keyword">delete</span> bt_row_ptr; bt_row_ptr = 0; <a name="l00200"></a>00200 } <a name="l00201"></a>00201 <a name="l00202"></a><a class="code" href="classlibdap_1_1Sequence.html#8a90ca537aeb073da447e4bd55c072a4">00202</a> <a class="code" href="classlibdap_1_1Sequence.html#8a90ca537aeb073da447e4bd55c072a4">Sequence::~Sequence</a>() <a name="l00203"></a>00203 { <a name="l00204"></a>00204 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">"Entering Sequence::~Sequence"</span> << endl); <a name="l00205"></a>00205 <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="l00206"></a>00206 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = *i ; <a name="l00207"></a>00207 <span class="keyword">delete</span> btp ; btp = 0; <a name="l00208"></a>00208 } <a name="l00209"></a>00209 <a name="l00210"></a>00210 for_each(d_values.begin(), d_values.end(), delete_rows); <a name="l00211"></a>00211 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">"exiting Sequence::~Sequence"</span> << endl); <a name="l00212"></a>00212 } <a name="l00213"></a>00213 <a name="l00214"></a>00214 <a class="code" href="classlibdap_1_1Sequence.html" title="Holds a sequence.">Sequence</a> & <a name="l00215"></a><a class="code" href="classlibdap_1_1Sequence.html#8edd3c82bd969c6f286607731a597aeb">00215</a> <a class="code" href="classlibdap_1_1Sequence.html#8edd3c82bd969c6f286607731a597aeb">Sequence::operator=</a>(<span class="keyword">const</span> <a class="code" href="classlibdap_1_1Sequence.html" title="Holds a sequence.">Sequence</a> &rhs) <a name="l00216"></a>00216 { <a name="l00217"></a>00217 <span class="keywordflow">if</span> (<span class="keyword">this</span> == &rhs) <a name="l00218"></a>00218 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00219"></a>00219 <a name="l00220"></a>00220 <span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Constructor.html">Constructor</a> &<span class="keyword">></span>(*this) = rhs; <span class="comment">// run Constructor=</span> <a name="l00221"></a>00221 <a name="l00222"></a>00222 _duplicate(rhs); <a name="l00223"></a>00223 <a name="l00224"></a>00224 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00225"></a>00225 } <a name="l00226"></a>00226 <a name="l00227"></a>00227 <span class="keywordtype">string</span> <a name="l00228"></a><a class="code" href="classlibdap_1_1Sequence.html#24016ba1d3b9b755699959abf0219ff1">00228</a> <a class="code" href="classlibdap_1_1Sequence.html#24016ba1d3b9b755699959abf0219ff1">Sequence::toString</a>() <a name="l00229"></a>00229 { <a name="l00230"></a>00230 ostringstream oss; <a name="l00231"></a>00231 <a name="l00232"></a>00232 oss << <a class="code" href="classlibdap_1_1Sequence.html#24016ba1d3b9b755699959abf0219ff1">BaseType::toString</a>(); <a name="l00233"></a>00233 <a name="l00234"></a>00234 <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="l00235"></a>00235 oss << (*i)->toString(); <a name="l00236"></a>00236 } <a name="l00237"></a>00237 <a name="l00238"></a>00238 oss << endl; <a name="l00239"></a>00239 <a name="l00240"></a>00240 <span class="keywordflow">return</span> oss.str(); <a name="l00241"></a>00241 } <a name="l00242"></a>00242 <a name="l00243"></a>00243 <span class="keywordtype">int</span> <a name="l00244"></a><a class="code" href="classlibdap_1_1Sequence.html#c954b8bf5119d75b0b441fa7d89fbd2f">00244</a> <a class="code" href="classlibdap_1_1Sequence.html#c954b8bf5119d75b0b441fa7d89fbd2f" title="Count the members of constructor types.">Sequence::element_count</a>(<span class="keywordtype">bool</span> leaves) <a name="l00245"></a>00245 { <a name="l00246"></a>00246 <span class="keywordflow">if</span> (!leaves) <a name="l00247"></a>00247 <span class="keywordflow">return</span> <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.size(); <a name="l00248"></a>00248 <span class="keywordflow">else</span> { <a name="l00249"></a>00249 <span class="keywordtype">int</span> i = 0; <a name="l00250"></a>00250 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> iter = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); iter != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); iter++) { <a name="l00251"></a>00251 i += (*iter)->element_count(<span class="keyword">true</span>); <a name="l00252"></a>00252 } <a name="l00253"></a>00253 <span class="keywordflow">return</span> i; <a name="l00254"></a>00254 } <a name="l00255"></a>00255 } <a name="l00256"></a>00256 <a name="l00257"></a>00257 <span class="keywordtype">bool</span> <a name="l00258"></a><a class="code" href="classlibdap_1_1Sequence.html#ae52bdb038d59fbce4f8f6128dfc4559">00258</a> <a class="code" href="classlibdap_1_1Sequence.html#ae52bdb038d59fbce4f8f6128dfc4559" title="Check to see whether this variable can be printed simply.">Sequence::is_linear</a>() <a name="l00259"></a>00259 { <a name="l00260"></a>00260 <span class="keywordtype">bool</span> linear = <span class="keyword">true</span>; <a name="l00261"></a>00261 <span class="keywordtype">bool</span> seq_found = <span class="keyword">false</span>; <a name="l00262"></a>00262 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> iter = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); linear && iter != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); iter++) { <a name="l00263"></a>00263 <span class="keywordflow">if</span> ((*iter)->type() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>) { <a name="l00264"></a>00264 <span class="comment">// A linear sequence cannot have more than one child seq. at any</span> <a name="l00265"></a>00265 <span class="comment">// one level. If we've already found a seq at this level, return</span> <a name="l00266"></a>00266 <span class="comment">// false.</span> <a name="l00267"></a>00267 <span class="keywordflow">if</span> (seq_found) { <a name="l00268"></a>00268 linear = <span class="keyword">false</span>; <a name="l00269"></a>00269 <span class="keywordflow">break</span>; <a name="l00270"></a>00270 } <a name="l00271"></a>00271 seq_found = <span class="keyword">true</span>; <a name="l00272"></a>00272 linear = <span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Sequence.html" title="Holds a sequence.">Sequence</a> *<span class="keyword">></span>((*iter))-><a class="code" href="classlibdap_1_1Sequence.html#ae52bdb038d59fbce4f8f6128dfc4559" title="Check to see whether this variable can be printed simply.">is_linear</a>(); <a name="l00273"></a>00273 } <a name="l00274"></a>00274 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((*iter)->type() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e6d93eb0a69e67742f061966ce594b9a6c">dods_structure_c</a>) { <a name="l00275"></a>00275 linear = <span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Structure.html" title="Holds a structure (aggregate) type.">Structure</a>*<span class="keyword">></span>((*iter))-><a class="code" href="classlibdap_1_1Sequence.html#ae52bdb038d59fbce4f8f6128dfc4559" title="Check to see whether this variable can be printed simply.">is_linear</a>(); <a name="l00276"></a>00276 } <a name="l00277"></a>00277 <span class="keywordflow">else</span> { <a name="l00278"></a>00278 <span class="comment">// A linear sequence cannot have Arrays, Lists or Grids.</span> <a name="l00279"></a>00279 linear = (*iter)->is_simple_type(); <a name="l00280"></a>00280 } <a name="l00281"></a>00281 } <a name="l00282"></a>00282 <a name="l00283"></a>00283 <span class="keywordflow">return</span> linear; <a name="l00284"></a>00284 } <a name="l00285"></a>00285 <a name="l00286"></a>00286 <span class="keywordtype">void</span> <a name="l00287"></a><a class="code" href="classlibdap_1_1Sequence.html#c98c3b73dfc584423d2fa90c6152b4eb">00287</a> <a class="code" href="classlibdap_1_1Sequence.html#c98c3b73dfc584423d2fa90c6152b4eb">Sequence::set_send_p</a>(<span class="keywordtype">bool</span> state) <a name="l00288"></a>00288 { <a name="l00289"></a>00289 <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="l00290"></a>00290 (*i)->set_send_p(state); <a name="l00291"></a>00291 } <a name="l00292"></a>00292 <a name="l00293"></a>00293 <a class="code" href="classlibdap_1_1Sequence.html#c98c3b73dfc584423d2fa90c6152b4eb">BaseType::set_send_p</a>(state); <a name="l00294"></a>00294 } <a name="l00295"></a>00295 <a name="l00296"></a>00296 <span class="keywordtype">void</span> <a name="l00297"></a><a class="code" href="classlibdap_1_1Sequence.html#79e5a9f5c44763e61964b7ec500edfeb">00297</a> <a class="code" href="classlibdap_1_1Sequence.html#79e5a9f5c44763e61964b7ec500edfeb" title="Sets the value of the read_p property.">Sequence::set_read_p</a>(<span class="keywordtype">bool</span> state) <a name="l00298"></a>00298 { <a name="l00299"></a>00299 <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="l00300"></a>00300 (*i)->set_read_p(state); <a name="l00301"></a>00301 } <a name="l00302"></a>00302 <a name="l00303"></a>00303 <a class="code" href="classlibdap_1_1Sequence.html#79e5a9f5c44763e61964b7ec500edfeb" title="Sets the value of the read_p property.">BaseType::set_read_p</a>(state); <a name="l00304"></a>00304 } <a name="l00305"></a>00305 <a name="l00306"></a>00306 <span class="keywordtype">void</span> <a name="l00307"></a><a class="code" href="classlibdap_1_1Sequence.html#f600cb78f1a48f7de6b401b17de5f1ef">00307</a> <a class="code" href="classlibdap_1_1Sequence.html#f600cb78f1a48f7de6b401b17de5f1ef">Sequence::set_in_selection</a>(<span class="keywordtype">bool</span> state) <a name="l00308"></a>00308 { <a name="l00309"></a>00309 <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="l00310"></a>00310 (*i)->set_in_selection(state); <a name="l00311"></a>00311 } <a name="l00312"></a>00312 <a name="l00313"></a>00313 <a class="code" href="classlibdap_1_1Sequence.html#f600cb78f1a48f7de6b401b17de5f1ef">BaseType::set_in_selection</a>(state); <a name="l00314"></a>00314 } <a name="l00315"></a>00315 <a name="l00325"></a>00325 <span class="keywordtype">void</span> <a name="l00326"></a><a class="code" href="classlibdap_1_1Sequence.html#c0108a453693288fe51e813a80a94198">00326</a> <a class="code" href="classlibdap_1_1Sequence.html#c0108a453693288fe51e813a80a94198" title="Adds a variable to the Sequence.">Sequence::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="l00327"></a>00327 { <a name="l00328"></a>00328 <span class="keywordflow">if</span> (!bt) <a name="l00329"></a>00329 <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="l00330"></a>00330 <span class="stringliteral">"Cannot add variable: NULL pointer"</span>); <a name="l00331"></a>00331 <span class="comment">// Jose Garcia</span> <a name="l00332"></a>00332 <span class="comment">// We append a copy of bt so the owner of bt is free to deallocate</span> <a name="l00333"></a>00333 <a name="l00334"></a>00334 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *bt_copy = bt-><a class="code" href="classlibdap_1_1BaseType.html#0b130311c9901fb8a7ab11ea19090ef0">ptr_duplicate</a>(); <a name="l00335"></a>00335 bt_copy-><a class="code" href="classlibdap_1_1BaseType.html#5b6a39f6ce6594fa74f3fc899ac9a966">set_parent</a>(<span class="keyword">this</span>); <a name="l00336"></a>00336 <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.push_back(bt_copy); <a name="l00337"></a>00337 } <a name="l00338"></a>00338 <a name="l00339"></a>00339 <span class="comment">// Deprecated</span> <a name="l00340"></a>00340 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> * <a name="l00341"></a><a class="code" href="classlibdap_1_1Sequence.html#26cbbe0d1d9f59875a9d5612b7f1f12b">00341</a> <a class="code" href="classlibdap_1_1Sequence.html#c385089cc14e10118ffba659e104d066" title="Returns a pointer to a member of a constructor class.">Sequence::var</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &n, <a class="code" href="classlibdap_1_1BaseType.html#e9c6e71855b90a0e552713011c9ab81f">btp_stack</a> &s) <a name="l00342"></a>00342 { <a name="l00343"></a>00343 <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="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> *btp = m_exact_match(name, &s); <a name="l00346"></a>00346 <span class="keywordflow">if</span> (btp) <a name="l00347"></a>00347 <span class="keywordflow">return</span> btp; <a name="l00348"></a>00348 <a name="l00349"></a>00349 <span class="keywordflow">return</span> m_leaf_match(name, &s); <a name="l00350"></a>00350 } <a name="l00351"></a>00351 <a name="l00352"></a>00352 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> * <a name="l00353"></a><a class="code" href="classlibdap_1_1Sequence.html#c385089cc14e10118ffba659e104d066">00353</a> <a class="code" href="classlibdap_1_1Sequence.html#c385089cc14e10118ffba659e104d066" title="Returns a pointer to a member of a constructor class.">Sequence::var</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name, <span class="keywordtype">bool</span> exact_match, <a class="code" href="classlibdap_1_1BaseType.html#e9c6e71855b90a0e552713011c9ab81f">btp_stack</a> *s) <a name="l00354"></a>00354 { <a name="l00355"></a>00355 <span class="keywordtype">string</span> n = <a class="code" href="namespacelibdap.html#376f9593431111a80ef78c98b8f4a0e2">www2id</a>(name); <a name="l00356"></a>00356 <a name="l00357"></a>00357 <span class="keywordflow">if</span> (exact_match) <a name="l00358"></a>00358 <span class="keywordflow">return</span> m_exact_match(n, s); <a name="l00359"></a>00359 <span class="keywordflow">else</span> <a name="l00360"></a>00360 <span class="keywordflow">return</span> m_leaf_match(n, s); <a name="l00361"></a>00361 } <a name="l00362"></a>00362 <a name="l00363"></a>00363 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> * <a name="l00364"></a>00364 Sequence::m_leaf_match(<span class="keyword">const</span> <span class="keywordtype">string</span> &name, btp_stack *s) <a name="l00365"></a>00365 { <a name="l00366"></a>00366 <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="l00367"></a>00367 <span class="keywordflow">if</span> ((*i)->name() == name) { <a name="l00368"></a>00368 <span class="keywordflow">if</span> (s) <a name="l00369"></a>00369 s->push(static_cast<BaseType *>(<span class="keyword">this</span>)); <a name="l00370"></a>00370 <span class="keywordflow">return</span> *i; <a name="l00371"></a>00371 } <a name="l00372"></a>00372 <span class="keywordflow">if</span> ((*i)->is_constructor_type()) { <a name="l00373"></a>00373 <a class="code" href="classlibdap_1_1BaseType.html#85729dec5e1c563a06bff3f3ec660822" title="The BaseType constructor.">BaseType</a> *btp = (*i)->var(name, <span class="keyword">false</span>, s); <a name="l00374"></a>00374 <span class="keywordflow">if</span> (btp) { <a name="l00375"></a>00375 <span class="keywordflow">if</span> (s) <a name="l00376"></a>00376 s->push(static_cast<BaseType *>(<span class="keyword">this</span>)); <a name="l00377"></a>00377 <span class="keywordflow">return</span> btp; <a name="l00378"></a>00378 } <a name="l00379"></a>00379 } <a name="l00380"></a>00380 } <a name="l00381"></a>00381 <a name="l00382"></a>00382 <span class="keywordflow">return</span> 0; <a name="l00383"></a>00383 } <a name="l00384"></a>00384 <a name="l00385"></a>00385 BaseType * <a name="l00386"></a>00386 Sequence::m_exact_match(<span class="keyword">const</span> <span class="keywordtype">string</span> &name, btp_stack *s) <a name="l00387"></a>00387 { <a name="l00388"></a>00388 <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="l00389"></a>00389 <span class="keywordflow">if</span> ((*i)->name() == name) { <a name="l00390"></a>00390 <span class="keywordflow">if</span> (s) <a name="l00391"></a>00391 s->push(static_cast<BaseType *>(<span class="keyword">this</span>)); <a name="l00392"></a>00392 <span class="keywordflow">return</span> *i; <a name="l00393"></a>00393 } <a name="l00394"></a>00394 } <a name="l00395"></a>00395 <a name="l00396"></a>00396 string::size_type dot_pos = name.find(<span class="stringliteral">"."</span>); <span class="comment">// zero-based index of `.'</span> <a name="l00397"></a>00397 <span class="keywordflow">if</span> (dot_pos != string::npos) { <a name="l00398"></a>00398 <span class="keywordtype">string</span> aggregate = name.substr(0, dot_pos); <a name="l00399"></a>00399 <span class="keywordtype">string</span> field = name.substr(dot_pos + 1); <a name="l00400"></a>00400 <a name="l00401"></a>00401 <a class="code" href="classlibdap_1_1BaseType.html#85729dec5e1c563a06bff3f3ec660822" title="The BaseType constructor.">BaseType</a> *agg_ptr = <a class="code" href="classlibdap_1_1Sequence.html#c385089cc14e10118ffba659e104d066" title="Returns a pointer to a member of a constructor class.">var</a>(aggregate); <a name="l00402"></a>00402 <span class="keywordflow">if</span> (agg_ptr) { <a name="l00403"></a>00403 <span class="keywordflow">if</span> (s) <a name="l00404"></a>00404 s->push(static_cast<BaseType *>(<span class="keyword">this</span>)); <a name="l00405"></a>00405 <span class="keywordflow">return</span> agg_ptr->var(field, <span class="keyword">true</span>, s); <span class="comment">// recurse</span> <a name="l00406"></a>00406 } <a name="l00407"></a>00407 <span class="keywordflow">else</span> <a name="l00408"></a>00408 <span class="keywordflow">return</span> 0; <span class="comment">// qualified names must be *fully* qualified</span> <a name="l00409"></a>00409 } <a name="l00410"></a>00410 <a name="l00411"></a>00411 <span class="keywordflow">return</span> 0; <a name="l00412"></a>00412 } <a name="l00413"></a>00413 <a name="l00418"></a>00418 <a class="code" href="namespacelibdap.html#cf78ec36b2d70d02d8eea5cd50253922">BaseTypeRow</a> * <a name="l00419"></a><a class="code" href="classlibdap_1_1Sequence.html#f034547151c98b59dee6d2d6cb1a954b">00419</a> <a class="code" href="classlibdap_1_1Sequence.html#f034547151c98b59dee6d2d6cb1a954b" title="Get a whole row from the sequence.">Sequence::row_value</a>(<span class="keywordtype">size_t</span> row) <a name="l00420"></a>00420 { <a name="l00421"></a>00421 <span class="keywordflow">if</span> (row >= d_values.size()) <a name="l00422"></a>00422 <span class="keywordflow">return</span> 0; <a name="l00423"></a>00423 <span class="keywordflow">return</span> d_values[row]; <a name="l00424"></a>00424 } <a name="l00425"></a>00425 <a name="l00432"></a>00432 <span class="keywordtype">void</span> <a name="l00433"></a><a class="code" href="classlibdap_1_1Sequence.html#a581124c5883b3c020a843ddc5566192">00433</a> <a class="code" href="classlibdap_1_1Sequence.html#a581124c5883b3c020a843ddc5566192">Sequence::set_value</a>(<a class="code" href="namespacelibdap.html#d2918a01a28d16d423b047e2d312f760">SequenceValues</a> &values) <a name="l00434"></a>00434 { <a name="l00435"></a>00435 d_values = values; <a name="l00436"></a>00436 } <a name="l00437"></a>00437 <a name="l00440"></a>00440 <a class="code" href="namespacelibdap.html#d2918a01a28d16d423b047e2d312f760">SequenceValues</a> <a name="l00441"></a><a class="code" href="classlibdap_1_1Sequence.html#1efebfab9247785a056d085b1f3aab41">00441</a> <a class="code" href="classlibdap_1_1Sequence.html#1efebfab9247785a056d085b1f3aab41">Sequence::value</a>() <a name="l00442"></a>00442 { <a name="l00443"></a>00443 <span class="keywordflow">return</span> d_values; <a name="l00444"></a>00444 } <a name="l00445"></a>00445 <a name="l00451"></a>00451 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> * <a name="l00452"></a><a class="code" href="classlibdap_1_1Sequence.html#b17e4f1aedda0b734442001b5c81f269">00452</a> <a class="code" href="classlibdap_1_1Sequence.html#b17e4f1aedda0b734442001b5c81f269" title="Get the BaseType pointer to the named variable of a given row.">Sequence::var_value</a>(<span class="keywordtype">size_t</span> row, <span class="keyword">const</span> <span class="keywordtype">string</span> &name) <a name="l00453"></a>00453 { <a name="l00454"></a>00454 <a class="code" href="namespacelibdap.html#cf78ec36b2d70d02d8eea5cd50253922">BaseTypeRow</a> *bt_row_ptr = <a class="code" href="classlibdap_1_1Sequence.html#f034547151c98b59dee6d2d6cb1a954b" title="Get a whole row from the sequence.">row_value</a>(row); <a name="l00455"></a>00455 <span class="keywordflow">if</span> (!bt_row_ptr) <a name="l00456"></a>00456 <span class="keywordflow">return</span> 0; <a name="l00457"></a>00457 <a name="l00458"></a>00458 BaseTypeRow::iterator bt_row_iter = bt_row_ptr->begin(); <a name="l00459"></a>00459 BaseTypeRow::iterator bt_row_end = bt_row_ptr->end(); <a name="l00460"></a>00460 <span class="keywordflow">while</span> (bt_row_iter != bt_row_end && (*bt_row_iter)->name() != name) <a name="l00461"></a>00461 ++bt_row_iter; <a name="l00462"></a>00462 <a name="l00463"></a>00463 <span class="keywordflow">if</span> (bt_row_iter == bt_row_end) <a name="l00464"></a>00464 <span class="keywordflow">return</span> 0; <a name="l00465"></a>00465 <span class="keywordflow">else</span> <a name="l00466"></a>00466 <span class="keywordflow">return</span> *bt_row_iter; <a name="l00467"></a>00467 } <a name="l00468"></a>00468 <a name="l00474"></a>00474 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> * <a name="l00475"></a><a class="code" href="classlibdap_1_1Sequence.html#75cd422251a9c49294e25f2971164638">00475</a> <a class="code" href="classlibdap_1_1Sequence.html#b17e4f1aedda0b734442001b5c81f269" title="Get the BaseType pointer to the named variable of a given row.">Sequence::var_value</a>(<span class="keywordtype">size_t</span> row, <span class="keywordtype">size_t</span> i) <a name="l00476"></a>00476 { <a name="l00477"></a>00477 <a class="code" href="namespacelibdap.html#cf78ec36b2d70d02d8eea5cd50253922">BaseTypeRow</a> *bt_row_ptr = <a class="code" href="classlibdap_1_1Sequence.html#f034547151c98b59dee6d2d6cb1a954b" title="Get a whole row from the sequence.">row_value</a>(row); <a name="l00478"></a>00478 <span class="keywordflow">if</span> (!bt_row_ptr) <a name="l00479"></a>00479 <span class="keywordflow">return</span> 0; <a name="l00480"></a>00480 <a name="l00481"></a>00481 <span class="keywordflow">if</span> (i >= bt_row_ptr->size()) <a name="l00482"></a>00482 <span class="keywordflow">return</span> 0; <a name="l00483"></a>00483 <a name="l00484"></a>00484 <span class="keywordflow">return</span> (*bt_row_ptr)[i]; <a name="l00485"></a>00485 } <a name="l00486"></a>00486 <a name="l00487"></a>00487 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a name="l00488"></a><a class="code" href="classlibdap_1_1Sequence.html#501edaf93b113fcd227280543fb3ba10">00488</a> <a class="code" href="classlibdap_1_1Sequence.html#501edaf93b113fcd227280543fb3ba10" title="Returns the size of the class instance data.">Sequence::width</a>() <a name="l00489"></a>00489 { <a name="l00490"></a>00490 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sz = 0; <a name="l00491"></a>00491 <a name="l00492"></a>00492 <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="l00493"></a>00493 sz += (*i)->width(); <a name="l00494"></a>00494 } <a name="l00495"></a>00495 <a name="l00496"></a>00496 <span class="keywordflow">return</span> sz; <a name="l00497"></a>00497 } <a name="l00498"></a>00498 <a name="l00499"></a>00499 <span class="comment">// This version returns -1. Each API-specific subclass should define a more</span> <a name="l00500"></a>00500 <span class="comment">// reasonable version. jhrg 5/24/96</span> <a name="l00501"></a>00501 <a name="l00517"></a>00517 <span class="keywordtype">int</span> <a name="l00518"></a><a class="code" href="classlibdap_1_1Sequence.html#3ece45051c6f6f27c14082b0be07fb8f">00518</a> <a class="code" href="classlibdap_1_1Sequence.html#3ece45051c6f6f27c14082b0be07fb8f">Sequence::length</a>() <a name="l00519"></a>00519 { <a name="l00520"></a>00520 <span class="keywordflow">return</span> -1; <a name="l00521"></a>00521 } <a name="l00522"></a>00522 <a name="l00523"></a>00523 <a name="l00524"></a>00524 <span class="keywordtype">int</span> <a name="l00525"></a><a class="code" href="classlibdap_1_1Sequence.html#f2085366f0bb90822e1b85108b44df1b">00525</a> <a class="code" href="classlibdap_1_1Sequence.html#f2085366f0bb90822e1b85108b44df1b">Sequence::number_of_rows</a>() <a name="l00526"></a>00526 { <a name="l00527"></a>00527 <span class="keywordflow">return</span> d_values.size(); <a name="l00528"></a>00528 } <a name="l00529"></a>00529 <a name="l00533"></a>00533 <span class="keywordtype">void</span> <a name="l00534"></a><a class="code" href="classlibdap_1_1Sequence.html#d555ad129354768a042f4e94f36f299a">00534</a> <a class="code" href="classlibdap_1_1Sequence.html#d555ad129354768a042f4e94f36f299a" title="Rest the row number counter.">Sequence::reset_row_number</a>() <a name="l00535"></a>00535 { <a name="l00536"></a>00536 d_row_number = -1; <a name="l00537"></a>00537 } <a name="l00538"></a>00538 <a name="l00539"></a>00539 <span class="comment">// Notes:</span> <a name="l00540"></a>00540 <span class="comment">// Assume that read() is implemented so that, when reading data for a nested</span> <a name="l00541"></a>00541 <span class="comment">// sequence, only the outer most level is *actually* read.</span> <a name="l00542"></a>00542 <span class="comment">// This is a consequence of our current (12/7/99) implementation of</span> <a name="l00543"></a>00543 <span class="comment">// the JGOFS server (which is the only server to actually use nested</span> <a name="l00544"></a>00544 <span class="comment">// sequences). 12/7/99 jhrg</span> <a name="l00545"></a>00545 <span class="comment">//</span> <a name="l00546"></a>00546 <span class="comment">// Stop assuming this. This logic is being moved into the JGOFS server</span> <a name="l00547"></a>00547 <span class="comment">// itself. 6/1/2001 jhrg</span> <a name="l00548"></a>00548 <a name="l00549"></a>00549 <span class="comment">// The read() function returns a boolean value, with TRUE</span> <a name="l00550"></a>00550 <span class="comment">// indicating that read() should be called again because there's</span> <a name="l00551"></a>00551 <span class="comment">// more data to read, and FALSE indicating there's no more data</span> <a name="l00552"></a>00552 <span class="comment">// to read. Note that this behavior is necessary to properly</span> <a name="l00553"></a>00553 <span class="comment">// handle variables that contain Sequences. Jose Garcia If an</span> <a name="l00554"></a>00554 <span class="comment">// error exists while reading, the implementers of the surrogate</span> <a name="l00555"></a>00555 <span class="comment">// library SHOULD throw an Error object which will propagate</span> <a name="l00556"></a>00556 <span class="comment">// beyond this point to to the original caller.</span> <a name="l00557"></a>00557 <span class="comment">// Jose Garcia</span> <a name="l00558"></a>00558 <a name="l00591"></a>00591 <span class="keywordtype">bool</span> <a name="l00592"></a><a class="code" href="classlibdap_1_1Sequence.html#62d79555aa03b0a862314ccfdad090f8">00592</a> <a class="code" href="classlibdap_1_1Sequence.html#62d79555aa03b0a862314ccfdad090f8">Sequence::read_row</a>(<span class="keywordtype">int</span> row, <a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds, <a name="l00593"></a>00593 <a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> &eval, <span class="keywordtype">bool</span> ce_eval) <a name="l00594"></a>00594 { <a name="l00595"></a>00595 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">"Entering Sequence::read_row for "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << endl); <a name="l00596"></a>00596 <span class="keywordflow">if</span> (row < d_row_number) <a name="l00597"></a>00597 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1InternalErr.html" title="A class for software fault reporting.">InternalErr</a>(<span class="stringliteral">"Trying to back up inside a sequence!"</span>); <a name="l00598"></a>00598 <a name="l00599"></a>00599 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">"read_row: row number "</span> << row <a name="l00600"></a>00600 << <span class="stringliteral">", current row "</span> << d_row_number << endl); <a name="l00601"></a>00601 <span class="keywordflow">if</span> (row == d_row_number) <a name="l00602"></a>00602 { <a name="l00603"></a>00603 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">"Leaving Sequence::read_row for "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << endl); <a name="l00604"></a>00604 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00605"></a>00605 } <a name="l00606"></a>00606 <a name="l00607"></a>00607 dds.<a class="code" href="classlibdap_1_1DDS.html#8cd9b6a34f5e1a49665de3189e141de8">timeout_on</a>(); <a name="l00608"></a>00608 <a name="l00609"></a>00609 <span class="keywordtype">int</span> eof = 0; <span class="comment">// Start out assuming EOF is false.</span> <a name="l00610"></a>00610 <span class="keywordflow">while</span> (!eof && d_row_number < row) { <a name="l00611"></a>00611 <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="l00612"></a>00612 eof = (<a class="code" href="classlibdap_1_1BaseType.html#1da003c53f2e663223f603ab3fbd7c8e" title="Read data into a local buffer.">read</a>() == <span class="keyword">false</span>); <a name="l00613"></a>00613 } <a name="l00614"></a>00614 <a name="l00615"></a>00615 <span class="comment">// Advance the row number if ce_eval is false (we're not supposed to</span> <a name="l00616"></a>00616 <span class="comment">// evaluate the selection) or both ce_eval and the selection are</span> <a name="l00617"></a>00617 <span class="comment">// true.</span> <a name="l00618"></a>00618 <span class="keywordflow">if</span> (!eof && (!ce_eval || 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="l00619"></a>00619 d_row_number++; <a name="l00620"></a>00620 <a name="l00621"></a>00621 <a class="code" href="classlibdap_1_1Sequence.html#79e5a9f5c44763e61964b7ec500edfeb" title="Sets the value of the read_p property.">set_read_p</a>(<span class="keyword">false</span>); <span class="comment">// ...so that the next instance will be read</span> <a name="l00622"></a>00622 } <a name="l00623"></a>00623 <a name="l00624"></a>00624 <span class="comment">// Once we finish the above loop, set read_p to true so that the caller</span> <a name="l00625"></a>00625 <span class="comment">// knows that data *has* been read. This is how the read() methods of the</span> <a name="l00626"></a>00626 <span class="comment">// elements of the sequence know to not call read() but instead look for</span> <a name="l00627"></a>00627 <span class="comment">// data values inside themselves.</span> <a name="l00628"></a>00628 <a class="code" href="classlibdap_1_1Sequence.html#79e5a9f5c44763e61964b7ec500edfeb" title="Sets the value of the read_p property.">set_read_p</a>(<span class="keyword">true</span>); <a name="l00629"></a>00629 <a name="l00630"></a>00630 dds.<a class="code" href="classlibdap_1_1DDS.html#6740f99a5fc64640505924c5603ace0a">timeout_off</a>(); <a name="l00631"></a>00631 <a name="l00632"></a>00632 <span class="comment">// Return true if we have valid data, false if we've read to the EOF.</span> <a name="l00633"></a>00633 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">"Leaving Sequence::read_row for "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() <a name="l00634"></a>00634 << <span class="stringliteral">" with "</span> << (eof == 0) << endl); <a name="l00635"></a>00635 <span class="keywordflow">return</span> eof == 0; <a name="l00636"></a>00636 } <a name="l00637"></a>00637 <a name="l00638"></a>00638 <span class="comment">// Private. This is used to process constraints on the rows of a sequence.</span> <a name="l00639"></a>00639 <span class="comment">// Starting with 3.2 we support constraints like Sequence[10:2:20]. This</span> <a name="l00640"></a>00640 <span class="comment">// odd-looking logic first checks if d_ending_row_number is the sentinel</span> <a name="l00641"></a>00641 <span class="comment">// value of -1. If so, the sequence was not constrained by row number and</span> <a name="l00642"></a>00642 <span class="comment">// this method should never return true (which indicates that we're at the</span> <a name="l00643"></a>00643 <span class="comment">// end of a row-number constraint). If d_ending_row_number is not -1, then is</span> <a name="l00644"></a>00644 <span class="comment">// \e i at the end point? 6/1/2001 jhrg</span> <a name="l00645"></a>00645 <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a name="l00646"></a>00646 Sequence::is_end_of_rows(<span class="keywordtype">int</span> i) <a name="l00647"></a>00647 { <a name="l00648"></a>00648 <span class="keywordflow">return</span> ((d_ending_row_number == -1) ? <span class="keyword">false</span> : (i > d_ending_row_number)); <a name="l00649"></a>00649 } <a name="l00650"></a>00650 <a name="l00711"></a>00711 <span class="keywordtype">bool</span> <a name="l00712"></a><a class="code" href="classlibdap_1_1Sequence.html#d89a496720935e04e472a75ce7804065">00712</a> <a class="code" href="classlibdap_1_1Sequence.html#d89a496720935e04e472a75ce7804065">Sequence::serialize</a>(<a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> &eval, <a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds, <a name="l00713"></a>00713 <a class="code" href="classlibdap_1_1Marshaller.html" title="abstract base class used to marshall/serialize dap data objects">Marshaller</a> &m, <span class="keywordtype">bool</span> ce_eval) <a name="l00714"></a>00714 { <a name="l00715"></a>00715 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">"Entering Sequence::serialize for "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << endl); <a name="l00716"></a>00716 <a name="l00717"></a>00717 <span class="comment">// Special case leaf sequences!</span> <a name="l00718"></a>00718 <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1Sequence.html#3cb03f3ccb14372106e91461b468c1bd">is_leaf_sequence</a>()) <a name="l00719"></a>00719 <span class="keywordflow">return</span> <a class="code" href="classlibdap_1_1Sequence.html#1e28f9c0d173929383e1ffc2002e66ce">serialize_leaf</a>(dds, eval, m, ce_eval); <a name="l00720"></a>00720 <span class="keywordflow">else</span> <a name="l00721"></a>00721 <span class="keywordflow">return</span> <a class="code" href="classlibdap_1_1Sequence.html#30fcc5756f357e1c14f3fafac66e0a30">serialize_parent_part_one</a>(dds, eval, m); <a name="l00722"></a>00722 } <a name="l00723"></a>00723 <a name="l00724"></a>00724 <span class="comment">// We know this is not a leaf Sequence. That means that this Sequence holds</span> <a name="l00725"></a>00725 <span class="comment">// another Sequence as one of its fields _and_ that child Sequence triggers</span> <a name="l00726"></a>00726 <span class="comment">// the actual transmission of values.</span> <a name="l00727"></a>00727 <a name="l00728"></a>00728 <span class="keywordtype">bool</span> <a name="l00729"></a><a class="code" href="classlibdap_1_1Sequence.html#30fcc5756f357e1c14f3fafac66e0a30">00729</a> <a class="code" href="classlibdap_1_1Sequence.html#30fcc5756f357e1c14f3fafac66e0a30">Sequence::serialize_parent_part_one</a>(<a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds, <a name="l00730"></a>00730 <a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> &eval, <a class="code" href="classlibdap_1_1Marshaller.html" title="abstract base class used to marshall/serialize dap data objects">Marshaller</a> &m) <a name="l00731"></a>00731 { <a name="l00732"></a>00732 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">"Entering serialize_parent_part_one for "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << endl); <a name="l00733"></a>00733 <a name="l00734"></a>00734 <span class="keywordtype">int</span> i = (d_starting_row_number != -1) ? d_starting_row_number : 0; <a name="l00735"></a>00735 <a name="l00736"></a>00736 <span class="comment">// read_row returns true if valid data was read, false if the EOF was</span> <a name="l00737"></a>00737 <span class="comment">// found. 6/1/2001 jhrg</span> <a name="l00738"></a>00738 <span class="comment">// Since this is a parent sequence, read the row ignoring the CE (all of</span> <a name="l00739"></a>00739 <span class="comment">// the CE clauses will be evaluated by the leaf sequence).</span> <a name="l00740"></a>00740 <span class="keywordtype">bool</span> status = <a class="code" href="classlibdap_1_1Sequence.html#62d79555aa03b0a862314ccfdad090f8">read_row</a>(i, dds, eval, <span class="keyword">false</span>); <a name="l00741"></a>00741 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">"Sequence::serialize_parent_part_one::read_row() status: "</span> << status << endl); <a name="l00742"></a>00742 <a name="l00743"></a>00743 <span class="keywordflow">while</span> (status && !is_end_of_rows(i)) { <a name="l00744"></a>00744 i += d_row_stride; <a name="l00745"></a>00745 <a name="l00746"></a>00746 <span class="comment">// DBG(cerr << "Writing Start of Instance marker" << endl);</span> <a name="l00747"></a>00747 <span class="comment">// write_start_of_instance(sink);</span> <a name="l00748"></a>00748 <a name="l00749"></a>00749 <span class="comment">// In this loop serialize will signal an error with an exception.</span> <a name="l00750"></a>00750 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> iter = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); iter != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); iter++) { <a name="l00751"></a>00751 <span class="comment">// Only call serialize for child Sequences; the leaf sequence</span> <a name="l00752"></a>00752 <span class="comment">// will trigger the transmission of values for its parents (this</span> <a name="l00753"></a>00753 <span class="comment">// sequence and maybe others) once it gets soem valid data to</span> <a name="l00754"></a>00754 <span class="comment">// send.</span> <a name="l00755"></a>00755 <span class="comment">// Note that if the leaf sequence has no variables in the current</span> <a name="l00756"></a>00756 <span class="comment">// projection, its serialize() method will never be called and that's</span> <a name="l00757"></a>00757 <span class="comment">// the method that triggers actually sending values. Thus the leaf</span> <a name="l00758"></a>00758 <span class="comment">// sequence must be the lowest level sequence with values whose send_p</span> <a name="l00759"></a>00759 <span class="comment">// property is true.</span> <a name="l00760"></a>00760 <span class="keywordflow">if</span> ((*iter)->send_p() && (*iter)->type() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>) <a name="l00761"></a>00761 (*iter)->serialize(eval, dds, m); <a name="l00762"></a>00762 } <a name="l00763"></a>00763 <a name="l00764"></a>00764 <a class="code" href="classlibdap_1_1Sequence.html#79e5a9f5c44763e61964b7ec500edfeb" title="Sets the value of the read_p property.">set_read_p</a>(<span class="keyword">false</span>); <span class="comment">// ...so this will read the next instance</span> <a name="l00765"></a>00765 <a name="l00766"></a>00766 status = <a class="code" href="classlibdap_1_1Sequence.html#62d79555aa03b0a862314ccfdad090f8">read_row</a>(i, dds, eval, <span class="keyword">false</span>); <a name="l00767"></a>00767 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Sequence::serialize_parent_part_one::read_row() status: "</span> << status << endl); <a name="l00768"></a>00768 } <a name="l00769"></a>00769 <span class="comment">// Reset current row number for next nested sequence element.</span> <a name="l00770"></a>00770 d_row_number = -1; <a name="l00771"></a>00771 <a name="l00772"></a>00772 <span class="comment">// Always write the EOS marker? 12/23/04 jhrg</span> <a name="l00773"></a>00773 <span class="comment">// Yes. According to DAP2, a completely empty response is signalled by</span> <a name="l00774"></a>00774 <span class="comment">// a return value of only the EOS marker for the outermost sequence.</span> <a name="l00775"></a>00775 <span class="keywordflow">if</span> (d_top_most || d_wrote_soi) { <a name="l00776"></a>00776 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Writing End of Sequence marker"</span> << endl); <a name="l00777"></a>00777 write_end_of_sequence(m); <a name="l00778"></a>00778 d_wrote_soi = <span class="keyword">false</span>; <a name="l00779"></a>00779 } <a name="l00780"></a>00780 <a name="l00781"></a>00781 <span class="keywordflow">return</span> <span class="keyword">true</span>; <span class="comment">// Signal errors with exceptions.</span> <a name="l00782"></a>00782 } <a name="l00783"></a>00783 <a name="l00784"></a>00784 <span class="comment">// If we are here then we know that this is 'parent sequence' and that the</span> <a name="l00785"></a>00785 <span class="comment">// leaf seq has found valid data to send. We also know that</span> <a name="l00786"></a>00786 <span class="comment">// serialize_parent_part_one has been called so data are in the instance's</span> <a name="l00787"></a>00787 <span class="comment">// fields. This is wheree we send data. Whereas ..._part_one() contains a</span> <a name="l00788"></a>00788 <span class="comment">// loop to iterate over all of rows in a parent sequence, this does not. This</span> <a name="l00789"></a>00789 <span class="comment">// method assumes that the serialize_leaf() will call it each time it needs</span> <a name="l00790"></a>00790 <span class="comment">// to be called.</span> <a name="l00791"></a>00791 <span class="comment">//</span> <a name="l00792"></a>00792 <span class="comment">// NB: This code only works if the child sequences appear after all other</span> <a name="l00793"></a>00793 <span class="comment">// variables.</span> <a name="l00794"></a>00794 <span class="keywordtype">void</span> <a name="l00795"></a><a class="code" href="classlibdap_1_1Sequence.html#7e73cc4aecdca6ca600a5ce81fe1780c">00795</a> <a class="code" href="classlibdap_1_1Sequence.html#7e73cc4aecdca6ca600a5ce81fe1780c">Sequence::serialize_parent_part_two</a>(<a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds, <a name="l00796"></a>00796 <a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> &eval, <a class="code" href="classlibdap_1_1Marshaller.html" title="abstract base class used to marshall/serialize dap data objects">Marshaller</a> &m) <a name="l00797"></a>00797 { <a name="l00798"></a>00798 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Entering serialize_parent_part_two for "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << endl); <a name="l00799"></a>00799 <a name="l00800"></a>00800 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = <a class="code" href="classlibdap_1_1BaseType.html#eabb771d731dbcef92fff731fb429f85">get_parent</a>(); <a name="l00801"></a>00801 <span class="keywordflow">if</span> (btp && btp-><a class="code" href="classlibdap_1_1BaseType.html#bc6b2d7099f00bb5f324ec129bff2a17" title="Returns the type of the class instance.">type</a>() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>) <a name="l00802"></a>00802 dynamic_cast<Sequence&>(*btp).serialize_parent_part_two(dds, eval, m); <a name="l00803"></a>00803 <a name="l00804"></a>00804 <span class="keywordflow">if</span> (d_unsent_data) { <a name="l00805"></a>00805 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Writing Start of Instance marker"</span> << endl); <a name="l00806"></a>00806 d_wrote_soi = <span class="keyword">true</span>; <a name="l00807"></a>00807 write_start_of_instance(m); <a name="l00808"></a>00808 <a name="l00809"></a>00809 <span class="comment">// In this loop serialize will signal an error with an exception.</span> <a name="l00810"></a>00810 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> iter = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); iter != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); iter++) { <a name="l00811"></a>00811 <span class="comment">// Send all the non-sequence variables</span> <a name="l00812"></a>00812 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Sequence::serialize_parent_part_two(), serializing "</span> <a name="l00813"></a>00813 << (*iter)->name() << endl); <a name="l00814"></a>00814 <span class="keywordflow">if</span> ((*iter)->send_p() && (*iter)->type() != <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>) { <a name="l00815"></a>00815 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Send P is true, sending "</span> << (*iter)->name() << endl); <a name="l00816"></a>00816 (*iter)->serialize(eval, dds, m, <span class="keyword">false</span>); <a name="l00817"></a>00817 } <a name="l00818"></a>00818 } <a name="l00819"></a>00819 <a name="l00820"></a>00820 d_unsent_data = <span class="keyword">false</span>; <span class="comment">// read should set this.</span> <a name="l00821"></a>00821 } <a name="l00822"></a>00822 } <a name="l00823"></a>00823 <a name="l00824"></a>00824 <span class="comment">// This code is only run by a leaf sequence. Note that a one level sequence</span> <a name="l00825"></a>00825 <span class="comment">// is also a leaf sequence.</span> <a name="l00826"></a>00826 <span class="keywordtype">bool</span> <a name="l00827"></a><a class="code" href="classlibdap_1_1Sequence.html#1e28f9c0d173929383e1ffc2002e66ce">00827</a> <a class="code" href="classlibdap_1_1Sequence.html#1e28f9c0d173929383e1ffc2002e66ce">Sequence::serialize_leaf</a>(<a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds, <a name="l00828"></a>00828 <a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> &eval, <a class="code" href="classlibdap_1_1Marshaller.html" title="abstract base class used to marshall/serialize dap data objects">Marshaller</a> &m, <span class="keywordtype">bool</span> ce_eval) <a name="l00829"></a>00829 { <a name="l00830"></a>00830 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Entering Sequence::serialize_leaf for "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << endl); <a name="l00831"></a>00831 <span class="keywordtype">int</span> i = (d_starting_row_number != -1) ? d_starting_row_number : 0; <a name="l00832"></a>00832 <a name="l00833"></a>00833 <span class="comment">// read_row returns true if valid data was read, false if the EOF was</span> <a name="l00834"></a>00834 <span class="comment">// found. 6/1/2001 jhrg</span> <a name="l00835"></a>00835 <span class="keywordtype">bool</span> status = <a class="code" href="classlibdap_1_1Sequence.html#62d79555aa03b0a862314ccfdad090f8">read_row</a>(i, dds, eval, ce_eval); <a name="l00836"></a>00836 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Sequence::serialize_leaf::read_row() status: "</span> << status << endl); <a name="l00837"></a>00837 <a name="l00838"></a>00838 <span class="comment">// Once the first valid (satisfies the CE) row of the leaf sequence has</span> <a name="l00839"></a>00839 <span class="comment">// been read, we know we're going to send data. Send the current instance</span> <a name="l00840"></a>00840 <span class="comment">// of the parent/ancestor sequences now, if there are any. We only need</span> <a name="l00841"></a>00841 <span class="comment">// to do this once, hence it's not inside the while loop, but we only</span> <a name="l00842"></a>00842 <span class="comment">// send the parent seq data _if_ there's data in the leaf to send, that's</span> <a name="l00843"></a>00843 <span class="comment">// why we wait until after the first call to read_row() here in the leaf</span> <a name="l00844"></a>00844 <span class="comment">// sequence.</span> <a name="l00845"></a>00845 <span class="comment">//</span> <a name="l00846"></a>00846 <span class="comment">// NB: It's important to only call serialize_parent_part_two() for a</span> <a name="l00847"></a>00847 <span class="comment">// Sequence that really is the parent of a leaf sequence. The fancy cast</span> <a name="l00848"></a>00848 <span class="comment">// will throw and exception if btp is not a Sequence, but doesn't test</span> <a name="l00849"></a>00849 <span class="comment">// that it's a parent sequence as we've defined them here.</span> <a name="l00850"></a>00850 <span class="keywordflow">if</span> (status && !is_end_of_rows(i)) { <a name="l00851"></a>00851 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = <a class="code" href="classlibdap_1_1BaseType.html#eabb771d731dbcef92fff731fb429f85">get_parent</a>(); <a name="l00852"></a>00852 <span class="keywordflow">if</span> (btp && btp-><a class="code" href="classlibdap_1_1BaseType.html#bc6b2d7099f00bb5f324ec129bff2a17" title="Returns the type of the class instance.">type</a>() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>) <a name="l00853"></a>00853 dynamic_cast<Sequence&>(*btp).serialize_parent_part_two(dds, <a name="l00854"></a>00854 eval, m); <a name="l00855"></a>00855 } <a name="l00856"></a>00856 <a name="l00857"></a>00857 d_wrote_soi = <span class="keyword">false</span>; <a name="l00858"></a>00858 <span class="keywordflow">while</span> (status && !is_end_of_rows(i)) { <a name="l00859"></a>00859 i += d_row_stride; <a name="l00860"></a>00860 <a name="l00861"></a>00861 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Writing Start of Instance marker"</span> << endl); <a name="l00862"></a>00862 d_wrote_soi = <span class="keyword">true</span>; <a name="l00863"></a>00863 write_start_of_instance(m); <a name="l00864"></a>00864 <a name="l00865"></a>00865 <span class="comment">// In this loop serialize will signal an error with an exception.</span> <a name="l00866"></a>00866 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> iter = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); iter != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); iter++) { <a name="l00867"></a>00867 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Sequence::serialize_leaf(), serializing "</span> <a name="l00868"></a>00868 << (*iter)->name() << endl); <a name="l00869"></a>00869 <span class="keywordflow">if</span> ((*iter)->send_p()) { <a name="l00870"></a>00870 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Send P is true, sending "</span> << (*iter)->name() << endl); <a name="l00871"></a>00871 (*iter)->serialize(eval, dds, m, <span class="keyword">false</span>); <a name="l00872"></a>00872 } <a name="l00873"></a>00873 } <a name="l00874"></a>00874 <a name="l00875"></a>00875 <a class="code" href="classlibdap_1_1Sequence.html#79e5a9f5c44763e61964b7ec500edfeb" title="Sets the value of the read_p property.">set_read_p</a>(<span class="keyword">false</span>); <span class="comment">// ...so this will read the next instance</span> <a name="l00876"></a>00876 <a name="l00877"></a>00877 status = <a class="code" href="classlibdap_1_1Sequence.html#62d79555aa03b0a862314ccfdad090f8">read_row</a>(i, dds, eval, ce_eval); <a name="l00878"></a>00878 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Sequence::serialize_leaf::read_row() status: "</span> << status << endl); <a name="l00879"></a>00879 } <a name="l00880"></a>00880 <a name="l00881"></a>00881 <span class="comment">// Only write the EOS marker if there's a matching Start Of Instnace</span> <a name="l00882"></a>00882 <span class="comment">// Marker in the stream.</span> <a name="l00883"></a>00883 <span class="keywordflow">if</span> (d_wrote_soi || d_top_most) { <a name="l00884"></a>00884 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Writing End of Sequence marker"</span> << endl); <a name="l00885"></a>00885 write_end_of_sequence(m); <a name="l00886"></a>00886 } <a name="l00887"></a>00887 <a name="l00888"></a>00888 <span class="keywordflow">return</span> <span class="keyword">true</span>; <span class="comment">// Signal errors with exceptions.</span> <a name="l00889"></a>00889 } <a name="l00890"></a>00890 <a name="l00913"></a>00913 <span class="keywordtype">void</span> <a name="l00914"></a><a class="code" href="classlibdap_1_1Sequence.html#aa428c1a32fea386549399dd19b756ac">00914</a> <a class="code" href="classlibdap_1_1Sequence.html#aa428c1a32fea386549399dd19b756ac">Sequence::intern_data</a>(<a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> &eval, <a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds) <a name="l00915"></a>00915 { <a name="l00916"></a>00916 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Sequence::intern_data - for "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << endl); <a name="l00917"></a>00917 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">" intern_data, values: "</span> << &d_values << endl); <a name="l00918"></a>00918 <a name="l00919"></a>00919 <span class="comment">// Why use a stack instead of return values? We need the stack because</span> <a name="l00920"></a>00920 <span class="comment">// Sequences neted three of more levels deep will loose the middle</span> <a name="l00921"></a>00921 <span class="comment">// instances when the intern_data_parent_part_two() code is run.</span> <a name="l00922"></a>00922 <a class="code" href="classlibdap_1_1Sequence.html#fa1dc14e98a94efc8944cdb08214a166">sequence_values_stack_t</a> sequence_values_stack; <a name="l00923"></a>00923 <a name="l00924"></a>00924 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">" pushing d_values of "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << <span class="stringliteral">" ("</span> << &d_values <a name="l00925"></a>00925 << <span class="stringliteral">") on stack; size: "</span> << sequence_values_stack.size() << endl); <a name="l00926"></a>00926 sequence_values_stack.push(&d_values); <a name="l00927"></a>00927 <a name="l00928"></a>00928 <a class="code" href="classlibdap_1_1Sequence.html#c193f301017ed380059b94907f9e0be4">intern_data_private</a>(eval, dds, sequence_values_stack); <a name="l00929"></a>00929 } <a name="l00930"></a>00930 <a name="l00931"></a>00931 <span class="keywordtype">void</span> <a name="l00932"></a><a class="code" href="classlibdap_1_1Sequence.html#c193f301017ed380059b94907f9e0be4">00932</a> <a class="code" href="classlibdap_1_1Sequence.html#c193f301017ed380059b94907f9e0be4">Sequence::intern_data_private</a>(<a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> &eval, <a name="l00933"></a>00933 <a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds, <a name="l00934"></a>00934 sequence_values_stack_t &sequence_values_stack) <a name="l00935"></a>00935 { <a name="l00936"></a>00936 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Entering intern_data_private for "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << endl); <a name="l00937"></a>00937 <a name="l00938"></a>00938 <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1Sequence.html#3cb03f3ccb14372106e91461b468c1bd">is_leaf_sequence</a>()) <a name="l00939"></a>00939 <a class="code" href="classlibdap_1_1Sequence.html#25f2ba65cd6ff7553988739a5c1a08d4">intern_data_for_leaf</a>(dds, eval, sequence_values_stack); <a name="l00940"></a>00940 <span class="keywordflow">else</span> <a name="l00941"></a>00941 <a class="code" href="classlibdap_1_1Sequence.html#6593f7531b7b2a307f5fe4a7bb276225">intern_data_parent_part_one</a>(dds, eval, sequence_values_stack); <a name="l00942"></a>00942 } <a name="l00943"></a>00943 <a name="l00944"></a>00944 <span class="keywordtype">void</span> <a name="l00945"></a><a class="code" href="classlibdap_1_1Sequence.html#6593f7531b7b2a307f5fe4a7bb276225">00945</a> <a class="code" href="classlibdap_1_1Sequence.html#6593f7531b7b2a307f5fe4a7bb276225">Sequence::intern_data_parent_part_one</a>(<a class="code" href="classlibdap_1_1DDS.html">DDS</a> & dds, <a name="l00946"></a>00946 <a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> & eval, <a name="l00947"></a>00947 sequence_values_stack_t & <a name="l00948"></a>00948 sequence_values_stack) <a name="l00949"></a>00949 { <a name="l00950"></a>00950 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Entering intern_data_parent_part_one for "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << endl); <a name="l00951"></a>00951 <a name="l00952"></a>00952 <span class="keywordtype">int</span> i = (<a class="code" href="classlibdap_1_1Sequence.html#d15a2b640e4bee850577ca9500ad31c3" title="Get the starting row number.">get_starting_row_number</a>() != -1) ? <a class="code" href="classlibdap_1_1Sequence.html#d15a2b640e4bee850577ca9500ad31c3" title="Get the starting row number.">get_starting_row_number</a>() : 0; <a name="l00953"></a>00953 <a name="l00954"></a>00954 <span class="comment">// read_row returns true if valid data was read, false if the EOF was</span> <a name="l00955"></a>00955 <span class="comment">// found. 6/1/2001 jhrg</span> <a name="l00956"></a>00956 <span class="comment">// Since this is a parent sequence, read the row ignoring the CE (all of</span> <a name="l00957"></a>00957 <span class="comment">// the CE clauses will be evaluated by the leaf sequence).</span> <a name="l00958"></a>00958 <span class="keywordtype">bool</span> status = <a class="code" href="classlibdap_1_1Sequence.html#62d79555aa03b0a862314ccfdad090f8">read_row</a>(i, dds, eval, <span class="keyword">false</span>); <a name="l00959"></a>00959 <a name="l00960"></a>00960 <span class="comment">// Grab the current size of the value stack. We do this because it is</span> <a name="l00961"></a>00961 <span class="comment">// possible that no nested sequences for this row happened to be</span> <a name="l00962"></a>00962 <span class="comment">// selected because of a constract evaluation or the last row is not</span> <a name="l00963"></a>00963 <span class="comment">// selected because of a constraint evaluation. In either case, no</span> <a name="l00964"></a>00964 <span class="comment">// nested sequence d_values are pused onto the stack, so there is</span> <a name="l00965"></a>00965 <span class="comment">// nothing to pop at the end of this function. pcw 07/14/08</span> <a name="l00966"></a>00966 SequenceValues::size_type orig_stack_size = sequence_values_stack.size() ; <a name="l00967"></a>00967 <a name="l00968"></a>00968 <span class="keywordflow">while</span> (status <a name="l00969"></a>00969 && (<a class="code" href="classlibdap_1_1Sequence.html#e1489f3bc8bb269e51831add438aa392" title="Get the ending row number.">get_ending_row_number</a>() == -1 <a name="l00970"></a>00970 || i <= <a class="code" href="classlibdap_1_1Sequence.html#e1489f3bc8bb269e51831add438aa392" title="Get the ending row number.">get_ending_row_number</a>())) <a name="l00971"></a>00971 { <a name="l00972"></a>00972 i += <a class="code" href="classlibdap_1_1Sequence.html#e1461dd491795a2d6b0bd3112aca8550" title="Get the row stride.">get_row_stride</a>(); <a name="l00973"></a>00973 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> iter = <a class="code" href="classlibdap_1_1Constructor.html#deafe3d6c82d07b456a598a7b446c2c6">var_begin</a>(); iter != <a class="code" href="classlibdap_1_1Constructor.html#936b38c7c35ffb4fe17c5b8e85bdaaa2">var_end</a>(); iter++) { <a name="l00974"></a>00974 <span class="keywordflow">if</span> ((*iter)->send_p()) { <a name="l00975"></a>00975 <span class="keywordflow">switch</span> ((*iter)->type()) { <a name="l00976"></a>00976 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>: <a name="l00977"></a>00977 <span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Sequence.html" title="Holds a sequence.">Sequence</a>&<span class="keyword">></span>(**iter).intern_data_private( <a name="l00978"></a>00978 eval, dds, sequence_values_stack); <a name="l00979"></a>00979 <span class="keywordflow">break</span>; <a name="l00980"></a>00980 <a name="l00981"></a>00981 <span class="keywordflow">default</span>: <a name="l00982"></a>00982 (*iter)->intern_data(eval, dds); <a name="l00983"></a>00983 <span class="keywordflow">break</span>; <a name="l00984"></a>00984 } <a name="l00985"></a>00985 } <a name="l00986"></a>00986 } <a name="l00987"></a>00987 <a name="l00988"></a>00988 <a class="code" href="classlibdap_1_1Sequence.html#79e5a9f5c44763e61964b7ec500edfeb" title="Sets the value of the read_p property.">set_read_p</a>(<span class="keyword">false</span>); <span class="comment">// ...so this will read the next instance</span> <a name="l00989"></a>00989 <a name="l00990"></a>00990 status = <a class="code" href="classlibdap_1_1Sequence.html#62d79555aa03b0a862314ccfdad090f8">read_row</a>(i, dds, eval, <span class="keyword">false</span>); <a name="l00991"></a>00991 } <a name="l00992"></a>00992 <a name="l00993"></a>00993 <span class="comment">// Reset current row number for next nested sequence element.</span> <a name="l00994"></a>00994 <a class="code" href="classlibdap_1_1Sequence.html#d555ad129354768a042f4e94f36f299a" title="Rest the row number counter.">reset_row_number</a>(); <a name="l00995"></a>00995 <a name="l00996"></a>00996 <span class="comment">// if the size of the stack is larger than the original size (retrieved</span> <a name="l00997"></a>00997 <span class="comment">// above) then pop the top set of d_values from the stack. If it's the</span> <a name="l00998"></a>00998 <span class="comment">// same, then no nested sequences, or possible the last nested sequence,</span> <a name="l00999"></a>00999 <span class="comment">// were pushed onto the stack, so there is nothing to pop.</span> <a name="l01000"></a>01000 <span class="keywordflow">if</span>( sequence_values_stack.size() > orig_stack_size ) <a name="l01001"></a>01001 { <a name="l01002"></a>01002 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">" popping d_values ("</span> << sequence_values_stack.top() <a name="l01003"></a>01003 << <span class="stringliteral">") off stack; size: "</span> << sequence_values_stack.size() << endl); <a name="l01004"></a>01004 sequence_values_stack.pop(); <a name="l01005"></a>01005 } <a name="l01006"></a>01006 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Leaving intern_data_parent_part_one for "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << endl); <a name="l01007"></a>01007 } <a name="l01008"></a>01008 <a name="l01009"></a>01009 <span class="keywordtype">void</span> <a name="l01010"></a><a class="code" href="classlibdap_1_1Sequence.html#bf937ace290ad55a995d1baf5a05232b">01010</a> <a class="code" href="classlibdap_1_1Sequence.html#bf937ace290ad55a995d1baf5a05232b">Sequence::intern_data_parent_part_two</a>(<a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds, <a name="l01011"></a>01011 <a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> &eval, <a name="l01012"></a>01012 sequence_values_stack_t &sequence_values_stack) <a name="l01013"></a>01013 { <a name="l01014"></a>01014 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Entering intern_data_parent_part_two for "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << endl); <a name="l01015"></a>01015 <a name="l01016"></a>01016 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = <a class="code" href="classlibdap_1_1BaseType.html#eabb771d731dbcef92fff731fb429f85">get_parent</a>(); <a name="l01017"></a>01017 <span class="keywordflow">if</span> (btp && btp-><a class="code" href="classlibdap_1_1BaseType.html#bc6b2d7099f00bb5f324ec129bff2a17" title="Returns the type of the class instance.">type</a>() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>) { <a name="l01018"></a>01018 <span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Sequence.html" title="Holds a sequence.">Sequence</a>&<span class="keyword">></span>(*btp).intern_data_parent_part_two( <a name="l01019"></a>01019 dds, eval, sequence_values_stack); <a name="l01020"></a>01020 } <a name="l01021"></a>01021 <a name="l01022"></a>01022 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">" stack size: "</span> << sequence_values_stack.size() << endl); <a name="l01023"></a>01023 <a class="code" href="namespacelibdap.html#d2918a01a28d16d423b047e2d312f760">SequenceValues</a> *values = sequence_values_stack.top(); <a name="l01024"></a>01024 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">" using values = "</span> << (<span class="keywordtype">void</span> *)values << endl); <a name="l01025"></a>01025 <a name="l01026"></a>01026 <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1Sequence.html#1e361197948ce131e14e35454b2178b7" title="Get the unsent data property.">get_unsent_data</a>()) { <a name="l01027"></a>01027 <a class="code" href="namespacelibdap.html#cf78ec36b2d70d02d8eea5cd50253922">BaseTypeRow</a> *row_data = <span class="keyword">new</span> <a class="code" href="namespacelibdap.html#cf78ec36b2d70d02d8eea5cd50253922">BaseTypeRow</a>; <a name="l01028"></a>01028 <a name="l01029"></a>01029 <span class="comment">// In this loop transfer_data will signal an error with an exception.</span> <a name="l01030"></a>01030 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> iter = <a class="code" href="classlibdap_1_1Constructor.html#deafe3d6c82d07b456a598a7b446c2c6">var_begin</a>(); iter != <a class="code" href="classlibdap_1_1Constructor.html#936b38c7c35ffb4fe17c5b8e85bdaaa2">var_end</a>(); iter++) { <a name="l01031"></a>01031 <a name="l01032"></a>01032 <span class="keywordflow">if</span> ((*iter)->send_p() && (*iter)->type() != <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>) { <a name="l01033"></a>01033 row_data->push_back((*iter)->ptr_duplicate()); <a name="l01034"></a>01034 } <a name="l01035"></a>01035 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((*iter)->send_p()) { <span class="comment">//Sequence; must be the last variable</span> <a name="l01036"></a>01036 <a class="code" href="classlibdap_1_1Sequence.html" title="Holds a sequence.">Sequence</a> *tmp = <span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Sequence.html" title="Holds a sequence.">Sequence</a>*<span class="keyword">></span>((*iter)->ptr_duplicate()); <a name="l01037"></a>01037 <span class="keywordflow">if</span> (!tmp) <a name="l01038"></a>01038 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1InternalErr.html" title="A class for software fault reporting.">InternalErr</a>(__FILE__, __LINE__, <span class="stringliteral">"Expected a Sequence."</span>); <a name="l01039"></a>01039 row_data->push_back(tmp); <a name="l01040"></a>01040 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">" pushing d_values of "</span> << tmp-><a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() <a name="l01041"></a>01041 << <span class="stringliteral">" ("</span> << &(tmp->d_values) <a name="l01042"></a>01042 << <span class="stringliteral">") on stack; size: "</span> << sequence_values_stack.size() <a name="l01043"></a>01043 << endl); <a name="l01044"></a>01044 <span class="comment">// This pushes the d_values field of the newly created leaf</span> <a name="l01045"></a>01045 <span class="comment">// Sequence onto the stack. The code then returns to intern</span> <a name="l01046"></a>01046 <span class="comment">// _data_for_leaf() where this value will be used.</span> <a name="l01047"></a>01047 sequence_values_stack.push(&(tmp->d_values)); <a name="l01048"></a>01048 } <a name="l01049"></a>01049 } <a name="l01050"></a>01050 <a name="l01051"></a>01051 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">" pushing values for "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() <a name="l01052"></a>01052 << <span class="stringliteral">" to "</span> << values << endl); <a name="l01053"></a>01053 values->push_back(row_data); <a name="l01054"></a>01054 <a class="code" href="classlibdap_1_1Sequence.html#d7820138d2f1c9c8ff7dfa632dff60c2" title="Set the unsent data property.">set_unsent_data</a>(<span class="keyword">false</span>); <a name="l01055"></a>01055 } <a name="l01056"></a>01056 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Leaving intern_data_parent_part_two for "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << endl); <a name="l01057"></a>01057 } <a name="l01058"></a>01058 <a name="l01059"></a>01059 <span class="keywordtype">void</span> <a name="l01060"></a><a class="code" href="classlibdap_1_1Sequence.html#25f2ba65cd6ff7553988739a5c1a08d4">01060</a> <a class="code" href="classlibdap_1_1Sequence.html#25f2ba65cd6ff7553988739a5c1a08d4">Sequence::intern_data_for_leaf</a>(<a class="code" href="classlibdap_1_1DDS.html">DDS</a> &dds, <a name="l01061"></a>01061 <a class="code" href="classlibdap_1_1ConstraintEvaluator.html" title="Evaluate a constraint expression.">ConstraintEvaluator</a> &eval, <a name="l01062"></a>01062 sequence_values_stack_t &sequence_values_stack) <a name="l01063"></a>01063 { <a name="l01064"></a>01064 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Entering intern_data_for_leaf for "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << endl); <a name="l01065"></a>01065 <a name="l01066"></a>01066 <span class="keywordtype">int</span> i = (<a class="code" href="classlibdap_1_1Sequence.html#d15a2b640e4bee850577ca9500ad31c3" title="Get the starting row number.">get_starting_row_number</a>() != -1) ? <a class="code" href="classlibdap_1_1Sequence.html#d15a2b640e4bee850577ca9500ad31c3" title="Get the starting row number.">get_starting_row_number</a>() : 0; <a name="l01067"></a>01067 <a name="l01068"></a>01068 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">" reading row "</span> << i << endl); <a name="l01069"></a>01069 <span class="keywordtype">bool</span> status = <a class="code" href="classlibdap_1_1Sequence.html#62d79555aa03b0a862314ccfdad090f8">read_row</a>(i, dds, eval, <span class="keyword">true</span>); <a name="l01070"></a>01070 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">" status: "</span> << status << endl); <a name="l01071"></a>01071 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">" ending row number: "</span> << <a class="code" href="classlibdap_1_1Sequence.html#e1489f3bc8bb269e51831add438aa392" title="Get the ending row number.">get_ending_row_number</a>() << endl); <a name="l01072"></a>01072 <a name="l01073"></a>01073 <span class="keywordflow">if</span> (status && (<a class="code" href="classlibdap_1_1Sequence.html#e1489f3bc8bb269e51831add438aa392" title="Get the ending row number.">get_ending_row_number</a>() == -1 || i <= <a class="code" href="classlibdap_1_1Sequence.html#e1489f3bc8bb269e51831add438aa392" title="Get the ending row number.">get_ending_row_number</a>())) { <a name="l01074"></a>01074 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *btp = <a class="code" href="classlibdap_1_1BaseType.html#eabb771d731dbcef92fff731fb429f85">get_parent</a>(); <a name="l01075"></a>01075 <span class="keywordflow">if</span> (btp && btp-><a class="code" href="classlibdap_1_1BaseType.html#bc6b2d7099f00bb5f324ec129bff2a17" title="Returns the type of the class instance.">type</a>() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>) { <a name="l01076"></a>01076 <span class="comment">// This call will read the values for the parent sequences and</span> <a name="l01077"></a>01077 <span class="comment">// then allocate a new instance for the leaf and push that onto</span> <a name="l01078"></a>01078 <span class="comment">// the stack.</span> <a name="l01079"></a>01079 <span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Sequence.html" title="Holds a sequence.">Sequence</a>&<span class="keyword">></span>(*btp).intern_data_parent_part_two( <a name="l01080"></a>01080 dds, eval, sequence_values_stack); <a name="l01081"></a>01081 } <a name="l01082"></a>01082 <a name="l01083"></a>01083 <span class="comment">// intern_data_parent_part_two pushes the d_values field of the leaf</span> <a name="l01084"></a>01084 <span class="comment">// onto the stack, so this operation grabs that value and then loads</span> <a name="l01085"></a>01085 <span class="comment">// data into it.</span> <a name="l01086"></a>01086 <a class="code" href="namespacelibdap.html#d2918a01a28d16d423b047e2d312f760">SequenceValues</a> *values = sequence_values_stack.top(); <a name="l01087"></a>01087 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">" using values = "</span> << values << endl); <a name="l01088"></a>01088 <a name="l01089"></a>01089 <span class="keywordflow">while</span> (status && (<a class="code" href="classlibdap_1_1Sequence.html#e1489f3bc8bb269e51831add438aa392" title="Get the ending row number.">get_ending_row_number</a>() == -1 <a name="l01090"></a>01090 || i <= <a class="code" href="classlibdap_1_1Sequence.html#e1489f3bc8bb269e51831add438aa392" title="Get the ending row number.">get_ending_row_number</a>())) { <a name="l01091"></a>01091 i += <a class="code" href="classlibdap_1_1Sequence.html#e1461dd491795a2d6b0bd3112aca8550" title="Get the row stride.">get_row_stride</a>(); <a name="l01092"></a>01092 <a name="l01093"></a>01093 <span class="comment">// Copy data from the object's fields to this new BaeTypeRow instance</span> <a name="l01094"></a>01094 <a class="code" href="namespacelibdap.html#cf78ec36b2d70d02d8eea5cd50253922">BaseTypeRow</a> *row_data = <span class="keyword">new</span> <a class="code" href="namespacelibdap.html#cf78ec36b2d70d02d8eea5cd50253922">BaseTypeRow</a>; <a name="l01095"></a>01095 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> iter = <a class="code" href="classlibdap_1_1Constructor.html#deafe3d6c82d07b456a598a7b446c2c6">var_begin</a>(); iter != <a class="code" href="classlibdap_1_1Constructor.html#936b38c7c35ffb4fe17c5b8e85bdaaa2">var_end</a>(); iter++) { <a name="l01096"></a>01096 <span class="keywordflow">if</span> ((*iter)->send_p()) { <a name="l01097"></a>01097 row_data->push_back((*iter)->ptr_duplicate()); <a name="l01098"></a>01098 } <a name="l01099"></a>01099 } <a name="l01100"></a>01100 <a name="l01101"></a>01101 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">" pushing values for "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() <a name="l01102"></a>01102 << <span class="stringliteral">" to "</span> << values << endl); <a name="l01103"></a>01103 <span class="comment">// Save the row_data to values().</span> <a name="l01104"></a>01104 values->push_back(row_data); <a name="l01105"></a>01105 <a name="l01106"></a>01106 <a class="code" href="classlibdap_1_1Sequence.html#79e5a9f5c44763e61964b7ec500edfeb" title="Sets the value of the read_p property.">set_read_p</a>(<span class="keyword">false</span>); <span class="comment">// ...so this will read the next instance</span> <a name="l01107"></a>01107 <span class="comment">// Read the ith row into this object's fields</span> <a name="l01108"></a>01108 status = <a class="code" href="classlibdap_1_1Sequence.html#62d79555aa03b0a862314ccfdad090f8">read_row</a>(i, dds, eval, <span class="keyword">true</span>); <a name="l01109"></a>01109 } <a name="l01110"></a>01110 <a name="l01111"></a>01111 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">" popping d_values ("</span> << sequence_values_stack.top() <a name="l01112"></a>01112 << <span class="stringliteral">") off stack; size: "</span> << sequence_values_stack.size() << endl); <a name="l01113"></a>01113 sequence_values_stack.pop(); <a name="l01114"></a>01114 } <a name="l01115"></a>01115 <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Leaving intern_data_for_leaf for "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << endl); <a name="l01116"></a>01116 } <a name="l01117"></a>01117 <a name="l01138"></a>01138 <span class="keywordtype">bool</span> <a name="l01139"></a><a class="code" href="classlibdap_1_1Sequence.html#df58298f58caf27d467ad41b7ecbb6ec">01139</a> <a class="code" href="classlibdap_1_1Sequence.html#df58298f58caf27d467ad41b7ecbb6ec" title="Deserialize (read from the network) the entire Sequence.">Sequence::deserialize</a>(<a class="code" href="classlibdap_1_1UnMarshaller.html" title="abstract base class used to unmarshall/deserialize dap data objects">UnMarshaller</a> &um, <a class="code" href="classlibdap_1_1DDS.html">DDS</a> *dds, <span class="keywordtype">bool</span> reuse) <a name="l01140"></a>01140 { <a name="l01141"></a>01141 <a class="code" href="classlibdap_1_1DataDDS.html" title="Holds a DAP2 DDS.">DataDDS</a> *dd = <span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1DataDDS.html" title="Holds a DAP2 DDS.">DataDDS</a> *<span class="keyword">></span>(dds); <a name="l01142"></a>01142 <span class="keywordflow">if</span> (!dd) <a name="l01143"></a>01143 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1InternalErr.html" title="A class for software fault reporting.">InternalErr</a>(<span class="stringliteral">"Expected argument 'dds' to be a DataDDS!"</span>); <a name="l01144"></a>01144 <a name="l01145"></a>01145 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">"Reading from server/protocol version: "</span> <a name="l01146"></a>01146 << dd-><a class="code" href="classlibdap_1_1DataDDS.html#856b3990ae7b3571b940d23ede69d30e">get_protocol_major</a>() << <span class="stringliteral">"."</span> << dd-><a class="code" href="classlibdap_1_1DataDDS.html#2a5320f49d536c58f17cb8bff5cb1431">get_protocol_minor</a>() <a name="l01147"></a>01147 << endl); <a name="l01148"></a>01148 <a name="l01149"></a>01149 <span class="comment">// Check for old servers.</span> <a name="l01150"></a>01150 <span class="keywordflow">if</span> (dd-><a class="code" href="classlibdap_1_1DataDDS.html#856b3990ae7b3571b940d23ede69d30e">get_protocol_major</a>() < 2) { <a name="l01151"></a>01151 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(<span class="keywordtype">string</span>(<span class="stringliteral">"The protocl version ("</span>) + dd-><a class="code" href="classlibdap_1_1DataDDS.html#f43fc4392606e00c25ad9d8af7fc2a8f">get_protocol</a>() <a name="l01152"></a>01152 + <span class="stringliteral">") indicates that this\nis an old server which may not correctly transmit Sequence variables.\nContact the server administrator."</span>); <a name="l01153"></a>01153 } <a name="l01154"></a>01154 <a name="l01155"></a>01155 <span class="keywordflow">while</span> (<span class="keyword">true</span>) { <a name="l01156"></a>01156 <span class="comment">// Grab the sequence stream's marker.</span> <a name="l01157"></a>01157 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> marker = read_marker(um); <a name="l01158"></a>01158 <span class="keywordflow">if</span> (is_end_of_sequence(marker)) <a name="l01159"></a>01159 <span class="keywordflow">break</span>; <span class="comment">// EXIT the while loop here!!!</span> <a name="l01160"></a>01160 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (is_start_of_instance(marker)) { <a name="l01161"></a>01161 d_row_number++; <a name="l01162"></a>01162 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">"Reading row "</span> << d_row_number << <span class="stringliteral">" of "</span> <a name="l01163"></a>01163 << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << endl); <a name="l01164"></a>01164 <a class="code" href="namespacelibdap.html#cf78ec36b2d70d02d8eea5cd50253922">BaseTypeRow</a> *bt_row_ptr = <span class="keyword">new</span> <a class="code" href="namespacelibdap.html#cf78ec36b2d70d02d8eea5cd50253922">BaseTypeRow</a>; <a name="l01165"></a>01165 <span class="comment">// Read the instance's values, building up the row</span> <a name="l01166"></a>01166 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> iter = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); iter != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); iter++) { <a name="l01167"></a>01167 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *bt_ptr = (*iter)->ptr_duplicate(); <a name="l01168"></a>01168 bt_ptr-><a class="code" href="classlibdap_1_1BaseType.html#a14891b5342c1ce06399343de8b716d0" title="Receive data from the net.">deserialize</a>(um, dds, reuse); <a name="l01169"></a>01169 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">"Deserialized "</span> << bt_ptr-><a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << <span class="stringliteral">" ("</span> <a name="l01170"></a>01170 << bt_ptr << <span class="stringliteral">") = "</span>); <a name="l01171"></a>01171 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(bt_ptr-><a class="code" href="classlibdap_1_1BaseType.html#16f82585af6b66f434f2132f05c4960c" title="Prints the value of the variable.">print_val</a>(stderr, <span class="stringliteral">""</span>)); <a name="l01172"></a>01172 bt_row_ptr->push_back(bt_ptr); <a name="l01173"></a>01173 } <a name="l01174"></a>01174 <span class="comment">// Append this row to those accumulated.</span> <a name="l01175"></a>01175 d_values.push_back(bt_row_ptr); <a name="l01176"></a>01176 } <a name="l01177"></a>01177 <span class="keywordflow">else</span> <a name="l01178"></a>01178 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(<span class="stringliteral">"I could not read the expected Sequence data stream marker!"</span>); <a name="l01179"></a>01179 }; <a name="l01180"></a>01180 <a name="l01181"></a>01181 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01182"></a>01182 } <a name="l01183"></a>01183 <a name="l01184"></a>01184 <span class="comment">// Return the current row number.</span> <a name="l01185"></a>01185 <a name="l01197"></a>01197 <span class="keywordtype">int</span> <a name="l01198"></a><a class="code" href="classlibdap_1_1Sequence.html#d15a2b640e4bee850577ca9500ad31c3">01198</a> <a class="code" href="classlibdap_1_1Sequence.html#d15a2b640e4bee850577ca9500ad31c3" title="Get the starting row number.">Sequence::get_starting_row_number</a>() <a name="l01199"></a>01199 { <a name="l01200"></a>01200 <span class="keywordflow">return</span> d_starting_row_number; <a name="l01201"></a>01201 } <a name="l01202"></a>01202 <a name="l01213"></a>01213 <span class="keywordtype">int</span> <a name="l01214"></a><a class="code" href="classlibdap_1_1Sequence.html#e1461dd491795a2d6b0bd3112aca8550">01214</a> <a class="code" href="classlibdap_1_1Sequence.html#e1461dd491795a2d6b0bd3112aca8550" title="Get the row stride.">Sequence::get_row_stride</a>() <a name="l01215"></a>01215 { <a name="l01216"></a>01216 <span class="keywordflow">return</span> d_row_stride; <a name="l01217"></a>01217 } <a name="l01218"></a>01218 <a name="l01230"></a>01230 <span class="keywordtype">int</span> <a name="l01231"></a><a class="code" href="classlibdap_1_1Sequence.html#e1489f3bc8bb269e51831add438aa392">01231</a> <a class="code" href="classlibdap_1_1Sequence.html#e1489f3bc8bb269e51831add438aa392" title="Get the ending row number.">Sequence::get_ending_row_number</a>() <a name="l01232"></a>01232 { <a name="l01233"></a>01233 <span class="keywordflow">return</span> d_ending_row_number; <a name="l01234"></a>01234 } <a name="l01235"></a>01235 <a name="l01244"></a>01244 <span class="keywordtype">void</span> <a name="l01245"></a><a class="code" href="classlibdap_1_1Sequence.html#f182686c5766d73e5d896eecaadb96bc">01245</a> <a class="code" href="classlibdap_1_1Sequence.html#f182686c5766d73e5d896eecaadb96bc">Sequence::set_row_number_constraint</a>(<span class="keywordtype">int</span> start, <span class="keywordtype">int</span> stop, <span class="keywordtype">int</span> stride) <a name="l01246"></a>01246 { <a name="l01247"></a>01247 <span class="keywordflow">if</span> (stop < start) <a name="l01248"></a>01248 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(<a class="code" href="Error_8h.html#5806d25bc779e86c285438e687669803">malformed_expr</a>, <span class="stringliteral">"Starting row number must precede the ending row number."</span>); <a name="l01249"></a>01249 <a name="l01250"></a>01250 d_starting_row_number = start; <a name="l01251"></a>01251 d_row_stride = stride; <a name="l01252"></a>01252 d_ending_row_number = stop; <a name="l01253"></a>01253 } <a name="l01254"></a>01254 <a name="l01257"></a>01257 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a name="l01258"></a><a class="code" href="classlibdap_1_1Sequence.html#05f44d885d230f502c9d9ef081804c0e">01258</a> <a class="code" href="classlibdap_1_1Sequence.html#05f44d885d230f502c9d9ef081804c0e">Sequence::val2buf</a>(<span class="keywordtype">void</span> *, <span class="keywordtype">bool</span>) <a name="l01259"></a>01259 { <a name="l01260"></a>01260 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1InternalErr.html" title="A class for software fault reporting.">InternalErr</a>(__FILE__, __LINE__, <span class="stringliteral">"Never use this method; see the programmer's guide documentation."</span>); <a name="l01261"></a>01261 <span class="keywordflow">return</span> <span class="keyword">sizeof</span>(<a class="code" href="classlibdap_1_1Sequence.html" title="Holds a sequence.">Sequence</a>); <a name="l01262"></a>01262 } <a name="l01263"></a>01263 <a name="l01268"></a>01268 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a name="l01269"></a><a class="code" href="classlibdap_1_1Sequence.html#5372388bfc9d295889386ce2203ce86b">01269</a> <a class="code" href="classlibdap_1_1Sequence.html#5372388bfc9d295889386ce2203ce86b">Sequence::buf2val</a>(<span class="keywordtype">void</span> **) <a name="l01270"></a>01270 { <a name="l01271"></a>01271 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1InternalErr.html" title="A class for software fault reporting.">InternalErr</a>(__FILE__, __LINE__, <span class="stringliteral">"Use Sequence::var_value() or Sequence::row_value() in place of Sequence::buf2val()"</span>); <a name="l01272"></a>01272 <span class="keywordflow">return</span> <span class="keyword">sizeof</span>(<a class="code" href="classlibdap_1_1Sequence.html" title="Holds a sequence.">Sequence</a>); <a name="l01273"></a>01273 } <a name="l01274"></a>01274 <span class="comment">//#if FILE_METHODS</span> <a name="l01275"></a>01275 <span class="keywordtype">void</span> <a name="l01276"></a><a class="code" href="classlibdap_1_1Sequence.html#cdd568667443c96e6b7b25d3db0f6129">01276</a> <a class="code" href="classlibdap_1_1Sequence.html#6bbdd92e1d38e00948592b0764d859ab">Sequence::print_one_row</a>(FILE *out, <span class="keywordtype">int</span> row, <span class="keywordtype">string</span> space, <a name="l01277"></a>01277 <span class="keywordtype">bool</span> print_row_num) <a name="l01278"></a>01278 { <a name="l01279"></a>01279 <span class="keywordflow">if</span> (print_row_num) <a name="l01280"></a>01280 fprintf(out, <span class="stringliteral">"\n%s%d: "</span>, space.c_str(), row) ; <a name="l01281"></a>01281 <a name="l01282"></a>01282 fprintf(out, <span class="stringliteral">"{ "</span>) ; <a name="l01283"></a>01283 <a name="l01284"></a>01284 <span class="keywordtype">int</span> elements = <a class="code" href="classlibdap_1_1Sequence.html#c954b8bf5119d75b0b441fa7d89fbd2f" title="Count the members of constructor types.">element_count</a>() - 1; <a name="l01285"></a>01285 <span class="keywordtype">int</span> j; <a name="l01286"></a>01286 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *bt_ptr; <a name="l01287"></a>01287 <span class="comment">// Print first N-1 elements of the row.</span> <a name="l01288"></a>01288 <span class="keywordflow">for</span> (j = 0; j < elements; ++j) { <a name="l01289"></a>01289 bt_ptr = <a class="code" href="classlibdap_1_1Sequence.html#b17e4f1aedda0b734442001b5c81f269" title="Get the BaseType pointer to the named variable of a given row.">var_value</a>(row, j); <a name="l01290"></a>01290 <span class="keywordflow">if</span> (bt_ptr) { <span class="comment">// data</span> <a name="l01291"></a>01291 <span class="keywordflow">if</span> (bt_ptr-><a class="code" href="classlibdap_1_1BaseType.html#bc6b2d7099f00bb5f324ec129bff2a17" title="Returns the type of the class instance.">type</a>() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>) <a name="l01292"></a>01292 dynamic_cast<Sequence*>(bt_ptr)->print_val_by_rows <a name="l01293"></a>01293 (out, space + <span class="stringliteral">" "</span>, <span class="keyword">false</span>, print_row_num); <a name="l01294"></a>01294 <span class="keywordflow">else</span> <a name="l01295"></a>01295 bt_ptr-><a class="code" href="classlibdap_1_1BaseType.html#16f82585af6b66f434f2132f05c4960c" title="Prints the value of the variable.">print_val</a>(out, space, <span class="keyword">false</span>); <a name="l01296"></a>01296 fprintf(out, <span class="stringliteral">", "</span>) ; <a name="l01297"></a>01297 } <a name="l01298"></a>01298 } <a name="l01299"></a>01299 <a name="l01300"></a>01300 <span class="comment">// Print Nth element; end with a `}.'</span> <a name="l01301"></a>01301 bt_ptr = <a class="code" href="classlibdap_1_1Sequence.html#b17e4f1aedda0b734442001b5c81f269" title="Get the BaseType pointer to the named variable of a given row.">var_value</a>(row, j); <a name="l01302"></a>01302 <span class="keywordflow">if</span> (bt_ptr) { <span class="comment">// data</span> <a name="l01303"></a>01303 <span class="keywordflow">if</span> (bt_ptr-><a class="code" href="classlibdap_1_1BaseType.html#bc6b2d7099f00bb5f324ec129bff2a17" title="Returns the type of the class instance.">type</a>() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>) <a name="l01304"></a>01304 dynamic_cast<Sequence*>(bt_ptr)->print_val_by_rows <a name="l01305"></a>01305 (out, space + <span class="stringliteral">" "</span>, <span class="keyword">false</span>, print_row_num); <a name="l01306"></a>01306 <span class="keywordflow">else</span> <a name="l01307"></a>01307 bt_ptr-><a class="code" href="classlibdap_1_1BaseType.html#16f82585af6b66f434f2132f05c4960c" title="Prints the value of the variable.">print_val</a>(out, space, <span class="keyword">false</span>); <a name="l01308"></a>01308 } <a name="l01309"></a>01309 <a name="l01310"></a>01310 fprintf(out, <span class="stringliteral">" }"</span>) ; <a name="l01311"></a>01311 } <a name="l01312"></a>01312 <span class="comment">//#endif</span> <a name="l01313"></a>01313 <span class="keywordtype">void</span> <a name="l01314"></a><a class="code" href="classlibdap_1_1Sequence.html#6bbdd92e1d38e00948592b0764d859ab">01314</a> <a class="code" href="classlibdap_1_1Sequence.html#6bbdd92e1d38e00948592b0764d859ab">Sequence::print_one_row</a>(ostream &out, <span class="keywordtype">int</span> row, <span class="keywordtype">string</span> space, <a name="l01315"></a>01315 <span class="keywordtype">bool</span> print_row_num) <a name="l01316"></a>01316 { <a name="l01317"></a>01317 <span class="keywordflow">if</span> (print_row_num) <a name="l01318"></a>01318 out << <span class="stringliteral">"\n"</span> << space << row << <span class="stringliteral">": "</span> ; <a name="l01319"></a>01319 <a name="l01320"></a>01320 out << <span class="stringliteral">"{ "</span> ; <a name="l01321"></a>01321 <a name="l01322"></a>01322 <span class="keywordtype">int</span> elements = <a class="code" href="classlibdap_1_1Sequence.html#c954b8bf5119d75b0b441fa7d89fbd2f" title="Count the members of constructor types.">element_count</a>(); <a name="l01323"></a>01323 <span class="keywordtype">int</span> j = 0; <a name="l01324"></a>01324 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *bt_ptr = 0; <a name="l01325"></a>01325 <a name="l01326"></a>01326 <span class="comment">// This version of print_one_row() works for both data read with</span> <a name="l01327"></a>01327 <span class="comment">// deserialize(), where each variable is assumed to have valid data, and</span> <a name="l01328"></a>01328 <span class="comment">// intern_data(), where some/many variables do not. Because of that, it's</span> <a name="l01329"></a>01329 <span class="comment">// not correct to assume that all of the elements will be printed, which</span> <a name="l01330"></a>01330 <span class="comment">// is what the old code did.</span> <a name="l01331"></a>01331 <span class="comment">// Print the first value</span> <a name="l01332"></a>01332 <span class="keywordflow">while</span> (j < elements && !bt_ptr) { <a name="l01333"></a>01333 bt_ptr = <a class="code" href="classlibdap_1_1Sequence.html#b17e4f1aedda0b734442001b5c81f269" title="Get the BaseType pointer to the named variable of a given row.">var_value</a>(row, j++); <a name="l01334"></a>01334 <span class="keywordflow">if</span> (bt_ptr) { <span class="comment">// data</span> <a name="l01335"></a>01335 <span class="keywordflow">if</span> (bt_ptr-><a class="code" href="classlibdap_1_1BaseType.html#bc6b2d7099f00bb5f324ec129bff2a17" title="Returns the type of the class instance.">type</a>() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>) <a name="l01336"></a>01336 dynamic_cast<Sequence*>(bt_ptr)->print_val_by_rows <a name="l01337"></a>01337 (out, space + <span class="stringliteral">" "</span>, <span class="keyword">false</span>, print_row_num); <a name="l01338"></a>01338 <span class="keywordflow">else</span> <a name="l01339"></a>01339 bt_ptr-><a class="code" href="classlibdap_1_1BaseType.html#16f82585af6b66f434f2132f05c4960c" title="Prints the value of the variable.">print_val</a>(out, space, <span class="keyword">false</span>); <a name="l01340"></a>01340 } <a name="l01341"></a>01341 } <a name="l01342"></a>01342 <a name="l01343"></a>01343 <span class="comment">// Print the remaining values</span> <a name="l01344"></a>01344 <span class="keywordflow">while</span> (j < elements) { <a name="l01345"></a>01345 bt_ptr = <a class="code" href="classlibdap_1_1Sequence.html#b17e4f1aedda0b734442001b5c81f269" title="Get the BaseType pointer to the named variable of a given row.">var_value</a>(row, j++); <a name="l01346"></a>01346 <span class="keywordflow">if</span> (bt_ptr) { <span class="comment">// data</span> <a name="l01347"></a>01347 out << <span class="stringliteral">", "</span>; <a name="l01348"></a>01348 <span class="keywordflow">if</span> (bt_ptr-><a class="code" href="classlibdap_1_1BaseType.html#bc6b2d7099f00bb5f324ec129bff2a17" title="Returns the type of the class instance.">type</a>() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>) <a name="l01349"></a>01349 dynamic_cast<Sequence*>(bt_ptr)->print_val_by_rows <a name="l01350"></a>01350 (out, space + <span class="stringliteral">" "</span>, <span class="keyword">false</span>, print_row_num); <a name="l01351"></a>01351 <span class="keywordflow">else</span> <a name="l01352"></a>01352 bt_ptr-><a class="code" href="classlibdap_1_1BaseType.html#16f82585af6b66f434f2132f05c4960c" title="Prints the value of the variable.">print_val</a>(out, space, <span class="keyword">false</span>); <a name="l01353"></a>01353 } <a name="l01354"></a>01354 } <a name="l01355"></a>01355 <a name="l01356"></a>01356 <span class="preprocessor">#if 0</span> <a name="l01357"></a>01357 <span class="preprocessor"></span> <span class="comment">// old version</span> <a name="l01358"></a>01358 <span class="keywordtype">int</span> elements = <a class="code" href="classlibdap_1_1Sequence.html#c954b8bf5119d75b0b441fa7d89fbd2f" title="Count the members of constructor types.">element_count</a>() - 1; <a name="l01359"></a>01359 <span class="keywordtype">int</span> j; <a name="l01360"></a>01360 <a class="code" href="classlibdap_1_1BaseType.html" title="The basic data type for the DODS DAP types.">BaseType</a> *bt_ptr; <a name="l01361"></a>01361 <span class="comment">// Print first N-1 elements of the row.</span> <a name="l01362"></a>01362 <span class="keywordflow">for</span> (j = 0; j < elements; ++j) { <a name="l01363"></a>01363 bt_ptr = <a class="code" href="classlibdap_1_1Sequence.html#b17e4f1aedda0b734442001b5c81f269" title="Get the BaseType pointer to the named variable of a given row.">var_value</a>(row, j); <a name="l01364"></a>01364 <span class="keywordflow">if</span> (bt_ptr) { <span class="comment">// data</span> <a name="l01365"></a>01365 <span class="keywordflow">if</span> (bt_ptr-><a class="code" href="classlibdap_1_1BaseType.html#bc6b2d7099f00bb5f324ec129bff2a17" title="Returns the type of the class instance.">type</a>() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>) <a name="l01366"></a>01366 dynamic_cast<Sequence*>(bt_ptr)->print_val_by_rows <a name="l01367"></a>01367 (out, space + <span class="stringliteral">" "</span>, <span class="keyword">false</span>, print_row_num); <a name="l01368"></a>01368 <span class="keywordflow">else</span> <a name="l01369"></a>01369 bt_ptr-><a class="code" href="classlibdap_1_1BaseType.html#16f82585af6b66f434f2132f05c4960c" title="Prints the value of the variable.">print_val</a>(out, space, <span class="keyword">false</span>); <a name="l01370"></a>01370 out << <span class="stringliteral">", "</span> ; <a name="l01371"></a>01371 } <a name="l01372"></a>01372 } <a name="l01373"></a>01373 <a name="l01374"></a>01374 <span class="comment">// Print Nth element; end with a `}.'</span> <a name="l01375"></a>01375 bt_ptr = <a class="code" href="classlibdap_1_1Sequence.html#b17e4f1aedda0b734442001b5c81f269" title="Get the BaseType pointer to the named variable of a given row.">var_value</a>(row, j); <a name="l01376"></a>01376 <span class="keywordflow">if</span> (bt_ptr) { <span class="comment">// data</span> <a name="l01377"></a>01377 <span class="keywordflow">if</span> (bt_ptr-><a class="code" href="classlibdap_1_1BaseType.html#bc6b2d7099f00bb5f324ec129bff2a17" title="Returns the type of the class instance.">type</a>() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a>) <a name="l01378"></a>01378 dynamic_cast<Sequence*>(bt_ptr)->print_val_by_rows <a name="l01379"></a>01379 (out, space + <span class="stringliteral">" "</span>, <span class="keyword">false</span>, print_row_num); <a name="l01380"></a>01380 <span class="keywordflow">else</span> <a name="l01381"></a>01381 bt_ptr-><a class="code" href="classlibdap_1_1BaseType.html#16f82585af6b66f434f2132f05c4960c" title="Prints the value of the variable.">print_val</a>(out, space, <span class="keyword">false</span>); <a name="l01382"></a>01382 } <a name="l01383"></a>01383 <span class="preprocessor">#endif</span> <a name="l01384"></a>01384 <span class="preprocessor"></span> <a name="l01385"></a>01385 out << <span class="stringliteral">" }"</span> ; <a name="l01386"></a>01386 } <a name="l01387"></a>01387 <a name="l01388"></a>01388 <span class="comment">//#if FILE_METHODS</span> <a name="l01389"></a>01389 <span class="keywordtype">void</span> <a name="l01390"></a><a class="code" href="classlibdap_1_1Sequence.html#e924f28d4c0253a3ab8d7912358ccac2">01390</a> <a class="code" href="classlibdap_1_1Sequence.html#b9e02fc99e9739e565b4e59377acf56d">Sequence::print_val_by_rows</a>(FILE *out, <span class="keywordtype">string</span> space, <span class="keywordtype">bool</span> print_decl_p, <a name="l01391"></a>01391 <span class="keywordtype">bool</span> print_row_numbers) <a name="l01392"></a>01392 { <a name="l01393"></a>01393 <span class="keywordflow">if</span> (print_decl_p) { <a name="l01394"></a>01394 <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="l01395"></a>01395 fprintf(out, <span class="stringliteral">" = "</span>) ; <a name="l01396"></a>01396 } <a name="l01397"></a>01397 <a name="l01398"></a>01398 fprintf(out, <span class="stringliteral">"{ "</span>) ; <a name="l01399"></a>01399 <a name="l01400"></a>01400 <span class="keywordtype">int</span> rows = <a class="code" href="classlibdap_1_1Sequence.html#f2085366f0bb90822e1b85108b44df1b">number_of_rows</a>() - 1; <a name="l01401"></a>01401 <span class="keywordtype">int</span> i; <a name="l01402"></a>01402 <span class="keywordflow">for</span> (i = 0; i < rows; ++i) { <a name="l01403"></a>01403 <a class="code" href="classlibdap_1_1Sequence.html#6bbdd92e1d38e00948592b0764d859ab">print_one_row</a>(out, i, space, print_row_numbers); <a name="l01404"></a>01404 fprintf(out, <span class="stringliteral">", "</span>) ; <a name="l01405"></a>01405 } <a name="l01406"></a>01406 <a class="code" href="classlibdap_1_1Sequence.html#6bbdd92e1d38e00948592b0764d859ab">print_one_row</a>(out, i, space, print_row_numbers); <a name="l01407"></a>01407 <a name="l01408"></a>01408 fprintf(out, <span class="stringliteral">" }"</span>) ; <a name="l01409"></a>01409 <a name="l01410"></a>01410 <span class="keywordflow">if</span> (print_decl_p) <a name="l01411"></a>01411 fprintf(out, <span class="stringliteral">";\n"</span>) ; <a name="l01412"></a>01412 } <a name="l01413"></a>01413 <span class="comment">//#endif</span> <a name="l01414"></a>01414 <span class="keywordtype">void</span> <a name="l01415"></a><a class="code" href="classlibdap_1_1Sequence.html#b9e02fc99e9739e565b4e59377acf56d">01415</a> <a class="code" href="classlibdap_1_1Sequence.html#b9e02fc99e9739e565b4e59377acf56d">Sequence::print_val_by_rows</a>(ostream &out, <span class="keywordtype">string</span> space, <span class="keywordtype">bool</span> print_decl_p, <a name="l01416"></a>01416 <span class="keywordtype">bool</span> print_row_numbers) <a name="l01417"></a>01417 { <a name="l01418"></a>01418 <span class="keywordflow">if</span> (print_decl_p) { <a name="l01419"></a>01419 <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="l01420"></a>01420 out << <span class="stringliteral">" = "</span> ; <a name="l01421"></a>01421 } <a name="l01422"></a>01422 <a name="l01423"></a>01423 out << <span class="stringliteral">"{ "</span> ; <a name="l01424"></a>01424 <a name="l01425"></a>01425 <span class="keywordtype">int</span> rows = <a class="code" href="classlibdap_1_1Sequence.html#f2085366f0bb90822e1b85108b44df1b">number_of_rows</a>() - 1; <a name="l01426"></a>01426 <span class="keywordtype">int</span> i; <a name="l01427"></a>01427 <span class="keywordflow">for</span> (i = 0; i < rows; ++i) { <a name="l01428"></a>01428 <a class="code" href="classlibdap_1_1Sequence.html#6bbdd92e1d38e00948592b0764d859ab">print_one_row</a>(out, i, space, print_row_numbers); <a name="l01429"></a>01429 out << <span class="stringliteral">", "</span> ; <a name="l01430"></a>01430 } <a name="l01431"></a>01431 <a class="code" href="classlibdap_1_1Sequence.html#6bbdd92e1d38e00948592b0764d859ab">print_one_row</a>(out, i, space, print_row_numbers); <a name="l01432"></a>01432 <a name="l01433"></a>01433 out << <span class="stringliteral">" }"</span> ; <a name="l01434"></a>01434 <a name="l01435"></a>01435 <span class="keywordflow">if</span> (print_decl_p) <a name="l01436"></a>01436 out << <span class="stringliteral">";\n"</span> ; <a name="l01437"></a>01437 } <a name="l01438"></a>01438 <span class="comment">//#if FILE_METHODS</span> <a name="l01439"></a>01439 <span class="keywordtype">void</span> <a name="l01440"></a><a class="code" href="classlibdap_1_1Sequence.html#de8d2f9a5c73eafeb180fb3782a0a199">01440</a> <a class="code" href="classlibdap_1_1Sequence.html#675995a38339e5139b80a4faa1a46824" title="Prints the value of the variable.">Sequence::print_val</a>(FILE *out, <span class="keywordtype">string</span> space, <span class="keywordtype">bool</span> print_decl_p) <a name="l01441"></a>01441 { <a name="l01442"></a>01442 <a class="code" href="classlibdap_1_1Sequence.html#b9e02fc99e9739e565b4e59377acf56d">print_val_by_rows</a>(out, space, print_decl_p, <span class="keyword">false</span>); <a name="l01443"></a>01443 } <a name="l01444"></a>01444 <span class="comment">//#endif</span> <a name="l01445"></a>01445 <span class="keywordtype">void</span> <a name="l01446"></a><a class="code" href="classlibdap_1_1Sequence.html#675995a38339e5139b80a4faa1a46824">01446</a> <a class="code" href="classlibdap_1_1Sequence.html#675995a38339e5139b80a4faa1a46824" title="Prints the value of the variable.">Sequence::print_val</a>(ostream &out, <span class="keywordtype">string</span> space, <span class="keywordtype">bool</span> print_decl_p) <a name="l01447"></a>01447 { <a name="l01448"></a>01448 <a class="code" href="classlibdap_1_1Sequence.html#b9e02fc99e9739e565b4e59377acf56d">print_val_by_rows</a>(out, space, print_decl_p, <span class="keyword">false</span>); <a name="l01449"></a>01449 } <a name="l01450"></a>01450 <a name="l01451"></a>01451 <a name="l01452"></a>01452 <span class="keywordtype">bool</span> <a name="l01453"></a><a class="code" href="classlibdap_1_1Sequence.html#e1200a839ab82343c66bce65390b5ab3">01453</a> <a class="code" href="classlibdap_1_1Sequence.html#e1200a839ab82343c66bce65390b5ab3" title="Compare an object&#39;s current state with the semantics of its type.">Sequence::check_semantics</a>(<span class="keywordtype">string</span> &msg, <span class="keywordtype">bool</span> all) <a name="l01454"></a>01454 { <a name="l01455"></a>01455 <span class="keywordflow">if</span> (!<a class="code" href="classlibdap_1_1BaseType.html#ec503abec2fd3090e7738c0a575491f8" title="Compare an object&#39;s current state with the semantics of its type.">BaseType::check_semantics</a>(msg)) <a name="l01456"></a>01456 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01457"></a>01457 <a name="l01458"></a>01458 <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="l01459"></a>01459 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01460"></a>01460 <a name="l01461"></a>01461 <span class="keywordflow">if</span> (all) <a name="l01462"></a>01462 <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="l01463"></a>01463 <span class="keywordflow">if</span> (!(*i)->check_semantics(msg, <span class="keyword">true</span>)) { <a name="l01464"></a>01464 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01465"></a>01465 } <a name="l01466"></a>01466 } <a name="l01467"></a>01467 <a name="l01468"></a>01468 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l01469"></a>01469 } <a name="l01470"></a>01470 <a name="l01471"></a>01471 <span class="keywordtype">void</span> <a name="l01472"></a><a class="code" href="classlibdap_1_1Sequence.html#b6618d3ef634d6c8ace79ca030c96378">01472</a> <a class="code" href="classlibdap_1_1Sequence.html#b6618d3ef634d6c8ace79ca030c96378">Sequence::set_leaf_p</a>(<span class="keywordtype">bool</span> state) <a name="l01473"></a>01473 { <a name="l01474"></a>01474 d_leaf_sequence = state; <a name="l01475"></a>01475 } <a name="l01476"></a>01476 <a name="l01477"></a>01477 <span class="keywordtype">bool</span> <a name="l01478"></a><a class="code" href="classlibdap_1_1Sequence.html#3cb03f3ccb14372106e91461b468c1bd">01478</a> <a class="code" href="classlibdap_1_1Sequence.html#3cb03f3ccb14372106e91461b468c1bd">Sequence::is_leaf_sequence</a>() <a name="l01479"></a>01479 { <a name="l01480"></a>01480 <span class="keywordflow">return</span> d_leaf_sequence; <a name="l01481"></a>01481 } <a name="l01482"></a>01482 <a name="l01507"></a>01507 <span class="keywordtype">void</span> <a name="l01508"></a><a class="code" href="classlibdap_1_1Sequence.html#630ae5ad80cc4ddbd1c07e7cae0eec6d">01508</a> <a class="code" href="classlibdap_1_1Sequence.html#630ae5ad80cc4ddbd1c07e7cae0eec6d" title="Mark the Sequence which holds the leaf elements.">Sequence::set_leaf_sequence</a>(<span class="keywordtype">int</span> lvl) <a name="l01509"></a>01509 { <a name="l01510"></a>01510 <span class="keywordtype">bool</span> has_child_sequence = <span class="keyword">false</span>; <a name="l01511"></a>01511 <a name="l01512"></a>01512 <span class="keywordflow">if</span> (lvl == 1) d_top_most = <span class="keyword">true</span>; <a name="l01513"></a>01513 <a name="l01514"></a>01514 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">"Processing sequence "</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << endl); <a name="l01515"></a>01515 <a name="l01516"></a>01516 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1Constructor.html#2b73df890f61ebb628359c8fd12839b0">Vars_iter</a> iter = <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.begin(); iter != <a class="code" href="classlibdap_1_1Constructor.html#c9830d0abf882c915fe714e127b48b55">_vars</a>.end(); iter++) { <a name="l01517"></a>01517 <span class="comment">// About the test for send_p(): Only descend into a sequence if it has</span> <a name="l01518"></a>01518 <span class="comment">// fields that might be sent. Thus if, in a two-level sequence, nothing</span> <a name="l01519"></a>01519 <span class="comment">// in the lower level is to be sent, the upper level is marked as the</span> <a name="l01520"></a>01520 <span class="comment">// leaf sequence. This ensures that values _will_ be sent (see the comment</span> <a name="l01521"></a>01521 <span class="comment">// in serialize_leaf() and serialize_parent_part_one()).</span> <a name="l01522"></a>01522 <span class="keywordflow">if</span> ((*iter)->type() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e60b03707324b30e4a7c88876bbf8c7e3b">dods_sequence_c</a> && (*iter)->send_p()) { <a name="l01523"></a>01523 <span class="keywordflow">if</span> (has_child_sequence) <a name="l01524"></a>01524 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(<span class="stringliteral">"This implementation does not support more than one nested sequence at a level. Contact the server administrator."</span>); <a name="l01525"></a>01525 <a name="l01526"></a>01526 has_child_sequence = <span class="keyword">true</span>; <a name="l01527"></a>01527 <span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Sequence.html" title="Holds a sequence.">Sequence</a>&<span class="keyword">></span>(**iter).set_leaf_sequence(++lvl); <a name="l01528"></a>01528 } <a name="l01529"></a>01529 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((*iter)->type() == <a class="code" href="namespacelibdap.html#05ca706d4539ae7b750c3bc7066ab6e6d93eb0a69e67742f061966ce594b9a6c">dods_structure_c</a>) { <a name="l01530"></a>01530 <span class="keyword">dynamic_cast<</span><a class="code" href="classlibdap_1_1Structure.html" title="Holds a structure (aggregate) type.">Structure</a>&<span class="keyword">></span>(**iter).set_leaf_sequence(lvl); <a name="l01531"></a>01531 } <a name="l01532"></a>01532 } <a name="l01533"></a>01533 <a name="l01534"></a>01534 <span class="keywordflow">if</span> (!has_child_sequence) <a name="l01535"></a>01535 <a class="code" href="classlibdap_1_1Sequence.html#b6618d3ef634d6c8ace79ca030c96378">set_leaf_p</a>(<span class="keyword">true</span>); <a name="l01536"></a>01536 <span class="keywordflow">else</span> <a name="l01537"></a>01537 <a class="code" href="classlibdap_1_1Sequence.html#b6618d3ef634d6c8ace79ca030c96378">set_leaf_p</a>(<span class="keyword">false</span>); <a name="l01538"></a>01538 <a name="l01539"></a>01539 <a class="code" href="debug_8h.html#c1f764c266c50f0050e33557004c914c">DBG2</a>(cerr << <span class="stringliteral">"is_leaf_sequence(): "</span> << <a class="code" href="classlibdap_1_1Sequence.html#3cb03f3ccb14372106e91461b468c1bd">is_leaf_sequence</a>() << <span class="stringliteral">" ("</span> << <a class="code" href="classlibdap_1_1BaseType.html#0a0c6b5d57813607dc06255b8e0b9bdc" title="Returns the name of the class instance.">name</a>() << <span class="stringliteral">")"</span> << endl); <a name="l01540"></a>01540 } <a name="l01541"></a>01541 <a name="l01550"></a>01550 <span class="keywordtype">void</span> <a name="l01551"></a><a class="code" href="classlibdap_1_1Sequence.html#cd0961a9479c9224d7b08021bb4d0c36">01551</a> <a class="code" href="classlibdap_1_1Sequence.html#cd0961a9479c9224d7b08021bb4d0c36" title="dumps information about this object">Sequence::dump</a>(ostream &strm)<span class="keyword"> const</span> <a name="l01552"></a>01552 <span class="keyword"></span>{ <a name="l01553"></a>01553 strm << <a class="code" href="classlibdap_1_1DapIndent.html#45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"Sequence::dump - ("</span> <a name="l01554"></a>01554 << (<span class="keywordtype">void</span> *)<span class="keyword">this</span> << <span class="stringliteral">")"</span> << endl ; <a name="l01555"></a>01555 <a class="code" href="classlibdap_1_1DapIndent.html#4ed2cce66dbff9ad4320e89142103c6c">DapIndent::Indent</a>() ; <a name="l01556"></a>01556 <a class="code" href="classlibdap_1_1Sequence.html#cd0961a9479c9224d7b08021bb4d0c36" title="dumps information about this object">Constructor::dump</a>(strm) ; <a name="l01557"></a>01557 strm << <a class="code" href="classlibdap_1_1DapIndent.html#45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"# rows deserialized: "</span> << d_row_number <a name="l01558"></a>01558 << endl ; <a name="l01559"></a>01559 strm << <a class="code" href="classlibdap_1_1DapIndent.html#45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"bracket notation information:"</span> << endl ; <a name="l01560"></a>01560 DapIndent::Indent() ; <a name="l01561"></a>01561 strm << <a class="code" href="classlibdap_1_1DapIndent.html#45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"starting row #: "</span> << d_starting_row_number <a name="l01562"></a>01562 << endl ; <a name="l01563"></a>01563 strm << <a class="code" href="classlibdap_1_1DapIndent.html#45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"row stride: "</span> << d_row_stride << endl ; <a name="l01564"></a>01564 strm << <a class="code" href="classlibdap_1_1DapIndent.html#45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"ending row #: "</span> << d_ending_row_number <a name="l01565"></a>01565 << endl ; <a name="l01566"></a>01566 <a class="code" href="classlibdap_1_1DapIndent.html#65c519d0916b031bcf60ca8d26fc82f8">DapIndent::UnIndent</a>() ; <a name="l01567"></a>01567 <a name="l01568"></a>01568 strm << <a class="code" href="classlibdap_1_1DapIndent.html#45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"data been sent? "</span> << d_unsent_data << endl ; <a name="l01569"></a>01569 strm << <a class="code" href="classlibdap_1_1DapIndent.html#45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"start of instance? "</span> << d_wrote_soi << endl ; <a name="l01570"></a>01570 strm << <a class="code" href="classlibdap_1_1DapIndent.html#45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"is leaf sequence? "</span> << d_leaf_sequence <a name="l01571"></a>01571 << endl ; <a name="l01572"></a>01572 strm << <a class="code" href="classlibdap_1_1DapIndent.html#45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"top most in hierarchy? "</span> << d_top_most <a name="l01573"></a>01573 << endl ; <a name="l01574"></a>01574 <a class="code" href="classlibdap_1_1DapIndent.html#65c519d0916b031bcf60ca8d26fc82f8">DapIndent::UnIndent</a>() ; <a name="l01575"></a>01575 } <a name="l01576"></a>01576 <a name="l01577"></a>01577 } <span class="comment">// namespace libdap</span> <a name="l01578"></a>01578 </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Wed Oct 7 19:57:07 2009 for libdap++ by <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>