Files
Upsilon/apps/graph/function_store.cpp
Romain Goyet 14cf96157c [apps/graph] Function store a color
Change-Id: I1339f999b9c41a4293dfc5211d2183db46300ecf
2016-08-29 13:38:06 +02:00

29 lines
742 B
C++

#include "function_store.h"
extern "C" {
#include <assert.h>
}
constexpr int numberOfDefaultColors = 3;
constexpr KDColor defaultColors[numberOfDefaultColors] = {
KDColorRed, KDColorGreen, KDColorBlue
};
Graph::FunctionStore::FunctionStore() :
m_numberOfFunctions(0)
{
}
Graph::Function * Graph::FunctionStore::functionAtIndex(int i) {
assert(i>=0 && i<m_numberOfFunctions);
return &m_functions[i];
}
void Graph::FunctionStore::pushFunction(const char * functionText) {
assert(m_numberOfFunctions < k_maxNumberOfFunctions);
m_functions[m_numberOfFunctions++] = Function(functionText, defaultColors[m_numberOfFunctions%numberOfDefaultColors]);
}
int Graph::FunctionStore::numberOfFunctions() {
return m_numberOfFunctions;
}