<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>libdap++: AttrTable.cc Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript"> $(document).ready(initResizable); </script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.3 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">libdap++ <span id="projectnumber">Updated for version 3.8.2</span></div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> </div> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> initNavTree('AttrTable_8cc.html',''); </script> <div id="doc-content"> <div class="header"> <div class="headertitle"> <h1>AttrTable.cc</h1> </div> </div> <div class="contents"> <a href="AttrTable_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">// jhrg 7/29/94</span> <a name="l00032"></a>00032 <a name="l00033"></a>00033 <span class="preprocessor">#include "<a class="code" href="config_8h.html">config.h</a>"</span> <a name="l00034"></a>00034 <a name="l00035"></a>00035 <span class="comment">// #define DODS_DEBUG</span> <a name="l00036"></a>00036 <a name="l00037"></a>00037 <span class="keyword">static</span> <span class="keywordtype">char</span> rcsid[]<a class="code" href="config_8h.html#a05e109ec893d0b12023d5b0cf4f718c4">not_used</a> = <a name="l00038"></a>00038 <span class="stringliteral">"$Id: AttrTable.cc 23473 2010-09-01 20:33:22Z mjohnson $"</span>; <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="preprocessor">#include <cassert></span> <a name="l00041"></a>00041 <a name="l00042"></a>00042 <span class="preprocessor">#include "<a class="code" href="AttrTable_8h.html">AttrTable.h</a>"</span> <a name="l00043"></a>00043 <a name="l00044"></a>00044 <span class="preprocessor">#include "<a class="code" href="util_8h.html">util.h</a>"</span> <a name="l00045"></a>00045 <span class="preprocessor">#include "<a class="code" href="escaping_8h.html">escaping.h</a>"</span> <a name="l00046"></a>00046 <a name="l00047"></a>00047 <span class="preprocessor">#include "<a class="code" href="debug_8h.html">debug.h</a>"</span> <a name="l00048"></a>00048 <a name="l00049"></a>00049 <span class="keyword">using</span> std::cerr; <a name="l00050"></a>00050 <span class="keyword">using</span> std::string; <a name="l00051"></a>00051 <span class="keyword">using</span> std::endl; <a name="l00052"></a>00052 <span class="keyword">using</span> std::vector; <a name="l00053"></a>00053 <a name="l00054"></a>00054 <span class="keyword">namespace </span>libdap { <a name="l00055"></a>00055 <a name="l00059"></a><a class="code" href="namespacelibdap.html#a84d1b6bca4eb21023f90f7b4ae6f382b">00059</a> <span class="keywordtype">string</span> <a class="code" href="namespacelibdap.html#a84d1b6bca4eb21023f90f7b4ae6f382b">AttrType_to_String</a>(<span class="keyword">const</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2a">AttrType</a> at) <a name="l00060"></a>00060 { <a name="l00061"></a>00061 <span class="keywordflow">switch</span> (at) { <a name="l00062"></a>00062 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>: <a name="l00063"></a>00063 <span class="keywordflow">return</span> <span class="stringliteral">"Container"</span>; <a name="l00064"></a>00064 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aae86f70fa90ecd95f3e0ca3413d16f34a">Attr_byte</a>: <a name="l00065"></a>00065 <span class="keywordflow">return</span> <span class="stringliteral">"Byte"</span>; <a name="l00066"></a>00066 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aafbdbc322a10942f70f23cf5436b93c3f">Attr_int16</a>: <a name="l00067"></a>00067 <span class="keywordflow">return</span> <span class="stringliteral">"Int16"</span>; <a name="l00068"></a>00068 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aac5f8b06f3bb92555ca17c7ac3a2c9acc">Attr_uint16</a>: <a name="l00069"></a>00069 <span class="keywordflow">return</span> <span class="stringliteral">"UInt16"</span>; <a name="l00070"></a>00070 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aaa9d080ef33455e44f820598bfba952ba">Attr_int32</a>: <a name="l00071"></a>00071 <span class="keywordflow">return</span> <span class="stringliteral">"Int32"</span>; <a name="l00072"></a>00072 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aaab33c61e98b52f9fd90fca55cd074923">Attr_uint32</a>: <a name="l00073"></a>00073 <span class="keywordflow">return</span> <span class="stringliteral">"UInt32"</span>; <a name="l00074"></a>00074 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa00ec5f70082c1c7c729d65d06340e708">Attr_float32</a>: <a name="l00075"></a>00075 <span class="keywordflow">return</span> <span class="stringliteral">"Float32"</span>; <a name="l00076"></a>00076 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aad0436c5332f3df3dde8f1d6bec998709">Attr_float64</a>: <a name="l00077"></a>00077 <span class="keywordflow">return</span> <span class="stringliteral">"Float64"</span>; <a name="l00078"></a>00078 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa5ab5e05bc3d3cb5ff64c0379faccd4a3">Attr_string</a>: <a name="l00079"></a>00079 <span class="keywordflow">return</span> <span class="stringliteral">"String"</span>; <a name="l00080"></a>00080 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aaab3f9f7548282b0ef0c588acef98caeb">Attr_url</a>: <a name="l00081"></a>00081 <span class="keywordflow">return</span> <span class="stringliteral">"Url"</span>; <a name="l00082"></a>00082 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aab38ca73333845a5796e061f8c2e9f8f2">Attr_other_xml</a>: <a name="l00083"></a>00083 <span class="keywordflow">return</span> <span class="stringliteral">"OtherXML"</span>; <a name="l00084"></a>00084 <span class="keywordflow">default</span>: <a name="l00085"></a>00085 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; <a name="l00086"></a>00086 } <a name="l00087"></a>00087 } <a name="l00088"></a>00088 <a name="l00089"></a><a class="code" href="namespacelibdap.html#a6d4117c49771ce2665142ff0dd9c976b">00089</a> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2a">AttrType</a> <a class="code" href="namespacelibdap.html#a6d4117c49771ce2665142ff0dd9c976b">String_to_AttrType</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &s) <a name="l00090"></a>00090 { <a name="l00091"></a>00091 <span class="keywordtype">string</span> s2 = s; <a name="l00092"></a>00092 <a class="code" href="namespacelibdap.html#a7edce266869606fc7bb46124f8d63809">downcase</a>(s2); <a name="l00093"></a>00093 <a name="l00094"></a>00094 <span class="keywordflow">if</span> (s2 == <span class="stringliteral">"container"</span>) <a name="l00095"></a>00095 <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>; <a name="l00096"></a>00096 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (s2 == <span class="stringliteral">"byte"</span>) <a name="l00097"></a>00097 <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aae86f70fa90ecd95f3e0ca3413d16f34a">Attr_byte</a>; <a name="l00098"></a>00098 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (s2 == <span class="stringliteral">"int16"</span>) <a name="l00099"></a>00099 <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aafbdbc322a10942f70f23cf5436b93c3f">Attr_int16</a>; <a name="l00100"></a>00100 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (s2 == <span class="stringliteral">"uint16"</span>) <a name="l00101"></a>00101 <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aac5f8b06f3bb92555ca17c7ac3a2c9acc">Attr_uint16</a>; <a name="l00102"></a>00102 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (s2 == <span class="stringliteral">"int32"</span>) <a name="l00103"></a>00103 <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aaa9d080ef33455e44f820598bfba952ba">Attr_int32</a>; <a name="l00104"></a>00104 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (s2 == <span class="stringliteral">"uint32"</span>) <a name="l00105"></a>00105 <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aaab33c61e98b52f9fd90fca55cd074923">Attr_uint32</a>; <a name="l00106"></a>00106 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (s2 == <span class="stringliteral">"float32"</span>) <a name="l00107"></a>00107 <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa00ec5f70082c1c7c729d65d06340e708">Attr_float32</a>; <a name="l00108"></a>00108 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (s2 == <span class="stringliteral">"float64"</span>) <a name="l00109"></a>00109 <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aad0436c5332f3df3dde8f1d6bec998709">Attr_float64</a>; <a name="l00110"></a>00110 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (s2 == <span class="stringliteral">"string"</span>) <a name="l00111"></a>00111 <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa5ab5e05bc3d3cb5ff64c0379faccd4a3">Attr_string</a>; <a name="l00112"></a>00112 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (s2 == <span class="stringliteral">"url"</span>) <a name="l00113"></a>00113 <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aaab3f9f7548282b0ef0c588acef98caeb">Attr_url</a>; <a name="l00114"></a>00114 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (s2 == <span class="stringliteral">"otherxml"</span>) <a name="l00115"></a>00115 <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aab38ca73333845a5796e061f8c2e9f8f2">Attr_other_xml</a>; <a name="l00116"></a>00116 <span class="keywordflow">else</span> <a name="l00117"></a>00117 <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa9c48931629d48c70dcd9bc21ef708308">Attr_unknown</a>; <a name="l00118"></a>00118 } <a name="l00119"></a>00119 <a name="l00122"></a><a class="code" href="classlibdap_1_1AttrTable.html#a4fa4213ffc8bd5ab96ff6ba148fd9eb1">00122</a> <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1AttrTable.html#a4fa4213ffc8bd5ab96ff6ba148fd9eb1">AttrTable::clone</a>(<span class="keyword">const</span> <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> &at) <a name="l00123"></a>00123 { <a name="l00124"></a>00124 d_name = at.d_name; <a name="l00125"></a>00125 d_is_global_attribute = at.d_is_global_attribute; <a name="l00126"></a>00126 <a name="l00127"></a>00127 <span class="comment">// Set the parent to null (no parent, not in container)</span> <a name="l00128"></a>00128 <span class="comment">// since using at.d_parent is semantically incorrect</span> <a name="l00129"></a>00129 <span class="comment">// and potentially dangerous.</span> <a name="l00130"></a>00130 d_parent = 0; <a name="l00131"></a>00131 <a name="l00132"></a>00132 <a class="code" href="classlibdap_1_1AttrTable.html#a18087581e0377a852a029d4aa9d64a1e">Attr_citer</a> i = at.attr_map.begin(); <a name="l00133"></a>00133 <a class="code" href="classlibdap_1_1AttrTable.html#a18087581e0377a852a029d4aa9d64a1e">Attr_citer</a> ie = at.attr_map.end(); <a name="l00134"></a>00134 <span class="keywordflow">for</span> (; i != ie; ++i) { <a name="l00135"></a>00135 <span class="comment">// this deep-copies containers recursively</span> <a name="l00136"></a>00136 <a class="code" href="structlibdap_1_1AttrTable_1_1entry.html">entry</a> *e = <span class="keyword">new</span> <a class="code" href="structlibdap_1_1AttrTable_1_1entry.html">entry</a>(*(*i)); <a name="l00137"></a>00137 attr_map.push_back(e); <a name="l00138"></a>00138 <a name="l00139"></a>00139 <span class="comment">// If the entry being added was a container,</span> <a name="l00140"></a>00140 <span class="comment">// set its parent to this to maintain invariant.</span> <a name="l00141"></a>00141 <span class="keywordflow">if</span> (e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a6491612f53754b89de9fc0168f800b04">type</a> == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>) { <a name="l00142"></a>00142 assert(e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a491a2518fc391fbc1b892f75a7e90797">attributes</a>); <a name="l00143"></a>00143 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a491a2518fc391fbc1b892f75a7e90797">attributes</a>->d_parent = <span class="keyword">this</span>; <a name="l00144"></a>00144 } <a name="l00145"></a>00145 } <a name="l00146"></a>00146 } <a name="l00147"></a>00147 <a name="l00151"></a><a class="code" href="classlibdap_1_1AttrTable.html#a09533d67357ad866f5e499f9eff2253e">00151</a> <a class="code" href="classlibdap_1_1AttrTable.html#a09533d67357ad866f5e499f9eff2253e">AttrTable::AttrTable</a>() <a name="l00152"></a>00152 : <a class="code" href="classlibdap_1_1DapObj.html" title="libdap base object for common functionality of libdap objects">DapObj</a>() <a name="l00153"></a>00153 , d_name(<span class="stringliteral">""</span>) <a name="l00154"></a>00154 , d_parent(0) <a name="l00155"></a>00155 , attr_map() <a name="l00156"></a>00156 , d_is_global_attribute(true) <a name="l00157"></a>00157 { <a name="l00158"></a>00158 } <a name="l00159"></a>00159 <a name="l00160"></a><a class="code" href="classlibdap_1_1AttrTable.html#a709c15ac098ebf761aafff16945eea4a">00160</a> <a class="code" href="classlibdap_1_1AttrTable.html#a09533d67357ad866f5e499f9eff2253e">AttrTable::AttrTable</a>(<span class="keyword">const</span> <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> &rhs) <a name="l00161"></a>00161 : <a class="code" href="classlibdap_1_1DapObj.html" title="libdap base object for common functionality of libdap objects">DapObj</a>() <a name="l00162"></a>00162 { <a name="l00163"></a>00163 <a class="code" href="classlibdap_1_1AttrTable.html#a4fa4213ffc8bd5ab96ff6ba148fd9eb1">clone</a>(rhs); <a name="l00164"></a>00164 } <a name="l00165"></a>00165 <a name="l00166"></a>00166 <span class="comment">// Private</span> <a name="l00167"></a>00167 <span class="keywordtype">void</span> AttrTable::delete_attr_table() <a name="l00168"></a>00168 { <a name="l00169"></a>00169 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> i = attr_map.begin(); i != attr_map.end(); ++i) { <a name="l00170"></a>00170 <span class="keyword">delete</span> *i; <a name="l00171"></a>00171 *i = 0; <a name="l00172"></a>00172 } <a name="l00173"></a>00173 attr_map.clear(); <a name="l00174"></a>00174 } <a name="l00175"></a>00175 <a name="l00176"></a><a class="code" href="classlibdap_1_1AttrTable.html#ac1a2ad7a01b70b53a0995f63649e23b7">00176</a> <a class="code" href="classlibdap_1_1AttrTable.html#ac1a2ad7a01b70b53a0995f63649e23b7">AttrTable::~AttrTable</a>() <a name="l00177"></a>00177 { <a name="l00178"></a>00178 <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Entering ~AttrTable ("</span> << <span class="keyword">this</span> << <span class="stringliteral">")"</span> << endl); <a name="l00179"></a>00179 delete_attr_table();<a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Exiting ~AttrTable"</span> << endl); <a name="l00180"></a>00180 } <a name="l00181"></a>00181 <a name="l00182"></a>00182 <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> & <a name="l00183"></a><a class="code" href="classlibdap_1_1AttrTable.html#a5110c171d6fa7911f4022145f2ad9027">00183</a> <a class="code" href="classlibdap_1_1AttrTable.html#a5110c171d6fa7911f4022145f2ad9027">AttrTable::operator=</a>(<span class="keyword">const</span> <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> &rhs) <a name="l00184"></a>00184 { <a name="l00185"></a>00185 <span class="keywordflow">if</span> (<span class="keyword">this</span> != &rhs) { <a name="l00186"></a>00186 delete_attr_table(); <a name="l00187"></a>00187 <a class="code" href="classlibdap_1_1AttrTable.html#a4fa4213ffc8bd5ab96ff6ba148fd9eb1">clone</a>(rhs); <a name="l00188"></a>00188 } <a name="l00189"></a>00189 <a name="l00190"></a>00190 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00191"></a>00191 } <a name="l00193"></a>00193 <a name="l00199"></a>00199 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a name="l00200"></a><a class="code" href="classlibdap_1_1AttrTable.html#a895e16236818e6b55790e4490cf6c2da">00200</a> <a class="code" href="classlibdap_1_1AttrTable.html#a895e16236818e6b55790e4490cf6c2da" title="Get the number of entries in this attribute table.">AttrTable::get_size</a>()<span class="keyword"> const</span> <a name="l00201"></a>00201 <span class="keyword"></span>{ <a name="l00202"></a>00202 <span class="keywordflow">return</span> attr_map.size(); <a name="l00203"></a>00203 } <a name="l00204"></a>00204 <a name="l00207"></a>00207 <span class="keywordtype">string</span> <a name="l00208"></a><a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee">00208</a> <a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">AttrTable::get_name</a>()<span class="keyword"> const</span> <a name="l00209"></a>00209 <span class="keyword"></span>{ <a name="l00210"></a>00210 <span class="keywordflow">return</span> d_name; <a name="l00211"></a>00211 } <a name="l00212"></a>00212 <a name="l00215"></a>00215 <span class="keywordtype">void</span> <a name="l00216"></a><a class="code" href="classlibdap_1_1AttrTable.html#a3d09ff6bf5a12789308b20440dcaf302">00216</a> <a class="code" href="classlibdap_1_1AttrTable.html#a3d09ff6bf5a12789308b20440dcaf302" title="Set the name of this attribute table.">AttrTable::set_name</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &n) <a name="l00217"></a>00217 { <a name="l00218"></a>00218 d_name = <a class="code" href="namespacelibdap.html#a376f9593431111a80ef78c98b8f4a0e2">www2id</a>(n); <a name="l00219"></a>00219 } <a name="l00220"></a>00220 <a name="l00238"></a>00238 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a name="l00239"></a><a class="code" href="classlibdap_1_1AttrTable.html#a7a526505d174c7a2f33e6b57761f8bc4">00239</a> <a class="code" href="classlibdap_1_1AttrTable.html#a7a526505d174c7a2f33e6b57761f8bc4" title="Add an attribute to the table.">AttrTable::append_attr</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name, <span class="keyword">const</span> <span class="keywordtype">string</span> &type, <a name="l00240"></a>00240 <span class="keyword">const</span> <span class="keywordtype">string</span> &attribute) <a name="l00241"></a>00241 { <a name="l00242"></a>00242 <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Entering AttrTable::append_attr"</span> << endl); <a name="l00243"></a>00243 <span class="keywordtype">string</span> lname = <a class="code" href="namespacelibdap.html#a376f9593431111a80ef78c98b8f4a0e2">www2id</a>(name); <a name="l00244"></a>00244 <a name="l00245"></a>00245 <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> iter = <a class="code" href="classlibdap_1_1AttrTable.html#ae7824f413ad036d91df0ef62cac14351">simple_find</a>(lname); <a name="l00246"></a>00246 <a name="l00247"></a>00247 <span class="comment">// If the types don't match OR this attribute is a container, calling</span> <a name="l00248"></a>00248 <span class="comment">// this mfunc is an error!</span> <a name="l00249"></a>00249 <span class="keywordflow">if</span> (iter != attr_map.end() && ((*iter)->type != <a class="code" href="namespacelibdap.html#a6d4117c49771ce2665142ff0dd9c976b">String_to_AttrType</a>(type))) <a name="l00250"></a>00250 <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">"An attribute called `"</span>) + name <a name="l00251"></a>00251 + <span class="keywordtype">string</span>(<span class="stringliteral">"' already exists but is of a different type"</span>)); <a name="l00252"></a>00252 <span class="keywordflow">if</span> (iter != attr_map.end() && (<a class="code" href="classlibdap_1_1AttrTable.html#a689563c3beb8e6f571387c5105821f27" title="Get the type name of an attribute within this attribute table.">get_type</a>(iter) == <span class="stringliteral">"Container"</span>)) <a name="l00253"></a>00253 <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">"An attribute called `"</span>) + name <a name="l00254"></a>00254 + <span class="keywordtype">string</span>(<span class="stringliteral">"' already exists but is a container."</span>)); <a name="l00255"></a>00255 <a name="l00256"></a>00256 <span class="keywordflow">if</span> (iter != attr_map.end()) { <span class="comment">// Must be a new attribute value; add it.</span> <a name="l00257"></a>00257 (*iter)->attr->push_back(attribute); <a name="l00258"></a>00258 <span class="keywordflow">return</span> (*iter)->attr->size(); <a name="l00259"></a>00259 } <a name="l00260"></a>00260 <span class="keywordflow">else</span> { <span class="comment">// Must be a completely new attribute; add it</span> <a name="l00261"></a>00261 <a class="code" href="structlibdap_1_1AttrTable_1_1entry.html">entry</a> *e = <span class="keyword">new</span> <a class="code" href="structlibdap_1_1AttrTable_1_1entry.html">entry</a>; <a name="l00262"></a>00262 <a name="l00263"></a>00263 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a36ed731e3d0e620c41157ee8bd96bc42">name</a> = lname; <a name="l00264"></a>00264 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a9d1e4aef0aefa68788a2c06e3072b0db">is_alias</a> = <span class="keyword">false</span>; <a name="l00265"></a>00265 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a6491612f53754b89de9fc0168f800b04">type</a> = <a class="code" href="namespacelibdap.html#a6d4117c49771ce2665142ff0dd9c976b">String_to_AttrType</a>(type); <span class="comment">// Record type using standard names.</span> <a name="l00266"></a>00266 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a09b4c87f7859554ac6390ed632f64117">attr</a> = <span class="keyword">new</span> vector<string>; <a name="l00267"></a>00267 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a09b4c87f7859554ac6390ed632f64117">attr</a>->push_back(attribute); <a name="l00268"></a>00268 <a name="l00269"></a>00269 attr_map.push_back(e); <a name="l00270"></a>00270 <a name="l00271"></a>00271 <span class="keywordflow">return</span> e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a09b4c87f7859554ac6390ed632f64117">attr</a>->size(); <span class="comment">// return the length of the attr vector</span> <a name="l00272"></a>00272 } <a name="l00273"></a>00273 } <a name="l00274"></a>00274 <a name="l00293"></a>00293 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a name="l00294"></a><a class="code" href="classlibdap_1_1AttrTable.html#a5b55410e211497f89ebcfad559920cbf">00294</a> <a class="code" href="classlibdap_1_1AttrTable.html#a7a526505d174c7a2f33e6b57761f8bc4" title="Add an attribute to the table.">AttrTable::append_attr</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name, <span class="keyword">const</span> <span class="keywordtype">string</span> &type, <a name="l00295"></a>00295 vector<string> *values) <a name="l00296"></a>00296 { <a name="l00297"></a>00297 <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Entering AttrTable::append_attr(..., vector)"</span> << endl); <a name="l00298"></a>00298 <span class="keywordtype">string</span> lname = <a class="code" href="namespacelibdap.html#a376f9593431111a80ef78c98b8f4a0e2">www2id</a>(name); <a name="l00299"></a>00299 <a name="l00300"></a>00300 <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> iter = <a class="code" href="classlibdap_1_1AttrTable.html#ae7824f413ad036d91df0ef62cac14351">simple_find</a>(lname); <a name="l00301"></a>00301 <a name="l00302"></a>00302 <span class="comment">// If the types don't match OR this attribute is a container, calling</span> <a name="l00303"></a>00303 <span class="comment">// this mfunc is an error!</span> <a name="l00304"></a>00304 <span class="keywordflow">if</span> (iter != attr_map.end() && ((*iter)->type != <a class="code" href="namespacelibdap.html#a6d4117c49771ce2665142ff0dd9c976b">String_to_AttrType</a>(type))) <a name="l00305"></a>00305 <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">"An attribute called `"</span>) + name <a name="l00306"></a>00306 + <span class="keywordtype">string</span>(<span class="stringliteral">"' already exists but is of a different type"</span>)); <a name="l00307"></a>00307 <span class="keywordflow">if</span> (iter != attr_map.end() && (<a class="code" href="classlibdap_1_1AttrTable.html#a689563c3beb8e6f571387c5105821f27" title="Get the type name of an attribute within this attribute table.">get_type</a>(iter) == <span class="stringliteral">"Container"</span>)) <a name="l00308"></a>00308 <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">"An attribute called `"</span>) + name <a name="l00309"></a>00309 + <span class="keywordtype">string</span>(<span class="stringliteral">"' already exists but is a container."</span>)); <a name="l00310"></a>00310 <a name="l00311"></a>00311 <span class="keywordflow">if</span> (iter != attr_map.end()) { <span class="comment">// Must be new attribute values; add.</span> <a name="l00312"></a>00312 vector<string>::iterator i = values->begin(); <a name="l00313"></a>00313 <span class="keywordflow">while</span> (i != values->end()) <a name="l00314"></a>00314 (*iter)->attr->push_back(*i++); <a name="l00315"></a>00315 <a name="l00316"></a>00316 <span class="keywordflow">return</span> (*iter)->attr->size(); <a name="l00317"></a>00317 } <a name="l00318"></a>00318 <span class="keywordflow">else</span> { <span class="comment">// Must be a completely new attribute; add it</span> <a name="l00319"></a>00319 <a class="code" href="structlibdap_1_1AttrTable_1_1entry.html">entry</a> *e = <span class="keyword">new</span> <a class="code" href="structlibdap_1_1AttrTable_1_1entry.html">entry</a>; <a name="l00320"></a>00320 <a name="l00321"></a>00321 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a36ed731e3d0e620c41157ee8bd96bc42">name</a> = lname; <a name="l00322"></a>00322 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a9d1e4aef0aefa68788a2c06e3072b0db">is_alias</a> = <span class="keyword">false</span>; <a name="l00323"></a>00323 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a6491612f53754b89de9fc0168f800b04">type</a> = <a class="code" href="namespacelibdap.html#a6d4117c49771ce2665142ff0dd9c976b">String_to_AttrType</a>(type); <span class="comment">// Record type using standard names.</span> <a name="l00324"></a>00324 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a09b4c87f7859554ac6390ed632f64117">attr</a> = <span class="keyword">new</span> vector<string>(*values); <a name="l00325"></a>00325 <a name="l00326"></a>00326 attr_map.push_back(e); <a name="l00327"></a>00327 <a name="l00328"></a>00328 <span class="keywordflow">return</span> e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a09b4c87f7859554ac6390ed632f64117">attr</a>->size(); <span class="comment">// return the length of the attr vector</span> <a name="l00329"></a>00329 } <a name="l00330"></a>00330 } <a name="l00331"></a>00331 <a name="l00340"></a>00340 <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> * <a name="l00341"></a><a class="code" href="classlibdap_1_1AttrTable.html#a03f3a1197f9529d4c0328830c765cfe1">00341</a> <a class="code" href="classlibdap_1_1AttrTable.html#a03f3a1197f9529d4c0328830c765cfe1" title="Add a container to the attribute table.">AttrTable::append_container</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name) <a name="l00342"></a>00342 { <a name="l00343"></a>00343 <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> *new_at = <span class="keyword">new</span> <a class="code" href="classlibdap_1_1AttrTable.html#a09533d67357ad866f5e499f9eff2253e">AttrTable</a>; <a name="l00344"></a>00344 <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> *ret = NULL; <a name="l00345"></a>00345 <span class="keywordflow">try</span> { <a name="l00346"></a>00346 ret = <a class="code" href="classlibdap_1_1AttrTable.html#a03f3a1197f9529d4c0328830c765cfe1" title="Add a container to the attribute table.">append_container</a>(new_at, name); <a name="l00347"></a>00347 } <a name="l00348"></a>00348 <span class="keywordflow">catch</span> (<a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a> &e) { <a name="l00349"></a>00349 <span class="comment">// an error occurred, attribute with that name already exists</span> <a name="l00350"></a>00350 <span class="keyword">delete</span> new_at; new_at = 0; <a name="l00351"></a>00351 <span class="keywordflow">throw</span> e; <a name="l00352"></a>00352 } <a name="l00353"></a>00353 <span class="keywordflow">return</span> ret; <a name="l00354"></a>00354 } <a name="l00355"></a>00355 <a name="l00368"></a>00368 <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> * <a name="l00369"></a><a class="code" href="classlibdap_1_1AttrTable.html#aa731fefe3e52fb193f7f2b5a39e04a4d">00369</a> <a class="code" href="classlibdap_1_1AttrTable.html#a03f3a1197f9529d4c0328830c765cfe1" title="Add a container to the attribute table.">AttrTable::append_container</a>(<a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> *at, <span class="keyword">const</span> <span class="keywordtype">string</span> &name) <a name="l00370"></a>00370 { <a name="l00371"></a>00371 <span class="keywordtype">string</span> lname = <a class="code" href="namespacelibdap.html#a376f9593431111a80ef78c98b8f4a0e2">www2id</a>(name); <a name="l00372"></a>00372 <a name="l00373"></a>00373 <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1AttrTable.html#ae7824f413ad036d91df0ef62cac14351">simple_find</a>(name) != <a class="code" href="classlibdap_1_1AttrTable.html#a543955729bad6b7a9d1d6b336596b1ba">attr_end</a>()) <a name="l00374"></a>00374 <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">"There already exists a container called `"</span>) <a name="l00375"></a>00375 + name + <span class="keywordtype">string</span>(<span class="stringliteral">"' in this attribute table."</span>)); <a name="l00376"></a>00376 <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr << <span class="stringliteral">"Setting appended attribute container name to: "</span> <a name="l00377"></a>00377 << lname << endl); <a name="l00378"></a>00378 at-><a class="code" href="classlibdap_1_1AttrTable.html#a3d09ff6bf5a12789308b20440dcaf302" title="Set the name of this attribute table.">set_name</a>(lname); <a name="l00379"></a>00379 <a name="l00380"></a>00380 <a class="code" href="structlibdap_1_1AttrTable_1_1entry.html">entry</a> *e = <span class="keyword">new</span> <a class="code" href="structlibdap_1_1AttrTable_1_1entry.html">entry</a>; <a name="l00381"></a>00381 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a36ed731e3d0e620c41157ee8bd96bc42">name</a> = lname; <a name="l00382"></a>00382 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a9d1e4aef0aefa68788a2c06e3072b0db">is_alias</a> = <span class="keyword">false</span>; <a name="l00383"></a>00383 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a6491612f53754b89de9fc0168f800b04">type</a> = <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>; <a name="l00384"></a>00384 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a491a2518fc391fbc1b892f75a7e90797">attributes</a> = at; <a name="l00385"></a>00385 <a name="l00386"></a>00386 attr_map.push_back(e); <a name="l00387"></a>00387 <a name="l00388"></a>00388 at->d_parent = <span class="keyword">this</span>; <a name="l00389"></a>00389 <a name="l00390"></a>00390 <span class="keywordflow">return</span> e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a491a2518fc391fbc1b892f75a7e90797">attributes</a>; <a name="l00391"></a>00391 } <a name="l00392"></a>00392 <a name="l00407"></a>00407 <span class="keywordtype">void</span> <a name="l00408"></a><a class="code" href="classlibdap_1_1AttrTable.html#a33653c34e856e2e5fc0578240eb7a959">00408</a> <a class="code" href="classlibdap_1_1AttrTable.html#a33653c34e856e2e5fc0578240eb7a959">AttrTable::find</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &target, <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> **at, <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> *iter) <a name="l00409"></a>00409 { <a name="l00410"></a>00410 string::size_type dotpos = target.rfind(<span class="charliteral">'.'</span>); <a name="l00411"></a>00411 <span class="keywordflow">if</span> (dotpos != string::npos) { <a name="l00412"></a>00412 <span class="keywordtype">string</span> container = target.substr(0, dotpos); <a name="l00413"></a>00413 <span class="keywordtype">string</span> field = target.substr(dotpos + 1); <a name="l00414"></a>00414 <a name="l00415"></a>00415 *at = <a class="code" href="classlibdap_1_1AttrTable.html#ae403d070910c829f74a59fbf4648588f" title="Find an attribute with a given name.">find_container</a>(container); <a name="l00416"></a>00416 <span class="keywordflow">if</span> (*at) { <a name="l00417"></a>00417 *iter = (*at)->simple_find(field); <a name="l00418"></a>00418 } <a name="l00419"></a>00419 <span class="keywordflow">else</span> { <a name="l00420"></a>00420 *iter = attr_map.end(); <a name="l00421"></a>00421 } <a name="l00422"></a>00422 } <a name="l00423"></a>00423 <span class="keywordflow">else</span> { <a name="l00424"></a>00424 *at = <a class="code" href="classlibdap_1_1AttrTable.html#aefdc93c9514013ebd644488cd8365924">recurrsive_find</a>(target, iter); <a name="l00425"></a>00425 } <a name="l00426"></a>00426 } <a name="l00427"></a>00427 <a name="l00439"></a>00439 <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> * <a name="l00440"></a><a class="code" href="classlibdap_1_1AttrTable.html#aefdc93c9514013ebd644488cd8365924">00440</a> <a class="code" href="classlibdap_1_1AttrTable.html#aefdc93c9514013ebd644488cd8365924">AttrTable::recurrsive_find</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &target, <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> *location) <a name="l00441"></a>00441 { <a name="l00442"></a>00442 <span class="comment">//*location = attr_begin();</span> <a name="l00443"></a>00443 <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> i = <a class="code" href="classlibdap_1_1AttrTable.html#a8881bb7044577dae3098f4a1d8bf4f2f">attr_begin</a>(); <a name="l00444"></a>00444 <span class="keywordflow">while</span> (i != <a class="code" href="classlibdap_1_1AttrTable.html#a543955729bad6b7a9d1d6b336596b1ba">attr_end</a>()) { <a name="l00445"></a>00445 <span class="keywordflow">if</span> (target == (*i)->name) { <a name="l00446"></a>00446 *location = i; <a name="l00447"></a>00447 <span class="keywordflow">return</span> <span class="keyword">this</span>; <a name="l00448"></a>00448 } <a name="l00449"></a>00449 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((*i)->type == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>) { <a name="l00450"></a>00450 <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> *at = (*i)->attributes-><a class="code" href="classlibdap_1_1AttrTable.html#aefdc93c9514013ebd644488cd8365924">recurrsive_find</a>(target, location); <a name="l00451"></a>00451 <span class="keywordflow">if</span> (at) <a name="l00452"></a>00452 <span class="keywordflow">return</span> at; <a name="l00453"></a>00453 } <a name="l00454"></a>00454 <a name="l00455"></a>00455 ++i; <a name="l00456"></a>00456 } <a name="l00457"></a>00457 <a name="l00458"></a>00458 *location = i; <a name="l00459"></a>00459 <span class="keywordflow">return</span> 0; <a name="l00460"></a>00460 } <a name="l00461"></a>00461 <a name="l00462"></a>00462 <span class="comment">// Made public for callers that want non-recursive find. [mjohnson 6 oct 09]</span> <a name="l00469"></a>00469 <span class="comment"></span><a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">AttrTable::Attr_iter</a> <a name="l00470"></a><a class="code" href="classlibdap_1_1AttrTable.html#ae7824f413ad036d91df0ef62cac14351">00470</a> <a class="code" href="classlibdap_1_1AttrTable.html#ae7824f413ad036d91df0ef62cac14351">AttrTable::simple_find</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &target) <a name="l00471"></a>00471 { <a name="l00472"></a>00472 <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> i; <a name="l00473"></a>00473 <span class="keywordflow">for</span> (i = attr_map.begin(); i != attr_map.end(); ++i) { <a name="l00474"></a>00474 <span class="keywordflow">if</span> (target == (*i)->name) { <a name="l00475"></a>00475 <span class="keywordflow">break</span>; <a name="l00476"></a>00476 } <a name="l00477"></a>00477 } <a name="l00478"></a>00478 <span class="keywordflow">return</span> i; <a name="l00479"></a>00479 } <a name="l00480"></a>00480 <a name="l00494"></a>00494 <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> * <a name="l00495"></a><a class="code" href="classlibdap_1_1AttrTable.html#ae403d070910c829f74a59fbf4648588f">00495</a> <a class="code" href="classlibdap_1_1AttrTable.html#ae403d070910c829f74a59fbf4648588f" title="Find an attribute with a given name.">AttrTable::find_container</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &target) <a name="l00496"></a>00496 { <a name="l00497"></a>00497 string::size_type dotpos = target.<a class="code" href="classlibdap_1_1AttrTable.html#a33653c34e856e2e5fc0578240eb7a959">find</a>(<span class="charliteral">'.'</span>); <a name="l00498"></a>00498 <span class="keywordflow">if</span> (dotpos != string::npos) { <a name="l00499"></a>00499 <span class="keywordtype">string</span> container = target.substr(0, dotpos); <a name="l00500"></a>00500 <span class="keywordtype">string</span> field = target.substr(dotpos + 1); <a name="l00501"></a>00501 <a name="l00502"></a>00502 <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> *at = <a class="code" href="classlibdap_1_1AttrTable.html#a6602967438b96bf1ba08e2b8195b9238">simple_find_container</a>(container); <a name="l00503"></a>00503 <span class="keywordflow">return</span> (at) ? at-><a class="code" href="classlibdap_1_1AttrTable.html#ae403d070910c829f74a59fbf4648588f" title="Find an attribute with a given name.">find_container</a>(field) : 0; <a name="l00504"></a>00504 } <a name="l00505"></a>00505 <span class="keywordflow">else</span> { <a name="l00506"></a>00506 <span class="keywordflow">return</span> <a class="code" href="classlibdap_1_1AttrTable.html#a6602967438b96bf1ba08e2b8195b9238">simple_find_container</a>(target); <a name="l00507"></a>00507 } <a name="l00508"></a>00508 } <a name="l00509"></a>00509 <a name="l00510"></a>00510 <span class="comment">// Made public for callers that want non-recursive find. [mjohnson 6 oct 09]</span> <a name="l00511"></a>00511 <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> * <a name="l00512"></a><a class="code" href="classlibdap_1_1AttrTable.html#a6602967438b96bf1ba08e2b8195b9238">00512</a> <a class="code" href="classlibdap_1_1AttrTable.html#a6602967438b96bf1ba08e2b8195b9238">AttrTable::simple_find_container</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &target) <a name="l00513"></a>00513 { <a name="l00514"></a>00514 <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>() == target) <a name="l00515"></a>00515 <span class="keywordflow">return</span> <span class="keyword">this</span>; <a name="l00516"></a>00516 <a name="l00517"></a>00517 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> i = attr_map.begin(); i != attr_map.end(); ++i) { <a name="l00518"></a>00518 <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1AttrTable.html#a2ca5cf1e2aa163259b00affe49547a0d">is_container</a>(i) && target == (*i)->name) { <a name="l00519"></a>00519 <span class="keywordflow">return</span> (*i)->attributes; <a name="l00520"></a>00520 } <a name="l00521"></a>00521 } <a name="l00522"></a>00522 <a name="l00523"></a>00523 <span class="keywordflow">return</span> 0; <a name="l00524"></a>00524 } <a name="l00525"></a>00525 <a name="l00533"></a>00533 <a name="l00535"></a>00535 <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> * <a name="l00536"></a><a class="code" href="classlibdap_1_1AttrTable.html#a4010172de5c41cd88f2422d5e1975522">00536</a> <a class="code" href="classlibdap_1_1AttrTable.html#a4010172de5c41cd88f2422d5e1975522" title="Get an attribute container.">AttrTable::get_attr_table</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name) <a name="l00537"></a>00537 { <a name="l00538"></a>00538 <span class="keywordflow">return</span> <a class="code" href="classlibdap_1_1AttrTable.html#ae403d070910c829f74a59fbf4648588f" title="Find an attribute with a given name.">find_container</a>(name); <a name="l00539"></a>00539 } <a name="l00540"></a>00540 <a name="l00542"></a>00542 <span class="keywordtype">string</span> <a name="l00543"></a><a class="code" href="classlibdap_1_1AttrTable.html#a689563c3beb8e6f571387c5105821f27">00543</a> <a class="code" href="classlibdap_1_1AttrTable.html#a689563c3beb8e6f571387c5105821f27" title="Get the type name of an attribute within this attribute table.">AttrTable::get_type</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name) <a name="l00544"></a>00544 { <a name="l00545"></a>00545 <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> p = <a class="code" href="classlibdap_1_1AttrTable.html#ae7824f413ad036d91df0ef62cac14351">simple_find</a>(name); <a name="l00546"></a>00546 <span class="keywordflow">return</span> (p != attr_map.end()) ? <a class="code" href="classlibdap_1_1AttrTable.html#a689563c3beb8e6f571387c5105821f27" title="Get the type name of an attribute within this attribute table.">get_type</a>(p) : (string)<span class="stringliteral">""</span>; <a name="l00547"></a>00547 } <a name="l00548"></a>00548 <a name="l00551"></a>00551 <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2a">AttrType</a> <a name="l00552"></a><a class="code" href="classlibdap_1_1AttrTable.html#aefcd82370930ba94a288f135d9417a93">00552</a> <a class="code" href="classlibdap_1_1AttrTable.html#aefcd82370930ba94a288f135d9417a93" title="Get the type of an attribute.">AttrTable::get_attr_type</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name) <a name="l00553"></a>00553 { <a name="l00554"></a>00554 <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> p = <a class="code" href="classlibdap_1_1AttrTable.html#ae7824f413ad036d91df0ef62cac14351">simple_find</a>(name); <a name="l00555"></a>00555 <span class="keywordflow">return</span> (p != attr_map.end()) ? <a class="code" href="classlibdap_1_1AttrTable.html#aefcd82370930ba94a288f135d9417a93" title="Get the type of an attribute.">get_attr_type</a>(p) : <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa9c48931629d48c70dcd9bc21ef708308">Attr_unknown</a>; <a name="l00556"></a>00556 } <a name="l00557"></a>00557 <a name="l00565"></a>00565 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a name="l00566"></a><a class="code" href="classlibdap_1_1AttrTable.html#a1c86cb6c91dfdc37b9787828dd09483c">00566</a> <a class="code" href="classlibdap_1_1AttrTable.html#a1c86cb6c91dfdc37b9787828dd09483c" title="Get the number of attributes in this container.">AttrTable::get_attr_num</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name) <a name="l00567"></a>00567 { <a name="l00568"></a>00568 <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> iter = <a class="code" href="classlibdap_1_1AttrTable.html#ae7824f413ad036d91df0ef62cac14351">simple_find</a>(name); <a name="l00569"></a>00569 <span class="keywordflow">return</span> (iter != attr_map.end()) ? <a class="code" href="classlibdap_1_1AttrTable.html#a1c86cb6c91dfdc37b9787828dd09483c" title="Get the number of attributes in this container.">get_attr_num</a>(iter) : 0; <a name="l00570"></a>00570 } <a name="l00571"></a>00571 <a name="l00584"></a>00584 vector<string> * <a name="l00585"></a><a class="code" href="classlibdap_1_1AttrTable.html#a7352d886789e9e38d530fc44c6cbef30">00585</a> <a class="code" href="classlibdap_1_1AttrTable.html#a7352d886789e9e38d530fc44c6cbef30" title="Get a vector-valued attribute.">AttrTable::get_attr_vector</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name) <a name="l00586"></a>00586 { <a name="l00587"></a>00587 <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> p = <a class="code" href="classlibdap_1_1AttrTable.html#ae7824f413ad036d91df0ef62cac14351">simple_find</a>(name); <a name="l00588"></a>00588 <span class="keywordflow">return</span> (p != attr_map.end()) ? <a class="code" href="classlibdap_1_1AttrTable.html#a7352d886789e9e38d530fc44c6cbef30" title="Get a vector-valued attribute.">get_attr_vector</a>(p) : 0; <a name="l00589"></a>00589 } <a name="l00590"></a>00590 <a name="l00607"></a>00607 <span class="keywordtype">void</span> <a name="l00608"></a><a class="code" href="classlibdap_1_1AttrTable.html#a9c8feb09ec38a783817bcd2fbd3421c8">00608</a> <a class="code" href="classlibdap_1_1AttrTable.html#a9c8feb09ec38a783817bcd2fbd3421c8" title="Deletes an attribute.">AttrTable::del_attr</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name, <span class="keywordtype">int</span> i) <a name="l00609"></a>00609 { <a name="l00610"></a>00610 <span class="keywordtype">string</span> lname = <a class="code" href="namespacelibdap.html#a376f9593431111a80ef78c98b8f4a0e2">www2id</a>(name); <a name="l00611"></a>00611 <a name="l00612"></a>00612 <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> iter = <a class="code" href="classlibdap_1_1AttrTable.html#ae7824f413ad036d91df0ef62cac14351">simple_find</a>(lname); <a name="l00613"></a>00613 <span class="keywordflow">if</span> (iter != attr_map.end()) { <a name="l00614"></a>00614 <span class="keywordflow">if</span> (i == -1) { <span class="comment">// Delete the whole attribute</span> <a name="l00615"></a>00615 <a class="code" href="structlibdap_1_1AttrTable_1_1entry.html">entry</a> *e = *iter; <a name="l00616"></a>00616 attr_map.erase(iter); <a name="l00617"></a>00617 <span class="keyword">delete</span> e; e = 0; <a name="l00618"></a>00618 } <a name="l00619"></a>00619 <span class="keywordflow">else</span> { <span class="comment">// Delete one element from attribute array</span> <a name="l00620"></a>00620 <span class="comment">// Don't try to delete elements from the vector of values if the</span> <a name="l00621"></a>00621 <span class="comment">// map is a container!</span> <a name="l00622"></a>00622 <span class="keywordflow">if</span> ((*iter)->type == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>) <a name="l00623"></a>00623 <span class="keywordflow">return</span>; <a name="l00624"></a>00624 <a name="l00625"></a>00625 vector<string> *sxp = (*iter)-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a09b4c87f7859554ac6390ed632f64117">attr</a>; <a name="l00626"></a>00626 <a name="l00627"></a>00627 assert(i >= 0 && i < (<span class="keywordtype">int</span>)sxp->size()); <a name="l00628"></a>00628 sxp->erase(sxp->begin() + i); <span class="comment">// rm the element</span> <a name="l00629"></a>00629 } <a name="l00630"></a>00630 } <a name="l00631"></a>00631 } <a name="l00632"></a>00632 <a name="l00634"></a>00634 <a name="l00639"></a>00639 <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">AttrTable::Attr_iter</a> <a name="l00640"></a><a class="code" href="classlibdap_1_1AttrTable.html#a8881bb7044577dae3098f4a1d8bf4f2f">00640</a> <a class="code" href="classlibdap_1_1AttrTable.html#a8881bb7044577dae3098f4a1d8bf4f2f">AttrTable::attr_begin</a>() <a name="l00641"></a>00641 { <a name="l00642"></a>00642 <span class="keywordflow">return</span> attr_map.begin(); <a name="l00643"></a>00643 } <a name="l00644"></a>00644 <a name="l00648"></a>00648 <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">AttrTable::Attr_iter</a> <a name="l00649"></a><a class="code" href="classlibdap_1_1AttrTable.html#a543955729bad6b7a9d1d6b336596b1ba">00649</a> <a class="code" href="classlibdap_1_1AttrTable.html#a543955729bad6b7a9d1d6b336596b1ba">AttrTable::attr_end</a>() <a name="l00650"></a>00650 { <a name="l00651"></a>00651 <span class="keywordflow">return</span> attr_map.end(); <a name="l00652"></a>00652 } <a name="l00653"></a>00653 <a name="l00662"></a>00662 <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">AttrTable::Attr_iter</a> <a name="l00663"></a><a class="code" href="classlibdap_1_1AttrTable.html#a8b9dd1020a256e884747e8ecf57c10a3">00663</a> <a class="code" href="classlibdap_1_1AttrTable.html#a8b9dd1020a256e884747e8ecf57c10a3">AttrTable::get_attr_iter</a>(<span class="keywordtype">int</span> i) <a name="l00664"></a>00664 { <a name="l00665"></a>00665 <span class="keywordflow">return</span> attr_map.begin() + i; <a name="l00666"></a>00666 } <a name="l00667"></a>00667 <a name="l00669"></a>00669 <span class="keywordtype">string</span> <a name="l00670"></a><a class="code" href="classlibdap_1_1AttrTable.html#ad7ce1789497599e99014696aa5afe736">00670</a> <a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">AttrTable::get_name</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> iter) <a name="l00671"></a>00671 { <a name="l00672"></a>00672 assert(iter != attr_map.end()); <a name="l00673"></a>00673 <a name="l00674"></a>00674 <span class="keywordflow">return</span> (*iter)->name; <a name="l00675"></a>00675 } <a name="l00676"></a>00676 <a name="l00678"></a>00678 <span class="keywordtype">bool</span> <a name="l00679"></a><a class="code" href="classlibdap_1_1AttrTable.html#a2ca5cf1e2aa163259b00affe49547a0d">00679</a> <a class="code" href="classlibdap_1_1AttrTable.html#a2ca5cf1e2aa163259b00affe49547a0d">AttrTable::is_container</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> i) <a name="l00680"></a>00680 { <a name="l00681"></a>00681 <span class="keywordflow">return</span> (*i)->type == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>; <a name="l00682"></a>00682 } <a name="l00683"></a>00683 <a name="l00689"></a>00689 <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> * <a name="l00690"></a><a class="code" href="classlibdap_1_1AttrTable.html#afd8cf7a6bf36504f48eda8a6ff11a56c">00690</a> <a class="code" href="classlibdap_1_1AttrTable.html#a4010172de5c41cd88f2422d5e1975522" title="Get an attribute container.">AttrTable::get_attr_table</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> iter) <a name="l00691"></a>00691 { <a name="l00692"></a>00692 assert(iter != attr_map.end()); <a name="l00693"></a>00693 <span class="keywordflow">return</span> (*iter)->type == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a> ? (*iter)->attributes : 0; <a name="l00694"></a>00694 } <a name="l00695"></a>00695 <a name="l00704"></a>00704 <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">AttrTable::Attr_iter</a> <a name="l00705"></a><a class="code" href="classlibdap_1_1AttrTable.html#abcdd3b10325085a3dd345343df159e48">00705</a> <a class="code" href="classlibdap_1_1AttrTable.html#abcdd3b10325085a3dd345343df159e48">AttrTable::del_attr_table</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> iter) <a name="l00706"></a>00706 { <a name="l00707"></a>00707 <span class="keywordflow">if</span> ((*iter)->type != <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>) <a name="l00708"></a>00708 <span class="keywordflow">return</span> ++iter; <a name="l00709"></a>00709 <a name="l00710"></a>00710 <span class="comment">// the caller intends to delete/reuse the contained AttrTable,</span> <a name="l00711"></a>00711 <span class="comment">// so zero it out so it doesn't get deleted before we delete the entry</span> <a name="l00712"></a>00712 <span class="comment">// [mjohnson]</span> <a name="l00713"></a>00713 <span class="keyword">struct </span><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html">entry</a>* e = *iter; <a name="l00714"></a>00714 <span class="comment">// container no longer has a parent.</span> <a name="l00715"></a>00715 <span class="keywordflow">if</span> (e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a491a2518fc391fbc1b892f75a7e90797">attributes</a>) { <a name="l00716"></a>00716 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a491a2518fc391fbc1b892f75a7e90797">attributes</a>->d_parent = 0; <a name="l00717"></a>00717 } <a name="l00718"></a>00718 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a491a2518fc391fbc1b892f75a7e90797">attributes</a> = 0; <a name="l00719"></a>00719 <span class="keyword">delete</span> e; <a name="l00720"></a>00720 <a name="l00721"></a>00721 <span class="keywordflow">return</span> attr_map.erase(iter); <a name="l00722"></a>00722 } <a name="l00723"></a>00723 <a name="l00727"></a>00727 <span class="keywordtype">string</span> <a name="l00728"></a><a class="code" href="classlibdap_1_1AttrTable.html#abfdfb5b51ff84a41596ebf0f28ca77df">00728</a> <a class="code" href="classlibdap_1_1AttrTable.html#a689563c3beb8e6f571387c5105821f27" title="Get the type name of an attribute within this attribute table.">AttrTable::get_type</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> iter) <a name="l00729"></a>00729 { <a name="l00730"></a>00730 assert(iter != attr_map.end()); <a name="l00731"></a>00731 <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#a84d1b6bca4eb21023f90f7b4ae6f382b">AttrType_to_String</a>((*iter)->type); <a name="l00732"></a>00732 } <a name="l00733"></a>00733 <a name="l00737"></a>00737 <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2a">AttrType</a> <a name="l00738"></a><a class="code" href="classlibdap_1_1AttrTable.html#a0893b78039439185dd39c69beaf0324e">00738</a> <a class="code" href="classlibdap_1_1AttrTable.html#aefcd82370930ba94a288f135d9417a93" title="Get the type of an attribute.">AttrTable::get_attr_type</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> iter) <a name="l00739"></a>00739 { <a name="l00740"></a>00740 <span class="keywordflow">return</span> (*iter)->type; <a name="l00741"></a>00741 } <a name="l00742"></a>00742 <a name="l00750"></a>00750 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a name="l00751"></a><a class="code" href="classlibdap_1_1AttrTable.html#acd12f3bd820be114b3cc3dd97aad7d89">00751</a> <a class="code" href="classlibdap_1_1AttrTable.html#a1c86cb6c91dfdc37b9787828dd09483c" title="Get the number of attributes in this container.">AttrTable::get_attr_num</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> iter) <a name="l00752"></a>00752 { <a name="l00753"></a>00753 assert(iter != attr_map.end()); <a name="l00754"></a>00754 <span class="keywordflow">return</span> ((*iter)->type == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>) <a name="l00755"></a>00755 ? (*iter)->attributes->get_size() <a name="l00756"></a>00756 : (*iter)->attr->size(); <a name="l00757"></a>00757 } <a name="l00758"></a>00758 <a name="l00775"></a>00775 <span class="keywordtype">string</span> <a name="l00776"></a><a class="code" href="classlibdap_1_1AttrTable.html#a060eb65435ff7deb0905c640f17b35dc">00776</a> <a class="code" href="classlibdap_1_1AttrTable.html#a615b618bb2333da0d7114eec2101defe">AttrTable::get_attr</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> iter, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i) <a name="l00777"></a>00777 { <a name="l00778"></a>00778 assert(iter != attr_map.end()); <a name="l00779"></a>00779 <span class="preprocessor">#if 1</span> <a name="l00780"></a>00780 <span class="preprocessor"></span> <span class="keywordflow">return</span> (*iter)->type == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a> ? (<span class="keywordtype">string</span>)<span class="stringliteral">"None"</span> : (*(*iter)->attr)[i]; <a name="l00781"></a>00781 <span class="preprocessor">#else</span> <a name="l00782"></a>00782 <span class="preprocessor"></span> <span class="keywordflow">if</span> ((*iter)->type == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>) { <a name="l00783"></a>00783 <span class="keywordflow">return</span> <span class="stringliteral">"None"</span>; <a name="l00784"></a>00784 } <a name="l00785"></a>00785 <span class="keywordflow">else</span> { <a name="l00786"></a>00786 cerr << <span class="stringliteral">"(*iter)->attr: "</span> << (*iter)->attr << endl; <a name="l00787"></a>00787 cerr << <span class="stringliteral">"(*iter)->name: "</span> << (*iter)->name << endl; <a name="l00788"></a>00788 cerr << <span class="stringliteral">"(*iter)->type: "</span> << (*iter)->type << endl; <a name="l00789"></a>00789 <span class="comment">//cerr << "get_attr: return value: [" << i << "]: " << (*(*iter)->attr)[i]<< endl;</span> <a name="l00790"></a>00790 <span class="keywordflow">if</span> ((*iter)->name == <span class="stringliteral">"SIS_ID"</span>) <a name="l00791"></a>00791 <span class="keywordflow">return</span> <span class="stringliteral">"SIS_ID_value"</span>; <a name="l00792"></a>00792 <span class="keywordflow">else</span> <a name="l00793"></a>00793 <span class="keywordflow">return</span> (*(*iter)->attr)[i]; <a name="l00794"></a>00794 } <a name="l00795"></a>00795 <span class="preprocessor">#endif</span> <a name="l00796"></a>00796 <span class="preprocessor"></span>} <a name="l00797"></a>00797 <a name="l00798"></a>00798 <span class="keywordtype">string</span> <a name="l00799"></a><a class="code" href="classlibdap_1_1AttrTable.html#a615b618bb2333da0d7114eec2101defe">00799</a> <a class="code" href="classlibdap_1_1AttrTable.html#a615b618bb2333da0d7114eec2101defe">AttrTable::get_attr</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i) <a name="l00800"></a>00800 { <a name="l00801"></a>00801 <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> p = <a class="code" href="classlibdap_1_1AttrTable.html#ae7824f413ad036d91df0ef62cac14351">simple_find</a>(name); <a name="l00802"></a>00802 <span class="keywordflow">return</span> (p != attr_map.end()) ? <a class="code" href="classlibdap_1_1AttrTable.html#a615b618bb2333da0d7114eec2101defe">get_attr</a>(p, i) : (string)<span class="stringliteral">""</span>; <a name="l00803"></a>00803 } <a name="l00804"></a>00804 <a name="l00816"></a>00816 vector<string> * <a name="l00817"></a><a class="code" href="classlibdap_1_1AttrTable.html#a19f9153c5bad64f5bc783d493ffa0733">00817</a> <a class="code" href="classlibdap_1_1AttrTable.html#a7352d886789e9e38d530fc44c6cbef30" title="Get a vector-valued attribute.">AttrTable::get_attr_vector</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> iter) <a name="l00818"></a>00818 { <a name="l00819"></a>00819 assert(iter != attr_map.end()); <a name="l00820"></a>00820 <span class="keywordflow">return</span> (*iter)->type != <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a> ? (*iter)->attr : 0; <a name="l00821"></a>00821 } <a name="l00822"></a>00822 <a name="l00823"></a>00823 <span class="keywordtype">bool</span> <a name="l00824"></a><a class="code" href="classlibdap_1_1AttrTable.html#a6923d18999608d59c02883b12cb18788">00824</a> <a class="code" href="classlibdap_1_1AttrTable.html#a2906fea416b22dcdf96df9eb5e21258a">AttrTable::is_global_attribute</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> iter) <a name="l00825"></a>00825 { <a name="l00826"></a>00826 assert(iter != attr_map.end()); <a name="l00827"></a>00827 <span class="keywordflow">if</span> ((*iter)->type == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>) <a name="l00828"></a>00828 <span class="keywordflow">return</span> (*iter)->attributes->is_global_attribute(); <a name="l00829"></a>00829 <span class="keywordflow">else</span> <a name="l00830"></a>00830 <span class="keywordflow">return</span> (*iter)->is_global; <a name="l00831"></a>00831 } <a name="l00832"></a>00832 <a name="l00833"></a>00833 <span class="keywordtype">void</span> <a name="l00834"></a><a class="code" href="classlibdap_1_1AttrTable.html#abf6da8bcff87a1976c9227f801b36d47">00834</a> <a class="code" href="classlibdap_1_1AttrTable.html#aadba23c830a02aa19c24c2a6f442dfd2">AttrTable::set_is_global_attribute</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> iter, <span class="keywordtype">bool</span> ga) <a name="l00835"></a>00835 { <a name="l00836"></a>00836 assert(iter != attr_map.end()); <a name="l00837"></a>00837 <span class="keywordflow">if</span> ((*iter)->type == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>) <a name="l00838"></a>00838 (*iter)->attributes->set_is_global_attribute(ga); <a name="l00839"></a>00839 <span class="keywordflow">else</span> <a name="l00840"></a>00840 (*iter)->is_global = ga; <a name="l00841"></a>00841 } <a name="l00842"></a>00842 <a name="l00844"></a>00844 <a name="l00845"></a>00845 <span class="comment">// Alias an attribute table. The alias should be added to this object.</span> <a name="l00851"></a>00851 <span class="comment"></span><span class="keywordtype">void</span> <a name="l00852"></a><a class="code" href="classlibdap_1_1AttrTable.html#acd28a0951ff0764a6d740fbc30d3052f">00852</a> <a class="code" href="classlibdap_1_1AttrTable.html#acd28a0951ff0764a6d740fbc30d3052f" title="Add an alias to a container held by this attribute table.">AttrTable::add_container_alias</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &name, <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> *src) <a name="l00853"></a>00853 { <a name="l00854"></a>00854 <span class="keywordtype">string</span> lname = <a class="code" href="namespacelibdap.html#a376f9593431111a80ef78c98b8f4a0e2">www2id</a>(name); <a name="l00855"></a>00855 <a name="l00856"></a>00856 <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1AttrTable.html#ae7824f413ad036d91df0ef62cac14351">simple_find</a>(lname) != <a class="code" href="classlibdap_1_1AttrTable.html#a543955729bad6b7a9d1d6b336596b1ba">attr_end</a>()) <a name="l00857"></a>00857 <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">"There already exists a container called `"</span>) <a name="l00858"></a>00858 + name + <span class="keywordtype">string</span>(<span class="stringliteral">"in this attribute table."</span>)); <a name="l00859"></a>00859 <a name="l00860"></a>00860 <a class="code" href="structlibdap_1_1AttrTable_1_1entry.html">entry</a> *e = <span class="keyword">new</span> <a class="code" href="structlibdap_1_1AttrTable_1_1entry.html">entry</a>; <a name="l00861"></a>00861 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a36ed731e3d0e620c41157ee8bd96bc42">name</a> = lname; <a name="l00862"></a>00862 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a9d1e4aef0aefa68788a2c06e3072b0db">is_alias</a> = <span class="keyword">true</span>; <a name="l00863"></a>00863 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a46aca5e9ac178e67b78059a553d67b20">aliased_to</a> = src-><a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(); <a name="l00864"></a>00864 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a6491612f53754b89de9fc0168f800b04">type</a> = <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>; <a name="l00865"></a>00865 <a name="l00866"></a>00866 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a491a2518fc391fbc1b892f75a7e90797">attributes</a> = src; <a name="l00867"></a>00867 <a name="l00868"></a>00868 attr_map.push_back(e); <a name="l00869"></a>00869 } <a name="l00870"></a>00870 <a name="l00883"></a>00883 <span class="keywordtype">void</span> <a name="l00884"></a><a class="code" href="classlibdap_1_1AttrTable.html#a77971a429d7c23360fd41a4df177489c">00884</a> <a class="code" href="classlibdap_1_1AttrTable.html#a77971a429d7c23360fd41a4df177489c" title="Add an alias for an attribute.">AttrTable::add_value_alias</a>(<a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> *das, <span class="keyword">const</span> <span class="keywordtype">string</span> &name, <a name="l00885"></a>00885 <span class="keyword">const</span> <span class="keywordtype">string</span> &source) <a name="l00886"></a>00886 { <a name="l00887"></a>00887 <span class="keywordtype">string</span> lname = <a class="code" href="namespacelibdap.html#a376f9593431111a80ef78c98b8f4a0e2">www2id</a>(name); <a name="l00888"></a>00888 <span class="keywordtype">string</span> lsource = <a class="code" href="namespacelibdap.html#a376f9593431111a80ef78c98b8f4a0e2">www2id</a>(source); <a name="l00889"></a>00889 <a name="l00890"></a>00890 <span class="comment">// find the container that holds source and its (sources's) iterator</span> <a name="l00891"></a>00891 <span class="comment">// within that container. Search at the uppermost level of the attribute</span> <a name="l00892"></a>00892 <span class="comment">// object to find values defined `above' the current container.</span> <a name="l00893"></a>00893 <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> *at; <a name="l00894"></a>00894 <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> iter; <a name="l00895"></a>00895 das-><a class="code" href="classlibdap_1_1AttrTable.html#a33653c34e856e2e5fc0578240eb7a959">find</a>(lsource, &at, &iter); <a name="l00896"></a>00896 <a name="l00897"></a>00897 <span class="comment">// If source is not found by looking at the topmost level, look in the</span> <a name="l00898"></a>00898 <span class="comment">// current table (i.e., alias z x where x is in the current container</span> <a name="l00899"></a>00899 <span class="comment">// won't be found by looking for `x' at the top level). See test case 26</span> <a name="l00900"></a>00900 <span class="comment">// in das-testsuite.</span> <a name="l00901"></a>00901 <span class="keywordflow">if</span> (!at || (iter == at-><a class="code" href="classlibdap_1_1AttrTable.html#a543955729bad6b7a9d1d6b336596b1ba">attr_end</a>()) || !*iter) { <a name="l00902"></a>00902 <a class="code" href="classlibdap_1_1AttrTable.html#a33653c34e856e2e5fc0578240eb7a959">find</a>(lsource, &at, &iter); <a name="l00903"></a>00903 <span class="keywordflow">if</span> (!at || (iter == at-><a class="code" href="classlibdap_1_1AttrTable.html#a543955729bad6b7a9d1d6b336596b1ba">attr_end</a>()) || !*iter) <a name="l00904"></a>00904 <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">"Could not find the attribute `"</span>) <a name="l00905"></a>00905 + source + <span class="keywordtype">string</span>(<span class="stringliteral">"' in the attribute object."</span>)); <a name="l00906"></a>00906 } <a name="l00907"></a>00907 <a name="l00908"></a>00908 <span class="comment">// If we've got a value to alias and it's being added at the top level of</span> <a name="l00909"></a>00909 <span class="comment">// the DAS, that's an error.</span> <a name="l00910"></a>00910 <span class="keywordflow">if</span> (at && !at-><a class="code" href="classlibdap_1_1AttrTable.html#a2ca5cf1e2aa163259b00affe49547a0d">is_container</a>(iter) && <span class="keyword">this</span> == das) <a name="l00911"></a>00911 <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">"A value cannot be aliased to the top level of the DAS;\nOnly containers may be present at that level of the DAS."</span>)); <a name="l00912"></a>00912 <a name="l00913"></a>00913 <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1AttrTable.html#ae7824f413ad036d91df0ef62cac14351">simple_find</a>(lname) != <a class="code" href="classlibdap_1_1AttrTable.html#a543955729bad6b7a9d1d6b336596b1ba">attr_end</a>()) <a name="l00914"></a>00914 <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">"There already exists a container called `"</span>) <a name="l00915"></a>00915 + name + string(<span class="stringliteral">"in this attribute table."</span>)); <a name="l00916"></a>00916 <a name="l00917"></a>00917 <a class="code" href="structlibdap_1_1AttrTable_1_1entry.html">entry</a> *e = <span class="keyword">new</span> <a class="code" href="structlibdap_1_1AttrTable_1_1entry.html">entry</a>; <a name="l00918"></a>00918 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a36ed731e3d0e620c41157ee8bd96bc42">name</a> = lname; <a name="l00919"></a>00919 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a9d1e4aef0aefa68788a2c06e3072b0db">is_alias</a> = <span class="keyword">true</span>; <a name="l00920"></a>00920 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a46aca5e9ac178e67b78059a553d67b20">aliased_to</a> = lsource; <a name="l00921"></a>00921 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a6491612f53754b89de9fc0168f800b04">type</a> = <a class="code" href="classlibdap_1_1AttrTable.html#aefcd82370930ba94a288f135d9417a93" title="Get the type of an attribute.">get_attr_type</a>(iter); <a name="l00922"></a>00922 <span class="keywordflow">if</span> (at && e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a6491612f53754b89de9fc0168f800b04">type</a> == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>) <a name="l00923"></a>00923 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a491a2518fc391fbc1b892f75a7e90797">attributes</a> = at-><a class="code" href="classlibdap_1_1AttrTable.html#a4010172de5c41cd88f2422d5e1975522" title="Get an attribute container.">get_attr_table</a>(iter); <a name="l00924"></a>00924 <span class="keywordflow">else</span> <a name="l00925"></a>00925 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a09b4c87f7859554ac6390ed632f64117">attr</a> = (*iter)->attr; <a name="l00926"></a>00926 <a name="l00927"></a>00927 attr_map.push_back(e); <a name="l00928"></a>00928 } <a name="l00929"></a>00929 <a name="l00930"></a>00930 <span class="comment">// Deprecated</span> <a name="l00949"></a>00949 <span class="comment"></span><span class="keywordtype">bool</span> <a name="l00950"></a><a class="code" href="classlibdap_1_1AttrTable.html#a2b9a67d2cc96dee860e6fb2d713a8252">00950</a> <a class="code" href="classlibdap_1_1AttrTable.html#a2b9a67d2cc96dee860e6fb2d713a8252" title="Adds an alias to the set of attributes.">AttrTable::attr_alias</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &alias, <a class="code" href="classlibdap_1_1AttrTable.html" title="Contains the attributes for a dataset.">AttrTable</a> *at, <span class="keyword">const</span> <span class="keywordtype">string</span> &name) <a name="l00951"></a>00951 { <a name="l00952"></a>00952 <a class="code" href="classlibdap_1_1AttrTable.html#a77971a429d7c23360fd41a4df177489c" title="Add an alias for an attribute.">add_value_alias</a>(at, alias, name); <a name="l00953"></a>00953 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00954"></a>00954 } <a name="l00955"></a>00955 <a name="l00963"></a>00963 <span class="keywordtype">bool</span> <a name="l00964"></a><a class="code" href="classlibdap_1_1AttrTable.html#aaf0369980f799252f9f133390c8b4d79">00964</a> <a class="code" href="classlibdap_1_1AttrTable.html#a2b9a67d2cc96dee860e6fb2d713a8252" title="Adds an alias to the set of attributes.">AttrTable::attr_alias</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &alias, <span class="keyword">const</span> <span class="keywordtype">string</span> &name) <a name="l00965"></a>00965 { <a name="l00966"></a>00966 <span class="keywordflow">return</span> <a class="code" href="classlibdap_1_1AttrTable.html#a2b9a67d2cc96dee860e6fb2d713a8252" title="Adds an alias to the set of attributes.">attr_alias</a>(alias, <span class="keyword">this</span>, name); <a name="l00967"></a>00967 } <a name="l00968"></a>00968 <a name="l00972"></a>00972 <span class="keywordtype">void</span> <a name="l00973"></a><a class="code" href="classlibdap_1_1AttrTable.html#aad6a9557cc76cfb925e55077e0470859">00973</a> <a class="code" href="classlibdap_1_1AttrTable.html#aad6a9557cc76cfb925e55077e0470859" title="Erase the attribute table.">AttrTable::erase</a>() <a name="l00974"></a>00974 { <a name="l00975"></a>00975 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> i = attr_map.begin(); i != attr_map.end(); ++i) { <a name="l00976"></a>00976 <span class="keyword">delete</span> *i; *i = 0; <a name="l00977"></a>00977 } <a name="l00978"></a>00978 <a name="l00979"></a>00979 attr_map.erase(attr_map.begin(), attr_map.end()); <a name="l00980"></a>00980 <a name="l00981"></a>00981 d_name = <span class="stringliteral">""</span>; <a name="l00982"></a>00982 } <a name="l00983"></a>00983 <a name="l00984"></a><a class="code" href="namespacelibdap.html#a867f85aa53e813ef6d0c11a5ff9588b5">00984</a> <span class="keyword">const</span> <span class="keywordtype">string</span> <a class="code" href="namespacelibdap.html#a867f85aa53e813ef6d0c11a5ff9588b5">double_quote</a> = <span class="stringliteral">"\""</span>; <a name="l00985"></a>00985 <a name="l00986"></a>00986 <span class="comment">// This is here as a result of the problem described in ticket #1163 where</span> <a name="l00987"></a>00987 <span class="comment">// the data handlers are adding quotes to string attributes so the DAS will</span> <a name="l00988"></a>00988 <span class="comment">// be printed correctly. But that has the affect of adding the quotes to the</span> <a name="l00989"></a>00989 <span class="comment">// attribute's _value_ not just it's print representation. As part of the fix</span> <a name="l00990"></a>00990 <span class="comment">// I made the code here add the quotes if the handlers are fixed (but not if</span> <a name="l00991"></a>00991 <span class="comment">// handlers are still adding them). The other part of 1163 is to fix all of</span> <a name="l00992"></a>00992 <span class="comment">// the handlers... What this fix means is that attributes whose values really</span> <a name="l00993"></a>00993 <span class="comment">// do contain bracketing quotes might be misunderstood, since we're assuming</span> <a name="l00994"></a>00994 <span class="comment">// those quotes were added by the handlers as a hack to get the output</span> <a name="l00995"></a>00995 <span class="comment">// formatting correct for the DAS. jhrg 7/30/08</span> <a name="l00996"></a>00996 <a name="l00997"></a>00997 <span class="keyword">static</span> <span class="keywordtype">void</span> <a name="l00998"></a>00998 write_string_attribute_for_das(ostream &out, <span class="keyword">const</span> <span class="keywordtype">string</span> &value, <span class="keyword">const</span> <span class="keywordtype">string</span> &term) <a name="l00999"></a>00999 { <a name="l01000"></a>01000 <span class="keywordflow">if</span> (<a class="code" href="namespacelibdap.html#af5f0e11f33c1eb25b831c02d65b2a9ee">is_quoted</a>(value)) <a name="l01001"></a>01001 out << value << term; <a name="l01002"></a>01002 <span class="keywordflow">else</span> <a name="l01003"></a>01003 out << <a class="code" href="namespacelibdap.html#a867f85aa53e813ef6d0c11a5ff9588b5">double_quote</a> << value << <a class="code" href="namespacelibdap.html#a867f85aa53e813ef6d0c11a5ff9588b5">double_quote</a> << term; <a name="l01004"></a>01004 } <a name="l01005"></a>01005 <a name="l01006"></a>01006 <span class="keyword">static</span> <span class="keywordtype">void</span> <a name="l01007"></a>01007 write_string_attribute_for_das(FILE *out, <span class="keyword">const</span> <span class="keywordtype">string</span> &value, <span class="keyword">const</span> <span class="keywordtype">string</span> &term) <a name="l01008"></a>01008 { <a name="l01009"></a>01009 <span class="keywordflow">if</span> (<a class="code" href="namespacelibdap.html#af5f0e11f33c1eb25b831c02d65b2a9ee">is_quoted</a>(value)) <a name="l01010"></a>01010 fprintf(out, <span class="stringliteral">"%s%s"</span>, value.c_str(), term.c_str()); <a name="l01011"></a>01011 <span class="keywordflow">else</span> <a name="l01012"></a>01012 fprintf(out, <span class="stringliteral">"\"%s\"%s"</span>, value.c_str(), term.c_str()); <a name="l01013"></a>01013 } <a name="l01014"></a>01014 <a name="l01015"></a>01015 <span class="comment">// Special treatment for XML: Make sure to escape double quotes when XML is</span> <a name="l01016"></a>01016 <span class="comment">// printed in a DAS.</span> <a name="l01017"></a>01017 <span class="keyword">static</span> <span class="keywordtype">void</span> <a name="l01018"></a>01018 write_xml_attribute_for_das(ostream &out, <span class="keyword">const</span> <span class="keywordtype">string</span> &value, <span class="keyword">const</span> <span class="keywordtype">string</span> &term) <a name="l01019"></a>01019 { <a name="l01020"></a>01020 <span class="keywordflow">if</span> (<a class="code" href="namespacelibdap.html#af5f0e11f33c1eb25b831c02d65b2a9ee">is_quoted</a>(value)) <a name="l01021"></a>01021 out << <a class="code" href="namespacelibdap.html#aa26bd967ca156771d2bd79db8bd3a91f">escape_double_quotes</a>(value) << term; <a name="l01022"></a>01022 <span class="keywordflow">else</span> <a name="l01023"></a>01023 out << <a class="code" href="namespacelibdap.html#a867f85aa53e813ef6d0c11a5ff9588b5">double_quote</a> << <a class="code" href="namespacelibdap.html#aa26bd967ca156771d2bd79db8bd3a91f">escape_double_quotes</a>(value) << <a class="code" href="namespacelibdap.html#a867f85aa53e813ef6d0c11a5ff9588b5">double_quote</a> << term; <a name="l01024"></a>01024 } <a name="l01025"></a>01025 <a name="l01026"></a>01026 <span class="keyword">static</span> <span class="keywordtype">void</span> <a name="l01027"></a>01027 write_xml_attribute_for_das(FILE *out, <span class="keyword">const</span> <span class="keywordtype">string</span> &value, <span class="keyword">const</span> <span class="keywordtype">string</span> &term) <a name="l01028"></a>01028 { <a name="l01029"></a>01029 <span class="keywordflow">if</span> (<a class="code" href="namespacelibdap.html#af5f0e11f33c1eb25b831c02d65b2a9ee">is_quoted</a>(value)) <a name="l01030"></a>01030 fprintf(out, <span class="stringliteral">"%s%s"</span>, <a class="code" href="namespacelibdap.html#aa26bd967ca156771d2bd79db8bd3a91f">escape_double_quotes</a>(value).c_str(), term.c_str()); <a name="l01031"></a>01031 <span class="keywordflow">else</span> <a name="l01032"></a>01032 fprintf(out, <span class="stringliteral">"\"%s\"%s"</span>, <a class="code" href="namespacelibdap.html#aa26bd967ca156771d2bd79db8bd3a91f">escape_double_quotes</a>(value).c_str(), term.c_str()); <a name="l01033"></a>01033 } <a name="l01034"></a>01034 <a name="l01037"></a>01037 <span class="keywordtype">void</span> <a name="l01038"></a><a class="code" href="classlibdap_1_1AttrTable.html#a1abee354d7f609ed55b849b0431bc48f">01038</a> <a class="code" href="classlibdap_1_1AttrTable.html#a1abee354d7f609ed55b849b0431bc48f">AttrTable::simple_print</a>(FILE *out, <span class="keywordtype">string</span> pad, <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> i, <a name="l01039"></a>01039 <span class="keywordtype">bool</span> dereference) <a name="l01040"></a>01040 { <a name="l01041"></a>01041 <span class="keywordflow">switch</span> ((*i)->type) { <a name="l01042"></a>01042 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>: <a name="l01043"></a>01043 fprintf(out, <span class="stringliteral">"%s%s {\n"</span>, pad.c_str(), <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(i)).c_str()); <a name="l01044"></a>01044 <a name="l01045"></a>01045 (*i)->attributes->print(out, pad + <span class="stringliteral">" "</span>, dereference); <a name="l01046"></a>01046 <a name="l01047"></a>01047 fprintf(out, <span class="stringliteral">"%s}\n"</span>, pad.c_str()); <a name="l01048"></a>01048 <span class="keywordflow">break</span>; <a name="l01049"></a>01049 <a name="l01050"></a>01050 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa5ab5e05bc3d3cb5ff64c0379faccd4a3">Attr_string</a>: { <a name="l01051"></a>01051 fprintf(out, <span class="stringliteral">"%s%s %s "</span>, pad.c_str(), <a class="code" href="classlibdap_1_1AttrTable.html#a689563c3beb8e6f571387c5105821f27" title="Get the type name of an attribute within this attribute table.">get_type</a>(i).c_str(), <a name="l01052"></a>01052 <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(i)).c_str()); <a name="l01053"></a>01053 <a name="l01054"></a>01054 vector<string> *sxp = (*i)->attr; <a name="l01055"></a>01055 vector<string>::iterator last = sxp->end() - 1; <a name="l01056"></a>01056 <span class="keywordflow">for</span> (vector<string>::iterator i = sxp->begin(); i != last; ++i) { <a name="l01057"></a>01057 write_string_attribute_for_das(out, *i, <span class="stringliteral">", "</span>); <a name="l01058"></a>01058 } <a name="l01059"></a>01059 write_string_attribute_for_das(out, *last, <span class="stringliteral">";\n"</span>); <a name="l01060"></a>01060 } <a name="l01061"></a>01061 <span class="keywordflow">break</span>; <a name="l01062"></a>01062 <a name="l01063"></a>01063 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aab38ca73333845a5796e061f8c2e9f8f2">Attr_other_xml</a>: { <a name="l01064"></a>01064 fprintf(out, <span class="stringliteral">"%s%s %s "</span>, pad.c_str(), <a class="code" href="classlibdap_1_1AttrTable.html#a689563c3beb8e6f571387c5105821f27" title="Get the type name of an attribute within this attribute table.">get_type</a>(i).c_str(), <a name="l01065"></a>01065 <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(i)).c_str()); <a name="l01066"></a>01066 <a name="l01067"></a>01067 vector<string> *sxp = (*i)->attr; <a name="l01068"></a>01068 vector<string>::iterator last = sxp->end() - 1; <a name="l01069"></a>01069 <span class="keywordflow">for</span> (vector<string>::iterator i = sxp->begin(); i != last; ++i) { <a name="l01070"></a>01070 write_xml_attribute_for_das(out, *i, <span class="stringliteral">", "</span>); <a name="l01071"></a>01071 } <a name="l01072"></a>01072 write_xml_attribute_for_das(out, *last, <span class="stringliteral">";\n"</span>); <a name="l01073"></a>01073 } <a name="l01074"></a>01074 <span class="keywordflow">break</span>; <a name="l01075"></a>01075 <a name="l01076"></a>01076 <span class="keywordflow">default</span>: { <a name="l01077"></a>01077 fprintf(out, <span class="stringliteral">"%s%s %s "</span>, pad.c_str(), <a class="code" href="classlibdap_1_1AttrTable.html#a689563c3beb8e6f571387c5105821f27" title="Get the type name of an attribute within this attribute table.">get_type</a>(i).c_str(), <a name="l01078"></a>01078 <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(i)).c_str()); <a name="l01079"></a>01079 <a name="l01080"></a>01080 vector<string> *sxp = (*i)->attr; <a name="l01081"></a>01081 vector<string>::iterator last = sxp->end() - 1; <a name="l01082"></a>01082 <span class="keywordflow">for</span> (vector<string>::iterator i = sxp->begin(); i != last; ++i) { <a name="l01083"></a>01083 fprintf(out, <span class="stringliteral">"%s%s"</span>, (*i).c_str(), <span class="stringliteral">", "</span>); <a name="l01084"></a>01084 } <a name="l01085"></a>01085 fprintf(out, <span class="stringliteral">"%s%s"</span>, (*last).c_str(), <span class="stringliteral">";\n"</span>); <a name="l01086"></a>01086 } <a name="l01087"></a>01087 <span class="keywordflow">break</span>; <a name="l01088"></a>01088 } <a name="l01089"></a>01089 } <a name="l01090"></a>01090 <a name="l01093"></a>01093 <span class="keywordtype">void</span> <a name="l01094"></a><a class="code" href="classlibdap_1_1AttrTable.html#ae167683da221e8d64aaf2fab58dbf22f">01094</a> <a class="code" href="classlibdap_1_1AttrTable.html#a1abee354d7f609ed55b849b0431bc48f">AttrTable::simple_print</a>(ostream &out, <span class="keywordtype">string</span> pad, <a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> i, <a name="l01095"></a>01095 <span class="keywordtype">bool</span> dereference) <a name="l01096"></a>01096 { <a name="l01097"></a>01097 <span class="keywordflow">switch</span> ((*i)->type) { <a name="l01098"></a>01098 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>: <a name="l01099"></a>01099 out << pad << <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(i)) << <span class="stringliteral">" {\n"</span>; <a name="l01100"></a>01100 <a name="l01101"></a>01101 (*i)->attributes->print(out, pad + <span class="stringliteral">" "</span>, dereference); <a name="l01102"></a>01102 <a name="l01103"></a>01103 out << pad << <span class="stringliteral">"}\n"</span>; <a name="l01104"></a>01104 <span class="keywordflow">break</span>; <a name="l01105"></a>01105 <a name="l01106"></a>01106 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa5ab5e05bc3d3cb5ff64c0379faccd4a3">Attr_string</a>: { <a name="l01107"></a>01107 out << pad << <a class="code" href="classlibdap_1_1AttrTable.html#a689563c3beb8e6f571387c5105821f27" title="Get the type name of an attribute within this attribute table.">get_type</a>(i) << <span class="stringliteral">" "</span> << <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(i)) << <span class="stringliteral">" "</span>; <a name="l01108"></a>01108 <a name="l01109"></a>01109 vector<string> *sxp = (*i)->attr; <a name="l01110"></a>01110 vector<string>::iterator last = sxp->end() - 1; <a name="l01111"></a>01111 <span class="keywordflow">for</span> (vector<string>::iterator i = sxp->begin(); i != last; ++i) { <a name="l01112"></a>01112 write_string_attribute_for_das(out, *i, <span class="stringliteral">", "</span>); <a name="l01113"></a>01113 } <a name="l01114"></a>01114 write_string_attribute_for_das(out, *last, <span class="stringliteral">";\n"</span>); <a name="l01115"></a>01115 } <a name="l01116"></a>01116 <span class="keywordflow">break</span>; <a name="l01117"></a>01117 <a name="l01118"></a>01118 <span class="keywordflow">case</span> <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aab38ca73333845a5796e061f8c2e9f8f2">Attr_other_xml</a>: { <a name="l01119"></a>01119 out << pad << <a class="code" href="classlibdap_1_1AttrTable.html#a689563c3beb8e6f571387c5105821f27" title="Get the type name of an attribute within this attribute table.">get_type</a>(i) << <span class="stringliteral">" "</span> << <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(i)) << <span class="stringliteral">" "</span>; <a name="l01120"></a>01120 <a name="l01121"></a>01121 vector<string> *sxp = (*i)->attr; <a name="l01122"></a>01122 vector<string>::iterator last = sxp->end() - 1; <a name="l01123"></a>01123 <span class="keywordflow">for</span> (vector<string>::iterator i = sxp->begin(); i != last; ++i) { <a name="l01124"></a>01124 write_xml_attribute_for_das(out, *i, <span class="stringliteral">", "</span>); <a name="l01125"></a>01125 } <a name="l01126"></a>01126 write_xml_attribute_for_das(out, *last, <span class="stringliteral">";\n"</span>); <a name="l01127"></a>01127 } <a name="l01128"></a>01128 <span class="keywordflow">break</span>; <a name="l01129"></a>01129 <a name="l01130"></a>01130 <span class="keywordflow">default</span>: { <a name="l01131"></a>01131 out << pad << <a class="code" href="classlibdap_1_1AttrTable.html#a689563c3beb8e6f571387c5105821f27" title="Get the type name of an attribute within this attribute table.">get_type</a>(i) << <span class="stringliteral">" "</span> << <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(i)) << <span class="stringliteral">" "</span>; <a name="l01132"></a>01132 <a name="l01133"></a>01133 vector<string> *sxp = (*i)->attr; <a name="l01134"></a>01134 vector<string>::iterator last = sxp->end() - 1; <a name="l01135"></a>01135 <span class="keywordflow">for</span> (vector<string>::iterator i = sxp->begin(); i != last; ++i) { <a name="l01136"></a>01136 out << *i <<<span class="stringliteral">", "</span>; <a name="l01137"></a>01137 } <a name="l01138"></a>01138 out << *last << <span class="stringliteral">";\n"</span>; <a name="l01139"></a>01139 } <a name="l01140"></a>01140 <span class="keywordflow">break</span>; <a name="l01141"></a>01141 } <a name="l01142"></a>01142 } <a name="l01143"></a>01143 <a name="l01154"></a>01154 <span class="keywordtype">void</span> <a name="l01155"></a><a class="code" href="classlibdap_1_1AttrTable.html#acc2d83b4f1c8e704a6f83ff966a999c8">01155</a> <a class="code" href="classlibdap_1_1AttrTable.html#acc2d83b4f1c8e704a6f83ff966a999c8" title="Prints the attribute table.">AttrTable::print</a>(FILE *out, <span class="keywordtype">string</span> pad, <span class="keywordtype">bool</span> dereference) <a name="l01156"></a>01156 { <a name="l01157"></a>01157 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> i = attr_map.begin(); i != attr_map.end(); ++i) { <a name="l01158"></a>01158 <span class="keywordflow">if</span> ((*i)->is_alias) { <a name="l01159"></a>01159 <span class="keywordflow">if</span> (dereference) { <a name="l01160"></a>01160 <a class="code" href="classlibdap_1_1AttrTable.html#a1abee354d7f609ed55b849b0431bc48f">simple_print</a>(out, pad, i, dereference); <a name="l01161"></a>01161 } <a name="l01162"></a>01162 <span class="keywordflow">else</span> { <a name="l01163"></a>01163 fprintf(out, <span class="stringliteral">"%sAlias %s %s;\n"</span>, <a name="l01164"></a>01164 pad.c_str(), <a name="l01165"></a>01165 <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(i)).c_str(), <a name="l01166"></a>01166 <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>((*i)->aliased_to).c_str()); <a name="l01167"></a>01167 } <a name="l01168"></a>01168 } <a name="l01169"></a>01169 <span class="keywordflow">else</span> { <a name="l01170"></a>01170 <a class="code" href="classlibdap_1_1AttrTable.html#a1abee354d7f609ed55b849b0431bc48f">simple_print</a>(out, pad, i, dereference); <a name="l01171"></a>01171 } <a name="l01172"></a>01172 } <a name="l01173"></a>01173 } <a name="l01174"></a>01174 <a name="l01185"></a>01185 <span class="keywordtype">void</span> <a name="l01186"></a><a class="code" href="classlibdap_1_1AttrTable.html#a785014928633842a93352cc05038ea38">01186</a> <a class="code" href="classlibdap_1_1AttrTable.html#acc2d83b4f1c8e704a6f83ff966a999c8" title="Prints the attribute table.">AttrTable::print</a>(ostream &out, <span class="keywordtype">string</span> pad, <span class="keywordtype">bool</span> dereference) <a name="l01187"></a>01187 { <a name="l01188"></a>01188 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> i = attr_map.begin(); i != attr_map.end(); ++i) { <a name="l01189"></a>01189 <span class="keywordflow">if</span> ((*i)->is_alias) { <a name="l01190"></a>01190 <span class="keywordflow">if</span> (dereference) { <a name="l01191"></a>01191 <a class="code" href="classlibdap_1_1AttrTable.html#a1abee354d7f609ed55b849b0431bc48f">simple_print</a>(out, pad, i, dereference); <a name="l01192"></a>01192 } <a name="l01193"></a>01193 <span class="keywordflow">else</span> { <a name="l01194"></a>01194 out << pad << <span class="stringliteral">"Alias "</span> << <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(i)) <a name="l01195"></a>01195 << <span class="stringliteral">" "</span> << <a class="code" href="namespacelibdap.html#afbd709ed83699c11234a213463d16b9c">id2www</a>((*i)->aliased_to) << <span class="stringliteral">";\n"</span>; <a name="l01196"></a>01196 } <a name="l01197"></a>01197 } <a name="l01198"></a>01198 <span class="keywordflow">else</span> { <a name="l01199"></a>01199 <a class="code" href="classlibdap_1_1AttrTable.html#a1abee354d7f609ed55b849b0431bc48f">simple_print</a>(out, pad, i, dereference); <a name="l01200"></a>01200 } <a name="l01201"></a>01201 } <a name="l01202"></a>01202 } <a name="l01203"></a>01203 <a name="l01208"></a>01208 <span class="keywordtype">void</span> <a name="l01209"></a><a class="code" href="classlibdap_1_1AttrTable.html#a5e27ea09f83831eded1b3d86de7f4534">01209</a> <a class="code" href="classlibdap_1_1AttrTable.html#a5e27ea09f83831eded1b3d86de7f4534">AttrTable::print_xml</a>(FILE *out, <span class="keywordtype">string</span> pad, <span class="keywordtype">bool</span> <span class="comment">/*constrained*/</span>) <a name="l01210"></a>01210 { <a name="l01211"></a>01211 <span class="comment">// Why this works: AttrTable is really a hacked class that used to</span> <a name="l01212"></a>01212 <span class="comment">// implement a single-level set of attributes. Containers</span> <a name="l01213"></a>01213 <span class="comment">// were added several years later by dropping in the 'entry' structure.</span> <a name="l01214"></a>01214 <span class="comment">// It's not a class in its own right; instead accessors from AttrTable</span> <a name="l01215"></a>01215 <span class="comment">// are used to access information from entry. So... the loop below</span> <a name="l01216"></a>01216 <span class="comment">// actually iterates over the entries of *this* (which is an instance of</span> <a name="l01217"></a>01217 <span class="comment">// AttrTable). A container is an entry whose sole value is an AttrTable</span> <a name="l01218"></a>01218 <span class="comment">// instance. 05/19/03 jhrg</span> <a name="l01219"></a>01219 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> i = <a class="code" href="classlibdap_1_1AttrTable.html#a8881bb7044577dae3098f4a1d8bf4f2f">attr_begin</a>(); i != <a class="code" href="classlibdap_1_1AttrTable.html#a543955729bad6b7a9d1d6b336596b1ba">attr_end</a>(); ++i) { <a name="l01220"></a>01220 <span class="keywordflow">if</span> ((*i)->is_alias) { <a name="l01221"></a>01221 fprintf(out, <span class="stringliteral">"%s<Alias name=\"%s\" Attribute=\"%s\"/>\n"</span>, <a name="l01222"></a>01222 pad.c_str(), <a class="code" href="namespacelibdap.html#a62463a13bf510db3a14c0053fea14f4d">id2xml</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(i)).c_str(), <a name="l01223"></a>01223 (*i)->aliased_to.c_str()); <a name="l01224"></a>01224 <a name="l01225"></a>01225 } <a name="l01226"></a>01226 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1AttrTable.html#a2ca5cf1e2aa163259b00affe49547a0d">is_container</a>(i)) { <a name="l01227"></a>01227 fprintf(out, <span class="stringliteral">"%s<Attribute name=\"%s\" type=\"%s\">\n"</span>, <a name="l01228"></a>01228 pad.c_str(), <a class="code" href="namespacelibdap.html#a62463a13bf510db3a14c0053fea14f4d">id2xml</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(i)).c_str(), <a name="l01229"></a>01229 <a class="code" href="classlibdap_1_1AttrTable.html#a689563c3beb8e6f571387c5105821f27" title="Get the type name of an attribute within this attribute table.">get_type</a>(i).c_str()); <a name="l01230"></a>01230 <a name="l01231"></a>01231 <a class="code" href="classlibdap_1_1AttrTable.html#a4010172de5c41cd88f2422d5e1975522" title="Get an attribute container.">get_attr_table</a>(i)-><a class="code" href="classlibdap_1_1AttrTable.html#a5e27ea09f83831eded1b3d86de7f4534">print_xml</a>(out, pad + <span class="stringliteral">" "</span><span class="comment">/*, constrained*/</span>); <a name="l01232"></a>01232 <a name="l01233"></a>01233 fprintf(out, <span class="stringliteral">"%s</Attribute>\n"</span>, pad.c_str()); <a name="l01234"></a>01234 } <a name="l01235"></a>01235 <span class="keywordflow">else</span> { <a name="l01236"></a>01236 fprintf(out, <span class="stringliteral">"%s<Attribute name=\"%s\" type=\"%s\">\n"</span>, <a name="l01237"></a>01237 pad.c_str(), <a class="code" href="namespacelibdap.html#a62463a13bf510db3a14c0053fea14f4d">id2xml</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(i)).c_str(), <a class="code" href="classlibdap_1_1AttrTable.html#a689563c3beb8e6f571387c5105821f27" title="Get the type name of an attribute within this attribute table.">get_type</a>(i).c_str()); <a name="l01238"></a>01238 <a name="l01239"></a>01239 <span class="keywordtype">string</span> value_pad = pad + <span class="stringliteral">" "</span>; <a name="l01240"></a>01240 <span class="comment">// Special handling for the OtherXML attribute type - don't escape</span> <a name="l01241"></a>01241 <span class="comment">// the XML and don't include the <value> element. Note that there</span> <a name="l01242"></a>01242 <span class="comment">// cannot be an vector of XML things as can be with the other types.</span> <a name="l01243"></a>01243 <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1AttrTable.html#aefcd82370930ba94a288f135d9417a93" title="Get the type of an attribute.">get_attr_type</a>(i) == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aab38ca73333845a5796e061f8c2e9f8f2">Attr_other_xml</a>) { <a name="l01244"></a>01244 <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1AttrTable.html#a1c86cb6c91dfdc37b9787828dd09483c" title="Get the number of attributes in this container.">get_attr_num</a>(i) != 1) <a name="l01245"></a>01245 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(<span class="stringliteral">"OtherXML attributes cannot be vector-valued."</span>); <a name="l01246"></a>01246 fprintf(out, <span class="stringliteral">"%s%s\n"</span>, value_pad.c_str(), <a class="code" href="classlibdap_1_1AttrTable.html#a615b618bb2333da0d7114eec2101defe">get_attr</a>(i, 0).c_str()); <a name="l01247"></a>01247 } <a name="l01248"></a>01248 <span class="keywordflow">else</span> { <a name="l01249"></a>01249 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> j = 0; j < <a class="code" href="classlibdap_1_1AttrTable.html#a1c86cb6c91dfdc37b9787828dd09483c" title="Get the number of attributes in this container.">get_attr_num</a>(i); ++j) { <a name="l01250"></a>01250 fprintf(out, <span class="stringliteral">"%s<value>%s</value>\n"</span>, value_pad.c_str(), <a name="l01251"></a>01251 <a class="code" href="namespacelibdap.html#a62463a13bf510db3a14c0053fea14f4d">id2xml</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a615b618bb2333da0d7114eec2101defe">get_attr</a>(i, j)).c_str()); <a name="l01252"></a>01252 } <a name="l01253"></a>01253 } <a name="l01254"></a>01254 fprintf(out, <span class="stringliteral">"%s</Attribute>\n"</span>, pad.c_str()); <a name="l01255"></a>01255 } <a name="l01256"></a>01256 } <a name="l01257"></a>01257 } <a name="l01258"></a>01258 <a name="l01263"></a>01263 <span class="keywordtype">void</span> <a name="l01264"></a><a class="code" href="classlibdap_1_1AttrTable.html#a21ee9e5f68e06fb698ef93553dcdc592">01264</a> <a class="code" href="classlibdap_1_1AttrTable.html#a5e27ea09f83831eded1b3d86de7f4534">AttrTable::print_xml</a>(ostream &out, <span class="keywordtype">string</span> pad, <span class="keywordtype">bool</span> <span class="comment">/*constrained*/</span>) <a name="l01265"></a>01265 { <a name="l01266"></a>01266 <span class="keywordflow">for</span> (<a class="code" href="classlibdap_1_1AttrTable.html#a3647edf8906b672bad7a8c5ffc81d62a">Attr_iter</a> i = <a class="code" href="classlibdap_1_1AttrTable.html#a8881bb7044577dae3098f4a1d8bf4f2f">attr_begin</a>(); i != <a class="code" href="classlibdap_1_1AttrTable.html#a543955729bad6b7a9d1d6b336596b1ba">attr_end</a>(); ++i) { <a name="l01267"></a>01267 <span class="keywordflow">if</span> ((*i)->is_alias) { <a name="l01268"></a>01268 out << pad << <span class="stringliteral">"<Alias name=\""</span> << <a class="code" href="namespacelibdap.html#a62463a13bf510db3a14c0053fea14f4d">id2xml</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(i)) <a name="l01269"></a>01269 << <span class="stringliteral">"\" Attribute=\""</span> << (*i)->aliased_to << <span class="stringliteral">"\"/>\n"</span>; <a name="l01270"></a>01270 <a name="l01271"></a>01271 } <a name="l01272"></a>01272 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1AttrTable.html#a2ca5cf1e2aa163259b00affe49547a0d">is_container</a>(i)) { <a name="l01273"></a>01273 out << pad << <span class="stringliteral">"<Attribute name=\""</span> << <a class="code" href="namespacelibdap.html#a62463a13bf510db3a14c0053fea14f4d">id2xml</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(i)) <a name="l01274"></a>01274 << <span class="stringliteral">"\" type=\""</span> << <a class="code" href="classlibdap_1_1AttrTable.html#a689563c3beb8e6f571387c5105821f27" title="Get the type name of an attribute within this attribute table.">get_type</a>(i) << <span class="stringliteral">"\">\n"</span>; <a name="l01275"></a>01275 <a name="l01276"></a>01276 <a class="code" href="classlibdap_1_1AttrTable.html#a4010172de5c41cd88f2422d5e1975522" title="Get an attribute container.">get_attr_table</a>(i)-><a class="code" href="classlibdap_1_1AttrTable.html#a5e27ea09f83831eded1b3d86de7f4534">print_xml</a>(out, pad + <span class="stringliteral">" "</span><span class="comment">/*, constrained*/</span>); <a name="l01277"></a>01277 <a name="l01278"></a>01278 out << pad << <span class="stringliteral">"</Attribute>\n"</span>; <a name="l01279"></a>01279 } <a name="l01280"></a>01280 <span class="keywordflow">else</span> { <a name="l01281"></a>01281 out << pad << <span class="stringliteral">"<Attribute name=\""</span> << <a class="code" href="namespacelibdap.html#a62463a13bf510db3a14c0053fea14f4d">id2xml</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a4c79bee34f6d3fb0947776adaa52aeee" title="Get the name of this attribute table.">get_name</a>(i)) <a name="l01282"></a>01282 << <span class="stringliteral">"\" type=\""</span> << <a class="code" href="classlibdap_1_1AttrTable.html#a689563c3beb8e6f571387c5105821f27" title="Get the type name of an attribute within this attribute table.">get_type</a>(i) << <span class="stringliteral">"\">\n"</span>; <a name="l01283"></a>01283 <a name="l01284"></a>01284 <span class="keywordtype">string</span> value_pad = pad + <span class="stringliteral">" "</span>; <a name="l01285"></a>01285 <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1AttrTable.html#aefcd82370930ba94a288f135d9417a93" title="Get the type of an attribute.">get_attr_type</a>(i) == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aab38ca73333845a5796e061f8c2e9f8f2">Attr_other_xml</a>) { <a name="l01286"></a>01286 <span class="keywordflow">if</span> (<a class="code" href="classlibdap_1_1AttrTable.html#a1c86cb6c91dfdc37b9787828dd09483c" title="Get the number of attributes in this container.">get_attr_num</a>(i) != 1) <a name="l01287"></a>01287 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(<span class="stringliteral">"OtherXML attributes cannot be vector-valued."</span>); <a name="l01288"></a>01288 out << value_pad << <a class="code" href="classlibdap_1_1AttrTable.html#a615b618bb2333da0d7114eec2101defe">get_attr</a>(i, 0) << <span class="stringliteral">"\n"</span>; <a name="l01289"></a>01289 } <a name="l01290"></a>01290 <span class="keywordflow">else</span> { <a name="l01291"></a>01291 <span class="keywordtype">string</span> value_pad = pad + <span class="stringliteral">" "</span>; <a name="l01292"></a>01292 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> j = 0; j < <a class="code" href="classlibdap_1_1AttrTable.html#a1c86cb6c91dfdc37b9787828dd09483c" title="Get the number of attributes in this container.">get_attr_num</a>(i); ++j) { <a name="l01293"></a>01293 out << value_pad << <span class="stringliteral">"<value>"</span> << <a class="code" href="namespacelibdap.html#a62463a13bf510db3a14c0053fea14f4d">id2xml</a>(<a class="code" href="classlibdap_1_1AttrTable.html#a615b618bb2333da0d7114eec2101defe">get_attr</a>(i, j)) << <span class="stringliteral">"</value>\n"</span>; <a name="l01294"></a>01294 } <a name="l01295"></a>01295 } <a name="l01296"></a>01296 out << pad << <span class="stringliteral">"</Attribute>\n"</span>; <a name="l01297"></a>01297 } <a name="l01298"></a>01298 } <a name="l01299"></a>01299 } <a name="l01300"></a>01300 <a name="l01308"></a>01308 <span class="keywordtype">void</span> <a name="l01309"></a><a class="code" href="classlibdap_1_1AttrTable.html#aa83039e176ada59b990c68b6f3c2cdb7">01309</a> <a class="code" href="classlibdap_1_1AttrTable.html#aa83039e176ada59b990c68b6f3c2cdb7" title="dumps information about this object">AttrTable::dump</a>(ostream &strm)<span class="keyword"> const</span> <a name="l01310"></a>01310 <span class="keyword"></span>{ <a name="l01311"></a>01311 strm << <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"AttrTable::dump - ("</span> <a name="l01312"></a>01312 << (<span class="keywordtype">void</span> *)<span class="keyword">this</span> << <span class="stringliteral">")"</span> << endl; <a name="l01313"></a>01313 <a class="code" href="classlibdap_1_1DapIndent.html#a4ed2cce66dbff9ad4320e89142103c6c">DapIndent::Indent</a>(); <a name="l01314"></a>01314 strm << <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"table name: "</span> << d_name << endl; <a name="l01315"></a>01315 <span class="keywordflow">if</span> (attr_map.size()) { <a name="l01316"></a>01316 strm << <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"attributes: "</span> << endl; <a name="l01317"></a>01317 DapIndent::Indent(); <a name="l01318"></a>01318 <a class="code" href="classlibdap_1_1AttrTable.html#a18087581e0377a852a029d4aa9d64a1e">Attr_citer</a> i = attr_map.begin(); <a name="l01319"></a>01319 <a class="code" href="classlibdap_1_1AttrTable.html#a18087581e0377a852a029d4aa9d64a1e">Attr_citer</a> ie = attr_map.end(); <a name="l01320"></a>01320 <span class="keywordflow">for</span> (; i != ie; ++i) { <a name="l01321"></a>01321 <a class="code" href="structlibdap_1_1AttrTable_1_1entry.html">entry</a> *e = (*i); <a name="l01322"></a>01322 <span class="keywordtype">string</span> type = <a class="code" href="namespacelibdap.html#a84d1b6bca4eb21023f90f7b4ae6f382b">AttrType_to_String</a>(e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a6491612f53754b89de9fc0168f800b04">type</a>); <a name="l01323"></a>01323 <span class="keywordflow">if</span> (e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a9d1e4aef0aefa68788a2c06e3072b0db">is_alias</a>) { <a name="l01324"></a>01324 strm << <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"alias: "</span> << e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a36ed731e3d0e620c41157ee8bd96bc42">name</a> <a name="l01325"></a>01325 << <span class="stringliteral">" aliased to: "</span> << e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a46aca5e9ac178e67b78059a553d67b20">aliased_to</a> <a name="l01326"></a>01326 << endl; <a name="l01327"></a>01327 } <a name="l01328"></a>01328 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a6491612f53754b89de9fc0168f800b04">type</a> == <a class="code" href="namespacelibdap.html#ae4f907cc24469ce7b0fef9e3d7758d2aa0f1d4f1e70981b989c7753420cc2233d">Attr_container</a>) { <a name="l01329"></a>01329 strm << <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"attr: "</span> << e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a36ed731e3d0e620c41157ee8bd96bc42">name</a> <a name="l01330"></a>01330 << <span class="stringliteral">" of type "</span> << type <a name="l01331"></a>01331 << endl; <a name="l01332"></a>01332 DapIndent::Indent(); <a name="l01333"></a>01333 e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a491a2518fc391fbc1b892f75a7e90797">attributes</a>-><a class="code" href="classlibdap_1_1AttrTable.html#aa83039e176ada59b990c68b6f3c2cdb7" title="dumps information about this object">dump</a>(strm); <a name="l01334"></a>01334 <a class="code" href="classlibdap_1_1DapIndent.html#a65c519d0916b031bcf60ca8d26fc82f8">DapIndent::UnIndent</a>(); <a name="l01335"></a>01335 } <a name="l01336"></a>01336 <span class="keywordflow">else</span> { <a name="l01337"></a>01337 strm << <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"attr: "</span> << e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a36ed731e3d0e620c41157ee8bd96bc42">name</a> <a name="l01338"></a>01338 << <span class="stringliteral">" of type "</span> << type <a name="l01339"></a>01339 << endl; <a name="l01340"></a>01340 DapIndent::Indent(); <a name="l01341"></a>01341 strm << <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a>; <a name="l01342"></a>01342 vector<string>::const_iterator iter = e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a09b4c87f7859554ac6390ed632f64117">attr</a>->begin(); <a name="l01343"></a>01343 vector<string>::const_iterator last = e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a09b4c87f7859554ac6390ed632f64117">attr</a>->end() - 1; <a name="l01344"></a>01344 <span class="keywordflow">for</span> (; iter != last; iter++) { <a name="l01345"></a>01345 strm << (*iter) << <span class="stringliteral">", "</span>; <a name="l01346"></a>01346 } <a name="l01347"></a>01347 strm << (*(e-><a class="code" href="structlibdap_1_1AttrTable_1_1entry.html#a09b4c87f7859554ac6390ed632f64117">attr</a>->end() - 1)) << endl; <a name="l01348"></a>01348 <a class="code" href="classlibdap_1_1DapIndent.html#a65c519d0916b031bcf60ca8d26fc82f8">DapIndent::UnIndent</a>(); <a name="l01349"></a>01349 } <a name="l01350"></a>01350 } <a name="l01351"></a>01351 <a class="code" href="classlibdap_1_1DapIndent.html#a65c519d0916b031bcf60ca8d26fc82f8">DapIndent::UnIndent</a>(); <a name="l01352"></a>01352 } <a name="l01353"></a>01353 <span class="keywordflow">else</span> { <a name="l01354"></a>01354 strm << <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"attributes: empty"</span> << endl; <a name="l01355"></a>01355 } <a name="l01356"></a>01356 <span class="keywordflow">if</span> (d_parent) { <a name="l01357"></a>01357 strm << <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"parent table:"</span> <a name="l01358"></a>01358 << d_name << <span class="stringliteral">":"</span> << (<span class="keywordtype">void</span> *)d_parent << endl; <a name="l01359"></a>01359 } <a name="l01360"></a>01360 <span class="keywordflow">else</span> { <a name="l01361"></a>01361 strm << <a class="code" href="classlibdap_1_1DapIndent.html#a45ca36e552f70fbdbca0599da4320aab">DapIndent::LMarg</a> << <span class="stringliteral">"parent table: none"</span> << d_name << endl; <a name="l01362"></a>01362 } <a name="l01363"></a>01363 <a class="code" href="classlibdap_1_1DapIndent.html#a65c519d0916b031bcf60ca8d26fc82f8">DapIndent::UnIndent</a>(); <a name="l01364"></a>01364 } <a name="l01365"></a>01365 <a name="l01366"></a>01366 } <span class="comment">// namespace libdap</span> <a name="l01367"></a>01367 </pre></div></div> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="AttrTable_8cc.html">AttrTable.cc</a> </li> <li class="footer">Generated on Tue Feb 8 2011 for libdap++ by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li> </ul> </div> </body> </html>