edmiRemoteIsKindOf
EdmiError edmiRemoteIsKindOf(SdaiServerContext serverContextId, SdaiInstance instanceId, SdaiEntity entityId, 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 |
SdaiEntity | entityId | A numeric entityID that uniquely identifies an entity definition instance in a dictionary model in the remote EDMdatabase |
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; SdaiEntity manEID, womanEID; 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 Man entity Id */ rstat = edmiRemoteGetEntity(myContext, modelId, "MAN", &manEID, NULL); /* Get Person entity Id */ rstat = edmiRemoteGetEntity(myContext, modelId, "WOMAN", &womanEID, 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 = edmiRemoteIsKindOf(myContext, personBuff[i], manEID, &isKindOfMan, NULL); rstat = edmiRemoteIsKindOf(myContext, personBuff[i], womanEID, &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.
Â