getContainerContentsWithInfo
Retrieves the list of members within a container and the metadata
associated with those members. This is an optional function. The RAM
should implement this function if the SCM provides the metadata with
the list of members. The RAM is required to implement getContainerContents
even
if getContainerContentsWithInfo
is implemented.
int getContainerContentsWithInfo(char instanceID[256],
char memberID[256], MemberDescriptorWithInfo** members,
int* numRecords, void** params, void*** customReturn,
char filter[256], char error[256]);
Variable | Function | Description |
---|---|---|
char instanceID[256] |
Input | The instance containing the container. |
char memberID[256] |
Input | The container's ID. |
MemberDescriptorWithInfo** members |
Output | This should be allocated and filled with the IDs and names of the members within the container. For each member, the metadata information should be allocated and filled. It should also be indicated if the member is a container. |
int* numRecords |
Output | The number of members for which the array has been allocated. |
void** params |
Input | Pointer to an array of custom parameters (see Handling custom parameters and return values). |
void*** customReturn |
Output | Used to reference an array of custom return values (see Handling custom parameters and return values). |
char filter[256] |
Input | This can be passed from the client to filter out sets of members. |
char error[256] |
Output | If an error occurs, this should be filled with a description of the error. |
Operation:
- Query the SCM for the given container's members and associated metadata, possibly applying a filter.
- Allocate the members array. If developing a RAM in C, use the
following code:
*members = (MemberDescriptorWithInfo*) malloc(sizeof(MemberDescriptorWithInfo) * *numRecords);
- For each member in the array, do the following
- Fill in the ID and name of the member
- Set if the member is a container. Set the
isContainer
field to1
if it is a container,0
if it not. - Set the
infoCount
field to the number of metadata key-value pairs associated with that member. - Allocate the info array. If developing a RAM in C, use the following
code, where i is the zero-based index of the member you are working
with:
(*members)[i].info = (KeyValPair *) malloc(sizeof(KeyValPair) * (*members)[i].infocount);
- Fill in the
info
array with the metadata key-value pairs for the member.
Note: If the getContainerContentsWithInfo function requires
custom parameters or custom returns, set up the function to use the
same custom parameters and custom returns as the getContainerContents
function. This allows the CARMA client to call the appropriate function
with no additional input from the user.