mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-25 08:41:01 +01:00
[apps/graph] Add methods to find active functions in function store
Change-Id: Ibe7242b945160b8917421186d061c46301bb004d
This commit is contained in:
@@ -17,6 +17,21 @@ Graph::Function * Graph::FunctionStore::functionAtIndex(int i) {
|
||||
return &m_functions[i];
|
||||
}
|
||||
|
||||
Graph::Function * Graph::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 (i == index) {
|
||||
return &m_functions[k];
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
assert(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Graph::Function * Graph::FunctionStore::addEmptyFunction() {
|
||||
assert(m_numberOfFunctions < k_maxNumberOfFunctions);
|
||||
const char * name = firstAvailableName();
|
||||
@@ -44,6 +59,16 @@ int Graph::FunctionStore::numberOfFunctions() {
|
||||
return m_numberOfFunctions;
|
||||
}
|
||||
|
||||
int Graph::FunctionStore::numberOfActiveFunctions() {
|
||||
int result = 0;
|
||||
for (int i = 0; i < m_numberOfFunctions; i++) {
|
||||
if (m_functions[i].isActive()) {
|
||||
result++;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const char * Graph::FunctionStore::firstAvailableName() {
|
||||
for (int k = 0; k < k_maxNumberOfFunctions; k++) {
|
||||
int j = 0;
|
||||
|
||||
Reference in New Issue
Block a user