Modif terrarium et creation TerrariumParameter

This commit is contained in:
Cameron Bray 2020-05-20 09:58:06 +02:00
parent 52a4906e2d
commit f9b655d9ce
4 changed files with 71 additions and 51 deletions

View file

@ -9,33 +9,16 @@
class Terrarium {
private:
int id;
float temperature;
float pression;
float PH;
int radState;
int tapState;
public:
Terrarium(int id);
float getTemperature() const;
void setTemperature(float temperature);
float getPression() const;
void setPression(float pression);
float getPh() const;
void setPh(float ph);
int getRadState() const;
void setRadState(int radState);
int getTapState() const;
void setTapState(int tadState);
};

View file

@ -0,0 +1,30 @@
//
// Created by camer on 20/05/2020.
//
#ifndef PROJET_VICTORAVECUNK_TERRARIUMPARAMETER_H
#define PROJET_VICTORAVECUNK_TERRARIUMPARAMETER_H
class TerrariumParameter { //TODO add to diagram
private:
float value;
int thresholdHigh;
int thresholdLow;
public:
TerrariumParameter(int thresholdHigh, int thresholdLow);
//getters setters
float getValue() const;
void setValue(float value);
int getThresholdHigh() const;
void setThresholdHigh(int thresholdHigh);
int getThresholdLow() const;
void setThresholdLow(int thresholdLow);
bool is2High();
bool is2Low();
};
#endif //PROJET_VICTORAVECUNK_TERRARIUMPARAMETER_H

View file

@ -4,30 +4,8 @@
#include "../include/Terrarium.h"
#include "../../core_simulation.h"
float Terrarium::getTemperature() const {
return temperature;
}
void Terrarium::setTemperature(float temperature) {
Terrarium::temperature = temperature;
}
float Terrarium::getPression() const {
return pression;
}
void Terrarium::setPression(float pression) {
Terrarium::pression = pression;
}
float Terrarium::getPh() const {
return PH;
}
void Terrarium::setPh(float ph) {
PH = ph;
}
Terrarium::Terrarium(int id) : id(id),
radState(LOW), tapState(LOW){}
int Terrarium::getRadState() const {
return radState;
@ -45,12 +23,3 @@ void Terrarium::setTapState(int tapState) {
Terrarium::tapState = tapState;
}
Terrarium::Terrarium(int id) {
id = id;
pression = 3000;
temperature = 20;
PH = 7;
radState = LOW;
tapState = LOW;
}

View file

@ -0,0 +1,38 @@
//
// Created by camer on 20/05/2020.
//
#include "../include/TerrariumParameter.h"
//Constructor
TerrariumParameter::TerrariumParameter(int thresholdHigh, int thresholdLow) : thresholdHigh(thresholdHigh),
thresholdLow(thresholdLow) {}
//Getters Setters
float TerrariumParameter::getValue() const {
return value;
}
void TerrariumParameter::setValue(float value) {
TerrariumParameter::value = value;
}
int TerrariumParameter::getThresholdHigh() const {
return thresholdHigh;
}
void TerrariumParameter::setThresholdHigh(int thresholdHigh) {
TerrariumParameter::thresholdHigh = thresholdHigh;
}
int TerrariumParameter::getThresholdLow() const {
return thresholdLow;
}
void TerrariumParameter::setThresholdLow(int thresholdLow) {
TerrariumParameter::thresholdLow = thresholdLow;
}
//Methods
bool TerrariumParameter::is2High() {
return this->value > this->thresholdHigh;
}
bool TerrariumParameter::is2Low() {
return this->value < this->thresholdLow;
}