Updated more float types in function APIs

Updated APIs calls to support EN_API_FLOAT_TYPE and few updates to the
DEF file
This commit is contained in:
Elad Salomons
2016-10-10 11:45:02 +03:00
parent 9942f6761d
commit ab4622b276
3 changed files with 171 additions and 173 deletions

View File

@@ -78,12 +78,12 @@ EXPORTS
ENgetrule = _ENgetrule@20 ENgetrule = _ENgetrule@20
ENsetrulepriority = _ENsetrulepriority@8 ENsetrulepriority = _ENsetrulepriority@8
ENgetpremise = _ENgetpremise@36 ENgetpremise = _ENgetpremise@36
ENsetpremise = _ENsetpremise@40 ENsetpremise = _ENsetpremise@36
ENsetpremiseindex = _ENsetpremiseindex@12 ENsetpremiseindex = _ENsetpremiseindex@12
ENsetpremisestatus = _ENsetpremisestatus@12 ENsetpremisestatus = _ENsetpremisestatus@12
ENsetpremisevalue = _ENsetpremisevalue@16 ENsetpremisevalue = _ENsetpremisevalue@12
ENgettrueaction = _ENgettrueaction@20 ENgettrueaction = _ENgettrueaction@20
ENsettrueaction = _ENsettrueaction@24 ENsettrueaction = _ENsettrueaction@20
ENgetfalseaction = _ENgetfalseaction@20 ENgetfalseaction = _ENgetfalseaction@20
ENsetfalseaction = _ENsetfalseaction@24 ENsetfalseaction = _ENsetfalseaction@20
ENgetruleID = _ENgetruleID@8 ENgetruleID = _ENgetruleID@8

View File

@@ -953,7 +953,7 @@ extern "C" {
@param value The value of the variable to be checked (e.g. 5.5) @param value The value of the variable to be checked (e.g. 5.5)
@return Error code. @return Error code.
*/ */
int DLLEXPORT ENsetpremise(int indexRule, int indexPremise, int logop, int object, int indexObj, int variable, int relop, int status, double value); int DLLEXPORT ENsetpremise(int indexRule, int indexPremise, int logop, int object, int indexObj, int variable, int relop, int status, EN_API_FLOAT_TYPE value);
/** /**
@brief Sets the index of an object in a premise of an existing rule-based control. @brief Sets the index of an object in a premise of an existing rule-based control.
@@ -980,7 +980,7 @@ extern "C" {
@param value The value of the variable to be checked (e.g. 5.5) @param value The value of the variable to be checked (e.g. 5.5)
@return Error code. @return Error code.
*/ */
int DLLEXPORT ENsetpremisevalue(int indexRule, int indexPremise, double value); int DLLEXPORT ENsetpremisevalue(int indexRule, int indexPremise, EN_API_FLOAT_TYPE value);
/** /**
@brief Gets the components of a true-action in an existing rule-based control. @brief Gets the components of a true-action in an existing rule-based control.
@@ -991,7 +991,7 @@ extern "C" {
@param setting The value of the link (e.g. pump speed 0.9) @param setting The value of the link (e.g. pump speed 0.9)
@return Error code. @return Error code.
*/ */
int DLLEXPORT ENgettrueaction(int indexRule, int indexAction, int *indexLink, int *status, double *setting); int DLLEXPORT ENgettrueaction(int indexRule, int indexAction, int *indexLink, int *status, EN_API_FLOAT_TYPE *setting);
/** /**
@brief Sets the components of a true-action in an existing rule-based control. @brief Sets the components of a true-action in an existing rule-based control.
@@ -1002,7 +1002,7 @@ extern "C" {
@param setting The value of the link (e.g. pump speed 0.9) @param setting The value of the link (e.g. pump speed 0.9)
@return Error code. @return Error code.
*/ */
int DLLEXPORT ENsettrueaction(int indexRule, int indexAction, int indexLink, int status, double setting); int DLLEXPORT ENsettrueaction(int indexRule, int indexAction, int indexLink, int status, EN_API_FLOAT_TYPE setting);
/** /**
@brief Gets the components of a false-action in an existing rule-based control. @brief Gets the components of a false-action in an existing rule-based control.
@@ -1013,7 +1013,7 @@ extern "C" {
@param setting The value of the link (e.g. pump speed 0.9) @param setting The value of the link (e.g. pump speed 0.9)
@return Error code. @return Error code.
*/ */
int DLLEXPORT ENgetfalseaction(int indexRule, int indexAction, int *indexLink, int *status, double *setting); int DLLEXPORT ENgetfalseaction(int indexRule, int indexAction, int *indexLink, int *status, EN_API_FLOAT_TYPE *setting);
/** /**
@brief Sets the components of a false-action in an existing rule-based control. @brief Sets the components of a false-action in an existing rule-based control.
@@ -1024,7 +1024,7 @@ extern "C" {
@param setting The value of the link (e.g. pump speed 0.9) @param setting The value of the link (e.g. pump speed 0.9)
@return Error code. @return Error code.
*/ */
int DLLEXPORT ENsetfalseaction(int indexRule, int indexAction, int indexLink, int status,double setting); int DLLEXPORT ENsetfalseaction(int indexRule, int indexAction, int indexLink, int status, EN_API_FLOAT_TYPE setting);
/** /**
@brief Returns the ID of a rule. @brief Returns the ID of a rule.

View File

@@ -3263,198 +3263,196 @@ int DLLEXPORT ENsetrulepriority(int index, EN_API_FLOAT_TYPE priority)
} }
int DLLEXPORT ENsetpremise(int indexRule, int indexPremise, int logop, int object, int indexObj, int variable, int relop, int status, double value) int DLLEXPORT ENsetpremise(int indexRule, int indexPremise, int logop, int object, int indexObj, int variable, int relop, int status, EN_API_FLOAT_TYPE value)
{ {
int count = 1,error = 0, nPremises, a, b; int count = 1,error = 0, nPremises, a, b;
EN_API_FLOAT_TYPE priority; EN_API_FLOAT_TYPE priority;
struct Premise *p; struct Premise *p;
if (indexRule > Nrules) return(257); if (indexRule > Nrules) return(257);
error = ENgetrule(indexRule, &nPremises, &a, &b, &priority); error = ENgetrule(indexRule, &nPremises, &a, &b, &priority);
if (indexPremise > nPremises) return(258); if (indexPremise > nPremises) return(258);
p = Rule[indexRule].Pchain; p = Rule[indexRule].Pchain;
while (count < indexPremise) while (count < indexPremise)
{ {
count++; count++;
p = p->next; p = p->next;
} }
p->logop = logop; p->logop = logop;
p->object = object; p->object = object;
p->index = indexObj; p->index = indexObj;
p->variable = variable; p->variable = variable;
p->relop = relop; p->relop = relop;
p->status = status; p->status = status;
p->value = value; p->value = value;
return(0); return(0);
} }
int DLLEXPORT ENsetpremiseindex(int indexRule, int indexPremise, int indexObj) int DLLEXPORT ENsetpremiseindex(int indexRule, int indexPremise, int indexObj)
{ {
int count = 1,error = 0, nPremises, a, b; int count = 1,error = 0, nPremises, a, b;
EN_API_FLOAT_TYPE priority; EN_API_FLOAT_TYPE priority;
struct Premise *p; struct Premise *p;
if (indexRule > Nrules) return(257); if (indexRule > Nrules) return(257);
error = ENgetrule(indexRule, &nPremises, &a, &b, &priority); error = ENgetrule(indexRule, &nPremises, &a, &b, &priority);
if (indexPremise > nPremises) return(258); if (indexPremise > nPremises) return(258);
p = Rule[indexRule].Pchain; p = Rule[indexRule].Pchain;
while (count < indexPremise) while (count < indexPremise)
{ {
count++; count++;
p = p->next; p = p->next;
} }
p->index = indexObj; p->index = indexObj;
return(0); return(0);
} }
int DLLEXPORT ENsetpremisestatus(int indexRule, int indexPremise, int status) int DLLEXPORT ENsetpremisestatus(int indexRule, int indexPremise, int status)
{ {
int count = 1, error = 0, nPremises, a, b; int count = 1, error = 0, nPremises, a, b;
EN_API_FLOAT_TYPE priority; EN_API_FLOAT_TYPE priority;
struct Premise *p; struct Premise *p;
if (indexRule > Nrules) return(257); if (indexRule > Nrules) return(257);
error = ENgetrule(indexRule, &nPremises, &a, &b, &priority); error = ENgetrule(indexRule, &nPremises, &a, &b, &priority);
if (indexPremise > nPremises) return(258); if (indexPremise > nPremises) return(258);
p = Rule[indexRule].Pchain; p = Rule[indexRule].Pchain;
while (count < indexPremise) while (count < indexPremise)
{ {
count++; count++;
p = p->next; p = p->next;
} }
p->status = status; p->status = status;
return(0); return(0);
} }
int DLLEXPORT ENsetpremisevalue(int indexRule, int indexPremise, double value) int DLLEXPORT ENsetpremisevalue(int indexRule, int indexPremise, EN_API_FLOAT_TYPE value)
{ {
int count = 1,error = 0, nPremises, a, b; int count = 1,error = 0, nPremises, a, b;
EN_API_FLOAT_TYPE priority; EN_API_FLOAT_TYPE priority;
struct Premise *p; struct Premise *p;
if (indexRule > Nrules) return(257); if (indexRule > Nrules) return(257);
error = ENgetrule(indexRule, &nPremises, &a, &b, &priority); error = ENgetrule(indexRule, &nPremises, &a, &b, &priority);
if (indexPremise > nPremises) return(258); if (indexPremise > nPremises) return(258);
p = Rule[indexRule].Pchain; p = Rule[indexRule].Pchain;
while (count < indexPremise) while (count < indexPremise)
{ {
count++; count++;
p = p->next; p = p->next;
} }
p->value = value; p->value = value;
return(0); return(0);
} }
int DLLEXPORT ENgettrueaction(int indexRule, int indexAction, int *indexLink, int *status, double *setting) int DLLEXPORT ENgettrueaction(int indexRule, int indexAction, int *indexLink, int *status, EN_API_FLOAT_TYPE *setting)
{ {
int count = 1, error = 0, nTrueAction, c, b; int count = 1, error = 0, nTrueAction, c, b;
EN_API_FLOAT_TYPE priority; EN_API_FLOAT_TYPE priority;
struct Action *a; struct Action *a;
if (indexRule > Nrules) return(252); if (indexRule > Nrules) return(252);
error = ENgetrule(indexRule, &c, &nTrueAction, &b, &priority); error = ENgetrule(indexRule, &c, &nTrueAction, &b, &priority);
if (indexAction > nTrueAction) return(253); if (indexAction > nTrueAction) return(253);
a = Rule[indexRule].Tchain; a = Rule[indexRule].Tchain;
while (count<indexAction) while (count<indexAction)
{ {
count++; count++;
a = a->next; a = a->next;
} }
*indexLink = a->link; *indexLink = a->link;
*status = a->status; *status = a->status;
*setting = a->setting; *setting = a->setting;
return(0); return(0);
} }
int DLLEXPORT ENsettrueaction(int indexRule, int indexAction, int indexLink, int status,double setting) int DLLEXPORT ENsettrueaction(int indexRule, int indexAction, int indexLink, int status, EN_API_FLOAT_TYPE setting)
{ {
int count = 1, error = 0, nTrueAction, c, b; int count = 1, error = 0, nTrueAction, c, b;
EN_API_FLOAT_TYPE priority; EN_API_FLOAT_TYPE priority;
struct Action *a; struct Action *a;
if (indexRule > Nrules) return(257); if (indexRule > Nrules) return(257);
error = ENgetrule(indexRule, &c, &nTrueAction, &b, &priority); error = ENgetrule(indexRule, &c, &nTrueAction, &b, &priority);
if (indexAction > nTrueAction) return(258); if (indexAction > nTrueAction) return(258);
a = Rule[indexRule].Tchain; a = Rule[indexRule].Tchain;
while (count<indexAction) while (count<indexAction)
{ {
count++; count++;
a = a->next; a = a->next;
} }
a->link = indexLink; a->link = indexLink;
a->status = status; a->status = status;
a->setting = setting; a->setting = setting;
return(0); return(0);
} }
int DLLEXPORT ENgetfalseaction(int indexRule, int indexAction, int *indexLink, int *status, double *setting) int DLLEXPORT ENgetfalseaction(int indexRule, int indexAction, int *indexLink, int *status, EN_API_FLOAT_TYPE *setting)
{ {
int count = 1, error = 0, nFalseAction, c, b; int count = 1, error = 0, nFalseAction, c, b;
EN_API_FLOAT_TYPE priority; EN_API_FLOAT_TYPE priority;
struct Action *a; struct Action *a;
if (indexRule > Nrules) return(257); if (indexRule > Nrules) return(257);
error = ENgetrule(indexRule, &c, &b, &nFalseAction, &priority); error = ENgetrule(indexRule, &c, &b, &nFalseAction, &priority);
if (indexAction > nFalseAction) return(258); if (indexAction > nFalseAction) return(258);
a = Rule[indexRule].Fchain; a = Rule[indexRule].Fchain;
while (count < indexAction) while (count < indexAction)
{ {
count++; count++;
a = a->next; a = a->next;
} }
*indexLink = a->link; *indexLink = a->link;
*status = a->status; *status = a->status;
*setting = a->setting; *setting = a->setting;
return(0); return(0);
} }
int DLLEXPORT ENsetfalseaction(int indexRule, int indexAction, int indexLink, int status,double setting) int DLLEXPORT ENsetfalseaction(int indexRule, int indexAction, int indexLink, int status,EN_API_FLOAT_TYPE setting)
{ {
int count = 1, error = 0, nFalseAction, c, b; int count = 1, error = 0, nFalseAction, c, b;
EN_API_FLOAT_TYPE priority; EN_API_FLOAT_TYPE priority;
struct Action *a; struct Action *a;
if (indexRule > Nrules) return(257); if (indexRule > Nrules) return(257);
error = ENgetrule(indexRule, &c, &b, &nFalseAction, &priority); error = ENgetrule(indexRule, &c, &b, &nFalseAction, &priority);
if (indexAction > nFalseAction) return(258); if (indexAction > nFalseAction) return(258);
a = Rule[indexRule].Fchain; a = Rule[indexRule].Fchain;
while (count < indexAction) while (count < indexAction)
{ {
count++; count++;
a = a->next; a = a->next;
} }
a->link = indexLink; a->link = indexLink;
a->status = status; a->status = status;
a->setting = setting; a->setting = setting;
return(0); return(0);
} }
int DLLEXPORT ENgetruleID(int indexRule, char* id) int DLLEXPORT ENgetruleID(int indexRule, char* id)
{ {
strcpy(id,"");
strcpy(id,""); if (!Openflag) return(102);
if (!Openflag) return(102); if (indexRule < 1 || indexRule > Nrules) return(257);
if (indexRule < 1 || indexRule > Nrules) return(257); strcpy(id,Rule[indexRule].label);
strcpy(id,Rule[indexRule].label);
return(0); return(0);
}
}
/*************************** END OF EPANET.C ***************************/ /*************************** END OF EPANET.C ***************************/