Rewrite of EN_setlinktype function (#305)

- Complete rewrite of EN_setlinktype with link index argument passed by reference
- New unit test of EN_setlinktype added
- New function EN_setlinknodes added
This commit is contained in:
Lew Rossman
2018-10-28 16:58:43 -04:00
parent 7d021d8b82
commit 8514929622
6 changed files with 211 additions and 16 deletions

View File

@@ -743,12 +743,12 @@ extern "C" {
/**
@brief Set the link type code for a specified link
@param id The id of a link
@param type The type code of the link.
@param[in,out] index The index of a link before [in] and after [out] the type change.
@param code The new type code of the link.
@return Error code
@see EN_LinkType
*/
int DLLEXPORT ENsetlinktype(char *id, EN_LinkType type);
int DLLEXPORT ENsetlinktype(int *index, EN_LinkType code);
/**
@brief Get the indexes of a link's start- and end-nodes.
@@ -872,6 +872,16 @@ extern "C" {
*/
int DLLEXPORT ENsetlinkid(int index, char *newid);
/**
@brief Set the indexes of a link's start- and end-nodes.
@param index The index of a link (first link is index 1)
@param node1 The index of the link's start node (first node is index 1).
@param node2 The index of the link's end node (first node is index 1).
@return Error code
@see ENsetnodeid, ENsetlinkid
*/
int DLLEXPORT ENsetlinknodes(int index, int node1, int node2);
/**
@brief Set a property value for a link.
@param index The index of a link. First link is index 1.
@@ -1064,7 +1074,6 @@ extern "C" {
@see ENgetcurveindex ENsetcurve
*/
int DLLEXPORT ENaddcurve(char *id);
/**
@brief Gets the number of premises, true actions, and false actions and the priority of an existing rule-based control.
@@ -1303,7 +1312,6 @@ extern "C" {
int DLLEXPORT EN_getlinkindex(EN_ProjectHandle ph, char *id, int *index);
int DLLEXPORT EN_getlinkid(EN_ProjectHandle ph, int index, char *id);
int DLLEXPORT EN_getlinktype(EN_ProjectHandle ph, int index, EN_LinkType *code);
int DLLEXPORT EN_setlinktype(EN_ProjectHandle ph, char *id, EN_LinkType type);
int DLLEXPORT EN_getlinknodes(EN_ProjectHandle ph, int index, int *node1, int *node2);
int DLLEXPORT EN_getlinkvalue(EN_ProjectHandle ph, int index, EN_LinkProperty code, EN_API_FLOAT_TYPE *value);
int DLLEXPORT EN_getcurve(EN_ProjectHandle ph, int curveIndex, char* id, int *nValues, EN_API_FLOAT_TYPE **xValues, EN_API_FLOAT_TYPE **yValues);
@@ -1319,6 +1327,8 @@ extern "C" {
int DLLEXPORT EN_setnodeid(EN_ProjectHandle ph, int index, char *newid);
int DLLEXPORT EN_setnodevalue(EN_ProjectHandle ph, int index, int code, EN_API_FLOAT_TYPE v);
int DLLEXPORT EN_setlinkid(EN_ProjectHandle ph, int index, char *newid);
int DLLEXPORT EN_setlinknodes(EN_ProjectHandle ph, int index, int node1, int node2);
int DLLEXPORT EN_setlinktype(EN_ProjectHandle ph, int *index, EN_LinkType code);
int DLLEXPORT EN_setlinkvalue(EN_ProjectHandle ph, int index, int code, EN_API_FLOAT_TYPE v);
int DLLEXPORT EN_addpattern(EN_ProjectHandle ph, char *id);
int DLLEXPORT EN_setpattern(EN_ProjectHandle ph, int index, EN_API_FLOAT_TYPE *f, int len);