Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »


 
Determines whether an instance is an instance of exactly the specified instance type.
Related function: edmiRemoteIsInstanceOfBN
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRemoteIsInstanceOf(SdaiServerContext serverContextId,
                                  SdaiInstance      instanceId, 
                                  SdaiEntity        entityId, 
                                  SdaiBoolean       *isInstanceOf, 
                                  SdaiInvocationId  *edmiInvocationId);
 
Arguments:

serverContextId

Context identification, from edmiDefineServerContext

instanceId

A numeric instanceID that uniquely identifies the instance of interrest in the remote _EDMdatabase{_}.

entityId

The numeric entityID that uniquely identifies the entity definition instance in a dictionary model in the remote _EDMdatabase{_}.

isInstanceOf

A variable that will receive TRUE if the instance given in argument <instanceId> is of the instance type given in the argument <entityId>. Otherwise, FALSE will be returned.

edmiInvocationId

Currently not used.

Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0 : Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an _EDMinterface_ error code. Use edmiGetErrorText to get the error text corresponding to the error code.
Example:
EdmiError rstat;
SdaiServerContext myContext;
SdaiQueryResult qexRes;
SdaiInstance *pInst;
SdaiInteger index = 0, nHits = 10000;
SdaiBoolean isRevolvingDoor;
SdaiModel modelId;
SdaiEntity revolvingDoorEID;
SdaiAttr openDirAID;
 
/* Define Remote Server Context */
rstat = edmiDefineServerContext("MyRemoteServerContext",
"Johnny", "Supervisor", "cf37ftr", 
"TCP", "9090", "MyServerHost", 
NULL, NULL, NULL, NULL, NULL, &myContext); 
 
/* Get the model Id */
rstat = edmiRemoteGetModelBN(myContext, "DataRepository",
"GeneralHospital", &modelId, NULL); 
 
/* Get Revolving Door entity Id */
rstat = edmiRemoteGetEntity(myContext, modelId,
"REVOLVING_DOOR", &revolvingDoorEID, NULL); 
 
/* Get Open Direction attribute Id */
rstat = edmiRemoteGetAttrDefinitionBN(myContext, "GeneralHospital",
"DOOR", "OPEN_DIRECTION", &openDirAID, NULL); 
 
/* Select all doors on first floor */
rstat = edmiRemoteSelectInstances(myContext,
"DataRepository", "GeneralHospital", 
"DOOR", "FLOOR = 1", SUBTYPES | ONLY_INSTANCE_IDS,  
NULL, NULL, NULL, &index, &nHits, &qexRes,  
NULL, NULL, NULL, NULL); 
 
/* All doors shall open outwards,
unless already specified otherwise. 
Leave revolving doors unchanged */ 
 
pInst = qexRes->instanceIds;
while (pInst) {
rstat = edmiRemoteIsInstanceOf(myContext, *pInst, 
revolvingDoorEID, &isRevolvingDoor, NULL); 
if (! isRevolvingDoor) { 
SdaiBoolean *_valSet; 
rstat = edmiRemoteTestAttrs(myContext, *pInst, 0, 1, 
&openDirAID, &_valSet, NULL);
if (! _valSet[0]) {
rstat = edmiRemotePutAttrsBN(myContext, *pInst, 1, NULL,  
&openDirAID, sdaiENUMERATION, "OPENDIR_OUTWARDS"); 


}
. . .

  • No labels