...
Code Block | ||||
---|---|---|---|---|
| ||||
EdmiError edmiConditionalDeepCopyInstances(SdaiInstance *sourceInstanceId,
SdaiModel modelId,
SdaiInteger options,
SdaiEntity *exclude_or_include,
SdaiInstance **newInstancesId);
|
Copies a selection of application instances either within an edmModel> or between two edmModels. Optionally, this function may copy only the selected instances or their entire instance graphs.
...
An instance graph is the resulting grid of application instances that appear when all referenced application instances are included recursively. Hence, a single application instance may comprise a great number of internally chained instances in its instance graph.
...
The target instances will implicitly be created, hence copying between existing instances cannot be performed by this operation.
...
The edmModel containing the source instance must be open for read access and the target edmModel must be open for write access
...
before this operation can be successfully performed.
...
Arguments
...
Type | Name | Comment |
*sourceInstanceId | A null-terminated buffer containing the instanceIDs of all the application instances to be copied. | |
modelId | The numeric modelID that uniquely identifies the edmModel in which to create the target instances. | |
options | See detailed descriptions of the available options below. | |
*exclude_or_include | An optional null-terminated buffer containing either application instanceIds or instance types (entityIds). The interpretation of the buffer contents and the actions taken depends on the value of the <options> argument. | |
**newInstancesId | A pointer variable that will receive the address of an allocated buffer containing all the instanceIds created in the target model. Use edmiFree to release the allocated memory. |
Option: Description:
Return Value
...
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Options
...
Option | Comment |
INCLUDE_TYPES | Only instance types (represented by their entityIds) listed in the <exclude_or_include> buffer argument will be copied. Add the SUBTYPES option to include all subtypes of the types listed in the <exclude_or_include> buffer. |
EXCLUDE_TYPES | Only instance types (represented by their entityIds) that are not listed in the <exclude_or_include> buffer argument will be copied. Add the SUBTYPES option to exclude all subtypes of the types listed in the <exclude_or_include> buffer. |
SUBTYPES | This option extends the INCLUDE_TYPES and EXCLUDE_TYPES options. When used, the list of entityIds in the <exclude_or_include> buffer will be extended with the entityIds of any subtype of the instance types listed therein. |
EXCLUDE_INSTANCES | The instances contained in the <exclude_or_include> buffer will not be copied to the target model. |
COPY_SHALLOW | Only the application instances explicitely listed in the <sourceInstanceId> buffer will be copied. This option prevents recursive copying of all the referenced instances that constitute the instance graph. |
EXCLUDE_ALL_INSTANCES | Only the application instances explicitely explicitly listed in the <sourceInstanceId> buffer will be copied. The copying will be shallow, i.e this option prevents recursive copying of all the referenced instances that constitute the instance graph. |
...
Example
...
Code Block | ||
---|---|---|
| ||
EdmiError rstat; SdaiRepository repId; SdaiModel srcModelId; SdaiModel tarModelId; SdaiInstance friends[NBUFF+1]; |
...
SdaiInteger index = 0, nHits = NBUFF; |
...
SdaiEntity exclude[2]; |
...
SdaiInstance *myFemaleFriends; |
...
rstat = edmiOpenRepositoryBN("DataRepository", sdaiRW, &repId); |
...
srcModelId = sdaiOpenModelBN(repId, "MyFriends", sdaiRO); |
...
tarModelId = sdaiOpenModelBN(repId, "MyNorwegianFemaleFriends", sdaiRW); |
...
rstat = edmiSelectInstancesBN(srcModelId, "PERSON", |
...
"NATIONALITY = 'NOR'", SUBTYPES, NBUFF, |
...
&index, &nHits, &friends[0]); |
...
friends[NBUFF] = 0; |
...
exclude[0] = sdaiGetEntity(srcModelId, "MALE"); |
...
exclude[1] = 0; |
...
if (rstat = edmiConditionalDeepCopyInstances(friends, tarModelId, |
...
EXCLUDE_TYPES, exclude, |
...
&myFemaleFriends)) { |
...
printf("\nError %d in edmiConditionalDeepCopyInstances: %s", rstat, |
...
edmiGetErrorText(rstat)); |
...
goto err; |
...
}
. . . |
See also
Filter by label (Content by label) | ||||||
---|---|---|---|---|---|---|
|