31 lines
826 B
C++
31 lines
826 B
C++
#include "Trait.h"
|
|
#include <iostream>
|
|
|
|
//Trait::Trait(const Trait& _t)
|
|
//{
|
|
// *this = _t;
|
|
//}
|
|
|
|
Trait::Trait(Trait::idType _ID, std::string _name, float value):
|
|
ID(_ID), name(_name), traitValueCont(value), traitType(Continious)
|
|
{}
|
|
|
|
Trait::Trait(Trait::idType _ID, std::string _name, int value):
|
|
ID(_ID), name(_name), traitValueDiscr(value), traitType(Discrete)
|
|
{}
|
|
|
|
void Trait::setTraitValue(float _value){
|
|
if(this->traitType == Continious){
|
|
this->traitValueCont = _value;
|
|
return;
|
|
}
|
|
/*throw*/std::cerr<<"Trait.cpp(17) Warning: can't assign float value to discrete trait\n";
|
|
}
|
|
|
|
void Trait::setTraitValue(int _value){
|
|
if(this->traitType == Discrete){
|
|
this->traitValueDiscr = _value;
|
|
return;
|
|
}
|
|
/*throw*/std::cerr<<"Trait.cpp(25) Warning: can't assign int value to continious trait\n";
|
|
} |