SDKReferenceObjectPtr< ObjectInterface > Class Template Reference

#include <sdkreferenceobjectptr.h>

Inheritance diagram for SDKReferenceObjectPtr< ObjectInterface >:

Detailed Description

template<class ObjectInterface>
class SDKReferenceObjectPtr< ObjectInterface >

Reference Object Pointer template for automatic destruction of unused objects.

Note
Simultaneous access to a SDKReferenceObjectPtr from different threads must be synchronized because the assignment operators are not atomic.

Public Member Functions

 SDKReferenceObjectPtr ()
 
 SDKReferenceObjectPtr (const SDKReferenceObjectPtr &src)
 
 SDKReferenceObjectPtr (const SDKReferenceObjectBasePtr &src)
 
 SDKReferenceObjectPtr (int zero)
 
 SDKReferenceObjectPtr (const ObjectInterface *src_itf)
 
 ~SDKReferenceObjectPtr ()
 
ObjectInterface * GetPtr () const
 
SDKReferenceObjectPtroperator= (int zero)
 
SDKReferenceObjectPtroperator= (const SDKReferenceObjectPtr &src)
 
SDKReferenceObjectPtroperator= (const SDKReferenceObjectBasePtr &src)
 
SDKReferenceObjectPtroperator= (ObjectInterface *src_itf)
 
 operator ObjectInterface * () const
 
ObjectInterface * operator-> () const
 
Bool operator== (ObjectInterface *x) const
 
Bool IsNull () const
 

Additional Inherited Members

- Protected Attributes inherited from SDKReferenceObjectBasePtr
SDKReferenceObjectitf
 

Constructor & Destructor Documentation

◆ SDKReferenceObjectPtr() [1/5]

Default constructor.

◆ SDKReferenceObjectPtr() [2/5]

SDKReferenceObjectPtr ( const SDKReferenceObjectPtr< ObjectInterface > &  src)

Copy constructor. Constructs a reference object with reference data from an existing object.

Parameters
[in]srcThe source reference object containing an interface pointer.

◆ SDKReferenceObjectPtr() [3/5]

Copy constructor. Constructs a reference object with reference data from an existing object.

Note
This constructor is for assignment from a different type of SDKReferenceObjectPtr without use of additional pointer casts
Parameters
[in]srcThe source reference object (of a different type) containing an interface pointer.

◆ SDKReferenceObjectPtr() [4/5]

Constructs a nullptr interface.

Parameters
[in]zeroPass 0.

◆ SDKReferenceObjectPtr() [5/5]

SDKReferenceObjectPtr ( const ObjectInterface *  src_itf)

Constructs a reference object with an interface/class pointer.

Parameters
[in]src_itfThe interface/class pointer.

◆ ~SDKReferenceObjectPtr()

Destructs the reference object, removes reference to the interface.

Member Function Documentation

◆ GetPtr()

ObjectInterface* GetPtr ( ) const

Gets the reference pointer.

Returns
The pointer to the interface.

◆ operator=() [1/4]

SDKReferenceObjectPtr& operator= ( int  zero)

Removes a references.

Parameters
[in]zeroPass 0.
Returns
*this

◆ operator=() [2/4]

SDKReferenceObjectPtr& operator= ( const SDKReferenceObjectPtr< ObjectInterface > &  src)

Assigns a reference to an already initialized reference object.

Parameters
[in]srcA reference object containing an interface pointer.
Returns
*this

◆ operator=() [3/4]

SDKReferenceObjectPtr& operator= ( const SDKReferenceObjectBasePtr src)

Assigns a reference to an already initialized reference object.

Note
This operator is for assignment from a different type of SDKReferenceObjectPtr without use of additional pointer casts.
Parameters
[in]srcA reference object (of a different type) containing an interface pointer
Returns
*this

◆ operator=() [4/4]

SDKReferenceObjectPtr& operator= ( ObjectInterface *  src_itf)

Assigns a reference to an already initialized reference object.

Parameters
[in]src_itfAn interface pointer.
Returns
*this

◆ operator ObjectInterface *()

operator ObjectInterface * ( ) const

Gets the reference pointer.

Returns
The pointer to the interface.

◆ operator->()

ObjectInterface* operator-> ( ) const

Overrides the -> operator. Makes the SDKReferenceObjectPtr looks like a real pointer.

Returns
The pointer to the interface.

◆ operator==()

Bool operator== ( ObjectInterface *  x) const

Compares the reference and the given object pointer.

Parameters
[in]xAn object pointer.
Returns
true if the reference and the given object pointer are equal, otherwise false.

◆ IsNull()

Bool IsNull ( ) const

Checks if an interface has been assigned.

Returns
true if the interface pointer is not nullptr, otherwise false.