OCCT3D OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    occ Namespace Reference

    Modern namespace for Open CASCADE Technology (OCCT 8.0+). More...

    Typedefs

    template<class T>
    using handle = opencascade::handle<T>
     Intrusive smart pointer template for Standard_Transient descendants. This is an alias to opencascade::handle<T>.

    Functions

    template<class TDerived, class TBase>
    handle< TDerived > down_cast (const handle< TBase > &theObject)
     Safe downcast from handle of base type to handle of derived type.
    template<class TDerived, class TBase>
    handle< TDerived > down_cast (const TBase *thePtr)
     Safe downcast from raw pointer to handle of derived type.
    template<class T>
    bool is_kind (const Standard_Transient *theObject)
     Check if object is of type T or inherits from T.
    template<class T, class TBase>
    bool is_kind (const handle< TBase > &theObject)
     Check if object is of type T or inherits from T (handle version).
    template<class T>
    bool is_instance (const Standard_Transient *theObject)
     Check if object is exactly of type T (not a derived type).
    template<class T, class TBase>
    bool is_instance (const handle< TBase > &theObject)
     Check if object is exactly of type T (handle version).
    template<class T>
    const handle< Standard_Type > & type_of ()
     Get the type descriptor for type T. Equivalent to STANDARD_TYPE(T) but with template syntax.

    Detailed Description

    Modern namespace for Open CASCADE Technology (OCCT 8.0+).

    Definition of Handle_Standard_Type as typedef for compatibility.

    This namespace provides the modern C++ interface with template syntax:

    occ::handle<Geom_Circle> aCircle = new Geom_Circle(anAxis, aRadius);
    if (auto aLine = occ::down_cast<Geom_Line>(aCurve))
    {
    // use aLine
    }
    Describes a circle in 3D space. A circle is defined by its radius and, as with any conic curve,...
    Definition Geom_Circle.hxx:59
    opencascade::handle< T > handle
    Intrusive smart pointer template for Standard_Transient descendants. This is an alias to opencascade:...
    Definition Standard_Handle.hxx:421
    handle< TDerived > down_cast(const handle< TBase > &theObject)
    Safe downcast from handle of base type to handle of derived type.
    Definition Standard_Handle.hxx:429

    Modern type checking helpers in occ namespace.

    These templates provide a cleaner syntax for runtime type checking:

    // Old pattern:
    if (theObject->IsKind(STANDARD_TYPE(Geom_Circle)))
    // New pattern:
    #define STANDARD_TYPE(theType)
    Helper macro to get instance of a type descriptor for a class in a legacy way.
    Definition Standard_Type.hxx:36
    bool is_kind(const Standard_Transient *theObject)
    Check if object is of type T or inherits from T.
    Definition Standard_Type.hxx:219

    Typedef Documentation

    ◆ handle

    template<class T>
    using occ::handle = opencascade::handle<T>

    Intrusive smart pointer template for Standard_Transient descendants. This is an alias to opencascade::handle<T>.

    Function Documentation

    ◆ down_cast() [1/2]

    template<class TDerived, class TBase>
    handle< TDerived > occ::down_cast ( const handle< TBase > & theObject)
    inline

    Safe downcast from handle of base type to handle of derived type.

    Template Parameters
    TDerivedTarget derived type
    TBaseSource base type (deduced)
    Parameters
    theObjectHandle to object of base type
    Returns
    Handle to derived type, or null handle if cast fails

    ◆ down_cast() [2/2]

    template<class TDerived, class TBase>
    handle< TDerived > occ::down_cast ( const TBase * thePtr)
    inline

    Safe downcast from raw pointer to handle of derived type.

    Template Parameters
    TDerivedTarget derived type
    TBaseSource base type (deduced)
    Parameters
    thePtrRaw pointer to object of base type
    Returns
    Handle to derived type, or null handle if cast fails

    ◆ is_instance() [1/2]

    template<class T, class TBase>
    bool occ::is_instance ( const handle< TBase > & theObject)
    inline

    Check if object is exactly of type T (handle version).

    Template Parameters
    TTarget type to check against
    TBaseBase type of the handle (deduced)
    Parameters
    theObjectHandle to object to check
    Returns
    true if theObject is not null and is exactly of type T

    ◆ is_instance() [2/2]

    template<class T>
    bool occ::is_instance ( const Standard_Transient * theObject)
    inline

    Check if object is exactly of type T (not a derived type).

    Template Parameters
    TTarget type to check against
    Parameters
    theObjectPointer to object to check
    Returns
    true if theObject is not null and is exactly of type T

    ◆ is_kind() [1/2]

    template<class T, class TBase>
    bool occ::is_kind ( const handle< TBase > & theObject)
    inline

    Check if object is of type T or inherits from T (handle version).

    Template Parameters
    TTarget type to check against
    TBaseBase type of the handle (deduced)
    Parameters
    theObjectHandle to object to check
    Returns
    true if theObject is not null and is of type T or derived from T

    ◆ is_kind() [2/2]

    template<class T>
    bool occ::is_kind ( const Standard_Transient * theObject)
    inline

    Check if object is of type T or inherits from T.

    Template Parameters
    TTarget type to check against
    Parameters
    theObjectPointer to object to check
    Returns
    true if theObject is not null and is of type T or derived from T

    ◆ type_of()

    template<class T>
    const handle< Standard_Type > & occ::type_of ( )
    inline

    Get the type descriptor for type T. Equivalent to STANDARD_TYPE(T) but with template syntax.

    Template Parameters
    TType to get descriptor for
    Returns
    Handle to type descriptor