edmiRemoteIsKindOfBN
Â
EdmiError edmiRemoteIsKindOfBN(SdaiServerContext serverContextId, SdaiInstance instanceId, SdaiString entityName, SdaiBoolean *isKindOf, SdaiInvocationId *edmiInvocationId);
Determines whether an instance is of a specified instance type or of any subtype of this instance type. The instance type is identified by its unique entityId. This operation returns sdaiTRUE if the specified instance is of the specified instance type or a subtype of this instance type, else sdaiFALSE is returned.
Â
Arguments
Type | Name | Comment |
SdaiServerContext | serverContextId | Context identification, from edmiDefineServerContext |
SdaiInstance | instanceId | A numeric instanceID that uniquely identifies the instance of interest in the remote EDMdatabase |
SdaiString | entityName | The name of the instance type to check <instanceId> against. Entity names are case insensitive. |
SdaiBoolean | isKindOf | A variable that will receive sdaiTRUE if the instanceId given in argument <instanceId> is of an instance type equal to that given in argument <entityId> or to any of its subtypes. If there is no such type relation, sdaiFALSE will be returned. |
SdaiInvocationId | edmiInvocationId | Currently not used. |
Return Value
Â
Options
 Â
Â
Example
Â
/* SCHEMA Relations ENTITY Person; PID : INTEGER; Name : STRING; END_ENTITY; ENTITY Man SUBTYPE OF Person; . . . HasBeard : BOOLEAN; . . . END_ENTITY; ENTITY Woman SUBTYPE OF Person; . . . IsVirgin : BOOLEAN; . . . END_ENTITY; END_SCHEMA; */ int i; EdmiError rstat; SdaiInteger nPerson, nTot; SdaiServerContext myContext; SdaiAggr personAggr; SdaiInstance *personBuff; SdaiBoolean isKindOfWoman, isKindOfMan; SdaiPrimitiveType personType; SdaiModel modelId; /* Define Remote Server Context */ rstat = edmiDefineServerContext("MyRemoteServerContext", "Johnny", "Supervisor", "cf37ftr", "TCP", "9090", "MyServerHost", NULL, NULL, NULL, NULL, NULL, &myContext); /* Get the id of the model MyRelations */ rstat = edmiRemoteGetModelBN(myContext, "JohnnysRepository", "MyRelations", &modelId, NULL); /* Get all persons */ rstat = edmiRemoteGetEntityExtentBN(myContext, "JohnnysRepository", "MyRelations", "PERSON", SUBTYPES, &personAggr, &nPerson, &nTot, NULL); rstat = edmiRemoteReadAggrElements(myContext, personAggr, 0, 0, nPerson, &nPerson, &personType, NULL, &personBuff, NULL); for (i=0;i<nPerson;i++) { rstat = edmiRemoteIsKindOfBN(myContext, personBuff[i], "MAN", &isKindOfMan, NULL); rstat = edmiRemoteIsKindOfBN(myContext, personBuff[i], "WOMAN", &isKindOfWoman, NULL); if (isKindOfMan) { /* Shave all the men */ rstat = edmiRemotePutAttrsBN(myContext, personBuff[i], 1, NULL, "HASBEARD", sdaiBOOLEAN, sdaiFALSE); } else if (isKindOfWoman) { /* Defile all the women */ rstat = edmiRemotePutAttrsBN(myContext, personBuff[i], 1, NULL, "ISVIRGIN", sdaiBOOLEAN, sdaiFALSE); } } . . .
Â
See also
Filter by label
There are no items with the selected labels at this time.
Â