cgGetParentType
Keywords: cgGetParentType, NVIDIA, NVIDIA Cg Toolkit, Cg Toolkit, Shader, Shader Programming, GPU Shader Programming, GPU Program

> ## 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

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

> ## 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

> cgGetNumParentTypes