Return object index from EN_addnode and EN_addlink (issue #432)

Adds an output argument to EN_addnode and EN_addlink that returns the index of the newly added object.
Also refactors the validity check on object ID names.
This commit is contained in:
Lew Rossman
2019-04-18 07:00:07 -04:00
parent 4494db8f56
commit 1583bea154
18 changed files with 149 additions and 154 deletions

View File

@@ -294,9 +294,9 @@ int DLLEXPORT ENsetqualtype(int qualType, char *chemName, char *chemUnits,
********************************************************************/
int DLLEXPORT ENaddnode(char *id, int nodeType)
int DLLEXPORT ENaddnode(char *id, int nodeType, int *index)
{
return EN_addnode(_defaultProject, id, nodeType);
return EN_addnode(_defaultProject, id, nodeType, index);
}
int DLLEXPORT ENdeletenode(int index, int actionCode)
@@ -431,9 +431,9 @@ int DLLEXPORT ENsetdemandname(int nodeIndex, int demandIndex, char *demandName)
********************************************************************/
int DLLEXPORT ENaddlink(char *id, int linkType, char *fromNode, char *toNode)
int DLLEXPORT ENaddlink(char *id, int linkType, char *fromNode, char *toNode, int *index)
{
return EN_addlink(_defaultProject, id, linkType, fromNode, toNode);
return EN_addlink(_defaultProject, id, linkType, fromNode, toNode, index);
}
int DLLEXPORT ENdeletelink(int index, int actionCode)