Open CASCADE Technology  7.3.1.dev
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

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

Public Member Functions

 NCollection_Handle ()
 Default constructor; creates null handle. More...
 
 NCollection_Handle (T *theObject)
 Constructor of handle from pointer on newly allocated object. More...
 
T * get ()
 Cast handle to contained type. More...
 
const T * get () const
 Cast handle to contained type. More...
 
T * operator-> ()
 Cast handle to contained type. More...
 
const T * operator-> () const
 Cast handle to contained type. More...
 
T & operator* ()
 Cast handle to contained type. More...
 
const T & operator* () const
 Cast handle to contained type. More...
 
- Public Member Functions inherited from opencascade::handle< Standard_Transient >
 handle ()
 Empty constructor. More...
 
 handle (const Standard_Transient *thePtr)
 Constructor from pointer to new object. More...
 
 handle (const handle &theHandle)
 Copy constructor. More...
 
 handle (handle &&theHandle)
 Move constructor. More...
 
 ~handle ()
 Destructor. More...
 
void Nullify ()
 Nullify the handle. More...
 
bool IsNull () const
 Check for being null. More...
 
void reset (Standard_Transient *thePtr)
 Reset by new pointer. More...
 
handleoperator= (const handle &theHandle)
 Assignment operator. More...
 
handleoperator= (const Standard_Transient *thePtr)
 Assignment to pointer. More...
 
handleoperator= (handle &&theHandle)
 Move operator. More...
 
Standard_Transientget () const
 STL-like cast to pointer to referred object (note non-const). More...
 
Standard_Transientoperator-> () const
 Member access operator (note non-const) More...
 
Standard_Transientoperator* () const
 Dereferencing operator (note non-const) More...
 
bool operator== (const handle< T2 > &theHandle) const
 Check for equality. More...
 
bool operator== (const T2 *thePtr) const
 Check for equality. More...
 
bool operator!= (const handle< T2 > &theHandle) const
 Check for inequality. More...
 
bool operator!= (const T2 *thePtr) const
 Check for inequality. More...
 
bool operator< (const handle< T2 > &theHandle) const
 Compare operator for possible use in std::map<> etc. More...
 
 operator Standard_Transient *handle::* () const
 Conversion to bool-compatible type for use in conditional expressions. More...
 
 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) More...
 
 operator handle< T2 > & ()
 Upcast to non-const reference to base type. NB: this cast can be dangerous, but required for legacy code; see #26377. More...
 

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

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: