To be completed (add example).
Search the specified model for the instances with an attribute value equal to the specified attribute. The attribute is specified by name via the arguments entityName and attributeName. Number of instances found is returned via the argument <numberOfHits>.
If no attribute hash table is defined for the specified attribute, no sequential search is performed and the function returns an error code.
Related functions: edmiGetHashedAttrInstances, edmiGetHashedAttrInstance, edmiGetHashedAttrInstanceBN , edmiHashModelInstances
Header:
#include "sdai.h"
Prototype:
EdmiError edmiGetHashedAttrInstances(SdaiModel modelId, SdaiString entityName, SdaiString attributeName, SdaiString attrStringValue, SdaiInteger attrIntegerValue, SdaiInteger maxBufferSize, SdaiInteger *index, SdaiInteger *numberOfHits, SdaiInstance *resultBuffer);
Arguments:
modelId | A numeric modelID that uniquely identifies the model of interest in the EDMdatabase. |
entityName | Specify the name of the instance type, i.e. the name of the entity that defines the instance type. Entity names are case insensitive. |
attributeName | Specifies the name of the attribute. Attribute names are case insensitive. |
attrStringValue | is used to specify the hash table key for hash tables of sdaiSTRING data type. |
attrIntegerValue | is used to specify the hash table key for hash tables of SdaiString, SdaiInstance, and EdmPackedDate data types. |
maxBufferSize | Specifies the size (in number of bytes) of the buffer used for receiving matching elements. The number of elements may never exceed the number that fits into a buffer with the size specified in this argument. |
*index | In: The index of the aggregate element to start reading from. The index of the first element in the actual aggregate will always be indexed zero, regardless of the aggregate type. Hence the legal index range is: 0<= index < number of elements in the aggregate. |
*numberOfHits | In: Specifies the maximum number of matching instances to return. If this number is greater than the limitation specified by the <maxBufferSize> argument, then the maximum number of hits will be calculated from the <maxBufferSize> argument. |
*resultBuffer | Address of a buffer in the calling application that will receive the instanceID of each returned matching instance. This buffer is mapped to a SdaiInstance array when the instanceID of each returned matching instance is stored. The <maxBufferSize> argument should prevent the function to write past buffer. |
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;
. . .