27 #ifndef TEMPLATEVALUE_H_
28 #define TEMPLATEVALUE_H_
44 sprintf(buffer,
"% .12lf",value);
56 template<
class Typ, std::
string toString(Typ)=
doubleToString>
99 const Typ typeValue = castValue->
getValue();
121 const Typ typeValue = castValue->
getValue();
133 virtual operator std::string(
void)
const {
148 printf(
"\n\n\t>>> [ERROR] <<<\nNo File to store GA [temp value].\n\t>>> [END] <<<\n\n\n");
155 for(
unsigned int d=0;d<sizeof(RESTORE_GA_TEMPLATE<int>);d++) {
156 fprintf(f,
"%c",integer.
buffer[d]);
158 fprintf(f,
"%s",
m_name.c_str());
160 for(
unsigned int x=0;x<sizeof(RESTORE_GA_TEMPLATE<Typ>);x++) {
161 fprintf(f,
"%c",temp.
buffer[x]);
180 printf(
"\n\n\t>>> [ERROR] <<<\nNo File to restore GA [temp value].\n\t>>> [END] <<<\n\n\n");
184 for(toread=0;toread<(int)sizeof(RESTORE_GA_TEMPLATE<int>);toread++){
185 fscanf(f,
"%c",&integer.
buffer[toread]);
187 toread=integer.
value;
188 buffer=
new char[toread];
189 for(
int y=0;y<toread;y++){
190 fscanf(f,
"%c",&buffer[y]);
196 for(
unsigned int x=0;x<sizeof(RESTORE_GA_TEMPLATE<Typ>);x++) {
197 fscanf(f,
"%c",&temp.
buffer[x]);
virtual bool restore(FILE *f)
restore the value from a file
Definition: TemplateValue.h:172
void setValue(Typ value)
this function is to change the value.
Definition: TemplateValue.h:82
Typ m_value
the real value
Definition: TemplateValue.h:209
virtual bool store(FILE *f) const
store the value in a file
Definition: TemplateValue.h:142
iparamkey name
Definition: inspectable.h:251
virtual IValue * operator*(const IValue &value) const
the implementation of the mul operator, what is part of the interface.
Definition: TemplateValue.h:90
template class for a IValue standard data type needs the data type and a methode for string convertin...
Definition: TemplateValue.h:57
TemplateValue(Typ value, std::string name="templateValue")
constructor needs the value and a name (for IValue -> is default implemented as "templateValue") ...
Definition: TemplateValue.h:65
std::string doubleToString(double value)
general function to converrt a double value to a string
Definition: TemplateValue.h:42
char buffer[]
Definition: restore.h:90
This class is a interface for a value which is part of a gen.
Definition: IValue.h:38
virtual IValue * operator+(const IValue &value) const
the implementation of the add operator what is part of the interface.
Definition: TemplateValue.h:112
std::string m_name
the name of this class.
Definition: IValue.h:93
Typ value
Definition: restore.h:89
Typ getValue(void) const
this function can be used to read the standard data type.
Definition: TemplateValue.h:76
virtual ~TemplateValue()
default destructor
Definition: TemplateValue.h:70