Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Typedefs | Functions
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< TDeriveddown_cast (const handle< TBase > &theObject)
 Safe downcast from handle of base type to handle of derived type.
 
template<class TDerived , class TBase >
handle< TDeriveddown_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:

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
STL input iterator that wraps an OCCT More()/Next() iterator.
Definition NCollection_ForwardRange.hxx:142
Intrusive smart pointer for use with Standard_Transient class and its descendants.
Definition Standard_Handle.hxx:54

Modern type checking helpers in occ namespace.

These templates provide a cleaner syntax for runtime type checking:

// Old pattern:
// New pattern:
if (occ::is_kind<Geom_Circle>(theObject))
#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

Typedef Documentation

◆ handle

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