genericvalues_8h-source.html

来自「仿真人工智能是指用人工的方法和技术」· HTML 代码 · 共 132 行

HTML
132
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>GenericValues.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body bgcolor="#ffffff"><!-- Generated by Doxygen 1.2.12 --><center><a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center><hr><h1>GenericValues.h</h1><a href="GenericValues_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">/*</font>00002 <font class="comment">Copyright (c) 2000,2001, Jelle Kok, University of Amsterdam</font>00003 <font class="comment">All rights reserved.</font>00004 <font class="comment"></font>00005 <font class="comment">Redistribution and use in source and binary forms, with or without </font>00006 <font class="comment">modification, are permitted provided that the following conditions are met:</font>00007 <font class="comment"></font>00008 <font class="comment">1. Redistributions of source code must retain the above copyright notice, this </font>00009 <font class="comment">list of conditions and the following disclaimer. </font>00010 <font class="comment"></font>00011 <font class="comment">2. Redistributions in binary form must reproduce the above copyright notice, </font>00012 <font class="comment">this list of conditions and the following disclaimer in the documentation </font>00013 <font class="comment">and/or other materials provided with the distribution. </font>00014 <font class="comment"></font>00015 <font class="comment">3. Neither the name of the University of Amsterdam nor the names of its </font>00016 <font class="comment">contributors may be used to endorse or promote products derived from this </font>00017 <font class="comment">software without specific prior written permission. </font>00018 <font class="comment"></font>00019 <font class="comment">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" </font>00020 <font class="comment">AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE </font>00021 <font class="comment">IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE </font>00022 <font class="comment">DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE </font>00023 <font class="comment">FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL </font>00024 <font class="comment">DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR </font>00025 <font class="comment">SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER </font>00026 <font class="comment">CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, </font>00027 <font class="comment">OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE </font>00028 <font class="comment">OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</font>00029 <font class="comment">*/</font>00047 <font class="preprocessor">#ifndef _GENERIC_VALUES_</font>00048 <font class="preprocessor"></font><font class="preprocessor">#define _GENERIC_VALUES_</font>00049 <font class="preprocessor"></font>00050 <font class="preprocessor">#include &lt;ostream.h&gt;</font>    <font class="comment">// needed for output stream</font>00051 <a name="l00053"></a><a class="code" href="GenericValues_8h.html#a4">00053</a> <font class="keyword">enum</font> <a class="code" href="GenericValues_8h.html#a4">GenericValueKind</a>00054 {00055   GENERIC_VALUE_DOUBLE  = 0,00056   GENERIC_VALUE_STRING  = 1,00057   GENERIC_VALUE_BOOLEAN = 2,00058   GENERIC_VALUE_INTEGER = 3,00059 };00060 00061 <font class="comment">/******************************************************************************/</font>00062 <font class="comment">/********************   CLASS GENERICVALUET   *********************************/</font>00063 <font class="comment">/******************************************************************************/</font>00064 <a name="l00069"></a><a class="code" href="classGenericValueT.html">00069</a> <font class="keyword">class </font><a class="code" href="classGenericValueT.html">GenericValueT</a>00070 {00071   <font class="comment">// private member data</font>00072 <font class="keyword">private</font>:00073 <a name="l00074"></a><a class="code" href="classGenericValueT.html#o0">00074</a>   <font class="keyword">const</font> <font class="keywordtype">char</font>*      <a class="code" href="classGenericValueT.html#o0">m_strName</a>;  <a name="l00076"></a><a class="code" href="classGenericValueT.html#o1">00076</a>   <font class="keywordtype">void</font>*            <a class="code" href="classGenericValueT.html#o1">m_vAddress</a>; <a name="l00077"></a><a class="code" href="classGenericValueT.html#o2">00077</a>   <a class="code" href="GenericValues_8h.html#a4">GenericValueKind</a> <a class="code" href="classGenericValueT.html#o2">m_type</a>;     00080   <font class="comment">// public methods</font>00081 <font class="keyword">public</font>:00082 00083   <font class="comment">// constructor for the GenericValueT class</font>00084   <a class="code" href="classGenericValueT.html#a0">GenericValueT</a>( <font class="keyword">const</font> <font class="keywordtype">char</font> *strName, <font class="keywordtype">void</font> *vAddress, <a class="code" href="GenericValues_8h.html#a4">GenericValueKind</a> type );00085 00086   <font class="comment">// destructor for the GenericValueT class</font>00087   <a class="code" href="classGenericValueT.html#a1">~GenericValueT</a>( );00088 00089   <font class="comment">// get methods for private member variables</font>00090   <font class="keyword">const</font> <font class="keywordtype">char</font>* <a class="code" href="classGenericValueT.html#a2">getName</a> ( );00091 00092   <font class="comment">// methods to set/get the value of this generic variable</font>00093   <font class="keywordtype">bool</font>  <a class="code" href="classGenericValueT.html#a3">setValue</a>( <font class="keyword">const</font> <font class="keywordtype">char</font> *strValue );00094   <font class="keywordtype">char</font>* <a class="code" href="classGenericValueT.html#a4">getValue</a>(       <font class="keywordtype">char</font> *strValue );00095 00096   <font class="comment">// display method</font>00097   <font class="keywordtype">void</font> <a class="code" href="classGenericValueT.html#a5">show</a>( ostream&amp; out, <font class="keyword">const</font> <font class="keywordtype">char</font> *strSeparator );00098 };00099 00100 <font class="comment">/******************************************************************************/</font>00101 <font class="comment">/********************   CLASS GENERICVALUES   *********************************/</font>00102 <font class="comment">/******************************************************************************/</font>00103 <a name="l00113"></a><a class="code" href="classGenericValues.html">00113</a> <font class="keyword">class </font><a class="code" href="classGenericValues.html">GenericValues</a>00114 {00115   <font class="comment">// private member data</font>00116 <font class="keyword">private</font>:00117 <a name="l00118"></a><a class="code" href="classGenericValues.html#o0">00118</a>   <font class="keywordtype">char</font>  *<a class="code" href="classGenericValues.html#o0">m_strClassName</a>;    <a name="l00121"></a><a class="code" href="classGenericValues.html#o1">00121</a>   <a class="code" href="classGenericValueT.html">GenericValueT</a> ** <a class="code" href="classGenericValues.html#o1">m_values</a>;<a name="l00123"></a><a class="code" href="classGenericValues.html#o2">00123</a>   <font class="keywordtype">int</font>   <a class="code" href="classGenericValues.html#o2">m_iValuesTotal</a>;     <a name="l00125"></a><a class="code" href="classGenericValues.html#o3">00125</a>   <font class="keywordtype">int</font>   <a class="code" href="classGenericValues.html#o3">m_iMaxGenericValues</a>;00129   <a class="code" href="classGenericValueT.html">GenericValueT</a>* <a class="code" href="classGenericValues.html#c0">getValuePtr</a>( <font class="keyword">const</font> <font class="keywordtype">char</font> *strName                             );00130 00131 <font class="keyword">public</font>:00132 00133   <font class="comment">// constructor for the GenericValues class</font>00134   <a class="code" href="classGenericValues.html#a0">GenericValues</a>           ( <font class="keywordtype">char</font> *strName,              <font class="keywordtype">int</font> iMaxValues        );00135 00136   <font class="comment">// destructor for the GenericValues class</font>00137   <font class="keyword">virtual</font> <a class="code" href="classGenericValues.html#a1">~GenericValues</a>  (                                                   );00138 00139   <font class="comment">// get methods for private member variables</font>00140   <font class="keywordtype">char</font>* <a class="code" href="classGenericValues.html#a2">getClassName</a>      (                                                   );00141   <font class="keywordtype">int</font>   <a class="code" href="classGenericValues.html#a3">getValuesTotal</a>    (                                                   );00142 00143   <font class="comment">// method for adding a generic value to the collection</font>00144   <font class="keywordtype">bool</font> <a class="code" href="classGenericValues.html#a4">addSetting</a>( <font class="keyword">const</font> <font class="keywordtype">char</font> *strName, <font class="keywordtype">void</font> *vAddress, <a class="code" href="GenericValues_8h.html#a4">GenericValueKind</a> t );00145 00146   <font class="comment">// methods for reading and writing generic values and collections of values</font>00147   <font class="keyword">virtual</font> <font class="keywordtype">char</font>* <a class="code" href="classGenericValues.html#a5">getValue</a>  ( <font class="keyword">const</font> <font class="keywordtype">char</font> *strName,       <font class="keywordtype">char</font> *strValue         );00148   <font class="keyword">virtual</font> <font class="keywordtype">bool</font>  <a class="code" href="classGenericValues.html#a6">setValue</a>  ( <font class="keyword">const</font> <font class="keywordtype">char</font> *strName, <font class="keyword">const</font> <font class="keywordtype">char</font> *strValue         );00149   <font class="keyword">virtual</font> <font class="keywordtype">bool</font>  <a class="code" href="classGenericValues.html#a7">readValues</a>( <font class="keyword">const</font> <font class="keywordtype">char</font> *strFile, <font class="keyword">const</font> <font class="keywordtype">char</font> *strSeparator = 0 );00150   <font class="keyword">virtual</font> <font class="keywordtype">bool</font>  <a class="code" href="classGenericValues.html#a8">saveValues</a>( <font class="keyword">const</font> <font class="keywordtype">char</font> *strFile, <font class="keyword">const</font> <font class="keywordtype">char</font> *strSeparator = 0,00151                                                        <font class="keywordtype">bool</font> bAppend = <font class="keyword">true</font>    );00152 00153   <font class="comment">// display method</font>00154   <font class="keyword">virtual</font> <font class="keywordtype">void</font>  <a class="code" href="classGenericValues.html#a9">show</a>      ( ostream&amp; out,        <font class="keyword">const</font> <font class="keywordtype">char</font> *strSeparator     );00155 };00156 00157 <font class="preprocessor">#endif</font></font></pre></div><hr><address><small>Generated on Thu Mar 7 00:37:42 2002 for UvA Trilearn 2001 by<a href="http://www.doxygen.org/index.html"><img src="doxygen.gif" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.12 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, &copy;&nbsp;1997-2001</small></address></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?