<!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>Atlas-C++: Element.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.4 --> <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">Atlas-C++</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="modules.html"><span>Modules</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> </ul> </div> <div class="header"> <div class="headertitle"> <div class="title">Element.h</div> </div> </div> <div class="contents"> <div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// This file may be redistributed and modified only under the terms of</span> <a name="l00002"></a>00002 <span class="comment">// the GNU Lesser General Public License (See COPYING for details).</span> <a name="l00003"></a>00003 <span class="comment">// Copyright (C) 2000-2001 Stefanus Du Toit, Karsten-O. Laux and Al Riddoch</span> <a name="l00004"></a>00004 <a name="l00005"></a>00005 <span class="comment">// $Id$</span> <a name="l00006"></a>00006 <a name="l00007"></a>00007 <span class="preprocessor">#ifndef ATLAS_MESSAGE_ELEMENT_H</span> <a name="l00008"></a>00008 <span class="preprocessor"></span><span class="preprocessor">#define ATLAS_MESSAGE_ELEMENT_H</span> <a name="l00009"></a>00009 <span class="preprocessor"></span> <a name="l00010"></a>00010 <span class="preprocessor">#include <Atlas/Exception.h></span> <a name="l00011"></a>00011 <a name="l00012"></a>00012 <span class="preprocessor">#include <string></span> <a name="l00013"></a>00013 <span class="preprocessor">#include <map></span> <a name="l00014"></a>00014 <span class="preprocessor">#include <vector></span> <a name="l00015"></a>00015 <a name="l00016"></a>00016 <span class="keyword">namespace </span>Atlas { <span class="keyword">namespace </span>Message { <a name="l00017"></a>00017 <a name="l00019"></a><a class="code" href="class_atlas_1_1_message_1_1_wrong_type_exception.html">00019</a> <span class="keyword">class </span><a class="code" href="class_atlas_1_1_message_1_1_wrong_type_exception.html" title="An exception class issued when the wrong type is requested in as().">WrongTypeException</a> : <span class="keyword">public</span> Atlas::<a class="code" href="class_atlas_1_1_exception.html" title="Base class for all exceptions thrown by Atlas-C++.">Exception</a> <a name="l00020"></a>00020 { <a name="l00021"></a>00021 <span class="keyword">public</span>: <a name="l00022"></a>00022 <a class="code" href="class_atlas_1_1_message_1_1_wrong_type_exception.html" title="An exception class issued when the wrong type is requested in as().">WrongTypeException</a>() : <a class="code" href="class_atlas_1_1_exception.html" title="Base class for all exceptions thrown by Atlas-C++.">Atlas::Exception</a>(<span class="stringliteral">"Wrong Message::Element type"</span>) { } <a name="l00023"></a>00023 }; <a name="l00024"></a>00024 <a name="l00025"></a>00025 <span class="keyword">class </span><a class="code" href="class_atlas_1_1_message_1_1_element.html" title="Multi-type container.">Element</a>; <a name="l00026"></a>00026 <a name="l00027"></a>00027 <span class="keyword">typedef</span> <span class="keywordtype">long</span> IntType; <a name="l00028"></a>00028 <span class="keyword">typedef</span> <span class="keywordtype">double</span> FloatType; <a name="l00029"></a>00029 <span class="keyword">typedef</span> <span class="keywordtype">void</span> * PtrType; <a name="l00030"></a>00030 <span class="keyword">typedef</span> std::string StringType; <a name="l00031"></a>00031 <span class="keyword">typedef</span> std::map<std::string, Element> MapType; <a name="l00032"></a>00032 <span class="keyword">typedef</span> std::vector<Element> ListType; <a name="l00033"></a>00033 <a name="l00059"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html">00059</a> <span class="keyword">class </span><a class="code" href="class_atlas_1_1_message_1_1_element.html" title="Multi-type container.">Element</a> <a name="l00060"></a>00060 { <a name="l00061"></a>00061 <span class="keyword">public</span>: <a name="l00062"></a>00062 <span class="keyword">enum</span> Type { <a name="l00063"></a>00063 TYPE_NONE, <a name="l00064"></a>00064 TYPE_INT, <a name="l00065"></a>00065 TYPE_FLOAT, <a name="l00066"></a>00066 TYPE_PTR, <a name="l00067"></a>00067 TYPE_STRING, <a name="l00068"></a>00068 TYPE_MAP, <a name="l00069"></a>00069 TYPE_LIST <a name="l00070"></a>00070 }; <a name="l00071"></a>00071 <a name="l00072"></a>00072 <span class="keyword">private</span>: <a name="l00073"></a>00073 <span class="comment">// These are now legacy typedefs. New code should use the</span> <a name="l00074"></a>00074 <span class="comment">// Atlas::Message::*Type versions.</span> <a name="l00075"></a>00075 <span class="keyword">typedef</span> Atlas::Message::IntType IntType; <a name="l00076"></a>00076 <span class="keyword">typedef</span> Atlas::Message::FloatType FloatType; <a name="l00077"></a>00077 <span class="keyword">typedef</span> Atlas::Message::PtrType PtrType; <a name="l00078"></a>00078 <span class="keyword">typedef</span> Atlas::Message::StringType StringType; <a name="l00079"></a>00079 <span class="keyword">typedef</span> Atlas::Message::MapType MapType; <a name="l00080"></a>00080 <span class="keyword">typedef</span> Atlas::Message::ListType ListType; <a name="l00081"></a>00081 <a name="l00083"></a>00083 <span class="keywordtype">void</span> clear(Type new_type = TYPE_NONE); <a name="l00084"></a>00084 <a name="l00085"></a>00085 <span class="keyword">public</span>: <a name="l00087"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6">00087</a> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>() <a name="l00088"></a>00088 : t(TYPE_NONE) <a name="l00089"></a>00089 { <a name="l00090"></a>00090 } <a name="l00091"></a>00091 <a name="l00093"></a>00093 ~<a class="code" href="class_atlas_1_1_message_1_1_element.html" title="Multi-type container.">Element</a>() <a name="l00094"></a>00094 { <a name="l00095"></a>00095 clear(); <a name="l00096"></a>00096 } <a name="l00097"></a>00097 <a name="l00099"></a>00099 <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>(<span class="keyword">const</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>& obj); <a name="l00100"></a>00100 <a name="l00102"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a4be54f577f2dc6abbc1b179dad555832">00102</a> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>(<span class="keywordtype">int</span> v) <a name="l00103"></a>00103 : t(TYPE_INT), i(v) <a name="l00104"></a>00104 { <a name="l00105"></a>00105 } <a name="l00106"></a>00106 <a name="l00108"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a17f78e2b9ca63006ff0bae3dc5186513">00108</a> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>(<span class="keywordtype">bool</span> v) <a name="l00109"></a>00109 : t(TYPE_INT), i(v) <a name="l00110"></a>00110 { <a name="l00111"></a>00111 } <a name="l00112"></a>00112 <a name="l00114"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a050c6ea9c21a842543e6d595bfbaa330">00114</a> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>(IntType v) <a name="l00115"></a>00115 : t(TYPE_INT), i(v) <a name="l00116"></a>00116 { <a name="l00117"></a>00117 } <a name="l00118"></a>00118 <a name="l00120"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#aab6a6ba79132ac7377484363dca318aa">00120</a> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>(<span class="keywordtype">float</span> v) <a name="l00121"></a>00121 : t(TYPE_FLOAT), f(v) <a name="l00122"></a>00122 { <a name="l00123"></a>00123 } <a name="l00124"></a>00124 <a name="l00126"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a0d7c50947cc213c6bae6d1b4ba1365c9">00126</a> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>(FloatType v) <a name="l00127"></a>00127 : t(TYPE_FLOAT), f(v) <a name="l00128"></a>00128 { <a name="l00129"></a>00129 } <a name="l00130"></a>00130 <a name="l00132"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a612a6f4b1a10d1245bf3848627da5cc2">00132</a> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>(PtrType v) <a name="l00133"></a>00133 : t(TYPE_PTR), p(v) <a name="l00134"></a>00134 { <a name="l00135"></a>00135 } <a name="l00136"></a>00136 <a name="l00138"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a3e2c6b6ef7538df1422d0abfb6485c05">00138</a> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* v) <a name="l00139"></a>00139 : t(TYPE_STRING) <a name="l00140"></a>00140 { <a name="l00141"></a>00141 <span class="keywordflow">if</span>(v) <a name="l00142"></a>00142 s = <span class="keyword">new</span> <a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType<StringType></a>(v); <a name="l00143"></a>00143 <span class="keywordflow">else</span> <a name="l00144"></a>00144 s = <span class="keyword">new</span> <a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType<StringType></a>(); <a name="l00145"></a>00145 } <a name="l00146"></a>00146 <a name="l00148"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a06d477c06eea8f3c5d3df5d69e055a14">00148</a> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>(<span class="keyword">const</span> StringType& v) <a name="l00149"></a>00149 : t(TYPE_STRING) <a name="l00150"></a>00150 { <a name="l00151"></a>00151 s = <span class="keyword">new</span> <a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType<StringType></a>(v); <a name="l00152"></a>00152 } <a name="l00154"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#ae7e30d1975ef9f971f057a42628cae25">00154</a> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>(<span class="keyword">const</span> MapType& v) <a name="l00155"></a>00155 : t(TYPE_MAP) <a name="l00156"></a>00156 { <a name="l00157"></a>00157 m = <span class="keyword">new</span> <a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType<MapType></a>(v); <a name="l00158"></a>00158 } <a name="l00160"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#aabf8cd76bd2736f16ae725313e1a0f78">00160</a> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>(<span class="keyword">const</span> ListType& v) <a name="l00161"></a>00161 : t(TYPE_LIST) <a name="l00162"></a>00162 { <a name="l00163"></a>00163 l = <span class="keyword">new</span> <a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType<ListType></a>(v); <a name="l00164"></a>00164 } <a name="l00165"></a>00165 <a name="l00167"></a>00167 <a class="code" href="class_atlas_1_1_message_1_1_element.html" title="Multi-type container.">Element</a>& <a class="code" href="class_atlas_1_1_message_1_1_element.html#a8c2f3ffe8b8d0eab5974a1a9a1ca5dc1" title="overload assignment operator !">operator=</a>(<span class="keyword">const</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html" title="Multi-type container.">Element</a>& obj); <a name="l00168"></a>00168 <a name="l00169"></a>00169 <a class="code" href="class_atlas_1_1_message_1_1_element.html" title="Multi-type container.">Element</a>& <a class="code" href="class_atlas_1_1_message_1_1_element.html#a8c2f3ffe8b8d0eab5974a1a9a1ca5dc1" title="overload assignment operator !">operator=</a>(<span class="keywordtype">int</span> v) <a name="l00170"></a>00170 { <a name="l00171"></a>00171 <span class="keywordflow">if</span> (TYPE_INT != t) <a name="l00172"></a>00172 { <a name="l00173"></a>00173 clear(TYPE_INT); <a name="l00174"></a>00174 } <a name="l00175"></a>00175 i = v; <a name="l00176"></a>00176 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00177"></a>00177 } <a name="l00178"></a>00178 <a name="l00179"></a>00179 <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>& <a class="code" href="class_atlas_1_1_message_1_1_element.html#a8c2f3ffe8b8d0eab5974a1a9a1ca5dc1" title="overload assignment operator !">operator=</a>(<span class="keywordtype">bool</span> v) <a name="l00180"></a>00180 { <a name="l00181"></a>00181 <span class="keywordflow">if</span> (TYPE_INT != t) <a name="l00182"></a>00182 { <a name="l00183"></a>00183 clear(TYPE_INT); <a name="l00184"></a>00184 } <a name="l00185"></a>00185 i = v; <a name="l00186"></a>00186 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00187"></a>00187 } <a name="l00188"></a>00188 <a name="l00189"></a>00189 <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>& <a class="code" href="class_atlas_1_1_message_1_1_element.html#a8c2f3ffe8b8d0eab5974a1a9a1ca5dc1" title="overload assignment operator !">operator=</a>(IntType v) <a name="l00190"></a>00190 { <a name="l00191"></a>00191 <span class="keywordflow">if</span> (TYPE_INT != t) <a name="l00192"></a>00192 { <a name="l00193"></a>00193 clear(TYPE_INT); <a name="l00194"></a>00194 } <a name="l00195"></a>00195 i = v; <a name="l00196"></a>00196 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00197"></a>00197 } <a name="l00198"></a>00198 <a name="l00199"></a>00199 <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>& <a class="code" href="class_atlas_1_1_message_1_1_element.html#a8c2f3ffe8b8d0eab5974a1a9a1ca5dc1" title="overload assignment operator !">operator=</a>(<span class="keywordtype">float</span> v) <a name="l00200"></a>00200 { <a name="l00201"></a>00201 <span class="keywordflow">if</span> (TYPE_FLOAT != t) <a name="l00202"></a>00202 { <a name="l00203"></a>00203 clear(TYPE_FLOAT); <a name="l00204"></a>00204 } <a name="l00205"></a>00205 f = v; <a name="l00206"></a>00206 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00207"></a>00207 } <a name="l00208"></a>00208 <a name="l00209"></a>00209 <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>& <a class="code" href="class_atlas_1_1_message_1_1_element.html#a8c2f3ffe8b8d0eab5974a1a9a1ca5dc1" title="overload assignment operator !">operator=</a>(FloatType v) <a name="l00210"></a>00210 { <a name="l00211"></a>00211 <span class="keywordflow">if</span> (TYPE_FLOAT != t) <a name="l00212"></a>00212 { <a name="l00213"></a>00213 clear(TYPE_FLOAT); <a name="l00214"></a>00214 } <a name="l00215"></a>00215 f = v; <a name="l00216"></a>00216 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00217"></a>00217 } <a name="l00218"></a>00218 <a name="l00219"></a>00219 <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>& <a class="code" href="class_atlas_1_1_message_1_1_element.html#a8c2f3ffe8b8d0eab5974a1a9a1ca5dc1" title="overload assignment operator !">operator=</a>(PtrType v) <a name="l00220"></a>00220 { <a name="l00221"></a>00221 <span class="keywordflow">if</span> (TYPE_PTR != t) <a name="l00222"></a>00222 { <a name="l00223"></a>00223 clear(TYPE_PTR); <a name="l00224"></a>00224 } <a name="l00225"></a>00225 p = v; <a name="l00226"></a>00226 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00227"></a>00227 } <a name="l00228"></a>00228 <a name="l00229"></a>00229 <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>& <a class="code" href="class_atlas_1_1_message_1_1_element.html#a8c2f3ffe8b8d0eab5974a1a9a1ca5dc1" title="overload assignment operator !">operator=</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> * v) <a name="l00230"></a>00230 { <a name="l00231"></a>00231 <span class="keywordflow">if</span> (TYPE_STRING != t || !s->unique()) <a name="l00232"></a>00232 { <a name="l00233"></a>00233 clear(TYPE_STRING); <a name="l00234"></a>00234 s = <span class="keyword">new</span> DataType<StringType>(v); <a name="l00235"></a>00235 } <span class="keywordflow">else</span> { <a name="l00236"></a>00236 *s = StringType(v); <a name="l00237"></a>00237 } <a name="l00238"></a>00238 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00239"></a>00239 } <a name="l00240"></a>00240 <a name="l00241"></a>00241 <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>& <a class="code" href="class_atlas_1_1_message_1_1_element.html#a8c2f3ffe8b8d0eab5974a1a9a1ca5dc1" title="overload assignment operator !">operator=</a>(<span class="keyword">const</span> StringType & v) <a name="l00242"></a>00242 { <a name="l00243"></a>00243 <span class="keywordflow">if</span> (TYPE_STRING != t || !s->unique()) <a name="l00244"></a>00244 { <a name="l00245"></a>00245 clear(TYPE_STRING); <a name="l00246"></a>00246 s = <span class="keyword">new</span> DataType<StringType>(v); <a name="l00247"></a>00247 } <span class="keywordflow">else</span> { <a name="l00248"></a>00248 *s = v; <a name="l00249"></a>00249 } <a name="l00250"></a>00250 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00251"></a>00251 } <a name="l00252"></a>00252 <a name="l00253"></a>00253 <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>& <a class="code" href="class_atlas_1_1_message_1_1_element.html#a8c2f3ffe8b8d0eab5974a1a9a1ca5dc1" title="overload assignment operator !">operator=</a>(<span class="keyword">const</span> MapType & v) <a name="l00254"></a>00254 { <a name="l00255"></a>00255 <span class="keywordflow">if</span> (TYPE_MAP != t || !m->unique()) <a name="l00256"></a>00256 { <a name="l00257"></a>00257 clear(TYPE_MAP); <a name="l00258"></a>00258 m = <span class="keyword">new</span> DataType<MapType>(v); <a name="l00259"></a>00259 } <span class="keywordflow">else</span> { <a name="l00260"></a>00260 *m = v; <a name="l00261"></a>00261 } <a name="l00262"></a>00262 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00263"></a>00263 } <a name="l00264"></a>00264 <a name="l00265"></a>00265 <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>& <a class="code" href="class_atlas_1_1_message_1_1_element.html#a8c2f3ffe8b8d0eab5974a1a9a1ca5dc1" title="overload assignment operator !">operator=</a>(<span class="keyword">const</span> ListType & v) <a name="l00266"></a>00266 { <a name="l00267"></a>00267 <span class="keywordflow">if</span> (TYPE_LIST != t || !l->unique()) <a name="l00268"></a>00268 { <a name="l00269"></a>00269 clear(TYPE_LIST); <a name="l00270"></a>00270 l = <span class="keyword">new</span> DataType<ListType>(v); <a name="l00271"></a>00271 } <span class="keywordflow">else</span> { <a name="l00272"></a>00272 *l = v; <a name="l00273"></a>00273 } <a name="l00274"></a>00274 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00275"></a>00275 } <a name="l00276"></a>00276 <a name="l00278"></a>00278 <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a47a20ea0dd457377b427e078e724dda7" title="Check for equality with another Element.">operator==</a>(<span class="keyword">const</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>& o) <span class="keyword">const</span>; <a name="l00279"></a>00279 <a name="l00280"></a>00280 <span class="preprocessor">#if defined(__GNUC__) && __GNUC__ < 3</span> <a name="l00281"></a>00281 <span class="preprocessor"></span> <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a23edcc06db08800e26defaa5de365b85" title="Check for inequality with anything we can check equality with.">operator!=</a>(<span class="keyword">const</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d672b44fa137c737e0c6452337bbef6" title="Construct an empty object.">Element</a>& o)<span class="keyword"> const</span> <a name="l00282"></a>00282 <span class="keyword"> </span>{ <a name="l00283"></a>00283 <span class="keywordflow">return</span> !(*<span class="keyword">this</span> == o); <a name="l00284"></a>00284 } <a name="l00285"></a>00285 <span class="preprocessor">#endif // defined(__GNUC__) && __GNUC__ < 3</span> <a name="l00286"></a>00286 <span class="preprocessor"></span> <a name="l00288"></a>00288 <span class="keyword">template</span><<span class="keyword">class</span> C> <a name="l00289"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a23edcc06db08800e26defaa5de365b85">00289</a> <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a23edcc06db08800e26defaa5de365b85" title="Check for inequality with anything we can check equality with.">operator!=</a>(C c)<span class="keyword"> const</span> <a name="l00290"></a>00290 <span class="keyword"> </span>{ <a name="l00291"></a>00291 <span class="keywordflow">return</span> !(*<span class="keyword">this</span> == c); <a name="l00292"></a>00292 } <a name="l00293"></a>00293 <a name="l00295"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#accb353829d096c51f068e1d7016b6249">00295</a> <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a47a20ea0dd457377b427e078e724dda7" title="Check for equality with another Element.">operator==</a>(IntType v)<span class="keyword"> const</span> <a name="l00296"></a>00296 <span class="keyword"> </span>{ <a name="l00297"></a>00297 <span class="keywordflow">return</span> (t == TYPE_INT && i == v); <a name="l00298"></a>00298 } <a name="l00299"></a>00299 <a name="l00301"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a4a150f4207759102aa37d9696ce77240">00301</a> <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a47a20ea0dd457377b427e078e724dda7" title="Check for equality with another Element.">operator==</a>(FloatType v)<span class="keyword"> const</span> <a name="l00302"></a>00302 <span class="keyword"> </span>{ <a name="l00303"></a>00303 <span class="keywordflow">return</span> t == TYPE_FLOAT && f == v; <a name="l00304"></a>00304 } <a name="l00305"></a>00305 <a name="l00307"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a788dbe6928bd686ba5716737db950740">00307</a> <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a47a20ea0dd457377b427e078e724dda7" title="Check for equality with another Element.">operator==</a>(PtrType v)<span class="keyword"> const</span> <a name="l00308"></a>00308 <span class="keyword"> </span>{ <a name="l00309"></a>00309 <span class="keywordflow">return</span> t == TYPE_PTR && p == v; <a name="l00310"></a>00310 } <a name="l00311"></a>00311 <a name="l00313"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a471712da2ba22282e2f1bc950c954518">00313</a> <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a47a20ea0dd457377b427e078e724dda7" title="Check for equality with another Element.">operator==</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> * v)<span class="keyword"> const</span> <a name="l00314"></a>00314 <span class="keyword"> </span>{ <a name="l00315"></a>00315 <span class="keywordflow">if</span>(t == TYPE_STRING) <a name="l00316"></a>00316 <span class="keywordflow">return</span> (*s == v); <a name="l00317"></a>00317 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00318"></a>00318 } <a name="l00319"></a>00319 <a name="l00321"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#ae3bd4c71d14c3cc23bc5e31db76bdeb7">00321</a> <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a47a20ea0dd457377b427e078e724dda7" title="Check for equality with another Element.">operator==</a>(<span class="keyword">const</span> StringType& v)<span class="keyword"> const</span> <a name="l00322"></a>00322 <span class="keyword"> </span>{ <a name="l00323"></a>00323 <span class="keywordflow">if</span>(t == TYPE_STRING) <a name="l00324"></a>00324 <span class="keywordflow">return</span> (*s == v); <a name="l00325"></a>00325 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00326"></a>00326 } <a name="l00327"></a>00327 <a name="l00329"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a6ce7257a4e7f0ba9fba0dce6af3f4150">00329</a> <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a47a20ea0dd457377b427e078e724dda7" title="Check for equality with another Element.">operator==</a>(<span class="keyword">const</span> MapType& v)<span class="keyword"> const</span> <a name="l00330"></a>00330 <span class="keyword"> </span>{ <a name="l00331"></a>00331 <span class="keywordflow">if</span>(t == TYPE_MAP) <a name="l00332"></a>00332 <span class="keywordflow">return</span> (*m == v); <a name="l00333"></a>00333 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00334"></a>00334 } <a name="l00335"></a>00335 <a name="l00337"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a2f44d67287dbff0fa2ede0e5c59b76cb">00337</a> <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a47a20ea0dd457377b427e078e724dda7" title="Check for equality with another Element.">operator==</a>(<span class="keyword">const</span> ListType& v)<span class="keyword"> const</span> <a name="l00338"></a>00338 <span class="keyword"> </span>{ <a name="l00339"></a>00339 <span class="keywordflow">if</span> (t == TYPE_LIST) <a name="l00340"></a>00340 <span class="keywordflow">return</span> (*l == v); <a name="l00341"></a>00341 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00342"></a>00342 } <a name="l00343"></a>00343 <a name="l00345"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#af472a81ae77aed9485cf07fd6af9fbd6">00345</a> Type <a class="code" href="class_atlas_1_1_message_1_1_element.html#af472a81ae77aed9485cf07fd6af9fbd6" title="Get the current type.">getType</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> t; } <a name="l00347"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#aa70fdeccddb6ec054981c7156f1c1249">00347</a> <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#aa70fdeccddb6ec054981c7156f1c1249" title="Check whether the current type is nothing.">isNone</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (t == TYPE_NONE); } <a name="l00349"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a7de7529561dcc22283e0884b2c0c4b68">00349</a> <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a7de7529561dcc22283e0884b2c0c4b68" title="Check whether the current type is int.">isInt</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (t == TYPE_INT); } <a name="l00351"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a8e51cd879a08363c751375630821c4fe">00351</a> <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a8e51cd879a08363c751375630821c4fe" title="Check whether the current type is double.">isFloat</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (t == TYPE_FLOAT); } <a name="l00353"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a6c24657f0ebcbbd98d34e21eaf54ad66">00353</a> <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a6c24657f0ebcbbd98d34e21eaf54ad66" title="Check whether the current type is pointer.">isPtr</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (t == TYPE_PTR); } <a name="l00355"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a8966bf862a9ae619b7d21a5b11d34c7f">00355</a> <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a8966bf862a9ae619b7d21a5b11d34c7f" title="Check whether the current type is numeric.">isNum</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> ((t == TYPE_FLOAT) || (t == TYPE_INT)); } <a name="l00357"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a56941658ab61f4fa18db5b83d2684052">00357</a> <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a56941658ab61f4fa18db5b83d2684052" title="Check whether the current type is std::string.">isString</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (t == TYPE_STRING); } <a name="l00359"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d8b65d49d72f8f2d3380e0a043e9c50">00359</a> <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9d8b65d49d72f8f2d3380e0a043e9c50" title="Check whether the current type is MapType.">isMap</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (t == TYPE_MAP); } <a name="l00361"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#af5322eb0edebd71d9f158459beec4b33">00361</a> <span class="keywordtype">bool</span> <a class="code" href="class_atlas_1_1_message_1_1_element.html#af5322eb0edebd71d9f158459beec4b33" title="Check whether the current type is ListType.">isList</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (t == TYPE_LIST); } <a name="l00362"></a>00362 <a name="l00364"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a0f13348d0e9ecec7782136c276903248">00364</a> IntType <a class="code" href="class_atlas_1_1_message_1_1_element.html#a0f13348d0e9ecec7782136c276903248" title="Retrieve the current value as a int.">asInt</a>() <span class="keyword">const</span> throw (<a class="code" href="class_atlas_1_1_message_1_1_wrong_type_exception.html" title="An exception class issued when the wrong type is requested in as().">WrongTypeException</a>) <a name="l00365"></a>00365 { <a name="l00366"></a>00366 <span class="keywordflow">if</span> (t == TYPE_INT) <span class="keywordflow">return</span> i; <a name="l00367"></a>00367 <span class="keywordflow">throw</span> WrongTypeException(); <a name="l00368"></a>00368 } <a name="l00369"></a>00369 IntType Int()<span class="keyword"> const</span> <a name="l00370"></a>00370 <span class="keyword"> </span>{ <a name="l00371"></a>00371 <span class="keywordflow">return</span> i; <a name="l00372"></a>00372 } <a name="l00374"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#af72f810ac0e3b08212a39e1ba26ed645">00374</a> FloatType <a class="code" href="class_atlas_1_1_message_1_1_element.html#af72f810ac0e3b08212a39e1ba26ed645" title="Retrieve the current value as a double.">asFloat</a>() <span class="keyword">const</span> throw (<a class="code" href="class_atlas_1_1_message_1_1_wrong_type_exception.html" title="An exception class issued when the wrong type is requested in as().">WrongTypeException</a>) <a name="l00375"></a>00375 { <a name="l00376"></a>00376 <span class="keywordflow">if</span> (t == TYPE_FLOAT) <span class="keywordflow">return</span> f; <a name="l00377"></a>00377 <span class="keywordflow">throw</span> WrongTypeException(); <a name="l00378"></a>00378 } <a name="l00379"></a>00379 FloatType Float()<span class="keyword"> const</span> <a name="l00380"></a>00380 <span class="keyword"> </span>{ <a name="l00381"></a>00381 <span class="keywordflow">return</span> f; <a name="l00382"></a>00382 } <a name="l00384"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#ad3fe6c53d5601ebe841cb70fae82d315">00384</a> PtrType <a class="code" href="class_atlas_1_1_message_1_1_element.html#ad3fe6c53d5601ebe841cb70fae82d315" title="Retrieve the current value as a pointer.">asPtr</a>() <span class="keyword">const</span> throw (<a class="code" href="class_atlas_1_1_message_1_1_wrong_type_exception.html" title="An exception class issued when the wrong type is requested in as().">WrongTypeException</a>) <a name="l00385"></a>00385 { <a name="l00386"></a>00386 <span class="keywordflow">if</span> (t == TYPE_PTR) <span class="keywordflow">return</span> p; <a name="l00387"></a>00387 <span class="keywordflow">throw</span> WrongTypeException(); <a name="l00388"></a>00388 } <a name="l00389"></a>00389 PtrType Ptr()<span class="keyword"> const</span> <a name="l00390"></a>00390 <span class="keyword"> </span>{ <a name="l00391"></a>00391 <span class="keywordflow">return</span> p; <a name="l00392"></a>00392 } <a name="l00394"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a9bbf88db833f91b54b5dc98f6e89ae58">00394</a> FloatType <a class="code" href="class_atlas_1_1_message_1_1_element.html#a9bbf88db833f91b54b5dc98f6e89ae58" title="Retrieve the current value as a number.">asNum</a>() <span class="keyword">const</span> throw (<a class="code" href="class_atlas_1_1_message_1_1_wrong_type_exception.html" title="An exception class issued when the wrong type is requested in as().">WrongTypeException</a>) <a name="l00395"></a>00395 { <a name="l00396"></a>00396 <span class="keywordflow">if</span> (t == TYPE_FLOAT) <span class="keywordflow">return</span> f; <a name="l00397"></a>00397 <span class="keywordflow">if</span> (t == TYPE_INT) <span class="keywordflow">return</span> FloatType(i); <a name="l00398"></a>00398 <span class="keywordflow">throw</span> WrongTypeException(); <a name="l00399"></a>00399 } <a name="l00401"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#aed6dd89e1fcb594cd4b02bfafab3faa0">00401</a> <span class="keyword">const</span> std::string& <a class="code" href="class_atlas_1_1_message_1_1_element.html#aed6dd89e1fcb594cd4b02bfafab3faa0" title="Retrieve the current value as a const std::string reference.">asString</a>() <span class="keyword">const</span> throw (<a class="code" href="class_atlas_1_1_message_1_1_wrong_type_exception.html" title="An exception class issued when the wrong type is requested in as().">WrongTypeException</a>) <a name="l00402"></a>00402 { <a name="l00403"></a>00403 <span class="keywordflow">if</span> (t == TYPE_STRING) <span class="keywordflow">return</span> *s; <a name="l00404"></a>00404 <span class="keywordflow">throw</span> WrongTypeException(); <a name="l00405"></a>00405 } <a name="l00407"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a7aa5f7c4c1cef5be35b3ac9dee2036e2">00407</a> std::string& <a class="code" href="class_atlas_1_1_message_1_1_element.html#aed6dd89e1fcb594cd4b02bfafab3faa0" title="Retrieve the current value as a const std::string reference.">asString</a>() throw (<a class="code" href="class_atlas_1_1_message_1_1_wrong_type_exception.html" title="An exception class issued when the wrong type is requested in as().">WrongTypeException</a>) <a name="l00408"></a>00408 { <a name="l00409"></a>00409 <span class="keywordflow">if</span> (t == TYPE_STRING) <span class="keywordflow">return</span> *(s = s->makeUnique()); <a name="l00410"></a>00410 <span class="keywordflow">throw</span> WrongTypeException(); <a name="l00411"></a>00411 } <a name="l00412"></a>00412 <span class="keyword">const</span> StringType& String()<span class="keyword"> const</span> <a name="l00413"></a>00413 <span class="keyword"> </span>{ <a name="l00414"></a>00414 <span class="keywordflow">return</span> *s; <a name="l00415"></a>00415 } <a name="l00416"></a>00416 StringType& String() <a name="l00417"></a>00417 { <a name="l00418"></a>00418 <span class="keywordflow">return</span> *(s = s->makeUnique()); <a name="l00419"></a>00419 } <a name="l00421"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#ad3fd9f538daffc94ab983018983e6f89">00421</a> <span class="keyword">const</span> MapType& <a class="code" href="class_atlas_1_1_message_1_1_element.html#ad3fd9f538daffc94ab983018983e6f89" title="Retrieve the current value as a const MapType reference.">asMap</a>() <span class="keyword">const</span> throw (<a class="code" href="class_atlas_1_1_message_1_1_wrong_type_exception.html" title="An exception class issued when the wrong type is requested in as().">WrongTypeException</a>) <a name="l00422"></a>00422 { <a name="l00423"></a>00423 <span class="keywordflow">if</span> (t == TYPE_MAP) <span class="keywordflow">return</span> *m; <a name="l00424"></a>00424 <span class="keywordflow">throw</span> WrongTypeException(); <a name="l00425"></a>00425 } <a name="l00427"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a7433be6062591c12edf93a84195847ac">00427</a> MapType& <a class="code" href="class_atlas_1_1_message_1_1_element.html#ad3fd9f538daffc94ab983018983e6f89" title="Retrieve the current value as a const MapType reference.">asMap</a>() throw (<a class="code" href="class_atlas_1_1_message_1_1_wrong_type_exception.html" title="An exception class issued when the wrong type is requested in as().">WrongTypeException</a>) <a name="l00428"></a>00428 { <a name="l00429"></a>00429 <span class="keywordflow">if</span> (t == TYPE_MAP) <span class="keywordflow">return</span> *(m = m->makeUnique()); <a name="l00430"></a>00430 <span class="keywordflow">throw</span> WrongTypeException(); <a name="l00431"></a>00431 } <a name="l00432"></a>00432 <span class="keyword">const</span> MapType& Map()<span class="keyword"> const</span> <a name="l00433"></a>00433 <span class="keyword"> </span>{ <a name="l00434"></a>00434 <span class="keywordflow">return</span> *m; <a name="l00435"></a>00435 } <a name="l00436"></a>00436 MapType& Map() <a name="l00437"></a>00437 { <a name="l00438"></a>00438 <span class="keywordflow">return</span> *(m = m->makeUnique()); <a name="l00439"></a>00439 } <a name="l00441"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a78c3ce3b25b9b3d2dd982b5134450f40">00441</a> <span class="keyword">const</span> ListType& <a class="code" href="class_atlas_1_1_message_1_1_element.html#a78c3ce3b25b9b3d2dd982b5134450f40" title="Retrieve the current value as a const ListType reference.">asList</a>() <span class="keyword">const</span> throw (<a class="code" href="class_atlas_1_1_message_1_1_wrong_type_exception.html" title="An exception class issued when the wrong type is requested in as().">WrongTypeException</a>) <a name="l00442"></a>00442 { <a name="l00443"></a>00443 <span class="keywordflow">if</span> (t == TYPE_LIST) <span class="keywordflow">return</span> *l; <a name="l00444"></a>00444 <span class="keywordflow">throw</span> WrongTypeException(); <a name="l00445"></a>00445 } <a name="l00447"></a><a class="code" href="class_atlas_1_1_message_1_1_element.html#a0560ce5a5032a1ef700858ca27320b7c">00447</a> ListType& <a class="code" href="class_atlas_1_1_message_1_1_element.html#a78c3ce3b25b9b3d2dd982b5134450f40" title="Retrieve the current value as a const ListType reference.">asList</a>() throw (<a class="code" href="class_atlas_1_1_message_1_1_wrong_type_exception.html" title="An exception class issued when the wrong type is requested in as().">WrongTypeException</a>) <a name="l00448"></a>00448 { <a name="l00449"></a>00449 <span class="keywordflow">if</span> (t == TYPE_LIST) <span class="keywordflow">return</span> *(l = l->makeUnique()); <a name="l00450"></a>00450 <span class="keywordflow">throw</span> WrongTypeException(); <a name="l00451"></a>00451 } <a name="l00452"></a>00452 <span class="keyword">const</span> ListType& List()<span class="keyword"> const</span> <a name="l00453"></a>00453 <span class="keyword"> </span>{ <a name="l00454"></a>00454 <span class="keywordflow">return</span> *l; <a name="l00455"></a>00455 } <a name="l00456"></a>00456 ListType& List() <a name="l00457"></a>00457 { <a name="l00458"></a>00458 <span class="keywordflow">return</span> *(l = l->makeUnique()); <a name="l00459"></a>00459 } <a name="l00460"></a>00460 <a name="l00461"></a>00461 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> * typeName(Type); <a name="l00462"></a>00462 <a name="l00463"></a>00463 <span class="keyword">protected</span>: <a name="l00464"></a>00464 <a name="l00465"></a>00465 <span class="keyword">template</span><<span class="keyword">class</span> C> <a name="l00466"></a><a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">00466</a> <span class="keyword">class </span><a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType</a> <a name="l00467"></a>00467 { <a name="l00468"></a>00468 <span class="keyword">public</span>: <a name="l00469"></a>00469 <a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType</a>() : _refcount(1) {} <a name="l00470"></a>00470 <a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType</a>(<span class="keyword">const</span> C& c) : _refcount(1), _data(c) {} <a name="l00471"></a>00471 <a name="l00472"></a>00472 <a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType</a>& operator=(<span class="keyword">const</span> C& c) {_data = c; <span class="keywordflow">return</span> *<span class="keyword">this</span>;} <a name="l00473"></a>00473 <a name="l00474"></a>00474 <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> C& c)<span class="keyword"> const </span>{<span class="keywordflow">return</span> _data == c;} <a name="l00475"></a>00475 <a name="l00476"></a>00476 <span class="keywordtype">void</span> ref() {++_refcount;} <a name="l00477"></a>00477 <span class="keywordtype">void</span> unref() {<span class="keywordflow">if</span>(--_refcount == 0) <span class="keyword">delete</span> <span class="keyword">this</span>;} <a name="l00478"></a>00478 <a name="l00479"></a>00479 <span class="keywordtype">bool</span> unique()<span class="keyword"> const </span>{<span class="keywordflow">return</span> _refcount == 1;} <a name="l00480"></a>00480 <a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType</a>* makeUnique() <a name="l00481"></a>00481 { <a name="l00482"></a>00482 <span class="keywordflow">if</span>(unique()) <a name="l00483"></a>00483 <span class="keywordflow">return</span> <span class="keyword">this</span>; <a name="l00484"></a>00484 unref(); <span class="comment">// _refcount > 1, so this is fine</span> <a name="l00485"></a>00485 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType</a>(_data); <a name="l00486"></a>00486 } <a name="l00487"></a>00487 <a name="l00488"></a>00488 operator C&() {<span class="keywordflow">return</span> _data;} <a name="l00489"></a>00489 <span class="comment">// operator const C&() const {return _data;}</span> <a name="l00490"></a>00490 <a name="l00491"></a>00491 <span class="keyword">private</span>: <a name="l00492"></a>00492 <a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType</a>(<span class="keyword">const</span> <a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType</a>&); <span class="comment">// unimplemented</span> <a name="l00493"></a>00493 <a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType</a>& operator=(<span class="keyword">const</span> <a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType</a>&); <span class="comment">// unimplemented</span> <a name="l00494"></a>00494 <a name="l00495"></a>00495 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> _refcount; <a name="l00496"></a>00496 C _data; <a name="l00497"></a>00497 }; <a name="l00498"></a>00498 <a name="l00499"></a>00499 Type t; <a name="l00500"></a>00500 <span class="keyword">union </span>{ <a name="l00501"></a>00501 IntType i; <a name="l00502"></a>00502 FloatType f; <a name="l00503"></a>00503 <span class="keywordtype">void</span>* p; <a name="l00504"></a>00504 <a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType<StringType></a>* s; <a name="l00505"></a>00505 <a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType<MapType></a>* m; <a name="l00506"></a>00506 <a class="code" href="class_atlas_1_1_message_1_1_element_1_1_data_type.html">DataType<ListType></a>* l; <a name="l00507"></a>00507 }; <a name="l00508"></a>00508 }; <a name="l00509"></a>00509 <a name="l00510"></a>00510 } } <span class="comment">// namespace Atlas::Message</span> <a name="l00511"></a>00511 <a name="l00512"></a>00512 <a name="l00513"></a>00513 <span class="preprocessor">#endif // ATLAS_MESSAGE_ELEMENT_H</span> </pre></div></div> </div> <HR> <P>Copyright 2000-2004 the respective authors.</P> <P>This document can be licensed under the terms of the GNU Free Documentation License or the GNU General Public License and may be freely distributed under the terms given by one of these licenses.</P>