Files
Upsilon/apps/graph/list/domain_parameter_controller.h
Émilie Feral 6de497c2ed [apps/shared] Templatize FloatParameterController to handle float/double
parameters.

Fix bug: when entering "e^234" as a parameter of a model keeping floats,
the FloatParameterController would accept the number (because e^234 is
defined in double) and store an undefined value in the model (because
e^234 is undefined in float).
2019-09-02 16:55:39 +02:00

40 lines
1.3 KiB
C++

#ifndef GRAPH_LIST_DOMAIN_PARAMATER_CONTROLLER_H
#define GRAPH_LIST_DOMAIN_PARAMATER_CONTROLLER_H
#include <escher/message_table_cell_with_expression.h>
#include <ion/storage.h>
#include "../../shared/cartesian_function.h"
#include "../../shared/expiring_pointer.h"
#include "../../shared/float_parameter_controller.h"
namespace Graph {
class DomainParameterController : public Shared::FloatParameterController<double> {
public:
DomainParameterController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate);
// ViewController
const char * title() override;
// ListViewDataSource
int numberOfRows() override;
void willDisplayCellForIndex(HighlightCell * cell, int index) override;
void setRecord(Ion::Storage::Record record) { m_record = record; }
private:
constexpr static int k_totalNumberOfCell = 2;
int reusableParameterCellCount(int type) override;
HighlightCell * reusableParameterCell(int index, int type) override;
bool handleEvent(Ion::Events::Event event) override;
bool setParameterAtIndex(int parameterIndex, double f) override;
double parameterAtIndex(int index) override;
void buttonAction() override;
Shared::ExpiringPointer<Shared::CartesianFunction> function();
MessageTableCellWithEditableText m_domainCells[k_totalNumberOfCell];
Ion::Storage::Record m_record;
};
}
#endif