edmiInstancesToContainerBN
EdmiError edmiInstancesToContainer(SdaiContainer sourceContainerId,
SdaiContainer targetContainerId,
SdaiAggr instances,
SdaiAppInstance *instanceBuffer);
Adds/removes an aggregate or buffer of instances to/from an instance container identified by its containerId. This function may also move instances between containers. The behaviour is controlled by the values given in the source and target parameters <sourceContainerId> and <targetContainerId >. The table below illustrates this
source | target | Behavior |
Unset | Set | The instances will be inserted into the target container. |
Set | Unset | The instances will be removed from the source container. |
Set | Set | The instances will be moved from source to target. I.e removed from the source container and inserted into the target container. |
Arguments
Type | Name | Comment |
SdaiModel | modelId | Instance Id that uniquely identifies the edmModel in the EDMdatabase |
SdaiString | sourceContainerName | The name of the instance container from which to remove the instances given in < instanceBuffer >. By default, no instances will be removed from any container. |
SdaiString | targetContainerName | The name of the instance container in which to insert the instances given in <instanceBuffer>. By default, no instances will be inserted into any container. |
SdaiAggr | instances | An aggregate containing all the instances to move to, from or between containers. If this parameter contains an aggregateId, the parameter <instanceBuffer> will be neglected. |
SdaiAppInstance | instanceBuffer | An instance buffer containing all the instances to move to, from or between containers. |
Return Value
Options
Example
EdmiError rstat;
SdaiModel modelId = 0;
SdaiContainer oldContId, newContId;
SdaiPrimitiveType contType;
SdaiAggr instAggr;
. . .
/* Get contents of old container */
rstat = edmiGetInstanceContainerId(modelId, "OldContainer",
&contType, &oldContId,
&instAggr)
if (contType == LOCK_CONTAINER) {
/* Create new container */
rstat = edmiCreateInstanceContainer(modelId, MODEL_LOCK_CONTAINER,
"NewContainer", NULL,
&newContId);
/* Move contents to new container */
rstat = edmiInstancesToContainerBN(modelId, "OldContainer",
"NewContainer", instAggr, 0);
/* Delete old container */
rstat = edmiDeleteInstanceContainer(oldContId);
}
. . .
See also