Contenido principal

findClass

R2026b

Find class in C++ library

Since R2026b

    Description

    classDef = findClass(idef,CPPName) finds a class in the specified interface definition that matches a fully qualified C++ class name and returns a clibgen.api.ClassDefinition object for the matching class. If the function does not find a match, it returns an empty ClassDefinition object.

    example

    Examples

    collapse all

    Find class SignalFilter in an interface definition, then rename it to a shorter MATLAB name.

    Configure the interface for a library defined by mathops_filter.hpp and create an interface definition.

    icfg = clibgen.api.InterfaceConfiguration("mathops",HeaderFiles="mathops_filter.hpp");
    idef = clibgen.api.InterfaceDefinition(icfg);

    Locate SignalFilter by its fully qualified C++ name, including the namespace.

    classDef = findClass(idef,"mathops::SignalFilter");
    classDef.MATLABName
    ans = "clib.mathops.mathops.SignalFilter"

    The MATLAB name includes the interface name mathops and the namespace in the library, also named mathops.

    Simplify the name to call in MATLAB.

    classDef.MATLABName = "clib.mathops.SignalFilter"
    ans = "clib.mathops.SignalFilter"

    Input Arguments

    collapse all

    Interface definition, specified as a clibgen.api.InterfaceDefinition object.

    Fully qualified C++ class name, specified as a string scalar.

    Output Arguments

    collapse all

    Class definition objects, returned as a clibgen.api.ClassDefinition object that represents the matching class in idef and there are templates. If the function does not find a match, returns an empty ClassDefinition object.

    Version History

    Introduced in R2026b