gtpc2me9C/C++ Language Support User's Guide

TO2_isCollection-Test If PID Is for a Collection

This function determines if a persistent identifier (PID) is for a collection.

Format

#include <c$to2.h>
BOOL TO2_isCollection (const TO2_PID_PTR   pid_ptr,
                             TO2_ENV_PTR   env_ptr);

pid_ptr
The pointer to the PID of the collection.

env_ptr
The pointer to the environment as returned by the TO2_createEnv function.

Normal Return

TO2_IS_FALSE
PID is not a collection.

TO2_IS_TRUE
PID is a collection.

Error Return

An error return is indicated by a zero return value and a nonzero error code. When zero is returned, use the TO2_getErrorCode function to determine the specific error code. For more information, see Error Handling.

The following error codes are common for this function:

TO2_ERROR_ENV

TO2_ERROR_METHOD

TO2_ERROR_PID

TO2_ERROR_ZERO_PID

Programming Considerations

Examples

The following example determines if a specified PID represents a TPFCS collection.

#include <c$to2.h>                 /* TO2 API function prototypes     */
#include <stdio.h>                 /* APIs for standard I/O functions */
TO2_ENV_PTR      env_ptr;          /* Pointer to TO2 Environment      */
TO2_PID          blob;
 
TO2_ERR_CODE     err_code;         /* TO2 error code value            */

  ·
  ·
  ·
if (TO2_isCollection(&blob, env_ptr) == TO2_IS_FALSE) { err_code = TO2_getErrorCode(env_ptr); if (err_code != 0) { printf("TO2_isCollection failed!\n"); process_error(env_ptr); } else { printf("Object IS NOT a TPFCS Collection.\n"); } } else { printf("Object IS a TPFCS Collection.\n"); }

Related Information

TO2_getCollectionType-Get the Type Value of the Collection.