Solution: Interpreter Combined With Adapter (And A Proxy)¶
#pragma once
#include "expression.h"
#include "sensor.h"
class SensorValueExpression : public Expression
{
public:
SensorValueExpression(Sensor* sensor) : _sensor(sensor) {}
int evaluate() override;
private:
Sensor* _sensor;
};
#include "expression-sensorvalue.h"
int SensorValueExpression::evaluate()
{
return _sensor->get_temperature();
}