Files
Upsilon/apps/graph/function_store.h
Émilie Feral e109a23485 [apps/graph] add methods to handle function names and colors.
Change-Id: Ic11f2dd6bd9cb473b436d5e7769e2660c173c733
2016-10-03 14:04:58 +02:00

36 lines
1003 B
C++

#ifndef GRAPH_FUNCTION_STORE_H
#define GRAPH_FUNCTION_STORE_H
#include "function.h"
namespace Graph {
/* FunctionStore is a dumb class.
* Its only job is to store functions and to give them a color. */
class FunctionStore {
public:
FunctionStore();
Function * functionAtIndex(int i);
Function * addEmptyFunction();
void removeFunction(Function * f);
int numberOfFunctions();
private:
const char * firstAvailableName();
const KDColor firstAvailableColor();
static constexpr int k_maxNumberOfFunctions = 8;
static constexpr int k_numberOfDefaultColors = 8;
static constexpr KDColor defaultColors[k_numberOfDefaultColors] = {
KDColorRed, KDColorGreen, KDColorBlue, KDColorBlack,
KDColor(0xBFD3EB), KDColor(0xFF00FF), KDColor(0x00FFEB), KDColor(0xBFAA00)
};
static constexpr const char * functionNames[k_maxNumberOfFunctions] = {
"f", "g", "h", "i", "j", "k", "l", "m"
};
int m_numberOfFunctions;
Function m_functions[k_maxNumberOfFunctions];
};
}
#endif