NAME

cgGetParentType - gets a parent type of a child type

SYNOPSIS

  #include <Cg/cg.h>

  CGtype cgGetParentType(CGtype type, int index);

PARAMETERS

type

Specifies the child type.

index

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

DESCRIPTION

cgGetParentType 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.

RETURN VALUES

Returns the number of parent types. (CGparameter)0 is returned if there are no parents.

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

ERRORS

CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if index is outside the proper range.

SEE ALSO

cgGetNumParentTypes