cgGetParentType(3)

NAME
cgGetParentType - gets a parent type of a child type

SYNOPSIS
  #include <Cg/cg.h>
  CGtype cgGetParentType( CGtype type,
                          int index );

PARAMETERS

type
    The child type.

index
    The index of the parent type. index must be greater than or equal to 0 and less than the value returned by cgGetNumParentTypes.

RETURN VALUES
Returns the number of parent types.

Returns NULL if there are no parents.

Returns CG_UNKNOWN_TYPE if type is a built-in type or an error is thrown.

DESCRIPTION
cgGetParentTypes returns a parent type of type.

A parent type is one from which the given type inherits, or an interface type that the given type implements. For example, given the type definitions:

    interface myiface {
        float4 eval(void);
    };
    struct mystruct : myiface {
        float4 value;
        float4 eval(void ) { return value; }
    };
mystruct has a single parent type, myiface.

Note that the current Cg language specification implies that a type may only have a single parent type -- an interface implemented by the given type.

EXAMPLES
to-be-written

ERRORS
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if index is outside the proper range.

HISTORY
cgGetParentType was introduced in Cg 1.2.

SEE ALSO
the cgGetNumParentTypes manpage