Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IValue.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2008-2011 LpzRobots development team *
3  * Joerg Weider <joergweide84 at aol dot com> (robot12) *
4  * Georg Martius <georg dot martius at web dot de> *
5  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
6  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
7  * Ralf Der <ralfder at mis dot mpg dot de> *
8  * Joern Hoffmann <jhoffmann at informatik dot uni-leipzig dot de *
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  * This program is distributed in the hope that it will be useful, *
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18  * GNU General Public License for more details. *
19  * *
20  * You should have received a copy of the GNU General Public License *
21  * along with this program; if not, write to the *
22  * Free Software Foundation, Inc., *
23  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
24  * *
25  ***************************************************************************/
26 #ifndef IVALUE_H_
27 #define IVALUE_H_
28 
29 //includes
30 #include <string>
31 #include <selforg/inspectable.h>
32 #include <selforg/storeable.h>
33 
34 /**
35  * This class is a interface for a value which is part of a gen. Over this concept is it paissible
36  * to make the Gen and the GenFactory independent from his saved type.
37  */
38 class IValue : public Inspectable
39 {
40 public:
41 
42  /**
43  * constructor
44  * Needs a string for the name of the value. In the normal way it is the Type of the Value. For example "templateValue".
45  * @param name (string) the name
46  */
47  IValue(std::string name);
48 
49 
50  /**
51  * default destructor
52  */
53  virtual ~IValue();
54 
55  /**
56  * the mul. operator. Dosn't change this class!!!
57  * @param (const IValue&) the other part of the operation
58  * @return (IValue*) the result
59  */
60  virtual IValue* operator*(const IValue&)const = 0;
61 
62  /**
63  * the add operator. Dosn't change this class!!!
64  * @param (const IValue&) the other part of the operation
65  * @return (IValue*) the result
66  */
67  virtual IValue* operator+(const IValue&)const = 0;
68 
69  /**
70  * the cast operator for a cast in type string
71  * @return (string) the value as string
72  */
73  virtual operator std::string(void)const;
74 
75  /**
76  * store the value in a file
77  * @param f (FILE*) the file to store
78  * @return (bool) true if all ok.
79  */
80  virtual bool store(FILE* f) const;
81 
82  /**
83  * restore the value from a file
84  * @param f (FILE*) the file where the value inside
85  * @return (bool) true if all ok.
86  */
87  virtual bool restore(FILE* f);
88 
89 protected:
90  /**
91  * the name of this class.
92  */
93  std::string m_name;
94 };
95 
96 #endif /* IVALUE_H_ */
virtual IValue * operator+(const IValue &) const =0
the add operator.
IValue(std::string name)
constructor Needs a string for the name of the value.
Definition: IValue.cpp:28
virtual ~IValue()
default destructor
Definition: IValue.cpp:32
iparamkey name
Definition: inspectable.h:251
virtual bool store(FILE *f) const
store the value in a file
Definition: IValue.cpp:40
Interface for inspectable objects.
Definition: inspectable.h:48
This class is a interface for a value which is part of a gen.
Definition: IValue.h:38
virtual IValue * operator*(const IValue &) const =0
the mul.
std::string m_name
the name of this class.
Definition: IValue.h:93
virtual bool restore(FILE *f)
restore the value from a file
Definition: IValue.cpp:44