Open CASCADE Technology 7.8.0
Data Structures | Public Types | Public Member Functions | Static Public Member Functions
NCollection_Handle< T > Class Template Reference

Purpose: This template class is used to define Handle adaptor for allocated dynamically objects of arbitrary type. More...

#include <NCollection_Handle.hxx>

Inheritance diagram for NCollection_Handle< T >:
Inheritance graph
[legend]

Public Types

typedefelement_type
 
- Public Types inherited from opencascade::handle< Standard_Transient >
typedef Standard_Transient element_type
 STL-compliant typedef of contained type.
 

Public Member Functions

 NCollection_Handle ()
 Default constructor; creates null handle.
 
 NCollection_Handle (T *theObject)
 Constructor of handle from pointer on newly allocated object.
 
T * get ()
 Cast handle to contained type.
 
const T * get () const
 Cast handle to contained type.
 
T * operator-> ()
 Cast handle to contained type.
 
const T * operator-> () const
 Cast handle to contained type.
 
T & operator* ()
 Cast handle to contained type.
 
const T & operator* () const
 Cast handle to contained type.
 
- Public Member Functions inherited from opencascade::handle< Standard_Transient >
 handle ()
 Empty constructor.
 
 handle (const Standard_Transient *thePtr)
 Constructor from pointer to new object.
 
 handle (const handle &theHandle)
 Copy constructor.
 
 handle (handle &&theHandle) Standard_Noexcept
 Move constructor.
 
 ~handle ()
 Destructor.
 
void Nullify ()
 Nullify the handle.
 
bool IsNull () const
 Check for being null.
 
void reset (Standard_Transient *thePtr)
 Reset by new pointer.
 
handleoperator= (const handle &theHandle)
 Assignment operator.
 
handleoperator= (const Standard_Transient *thePtr)
 Assignment to pointer.
 
handleoperator= (handle &&theHandle) Standard_Noexcept
 Move operator.
 
Standard_Transientget () const
 STL-like cast to pointer to referred object (note non-const).
 
Standard_Transientoperator-> () const
 Member access operator (note non-const)
 
Standard_Transientoperator* () const
 Dereferencing operator (note non-const)
 
bool operator== (const handle< T2 > &theHandle) const
 Check for equality.
 
bool operator== (const T2 *thePtr) const
 Check for equality.
 
bool operator!= (const handle< T2 > &theHandle) const
 Check for inequality.
 
bool operator!= (const T2 *thePtr) const
 Check for inequality.
 
bool operator< (const handle< T2 > &theHandle) const
 Compare operator for possible use in std::map<> etc.
 
 operator Standard_Transient *handle::* () const
 Conversion to bool-compatible type for use in conditional expressions.
 
 operator const handle< T2 > & () const
 Upcast to const reference to base type. NB: this implementation will cause ambiguity errors on calls to overloaded functions accepting handles to different types, since compatibility is checked in the cast code rather than ensured by SFINAE (possible with C++11)
 
 operator handle< T2 > & ()
 Upcast to non-const reference to base type. NB: this cast can be dangerous, but required for legacy code; see #26377.
 

Static Public Member Functions

static NCollection_Handle< T > DownCast (const opencascade::handle< Standard_Transient > &theOther)
 Downcast arbitrary Handle to the argument type if contained object is Handle for this type; returns null otherwise.
 
- Static Public Member Functions inherited from opencascade::handle< Standard_Transient >
static opencascade::std::enable_if< is_base_but_not_same< T2, Standard_Transient >::value, handle >::type DownCast (const handle< T2 > &theObject)
 Down casting operator from handle to base type.
 
static opencascade::std::enable_if< is_base_but_not_same< T2, Standard_Transient >::value, handle >::type DownCast (const T2 *thePtr)
 Down casting operator from pointer to base type.
 
static handle DownCast (const handle< T2 > &theObject, typename opencascade::std::enable_if<!is_base_but_not_same< T2, Standard_Transient >::value, void * >::type=0)
 For compatibility, define down casting operator from non-base type, as deprecated.
 
static handle DownCast (const T2 *thePtr, typename opencascade::std::enable_if<!is_base_but_not_same< T2, Standard_Transient >::value, void * >::type=0)
 For compatibility, define down casting operator from non-base type, as deprecated.
 

Detailed Description

template<class T>
class NCollection_Handle< T >

Purpose: This template class is used to define Handle adaptor for allocated dynamically objects of arbitrary type.

The advantage is that this handle will automatically destroy the object when last referred Handle is destroyed (i.e. it is a typical smart pointer), and that it can be handled as Handle(Standard_Transient) in OCCT components.

Member Typedef Documentation

◆ element_type

template<class T >
typedef T NCollection_Handle< T >::element_type

Constructor & Destructor Documentation

◆ NCollection_Handle() [1/2]

template<class T >
NCollection_Handle< T >::NCollection_Handle ( )
inline

Default constructor; creates null handle.

◆ NCollection_Handle() [2/2]

template<class T >
NCollection_Handle< T >::NCollection_Handle ( T *  theObject)
inline

Constructor of handle from pointer on newly allocated object.

Member Function Documentation

◆ DownCast()

template<class T >
static NCollection_Handle< T > NCollection_Handle< T >::DownCast ( const opencascade::handle< Standard_Transient > &  theOther)
inlinestatic

Downcast arbitrary Handle to the argument type if contained object is Handle for this type; returns null otherwise.

◆ get() [1/2]

template<class T >
T * NCollection_Handle< T >::get ( )
inline

Cast handle to contained type.

◆ get() [2/2]

template<class T >
const T * NCollection_Handle< T >::get ( ) const
inline

Cast handle to contained type.

◆ operator*() [1/2]

template<class T >
T & NCollection_Handle< T >::operator* ( )
inline

Cast handle to contained type.

◆ operator*() [2/2]

template<class T >
const T & NCollection_Handle< T >::operator* ( ) const
inline

Cast handle to contained type.

◆ operator->() [1/2]

template<class T >
T * NCollection_Handle< T >::operator-> ( )
inline

Cast handle to contained type.

◆ operator->() [2/2]

template<class T >
const T * NCollection_Handle< T >::operator-> ( ) const
inline

Cast handle to contained type.


The documentation for this class was generated from the following file: