IValue.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005-2009 by Robot Group Leipzig                        *
00003  *    martius@informatik.uni-leipzig.de                                    *
00004  *    fhesse@informatik.uni-leipzig.de                                     *
00005  *    der@informatik.uni-leipzig.de                                        *
00006  *    guettler@informatik.uni-leipzig.de                                   *
00007  *    jhoffmann@informatik.uni-leipzig.de                                  *
00008  *    joergweide84@aol.com (robot12)                                       *
00009  *                                                                         *
00010  *   This program is free software; you can redistribute it and/or modify  *
00011  *   it under the terms of the GNU General Public License as published by  *
00012  *   the Free Software Foundation; either version 2 of the License, or     *
00013  *   (at your option) any later version.                                   *
00014  *                                                                         *
00015  *   This program is distributed in the hope that it will be useful,       *
00016  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00017  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00018  *   GNU General Public License for more details.                          *
00019  *                                                                         *
00020  *   You should have received a copy of the GNU General Public License     *
00021  *   along with this program; if not, write to the                         *
00022  *   Free Software Foundation, Inc.,                                       *
00023  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00024  ***************************************************************************
00025  *                                                                         *
00026  *   This interface is only to describe a value for a Gen. It gives some   *
00027  *   conditions for the values. The operators add and mul must be declared.*
00028  *   They must have a name and it must be possible to change the value in a*
00029  *   string for log or debug outputs.                                      *
00030  *                                                                         *
00031  *   $Log: IValue.h,v $
00032  *   Revision 1.6  2009/10/21 14:08:19  robot12
00033  *   add restore and store functions to the ga package
00034  *
00035  *   Revision 1.5  2009/07/21 08:37:59  robot12
00036  *   add some comments
00037  *
00038  *   Revision 1.4  2009/06/26 13:08:25  robot12
00039  *   finishing Values and add some comments
00040  *
00041  *   Revision 1.3  2009/05/12 13:29:25  robot12
00042  *   some new function
00043  *   -> toString methodes
00044  *
00045  *   Revision 1.2  2009/05/06 13:28:22  robot12
00046  *   some implements... Finish
00047  *
00048  *   Revision 1.1  2009/05/04 15:27:57  robot12
00049  *   rename of some files and moving files to other positions
00050  *    - SingletonGenAlgAPI has one error!!! --> is not ready now
00051  *
00052  *   Revision 1.6  2009/05/04 09:20:52  robot12
00053  *   some implements.. Finish --> first compile
00054  *
00055  *   Revision 1.5  2009/04/29 14:32:28  robot12
00056  *   some implements... Part4
00057  *
00058  *   Revision 1.4  2009/04/24 11:26:07  robot12
00059  *   some implements
00060  *
00061  *   Revision 1.3  2009/04/23 15:17:42  jhoffmann
00062  *   inserted copyright-template, corrected includes, doxygen style templated
00063  *
00064  ***************************************************************************/
00065 #ifndef IVALUE_H_
00066 #define IVALUE_H_
00067 
00068 //includes
00069 #include <string>
00070 #include <selforg/inspectable.h>
00071 #include <selforg/storeable.h>
00072 
00073 /**
00074  * This class is a interface for a value which is part of a gen. Over this concept is it paissible
00075  * to make the Gen and the GenFactory independent from his saved type.
00076  */
00077 class IValue : public Inspectable
00078 {
00079 public:
00080 
00081   /**
00082    * constructor
00083    * Needs a string for the name of the value. In the normal way it is the Type of the Value. For example "templateValue".
00084    * @param name (string) the name
00085    */
00086   IValue(std::string name);
00087 
00088 
00089   /**
00090    * default destructor
00091    */
00092   virtual ~IValue();
00093 
00094   /**
00095    * the mul. operator. Dosn't change this class!!!
00096    * @param (const IValue&) the other part of the operation
00097    * @return (IValue*) the result
00098    */
00099   virtual IValue* operator*(const IValue&)const = 0;
00100 
00101    /**
00102         * the add operator. Dosn't change this class!!!
00103         * @param (const IValue&) the other part of the operation
00104         * @return (IValue*) the result
00105         */
00106   virtual IValue* operator+(const IValue&)const = 0;
00107 
00108   /**
00109    * the cast operator for a cast in type string
00110    * @return (string) the value as string
00111    */
00112   virtual operator std::string(void)const;
00113 
00114   /**
00115    * store the value in a file
00116    * @param f (FILE*) the file to store
00117    * @return (bool) true if all ok.
00118    */
00119   virtual bool store(FILE* f) const;
00120 
00121   /**
00122    * restore the value from a file
00123    * @param f (FILE*) the file where the value inside
00124    * @return (bool) true if all ok.
00125    */
00126   virtual bool restore(FILE* f);
00127 
00128 protected:
00129         /**
00130          * the name of this class.
00131          */
00132         std::string m_name;
00133 };
00134 
00135 #endif /* IVALUE_H_ */

Generated on Fri Oct 30 16:29:01 2009 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.4.7