[apps/graph] Handle undefined function

Change-Id: Id26e0f81ba5c1446655f33b2c63f97ab5b684e41
This commit is contained in:
Émilie Feral
2016-10-20 16:00:11 +02:00
parent 5693b9f95f
commit e5ff8f65c3
10 changed files with 66 additions and 18 deletions

View File

@@ -23,7 +23,22 @@ Function * FunctionStore::activeFunctionAtIndex(int i) {
assert(i>=0 && i<m_numberOfFunctions);
int index = 0;
for (int k = 0; k < m_numberOfFunctions; k++) {
if (m_functions[k].isActive()) {
if (m_functions[k].isActive() && m_functions[k].layout() != nullptr) {
if (i == index) {
return &m_functions[k];
}
index++;
}
}
assert(false);
return nullptr;
}
Function * FunctionStore::definedFunctionAtIndex(int i) {
assert(i>=0 && i<m_numberOfFunctions);
int index = 0;
for (int k = 0; k < m_numberOfFunctions; k++) {
if (m_functions[k].layout() != nullptr) {
if (i == index) {
return &m_functions[k];
}
@@ -71,6 +86,16 @@ int FunctionStore::numberOfActiveFunctions() {
return result;
}
int FunctionStore::numberOfDefinedFunctions() {
int result = 0;
for (int i = 0; i < m_numberOfFunctions; i++) {
if (m_functions[i].layout() != nullptr) {
result++;
}
}
return result;
}
const char * FunctionStore::firstAvailableName() {
for (int k = 0; k < k_maxNumberOfFunctions; k++) {
int j = 0;