Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > 4bc66056a634db26a1f4d0845dc41ca6 > files > 2738

mrpt-doc-0.9.5-0.1.20110925svn2670.fc16.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>ValueArg.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<div align="left"><a href="http://www.mrpt.org/">Main MRPT website</a> &gt; <b>C++ reference</b> </div>
<div align="right">
<a href="index.html"><img border="0" src="mrpt_logo.png" alt="MRPT logo"></a>
</div>
<!-- Generated by Doxygen 1.7.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="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>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
          <div class="left">
            <form id="FSearchBox" action="search.php" method="get">
              <img id="MSearchSelect" src="search/mag.png" alt=""/>
              <input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S" 
                     onfocus="searchBox.OnSearchFieldFocus(true)" 
                     onblur="searchBox.OnSearchFieldFocus(false)"/>
            </form>
          </div><div class="right"></div>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">ValueArg.h</div>  </div>
</div>
<div class="contents">
<a href="_value_arg_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/****************************************************************************** </span>
<a name="l00002"></a>00002 <span class="comment"> * </span>
<a name="l00003"></a>00003 <span class="comment"> *  file:  ValueArg.h</span>
<a name="l00004"></a>00004 <span class="comment"> * </span>
<a name="l00005"></a>00005 <span class="comment"> *  Copyright (c) 2003, Michael E. Smoot .</span>
<a name="l00006"></a>00006 <span class="comment"> *  Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.</span>
<a name="l00007"></a>00007 <span class="comment"> *  All rights reverved.</span>
<a name="l00008"></a>00008 <span class="comment"> * </span>
<a name="l00009"></a>00009 <span class="comment"> *  See the file COPYING in the top directory of this distribution for</span>
<a name="l00010"></a>00010 <span class="comment"> *  more information.</span>
<a name="l00011"></a>00011 <span class="comment"> *  </span>
<a name="l00012"></a>00012 <span class="comment"> *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS </span>
<a name="l00013"></a>00013 <span class="comment"> *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, </span>
<a name="l00014"></a>00014 <span class="comment"> *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL </span>
<a name="l00015"></a>00015 <span class="comment"> *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER </span>
<a name="l00016"></a>00016 <span class="comment"> *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING </span>
<a name="l00017"></a>00017 <span class="comment"> *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER </span>
<a name="l00018"></a>00018 <span class="comment"> *  DEALINGS IN THE SOFTWARE.  </span>
<a name="l00019"></a>00019 <span class="comment"> *  </span>
<a name="l00020"></a>00020 <span class="comment"> *****************************************************************************/</span> 
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="preprocessor">#ifndef TCLAP_VALUE_ARGUMENT_H</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define TCLAP_VALUE_ARGUMENT_H</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00028"></a>00028 
<a name="l00029"></a>00029 <span class="preprocessor">#include &lt;<a class="code" href="_arg_8h.html">mrpt/otherlibs/tclap/Arg.h</a>&gt;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &lt;<a class="code" href="_constraint_8h.html">mrpt/otherlibs/tclap/Constraint.h</a>&gt;</span>
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="comment">//#ifdef HAVE_CONFIG_H</span>
<a name="l00033"></a>00033 <span class="comment">//#include &lt;config.h&gt;</span>
<a name="l00034"></a>00034 <span class="comment">//#else</span>
<a name="l00035"></a><a class="code" href="_value_arg_8h.html#a91e904e6e4f21f803c49113b934e6966">00035</a> <span class="preprocessor">#define HAVE_SSTREAM</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="comment">//#endif</span>
<a name="l00037"></a>00037 
<a name="l00038"></a>00038 <span class="preprocessor">#if defined(HAVE_SSTREAM)</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span><span class="preprocessor">#include &lt;sstream&gt;</span>
<a name="l00040"></a>00040 <span class="preprocessor">#elif defined(HAVE_STRSTREAM)</span>
<a name="l00041"></a>00041 <span class="preprocessor"></span><span class="preprocessor">#include &lt;strstream&gt;</span>
<a name="l00042"></a>00042 <span class="preprocessor">#else</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#error &quot;Need a stringstream (sstream or strstream) to compile!&quot;</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span>
<a name="l00046"></a>00046 <span class="keyword">namespace </span>TCLAP {
<a name="l00047"></a>00047 
<a name="l00048"></a>00048 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt; <span class="keyword">class </span>ValueArg;
<a name="l00049"></a>00049 
<a name="l00050"></a><a class="code" href="namespace_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r.html">00050</a> <span class="keyword">namespace </span>VALUE_ARG_HELPER {
<a name="l00051"></a>00051 
<a name="l00052"></a><a class="code" href="namespace_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r.html#a0260b311b69be4efa20f31d17a4bfaa1ab725bb83b3fc055e8848dda32abb304e">00052</a> <span class="keyword">enum</span> <a class="code" href="namespace_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r.html#a0260b311b69be4efa20f31d17a4bfaa1">Error_e</a> { <a class="code" href="namespace_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r.html#a0260b311b69be4efa20f31d17a4bfaa1a130745503e92203de76687ec31950e36">EXTRACT_FAILURE</a> = 1000, <a class="code" href="namespace_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r.html#a0260b311b69be4efa20f31d17a4bfaa1ab725bb83b3fc055e8848dda32abb304e">EXTRACT_TOO_MANY</a> };
<a name="l00053"></a>00053 <span class="comment"></span>
<a name="l00054"></a>00054 <span class="comment">/**</span>
<a name="l00055"></a>00055 <span class="comment"> * This class is used to extract a value from an argument. </span>
<a name="l00056"></a>00056 <span class="comment"> * It is used because we need a special implementation to</span>
<a name="l00057"></a>00057 <span class="comment"> * deal with std::string and making a specialiced function</span>
<a name="l00058"></a>00058 <span class="comment"> * puts it in the T segment, thus generating link errors.</span>
<a name="l00059"></a>00059 <span class="comment"> * Having a specialiced class makes the symbols weak.</span>
<a name="l00060"></a>00060 <span class="comment"> * This is not pretty but I don&#39;t know how to make it</span>
<a name="l00061"></a>00061 <span class="comment"> * work any other way.</span>
<a name="l00062"></a>00062 <span class="comment"> */</span>
<a name="l00063"></a>00063 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt; <span class="keyword">class </span>ValueExtractor 
<a name="l00064"></a>00064 {<span class="comment"></span>
<a name="l00065"></a>00065 <span class="comment">        /**</span>
<a name="l00066"></a>00066 <span class="comment">         *</span>
<a name="l00067"></a>00067 <span class="comment">         */</span>
<a name="l00068"></a><a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor.html#a44894806661ab7511a4bc9981c78feb2">00068</a>         <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="class_t_c_l_a_p_1_1_value_arg.html" title="The basic labeled argument that parses a value.">ValueArg</a>&lt;T&gt;;
<a name="l00069"></a>00069 
<a name="l00070"></a>00070         <span class="keyword">private</span>:
<a name="l00071"></a>00071 <span class="comment"></span>
<a name="l00072"></a>00072 <span class="comment">                /**</span>
<a name="l00073"></a>00073 <span class="comment">                 * Reference to the value where the result of the extraction will </span>
<a name="l00074"></a>00074 <span class="comment">                 * be put.</span>
<a name="l00075"></a>00075 <span class="comment">                 */</span>
<a name="l00076"></a><a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor.html#a578f474590f01eb72ca06cea63fa826d">00076</a>         T &amp;<a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor.html#a578f474590f01eb72ca06cea63fa826d" title="Reference to the value where the result of the extraction will be put.">_value</a>;
<a name="l00077"></a>00077 <span class="comment"></span>
<a name="l00078"></a>00078 <span class="comment">                /**</span>
<a name="l00079"></a>00079 <span class="comment">                 * Constructor.</span>
<a name="l00080"></a>00080 <span class="comment">                 * \param value - Where the value extracted will be put.</span>
<a name="l00081"></a>00081 <span class="comment">                 */</span>
<a name="l00082"></a><a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor.html#ad4912da61093a68f7b41a03c6a71ae4f">00082</a>         <a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor.html#ad4912da61093a68f7b41a03c6a71ae4f" title="Constructor.">ValueExtractor</a>(T &amp;value) : <a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor.html#a578f474590f01eb72ca06cea63fa826d" title="Reference to the value where the result of the extraction will be put.">_value</a>(value) { }
<a name="l00083"></a>00083 <span class="comment"></span>
<a name="l00084"></a>00084 <span class="comment">                /**</span>
<a name="l00085"></a>00085 <span class="comment">                 * Method that will attempt to parse the input stream for a value</span>
<a name="l00086"></a>00086 <span class="comment">                 * of type T.</span>
<a name="l00087"></a>00087 <span class="comment">                 * \param val - Where the value parsed will be put.</span>
<a name="l00088"></a>00088 <span class="comment">                 */</span>
<a name="l00089"></a><a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor.html#a9f29ec2bc6e8af3c5e8c8f7233ea3255">00089</a>         <span class="keywordtype">int</span> <a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor.html#a9f29ec2bc6e8af3c5e8c8f7233ea3255" title="Method that will attempt to parse the input stream for a value of type T.">extractValue</a>( <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; val ) 
<a name="l00090"></a>00090                 {
<a name="l00091"></a>00091 
<a name="l00092"></a>00092 <span class="preprocessor">#if defined(HAVE_SSTREAM)</span>
<a name="l00093"></a>00093 <span class="preprocessor"></span>                        std::istringstream is(val);
<a name="l00094"></a>00094 <span class="preprocessor">#elif defined(HAVE_STRSTREAM)</span>
<a name="l00095"></a>00095 <span class="preprocessor"></span>                        std::istrstream is(val.c_str());
<a name="l00096"></a>00096 <span class="preprocessor">#else</span>
<a name="l00097"></a>00097 <span class="preprocessor"></span><span class="preprocessor">#error &quot;Need a stringstream (sstream or strstream) to compile!&quot;</span>
<a name="l00098"></a>00098 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00099"></a>00099 <span class="preprocessor"></span>
<a name="l00100"></a>00100             <span class="keywordtype">int</span> valuesRead = 0;
<a name="l00101"></a>00101             <span class="keywordflow">while</span> ( is.good() ) 
<a name="l00102"></a>00102                         {
<a name="l00103"></a>00103                 <span class="keywordflow">if</span> ( is.peek() != EOF )
<a name="l00104"></a>00104                     is &gt;&gt; <a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor.html#a578f474590f01eb72ca06cea63fa826d" title="Reference to the value where the result of the extraction will be put.">_value</a>;
<a name="l00105"></a>00105                 <span class="keywordflow">else</span>
<a name="l00106"></a>00106                     <span class="keywordflow">break</span>;
<a name="l00107"></a>00107         
<a name="l00108"></a>00108                 valuesRead++;
<a name="l00109"></a>00109             }
<a name="l00110"></a>00110       
<a name="l00111"></a>00111             <span class="keywordflow">if</span> ( is.fail() ) 
<a name="l00112"></a>00112                 <span class="keywordflow">return</span> <a class="code" href="namespace_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r.html#a0260b311b69be4efa20f31d17a4bfaa1a130745503e92203de76687ec31950e36">EXTRACT_FAILURE</a>;
<a name="l00113"></a>00113 
<a name="l00114"></a>00114             <span class="keywordflow">if</span> ( valuesRead &gt; 1 )
<a name="l00115"></a>00115                 <span class="keywordflow">return</span> <a class="code" href="namespace_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r.html#a0260b311b69be4efa20f31d17a4bfaa1ab725bb83b3fc055e8848dda32abb304e">EXTRACT_TOO_MANY</a>;
<a name="l00116"></a>00116 
<a name="l00117"></a>00117             <span class="keywordflow">return</span> 0;
<a name="l00118"></a>00118         }
<a name="l00119"></a>00119 };
<a name="l00120"></a>00120 <span class="comment"></span>
<a name="l00121"></a>00121 <span class="comment">/**</span>
<a name="l00122"></a>00122 <span class="comment"> * Specialization for string.  This is necessary because istringstream</span>
<a name="l00123"></a>00123 <span class="comment"> * operator&gt;&gt; is not able to ignore spaces...  meaning -x &quot;X Y&quot; will only </span>
<a name="l00124"></a>00124 <span class="comment"> * read &#39;X&#39;... and thus the specialization.</span>
<a name="l00125"></a>00125 <span class="comment"> */</span>
<a name="l00126"></a>00126 <span class="keyword">template</span>&lt;&gt; <span class="keyword">class </span>ValueExtractor&lt;std::string&gt; 
<a name="l00127"></a>00127 {<span class="comment"></span>
<a name="l00128"></a>00128 <span class="comment">        /**</span>
<a name="l00129"></a>00129 <span class="comment">         *</span>
<a name="l00130"></a>00130 <span class="comment">         */</span>
<a name="l00131"></a><a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor_3_01std_1_1string_01_4.html#a60f33d5df24db35deb2982d4b30738ed">00131</a>     <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="class_t_c_l_a_p_1_1_value_arg.html" title="The basic labeled argument that parses a value.">ValueArg</a>&lt;std::string&gt;;
<a name="l00132"></a>00132 
<a name="l00133"></a>00133     <span class="keyword">private</span>:
<a name="l00134"></a>00134         <span class="comment"></span>
<a name="l00135"></a>00135 <span class="comment">                /**</span>
<a name="l00136"></a>00136 <span class="comment">                 * Reference to the value where the result of the extraction will </span>
<a name="l00137"></a>00137 <span class="comment">                 * be put.</span>
<a name="l00138"></a>00138 <span class="comment">                 */</span>
<a name="l00139"></a><a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor_3_01std_1_1string_01_4.html#a89d6b0885738d1bed9ff1888f65f6bd5">00139</a>         std::string &amp;<a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor.html#a578f474590f01eb72ca06cea63fa826d" title="Reference to the value where the result of the extraction will be put.">_value</a>;
<a name="l00140"></a>00140 <span class="comment"></span>
<a name="l00141"></a>00141 <span class="comment">                /**</span>
<a name="l00142"></a>00142 <span class="comment">                 * Constructor.</span>
<a name="l00143"></a>00143 <span class="comment">                 * \param value - Where the value extracted will be put.</span>
<a name="l00144"></a>00144 <span class="comment">                 */</span>
<a name="l00145"></a><a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor_3_01std_1_1string_01_4.html#a94c463a7be752c2b74a378624cae1478">00145</a>         <a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor.html" title="This class is used to extract a value from an argument.">ValueExtractor</a>(std::string &amp;value) : <a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor.html#a578f474590f01eb72ca06cea63fa826d" title="Reference to the value where the result of the extraction will be put.">_value</a>(value) {}
<a name="l00146"></a>00146 <span class="comment"></span>
<a name="l00147"></a>00147 <span class="comment">                /**</span>
<a name="l00148"></a>00148 <span class="comment">                 * Method that will attempt to parse the input stream for a value</span>
<a name="l00149"></a>00149 <span class="comment">                 * of type std::string.</span>
<a name="l00150"></a>00150 <span class="comment">                 * \param val - Where the string parsed will be put.</span>
<a name="l00151"></a>00151 <span class="comment">                 */</span>
<a name="l00152"></a><a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor_3_01std_1_1string_01_4.html#a6792942bd7fdfc7f559df73a546ffa54">00152</a>         <span class="keywordtype">int</span> <a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor.html#a9f29ec2bc6e8af3c5e8c8f7233ea3255" title="Method that will attempt to parse the input stream for a value of type T.">extractValue</a>( <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; val ) 
<a name="l00153"></a>00153                 {
<a name="l00154"></a>00154             <a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor.html#a578f474590f01eb72ca06cea63fa826d" title="Reference to the value where the result of the extraction will be put.">_value</a> = val;
<a name="l00155"></a>00155             <span class="keywordflow">return</span> 0;
<a name="l00156"></a>00156         }
<a name="l00157"></a>00157 };
<a name="l00158"></a>00158 
<a name="l00159"></a>00159 } <span class="comment">//namespace VALUE_ARG_HELPER </span>
<a name="l00160"></a>00160 <span class="comment"></span>
<a name="l00161"></a>00161 <span class="comment">/**</span>
<a name="l00162"></a>00162 <span class="comment"> * The basic labeled argument that parses a value.</span>
<a name="l00163"></a>00163 <span class="comment"> * This is a template class, which means the type T defines the type</span>
<a name="l00164"></a>00164 <span class="comment"> * that a given object will attempt to parse when the flag/name is matched</span>
<a name="l00165"></a>00165 <span class="comment"> * on the command line.  While there is nothing stopping you from creating</span>
<a name="l00166"></a>00166 <span class="comment"> * an unflagged ValueArg, it is unwise and would cause significant problems.</span>
<a name="l00167"></a>00167 <span class="comment"> * Instead use an UnlabeledValueArg.</span>
<a name="l00168"></a>00168 <span class="comment"> */</span>
<a name="l00169"></a>00169 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
<a name="l00170"></a>00170 <span class="keyword">class </span>ValueArg : <span class="keyword">public</span> Arg 
<a name="l00171"></a>00171 {
<a name="l00172"></a>00172     <span class="keyword">protected</span>:
<a name="l00173"></a>00173 <span class="comment"></span>
<a name="l00174"></a>00174 <span class="comment">        /**</span>
<a name="l00175"></a>00175 <span class="comment">         * The value parsed from the command line.</span>
<a name="l00176"></a>00176 <span class="comment">         * Can be of any type, as long as the &gt;&gt; operator for the type</span>
<a name="l00177"></a>00177 <span class="comment">         * is defined.</span>
<a name="l00178"></a>00178 <span class="comment">         */</span>
<a name="l00179"></a><a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a9952212bcf288f00240b41abdd92fc5c">00179</a>         T <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a9952212bcf288f00240b41abdd92fc5c" title="The value parsed from the command line.">_value</a>;
<a name="l00180"></a>00180 <span class="comment"></span>
<a name="l00181"></a>00181 <span class="comment">        /**</span>
<a name="l00182"></a>00182 <span class="comment">         * A human readable description of the type to be parsed.</span>
<a name="l00183"></a>00183 <span class="comment">         * This is a hack, plain and simple.  Ideally we would use RTTI to</span>
<a name="l00184"></a>00184 <span class="comment">         * return the name of type T, but until there is some sort of</span>
<a name="l00185"></a>00185 <span class="comment">         * consistent support for human readable names, we are left to our</span>
<a name="l00186"></a>00186 <span class="comment">         * own devices.</span>
<a name="l00187"></a>00187 <span class="comment">         */</span>
<a name="l00188"></a><a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a892a2e3cbb939d1daee8950b414938fa">00188</a>         std::string <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a892a2e3cbb939d1daee8950b414938fa" title="A human readable description of the type to be parsed.">_typeDesc</a>;
<a name="l00189"></a>00189 <span class="comment"></span>
<a name="l00190"></a>00190 <span class="comment">        /**</span>
<a name="l00191"></a>00191 <span class="comment">         * A Constraint this Arg must conform to. </span>
<a name="l00192"></a>00192 <span class="comment">         */</span>
<a name="l00193"></a><a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#aab769ef038c9a1bbd9469e8d1b692d7a">00193</a>         <a class="code" href="class_t_c_l_a_p_1_1_constraint.html">Constraint&lt;T&gt;</a>* <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#aab769ef038c9a1bbd9469e8d1b692d7a" title="A Constraint this Arg must conform to.">_constraint</a>;
<a name="l00194"></a>00194 <span class="comment"></span>
<a name="l00195"></a>00195 <span class="comment">        /**</span>
<a name="l00196"></a>00196 <span class="comment">         * Extracts the value from the string.</span>
<a name="l00197"></a>00197 <span class="comment">         * Attempts to parse string as type T, if this fails an exception</span>
<a name="l00198"></a>00198 <span class="comment">         * is thrown.</span>
<a name="l00199"></a>00199 <span class="comment">         * \param val - value to be parsed. </span>
<a name="l00200"></a>00200 <span class="comment">         */</span>
<a name="l00201"></a>00201         <span class="keywordtype">void</span> <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#abf35854aeecbbca671795b095874aa9a" title="Extracts the value from the string.">_extractValue</a>( <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; val );
<a name="l00202"></a>00202 
<a name="l00203"></a>00203         <span class="keyword">public</span>:
<a name="l00204"></a>00204 <span class="comment"></span>
<a name="l00205"></a>00205 <span class="comment">        /**</span>
<a name="l00206"></a>00206 <span class="comment">         * Labeled ValueArg constructor.</span>
<a name="l00207"></a>00207 <span class="comment">         * You could conceivably call this constructor with a blank flag, </span>
<a name="l00208"></a>00208 <span class="comment">         * but that would make you a bad person.  It would also cause</span>
<a name="l00209"></a>00209 <span class="comment">         * an exception to be thrown.   If you want an unlabeled argument, </span>
<a name="l00210"></a>00210 <span class="comment">         * use the other constructor.</span>
<a name="l00211"></a>00211 <span class="comment">         * \param flag - The one character flag that identifies this</span>
<a name="l00212"></a>00212 <span class="comment">         * argument on the command line.</span>
<a name="l00213"></a>00213 <span class="comment">         * \param name - A one word name for the argument.  Can be</span>
<a name="l00214"></a>00214 <span class="comment">         * used as a long flag on the command line.</span>
<a name="l00215"></a>00215 <span class="comment">         * \param desc - A description of what the argument is for or</span>
<a name="l00216"></a>00216 <span class="comment">         * does.</span>
<a name="l00217"></a>00217 <span class="comment">         * \param req - Whether the argument is required on the command</span>
<a name="l00218"></a>00218 <span class="comment">         * line.</span>
<a name="l00219"></a>00219 <span class="comment">         * \param value - The default value assigned to this argument if it</span>
<a name="l00220"></a>00220 <span class="comment">         * is not present on the command line.</span>
<a name="l00221"></a>00221 <span class="comment">         * \param typeDesc - A short, human readable description of the</span>
<a name="l00222"></a>00222 <span class="comment">         * type that this object expects.  This is used in the generation</span>
<a name="l00223"></a>00223 <span class="comment">         * of the USAGE statement.  The goal is to be helpful to the end user</span>
<a name="l00224"></a>00224 <span class="comment">         * of the program.</span>
<a name="l00225"></a>00225 <span class="comment">         * \param v - An optional visitor.  You probably should not</span>
<a name="l00226"></a>00226 <span class="comment">         * use this unless you have a very good reason.</span>
<a name="l00227"></a>00227 <span class="comment">         */</span>
<a name="l00228"></a>00228         <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a4a9a2de87d52e40efa25a342e6d5cebe" title="Labeled ValueArg constructor.">ValueArg</a>( <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; flag, 
<a name="l00229"></a>00229                   <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; name, 
<a name="l00230"></a>00230                   <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; desc, 
<a name="l00231"></a>00231                   <span class="keywordtype">bool</span> req, 
<a name="l00232"></a>00232                   T value,
<a name="l00233"></a>00233                   <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; typeDesc,
<a name="l00234"></a>00234                   <a class="code" href="class_t_c_l_a_p_1_1_visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* v = NULL);
<a name="l00235"></a>00235                                  
<a name="l00236"></a>00236                                  <span class="comment"></span>
<a name="l00237"></a>00237 <span class="comment">        /**</span>
<a name="l00238"></a>00238 <span class="comment">         * Labeled ValueArg constructor.</span>
<a name="l00239"></a>00239 <span class="comment">         * You could conceivably call this constructor with a blank flag, </span>
<a name="l00240"></a>00240 <span class="comment">         * but that would make you a bad person.  It would also cause</span>
<a name="l00241"></a>00241 <span class="comment">         * an exception to be thrown.   If you want an unlabeled argument, </span>
<a name="l00242"></a>00242 <span class="comment">         * use the other constructor.</span>
<a name="l00243"></a>00243 <span class="comment">         * \param flag - The one character flag that identifies this</span>
<a name="l00244"></a>00244 <span class="comment">         * argument on the command line.</span>
<a name="l00245"></a>00245 <span class="comment">         * \param name - A one word name for the argument.  Can be</span>
<a name="l00246"></a>00246 <span class="comment">         * used as a long flag on the command line.</span>
<a name="l00247"></a>00247 <span class="comment">         * \param desc - A description of what the argument is for or</span>
<a name="l00248"></a>00248 <span class="comment">         * does.</span>
<a name="l00249"></a>00249 <span class="comment">         * \param req - Whether the argument is required on the command</span>
<a name="l00250"></a>00250 <span class="comment">         * line.</span>
<a name="l00251"></a>00251 <span class="comment">         * \param value - The default value assigned to this argument if it</span>
<a name="l00252"></a>00252 <span class="comment">         * is not present on the command line.</span>
<a name="l00253"></a>00253 <span class="comment">         * \param typeDesc - A short, human readable description of the</span>
<a name="l00254"></a>00254 <span class="comment">         * type that this object expects.  This is used in the generation</span>
<a name="l00255"></a>00255 <span class="comment">         * of the USAGE statement.  The goal is to be helpful to the end user</span>
<a name="l00256"></a>00256 <span class="comment">         * of the program.</span>
<a name="l00257"></a>00257 <span class="comment">         * \param parser - A CmdLine parser object to add this Arg to</span>
<a name="l00258"></a>00258 <span class="comment">         * \param v - An optional visitor.  You probably should not</span>
<a name="l00259"></a>00259 <span class="comment">         * use this unless you have a very good reason.</span>
<a name="l00260"></a>00260 <span class="comment">         */</span>
<a name="l00261"></a>00261         <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a4a9a2de87d52e40efa25a342e6d5cebe" title="Labeled ValueArg constructor.">ValueArg</a>( <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; flag, 
<a name="l00262"></a>00262                   <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; name, 
<a name="l00263"></a>00263                   <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; desc, 
<a name="l00264"></a>00264                   <span class="keywordtype">bool</span> req, 
<a name="l00265"></a>00265                   T value,
<a name="l00266"></a>00266                   <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; typeDesc,
<a name="l00267"></a>00267                   <a class="code" href="class_t_c_l_a_p_1_1_cmd_line_interface.html" title="The base class that manages the command line definition and passes along the parsing to the appropria...">CmdLineInterface</a>&amp; parser,
<a name="l00268"></a>00268                   <a class="code" href="class_t_c_l_a_p_1_1_visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* v = NULL );
<a name="l00269"></a>00269  <span class="comment"></span>
<a name="l00270"></a>00270 <span class="comment">        /**</span>
<a name="l00271"></a>00271 <span class="comment">         * Labeled ValueArg constructor.</span>
<a name="l00272"></a>00272 <span class="comment">         * You could conceivably call this constructor with a blank flag, </span>
<a name="l00273"></a>00273 <span class="comment">         * but that would make you a bad person.  It would also cause</span>
<a name="l00274"></a>00274 <span class="comment">         * an exception to be thrown.   If you want an unlabeled argument, </span>
<a name="l00275"></a>00275 <span class="comment">         * use the other constructor.</span>
<a name="l00276"></a>00276 <span class="comment">         * \param flag - The one character flag that identifies this</span>
<a name="l00277"></a>00277 <span class="comment">         * argument on the command line.</span>
<a name="l00278"></a>00278 <span class="comment">         * \param name - A one word name for the argument.  Can be</span>
<a name="l00279"></a>00279 <span class="comment">         * used as a long flag on the command line.</span>
<a name="l00280"></a>00280 <span class="comment">         * \param desc - A description of what the argument is for or</span>
<a name="l00281"></a>00281 <span class="comment">         * does.</span>
<a name="l00282"></a>00282 <span class="comment">         * \param req - Whether the argument is required on the command</span>
<a name="l00283"></a>00283 <span class="comment">         * line.</span>
<a name="l00284"></a>00284 <span class="comment">         * \param value - The default value assigned to this argument if it</span>
<a name="l00285"></a>00285 <span class="comment">         * is not present on the command line.</span>
<a name="l00286"></a>00286 <span class="comment">         * \param constraint - A pointer to a Constraint object used</span>
<a name="l00287"></a>00287 <span class="comment">                 * to constrain this Arg.</span>
<a name="l00288"></a>00288 <span class="comment">         * \param parser - A CmdLine parser object to add this Arg to.</span>
<a name="l00289"></a>00289 <span class="comment">         * \param v - An optional visitor.  You probably should not</span>
<a name="l00290"></a>00290 <span class="comment">         * use this unless you have a very good reason.</span>
<a name="l00291"></a>00291 <span class="comment">         */</span>
<a name="l00292"></a>00292         <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a4a9a2de87d52e40efa25a342e6d5cebe" title="Labeled ValueArg constructor.">ValueArg</a>( <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; flag, 
<a name="l00293"></a>00293                   <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; name, 
<a name="l00294"></a>00294                   <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; desc, 
<a name="l00295"></a>00295                   <span class="keywordtype">bool</span> req, 
<a name="l00296"></a>00296                   T value,
<a name="l00297"></a>00297                   <a class="code" href="class_t_c_l_a_p_1_1_constraint.html">Constraint&lt;T&gt;</a>* constraint,
<a name="l00298"></a>00298                   <a class="code" href="class_t_c_l_a_p_1_1_cmd_line_interface.html" title="The base class that manages the command line definition and passes along the parsing to the appropria...">CmdLineInterface</a>&amp; parser,
<a name="l00299"></a>00299                   <a class="code" href="class_t_c_l_a_p_1_1_visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* v = NULL );
<a name="l00300"></a>00300           <span class="comment"></span>
<a name="l00301"></a>00301 <span class="comment">        /**</span>
<a name="l00302"></a>00302 <span class="comment">         * Labeled ValueArg constructor.</span>
<a name="l00303"></a>00303 <span class="comment">         * You could conceivably call this constructor with a blank flag, </span>
<a name="l00304"></a>00304 <span class="comment">         * but that would make you a bad person.  It would also cause</span>
<a name="l00305"></a>00305 <span class="comment">         * an exception to be thrown.   If you want an unlabeled argument, </span>
<a name="l00306"></a>00306 <span class="comment">         * use the other constructor.</span>
<a name="l00307"></a>00307 <span class="comment">         * \param flag - The one character flag that identifies this</span>
<a name="l00308"></a>00308 <span class="comment">         * argument on the command line.</span>
<a name="l00309"></a>00309 <span class="comment">         * \param name - A one word name for the argument.  Can be</span>
<a name="l00310"></a>00310 <span class="comment">         * used as a long flag on the command line.</span>
<a name="l00311"></a>00311 <span class="comment">         * \param desc - A description of what the argument is for or</span>
<a name="l00312"></a>00312 <span class="comment">         * does.</span>
<a name="l00313"></a>00313 <span class="comment">         * \param req - Whether the argument is required on the command</span>
<a name="l00314"></a>00314 <span class="comment">         * line.</span>
<a name="l00315"></a>00315 <span class="comment">         * \param value - The default value assigned to this argument if it</span>
<a name="l00316"></a>00316 <span class="comment">         * is not present on the command line.</span>
<a name="l00317"></a>00317 <span class="comment">         * \param constraint - A pointer to a Constraint object used</span>
<a name="l00318"></a>00318 <span class="comment">                 * to constrain this Arg.</span>
<a name="l00319"></a>00319 <span class="comment">         * \param v - An optional visitor.  You probably should not</span>
<a name="l00320"></a>00320 <span class="comment">         * use this unless you have a very good reason.</span>
<a name="l00321"></a>00321 <span class="comment">         */</span>
<a name="l00322"></a>00322         <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a4a9a2de87d52e40efa25a342e6d5cebe" title="Labeled ValueArg constructor.">ValueArg</a>( <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; flag, 
<a name="l00323"></a>00323                   <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; name, 
<a name="l00324"></a>00324                   <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; desc, 
<a name="l00325"></a>00325                   <span class="keywordtype">bool</span> req, 
<a name="l00326"></a>00326                   T value,
<a name="l00327"></a>00327                   <a class="code" href="class_t_c_l_a_p_1_1_constraint.html">Constraint&lt;T&gt;</a>* constraint,
<a name="l00328"></a>00328                   <a class="code" href="class_t_c_l_a_p_1_1_visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* v = NULL );
<a name="l00329"></a>00329 <span class="comment"></span>
<a name="l00330"></a>00330 <span class="comment">        /**</span>
<a name="l00331"></a>00331 <span class="comment">         * Handles the processing of the argument.</span>
<a name="l00332"></a>00332 <span class="comment">         * This re-implements the Arg version of this method to set the</span>
<a name="l00333"></a>00333 <span class="comment">         * _value of the argument appropriately.  It knows the difference</span>
<a name="l00334"></a>00334 <span class="comment">         * between labeled and unlabeled.</span>
<a name="l00335"></a>00335 <span class="comment">         * \param i - Pointer the the current argument in the list.</span>
<a name="l00336"></a>00336 <span class="comment">         * \param args - Mutable list of strings. Passed </span>
<a name="l00337"></a>00337 <span class="comment">         * in from main().</span>
<a name="l00338"></a>00338 <span class="comment">         */</span>
<a name="l00339"></a>00339         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a8450096a5f8d383498e91b7ef78caf48" title="Handles the processing of the argument.">processArg</a>(<span class="keywordtype">int</span>* i, <a class="code" href="classstd_1_1vector.html">std::vector&lt;std::string&gt;</a>&amp; args); 
<a name="l00340"></a>00340 <span class="comment"></span>
<a name="l00341"></a>00341 <span class="comment">        /**</span>
<a name="l00342"></a>00342 <span class="comment">         * Returns the value of the argument.</span>
<a name="l00343"></a>00343 <span class="comment">         */</span>
<a name="l00344"></a>00344         T&amp; <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a241ea8229448c9384b2a60c50ee395e9" title="Returns the value of the argument.">getValue</a>() ;
<a name="l00345"></a>00345 <span class="comment"></span>
<a name="l00346"></a>00346 <span class="comment">        /**</span>
<a name="l00347"></a>00347 <span class="comment">         * Specialization of shortID.</span>
<a name="l00348"></a>00348 <span class="comment">         * \param val - value to be used.</span>
<a name="l00349"></a>00349 <span class="comment">         */</span>
<a name="l00350"></a>00350         <span class="keyword">virtual</span> std::string <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a0681144a46ae08d7ad354978c1bac2aa" title="Specialization of shortID.">shortID</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; val = <span class="stringliteral">&quot;val&quot;</span>) <span class="keyword">const</span>;
<a name="l00351"></a>00351 <span class="comment"></span>
<a name="l00352"></a>00352 <span class="comment">        /**</span>
<a name="l00353"></a>00353 <span class="comment">         * Specialization of longID.</span>
<a name="l00354"></a>00354 <span class="comment">         * \param val - value to be used.</span>
<a name="l00355"></a>00355 <span class="comment">         */</span>
<a name="l00356"></a>00356         <span class="keyword">virtual</span> std::string <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a65f614d1864b7baf6857cdbdd5fc7830" title="Specialization of longID.">longID</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; val = <span class="stringliteral">&quot;val&quot;</span>) <span class="keyword">const</span>;
<a name="l00357"></a>00357 
<a name="l00358"></a>00358 };
<a name="l00359"></a>00359 
<a name="l00360"></a>00360 <span class="comment"></span>
<a name="l00361"></a>00361 <span class="comment">/**</span>
<a name="l00362"></a>00362 <span class="comment"> * Constructor implementation.</span>
<a name="l00363"></a>00363 <span class="comment"> */</span>
<a name="l00364"></a>00364 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
<a name="l00365"></a><a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a4a9a2de87d52e40efa25a342e6d5cebe">00365</a> <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a4a9a2de87d52e40efa25a342e6d5cebe" title="Labeled ValueArg constructor.">ValueArg&lt;T&gt;::ValueArg</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; flag, 
<a name="l00366"></a>00366                       <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; name, 
<a name="l00367"></a>00367                       <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; desc, 
<a name="l00368"></a>00368                       <span class="keywordtype">bool</span> req, 
<a name="l00369"></a>00369                       T val,
<a name="l00370"></a>00370                       <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; typeDesc,
<a name="l00371"></a>00371                       <a class="code" href="class_t_c_l_a_p_1_1_visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* v)
<a name="l00372"></a>00372 : <a class="code" href="class_t_c_l_a_p_1_1_arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>(flag, name, desc, req, true, v),
<a name="l00373"></a>00373   _value( val ),
<a name="l00374"></a>00374   _typeDesc( typeDesc ),
<a name="l00375"></a>00375   _constraint( NULL )
<a name="l00376"></a>00376 { }
<a name="l00377"></a>00377 
<a name="l00378"></a>00378 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
<a name="l00379"></a><a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a54662f035ae290ca2929516152b1b3c1">00379</a> <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a4a9a2de87d52e40efa25a342e6d5cebe" title="Labeled ValueArg constructor.">ValueArg&lt;T&gt;::ValueArg</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; flag, 
<a name="l00380"></a>00380                       <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; name, 
<a name="l00381"></a>00381                       <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; desc, 
<a name="l00382"></a>00382                       <span class="keywordtype">bool</span> req, 
<a name="l00383"></a>00383                       T val,
<a name="l00384"></a>00384                       <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; typeDesc,
<a name="l00385"></a>00385                       <a class="code" href="class_t_c_l_a_p_1_1_cmd_line_interface.html" title="The base class that manages the command line definition and passes along the parsing to the appropria...">CmdLineInterface</a>&amp; parser,
<a name="l00386"></a>00386                       <a class="code" href="class_t_c_l_a_p_1_1_visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* v)
<a name="l00387"></a>00387 : <a class="code" href="class_t_c_l_a_p_1_1_arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>(flag, name, desc, req, true, v),
<a name="l00388"></a>00388   _value( val ),
<a name="l00389"></a>00389   _typeDesc( typeDesc ),
<a name="l00390"></a>00390   _constraint( NULL )
<a name="l00391"></a>00391 { 
<a name="l00392"></a>00392     parser.<a class="code" href="class_t_c_l_a_p_1_1_cmd_line_interface.html#a13b29ab754c030185e58f779dc355631" title="Adds an argument to the list of arguments to be parsed.">add</a>( <span class="keyword">this</span> );
<a name="l00393"></a>00393 }
<a name="l00394"></a>00394 
<a name="l00395"></a>00395 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
<a name="l00396"></a><a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a265940821ea45b7a4a452697bb2dd792">00396</a> <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a4a9a2de87d52e40efa25a342e6d5cebe" title="Labeled ValueArg constructor.">ValueArg&lt;T&gt;::ValueArg</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; flag, 
<a name="l00397"></a>00397                       <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; name, 
<a name="l00398"></a>00398                       <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; desc, 
<a name="l00399"></a>00399                       <span class="keywordtype">bool</span> req, 
<a name="l00400"></a>00400                       T val,
<a name="l00401"></a>00401                       <a class="code" href="class_t_c_l_a_p_1_1_constraint.html">Constraint&lt;T&gt;</a>* constraint,
<a name="l00402"></a>00402                       <a class="code" href="class_t_c_l_a_p_1_1_visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* v)
<a name="l00403"></a>00403 : <a class="code" href="class_t_c_l_a_p_1_1_arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>(flag, name, desc, req, true, v),
<a name="l00404"></a>00404   _value( val ),
<a name="l00405"></a>00405   _typeDesc( constraint-&gt;shortID() ),
<a name="l00406"></a>00406   _constraint( constraint )
<a name="l00407"></a>00407 { }
<a name="l00408"></a>00408 
<a name="l00409"></a>00409 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
<a name="l00410"></a><a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a0479fda3ce390d52b6e8376a4ee5764e">00410</a> <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a4a9a2de87d52e40efa25a342e6d5cebe" title="Labeled ValueArg constructor.">ValueArg&lt;T&gt;::ValueArg</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; flag, 
<a name="l00411"></a>00411                       <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; name, 
<a name="l00412"></a>00412                       <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; desc, 
<a name="l00413"></a>00413                       <span class="keywordtype">bool</span> req, 
<a name="l00414"></a>00414                       T val,
<a name="l00415"></a>00415                       <a class="code" href="class_t_c_l_a_p_1_1_constraint.html">Constraint&lt;T&gt;</a>* constraint,
<a name="l00416"></a>00416                       <a class="code" href="class_t_c_l_a_p_1_1_cmd_line_interface.html" title="The base class that manages the command line definition and passes along the parsing to the appropria...">CmdLineInterface</a>&amp; parser,
<a name="l00417"></a>00417                       <a class="code" href="class_t_c_l_a_p_1_1_visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* v)
<a name="l00418"></a>00418 : <a class="code" href="class_t_c_l_a_p_1_1_arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>(flag, name, desc, req, true, v),
<a name="l00419"></a>00419   _value( val ),
<a name="l00420"></a>00420   _typeDesc( constraint-&gt;shortID() ),
<a name="l00421"></a>00421   _constraint( constraint )
<a name="l00422"></a>00422 { 
<a name="l00423"></a>00423     parser.<a class="code" href="class_t_c_l_a_p_1_1_cmd_line_interface.html#a13b29ab754c030185e58f779dc355631" title="Adds an argument to the list of arguments to be parsed.">add</a>( <span class="keyword">this</span> );
<a name="l00424"></a>00424 }
<a name="l00425"></a>00425 
<a name="l00426"></a>00426 <span class="comment"></span>
<a name="l00427"></a>00427 <span class="comment">/**</span>
<a name="l00428"></a>00428 <span class="comment"> * Implementation of getValue().</span>
<a name="l00429"></a>00429 <span class="comment"> */</span>
<a name="l00430"></a>00430 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
<a name="l00431"></a><a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a241ea8229448c9384b2a60c50ee395e9">00431</a> T&amp; <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a241ea8229448c9384b2a60c50ee395e9" title="Returns the value of the argument.">ValueArg&lt;T&gt;::getValue</a>() { <span class="keywordflow">return</span> _value; }
<a name="l00432"></a>00432 <span class="comment"></span>
<a name="l00433"></a>00433 <span class="comment">/**</span>
<a name="l00434"></a>00434 <span class="comment"> * Implementation of processArg().</span>
<a name="l00435"></a>00435 <span class="comment"> */</span>
<a name="l00436"></a>00436 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
<a name="l00437"></a><a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a8450096a5f8d383498e91b7ef78caf48">00437</a> <span class="keywordtype">bool</span> <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html" title="The basic labeled argument that parses a value.">ValueArg&lt;T&gt;::processArg</a>(<span class="keywordtype">int</span> *i, <a class="code" href="classstd_1_1vector.html">std::vector&lt;std::string&gt;</a>&amp; args)
<a name="l00438"></a>00438 {
<a name="l00439"></a>00439     <span class="keywordflow">if</span> ( _ignoreable &amp;&amp; Arg::ignoreRest() )
<a name="l00440"></a>00440                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00441"></a>00441 
<a name="l00442"></a>00442     <span class="keywordflow">if</span> ( _hasBlanks( args[*i] ) )
<a name="l00443"></a>00443                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00444"></a>00444 
<a name="l00445"></a>00445     std::string flag = args[*i];
<a name="l00446"></a>00446 
<a name="l00447"></a>00447     std::string value = <span class="stringliteral">&quot;&quot;</span>;
<a name="l00448"></a>00448     trimFlag( flag, value );
<a name="l00449"></a>00449 
<a name="l00450"></a>00450     <span class="keywordflow">if</span> ( argMatches( flag ) )
<a name="l00451"></a>00451     {
<a name="l00452"></a>00452         <span class="keywordflow">if</span> ( _alreadySet )
<a name="l00453"></a>00453                         <span class="keywordflow">throw</span>( <a class="code" href="class_t_c_l_a_p_1_1_cmd_line_parse_exception.html" title="Thrown from CmdLine when the arguments on the command line are not properly specified, e.g.">CmdLineParseException</a>(<span class="stringliteral">&quot;Argument already set!&quot;</span>, toString()) );
<a name="l00454"></a>00454 
<a name="l00455"></a>00455         <span class="keywordflow">if</span> ( Arg::delimiter() != <span class="charliteral">&#39; &#39;</span> &amp;&amp; value == <span class="stringliteral">&quot;&quot;</span> )
<a name="l00456"></a>00456                         <span class="keywordflow">throw</span>( <a class="code" href="class_t_c_l_a_p_1_1_arg_parse_exception.html" title="Thrown from within the child Arg classes when it fails to properly parse the argument it has been pas...">ArgParseException</a>( 
<a name="l00457"></a>00457                                                         <span class="stringliteral">&quot;Couldn&#39;t find delimiter for this argument!&quot;</span>,
<a name="l00458"></a>00458                              toString() ) );
<a name="l00459"></a>00459 
<a name="l00460"></a>00460         <span class="keywordflow">if</span> ( value == <span class="stringliteral">&quot;&quot;</span> )
<a name="l00461"></a>00461         {
<a name="l00462"></a>00462             (*i)++;
<a name="l00463"></a>00463             <span class="keywordflow">if</span> ( static_cast&lt;unsigned int&gt;(*i) &lt; args.size() ) 
<a name="l00464"></a>00464                                 _extractValue( args[*i] );
<a name="l00465"></a>00465             <span class="keywordflow">else</span>
<a name="l00466"></a>00466                                 <span class="keywordflow">throw</span>( <a class="code" href="class_t_c_l_a_p_1_1_arg_parse_exception.html" title="Thrown from within the child Arg classes when it fails to properly parse the argument it has been pas...">ArgParseException</a>(<span class="stringliteral">&quot;Missing a value for this argument!&quot;</span>,
<a name="l00467"></a>00467                                                     toString() ) );
<a name="l00468"></a>00468         }
<a name="l00469"></a>00469         <span class="keywordflow">else</span>
<a name="l00470"></a>00470                         _extractValue( value );
<a name="l00471"></a>00471                                 
<a name="l00472"></a>00472         _alreadySet = <span class="keyword">true</span>;
<a name="l00473"></a>00473         _checkWithVisitor();
<a name="l00474"></a>00474         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00475"></a>00475     }   
<a name="l00476"></a>00476     <span class="keywordflow">else</span>
<a name="l00477"></a>00477                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00478"></a>00478 }
<a name="l00479"></a>00479 <span class="comment"></span>
<a name="l00480"></a>00480 <span class="comment">/**</span>
<a name="l00481"></a>00481 <span class="comment"> * Implementation of shortID.</span>
<a name="l00482"></a>00482 <span class="comment"> */</span>
<a name="l00483"></a>00483 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
<a name="l00484"></a><a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a0681144a46ae08d7ad354978c1bac2aa">00484</a> std::string <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html" title="The basic labeled argument that parses a value.">ValueArg&lt;T&gt;::shortID</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; val)<span class="keyword"> const</span>
<a name="l00485"></a>00485 <span class="keyword"></span>{
<a name="l00486"></a>00486     <span class="keywordflow">return</span> Arg::shortID( _typeDesc ); 
<a name="l00487"></a>00487 }
<a name="l00488"></a>00488 <span class="comment"></span>
<a name="l00489"></a>00489 <span class="comment">/**</span>
<a name="l00490"></a>00490 <span class="comment"> * Implementation of longID.</span>
<a name="l00491"></a>00491 <span class="comment"> */</span>
<a name="l00492"></a>00492 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
<a name="l00493"></a><a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#a65f614d1864b7baf6857cdbdd5fc7830">00493</a> std::string <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html" title="The basic labeled argument that parses a value.">ValueArg&lt;T&gt;::longID</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; val)<span class="keyword"> const</span>
<a name="l00494"></a>00494 <span class="keyword"></span>{
<a name="l00495"></a>00495     <span class="keywordflow">return</span> Arg::longID( _typeDesc ); 
<a name="l00496"></a>00496 }
<a name="l00497"></a>00497 
<a name="l00498"></a>00498 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
<a name="l00499"></a><a class="code" href="class_t_c_l_a_p_1_1_value_arg.html#abf35854aeecbbca671795b095874aa9a">00499</a> <span class="keywordtype">void</span> <a class="code" href="class_t_c_l_a_p_1_1_value_arg.html" title="The basic labeled argument that parses a value.">ValueArg&lt;T&gt;::_extractValue</a>( <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a>&amp; val ) 
<a name="l00500"></a>00500 {
<a name="l00501"></a>00501         VALUE_ARG_HELPER::ValueExtractor&lt;T&gt; ve(_value);
<a name="l00502"></a>00502 
<a name="l00503"></a>00503         <span class="keywordtype">int</span> err = ve.<a class="code" href="class_t_c_l_a_p_1_1_v_a_l_u_e___a_r_g___h_e_l_p_e_r_1_1_value_extractor.html#a9f29ec2bc6e8af3c5e8c8f7233ea3255" title="Method that will attempt to parse the input stream for a value of type T.">extractValue</a>(val);
<a name="l00504"></a>00504 
<a name="l00505"></a>00505         <span class="keywordflow">if</span> ( err == <a class="code" href="namespace_t_c_l_a_p_1_1_m_u_l_t_i___a_r_g___h_e_l_p_e_r.html#a05e9d7d66a5aebe00a18ed3e642171b8a34e78ac3b2516d88e25b585302d0b583">VALUE_ARG_HELPER::EXTRACT_FAILURE</a> )
<a name="l00506"></a>00506                 <span class="keywordflow">throw</span>( <a class="code" href="class_t_c_l_a_p_1_1_arg_parse_exception.html" title="Thrown from within the child Arg classes when it fails to properly parse the argument it has been pas...">ArgParseException</a>(<span class="stringliteral">&quot;Couldn&#39;t read argument value from string &#39;&quot;</span> +
<a name="l00507"></a>00507                                      val + <span class="stringliteral">&quot;&#39;&quot;</span>, toString() ) );
<a name="l00508"></a>00508 
<a name="l00509"></a>00509         <span class="keywordflow">if</span> ( err == <a class="code" href="namespace_t_c_l_a_p_1_1_m_u_l_t_i___a_r_g___h_e_l_p_e_r.html#a05e9d7d66a5aebe00a18ed3e642171b8a3a8b1e6fa3593f61a712dea63322da0d">VALUE_ARG_HELPER::EXTRACT_TOO_MANY</a> )
<a name="l00510"></a>00510                 <span class="keywordflow">throw</span>( <a class="code" href="class_t_c_l_a_p_1_1_arg_parse_exception.html" title="Thrown from within the child Arg classes when it fails to properly parse the argument it has been pas...">ArgParseException</a>(
<a name="l00511"></a>00511                                         <span class="stringliteral">&quot;More than one valid value parsed from string &#39;&quot;</span> +
<a name="l00512"></a>00512                                     val + <span class="stringliteral">&quot;&#39;&quot;</span>, toString() ) );
<a name="l00513"></a>00513 
<a name="l00514"></a>00514         <span class="keywordflow">if</span> ( _constraint != NULL )
<a name="l00515"></a>00515                 <span class="keywordflow">if</span> ( ! _constraint-&gt;check( _value ) )
<a name="l00516"></a>00516                         <span class="keywordflow">throw</span>( <a class="code" href="class_t_c_l_a_p_1_1_cmd_line_parse_exception.html" title="Thrown from CmdLine when the arguments on the command line are not properly specified, e.g.">CmdLineParseException</a>( <span class="stringliteral">&quot;Value &#39;&quot;</span> + val + 
<a name="l00517"></a>00517                                                                               <span class="stringliteral">&quot;&#39; does not meet constraint: &quot;</span> + 
<a name="l00518"></a>00518                                                                                   _constraint-&gt;description(),
<a name="l00519"></a>00519                                                                                   toString() ) );
<a name="l00520"></a>00520 }
<a name="l00521"></a>00521 
<a name="l00522"></a>00522 } <span class="comment">// namespace TCLAP</span>
<a name="l00523"></a>00523 
<a name="l00524"></a>00524 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<br><hr><br> <table border="0" width="100%"> <tr> <td> Page generated by <a href="http://www.doxygen.org" target="_blank">Doxygen 1.7.5</a> for MRPT 0.9.5 SVN: at Sun Sep 25 17:20:18 UTC 2011</td><td></td> <td width="100"> </td> <td width="150">  </td></tr> </table>  </body></html>