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:

  1. Query the SCM for the given container's members and associated metadata, possibly applying a filter.
  2. Allocate the members array. If developing a RAM in C, use the following code:
    *members = (MemberDescriptorWithInfo*) 
    								malloc(sizeof(MemberDescriptorWithInfo) * *numRecords);
  3. For each member in the array, do the following
    1. Fill in the ID and name of the member
    2. Set if the member is a container. Set the isContainer field to 1 if it is a container, 0 if it not.
    3. Set the infoCount field to the number of metadata key-value pairs associated with that member.
    4. 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);
    5. 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.