00001 /*************************************************************************** 00002 * Copyright (C) 2008-2011 LpzRobots development team * 00003 * Joerg Weider <joergweide84 at aol dot com> (robot12) * 00004 * Georg Martius <georg dot martius at web dot de> * 00005 * Frank Guettler <guettler at informatik dot uni-leipzig dot de * 00006 * Frank Hesse <frank at nld dot ds dot mpg dot de> * 00007 * Ralf Der <ralfder at mis dot mpg dot de> * 00008 * Joern Hoffmann <jhoffmann at informatik dot uni-leipzig dot de * 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 #ifndef IVALUE_H_ 00027 #define IVALUE_H_ 00028 00029 //includes 00030 #include <string> 00031 #include <selforg/inspectable.h> 00032 #include <selforg/storeable.h> 00033 00034 /** 00035 * This class is a interface for a value which is part of a gen. Over this concept is it paissible 00036 * to make the Gen and the GenFactory independent from his saved type. 00037 */ 00038 class IValue : public Inspectable 00039 { 00040 public: 00041 00042 /** 00043 * constructor 00044 * Needs a string for the name of the value. In the normal way it is the Type of the Value. For example "templateValue". 00045 * @param name (string) the name 00046 */ 00047 IValue(std::string name); 00048 00049 00050 /** 00051 * default destructor 00052 */ 00053 virtual ~IValue(); 00054 00055 /** 00056 * the mul. operator. Dosn't change this class!!! 00057 * @param (const IValue&) the other part of the operation 00058 * @return (IValue*) the result 00059 */ 00060 virtual IValue* operator*(const IValue&)const = 0; 00061 00062 /** 00063 * the add operator. Dosn't change this class!!! 00064 * @param (const IValue&) the other part of the operation 00065 * @return (IValue*) the result 00066 */ 00067 virtual IValue* operator+(const IValue&)const = 0; 00068 00069 /** 00070 * the cast operator for a cast in type string 00071 * @return (string) the value as string 00072 */ 00073 virtual operator std::string(void)const; 00074 00075 /** 00076 * store the value in a file 00077 * @param f (FILE*) the file to store 00078 * @return (bool) true if all ok. 00079 */ 00080 virtual bool store(FILE* f) const; 00081 00082 /** 00083 * restore the value from a file 00084 * @param f (FILE*) the file where the value inside 00085 * @return (bool) true if all ok. 00086 */ 00087 virtual bool restore(FILE* f); 00088 00089 protected: 00090 /** 00091 * the name of this class. 00092 */ 00093 std::string m_name; 00094 }; 00095 00096 #endif /* IVALUE_H_ */