Custom Platform Support Development Kit  1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
FCM::AutoPtr< T > Class Template Reference

This defines smart pointer to manage AddRef and Release calls to FCM objects. In AutoPtr<T> , T has to be an interface derived from IFCMUnknown. AutoPtr<T> can be used to control the lifetime of objects without explicitly calling AddRef and Release. More...

#include <FCMPluginInterface.h>

Public Member Functions

 AutoPtr (T *p)
 Constructs an AutoPtr<T> object. More...
 
 AutoPtr (const AutoPtr< T > &pObj)
 Copy constructor for AutoPtr<T> More...
 
template<typename Q >
 AutoPtr (Q *p)
 Constructs an AutoPtr<T> object from a pointer to Q, where both T and Q have to be interfaces derived from IFCMUnknown. The construction succeeds only if the QueryInterface call for the interface T succeeds on the object passed. More...
 
template<typename Q >
 AutoPtr (const AutoPtr< Q > &pObj)
 Constructs an AutoPtr<T> object from an AutoPtr<Q> object, where both T and Q are interfaces derived from IFCMUnknown. The construction succeeds only if the QueryInterface call for the interface T succeeds on the object passed. More...
 
 operator T * () const
 The operator to convert to T *.
 
T * operator-> () const
 The member access operator to get the pointer held by this object.
 
T ** operator& ()
 The address operator that returns the address of pointer held by this object.
 
 operator bool () const
 The operator to convert to bool. More...
 
bool operator!= (T *p) const
 The != comparison operator. More...
 
bool operator== (T *p) const
 The == comparison operator. More...
 
void operator= (T *p)
 The overloaded assignment operator to assign a pointer. More...
 
void operator= (const AutoPtr< T > &pObj)
 The overloaded assignment operator to assign an AutoPtr<T> object. More...
 
template<typename Q >
void operator= (const AutoPtr< Q > &pObj)
 The overloaded assignment operator. to assign an AutoPtr<Q> object. More...
 
template<typename Q >
void operator= (Q *p)
 Overloaded assignment operator. More...
 
void Reset ()
 Resets the pointer after calling Release.
 
void Detach ()
 Detaches the pointer without calling Release.
 
void Attach (T *p)
 Attaches the pointer without calling AddRef.
 
template<typename Q >
bool IsSameUnknown (Q *pArg)
 Returns true if the underlying IFCMUnknown pointer this object is same as that of the argument.
 

Public Attributes

T * m_Ptr
 

Detailed Description

template<typename T>
class FCM::AutoPtr< T >

This defines smart pointer to manage AddRef and Release calls to FCM objects. In AutoPtr<T> , T has to be an interface derived from IFCMUnknown. AutoPtr<T> can be used to control the lifetime of objects without explicitly calling AddRef and Release.

Constructor & Destructor Documentation

template<typename T>
FCM::AutoPtr< T >::AutoPtr ( T *  p)
inline

Constructs an AutoPtr<T> object.

Parameters
p(IN) The pointer to object of type T. T has to be derived from IFCMUnknown The constructor in turn calls AddRef on the pointer p
template<typename T>
FCM::AutoPtr< T >::AutoPtr ( const AutoPtr< T > &  pObj)
inline

Copy constructor for AutoPtr<T>

Parameters
pObj(IN) An object of AutoPtr<T> . The constructor in turn calls AddRef on the pointer held by pObj.
template<typename T>
template<typename Q >
FCM::AutoPtr< T >::AutoPtr ( Q *  p)
inline

Constructs an AutoPtr<T> object from a pointer to Q, where both T and Q have to be interfaces derived from IFCMUnknown. The construction succeeds only if the QueryInterface call for the interface T succeeds on the object passed.

Parameters
p(IN) A pointer to an object of type Q. Q has to be derived from IFCMUnknown. The QueryInterface call for the interface T on the object p points to should succeed for successful construction of AutoPtr<T> . On successful construction, it calls AddRef on the pointer p. In case of failure, the AutoPtr<T> object created points to NULL.
template<typename T>
template<typename Q >
FCM::AutoPtr< T >::AutoPtr ( const AutoPtr< Q > &  pObj)
inline

Constructs an AutoPtr<T> object from an AutoPtr<Q> object, where both T and Q are interfaces derived from IFCMUnknown. The construction succeeds only if the QueryInterface call for the interface T succeeds on the object passed.

Parameters
pObj(IN) An object of AutoPtr<Q> , where Q has to be derived from IFCMUnknown. The QueryInterface call for the interface T on the object pObj should succeed for successful construction of AutoPtr<T> . On successful construction it calls AddRef on the pObj. In case of failure the AutoPtr<T> object created will point to NULL.

Member Function Documentation

template<typename T>
FCM::AutoPtr< T >::operator bool ( ) const
inline

The operator to convert to bool.

Returns
Returns true if the pointer held by this object is not NULL, else returns false.
template<typename T>
bool FCM::AutoPtr< T >::operator!= ( T *  p) const
inline

The != comparison operator.

Parameters
p(IN) The pointer to compare.
Returns
Returns true if the pointer p is not same the one held by this object.
template<typename T>
void FCM::AutoPtr< T >::operator= ( T *  p)
inline

The overloaded assignment operator to assign a pointer.

Parameters
p(IN) The pointer to assign.
template<typename T>
void FCM::AutoPtr< T >::operator= ( const AutoPtr< T > &  pObj)
inline

The overloaded assignment operator to assign an AutoPtr<T> object.

Parameters
pObj(IN) The AutoPtr<T> object to assign.
template<typename T>
template<typename Q >
void FCM::AutoPtr< T >::operator= ( const AutoPtr< Q > &  pObj)
inline

The overloaded assignment operator. to assign an AutoPtr<Q> object.

Parameters
pObj(IN) The AutoPtr<Q> object to assign. The QueryInterface call for the interface T on the object pObj should succeed.
template<typename T>
template<typename Q >
void FCM::AutoPtr< T >::operator= ( Q *  p)
inline

Overloaded assignment operator.

Parameters
p(IN) The pointer to Q to assign. The QueryInterface call for the interface T on the object p should succeed.
template<typename T>
bool FCM::AutoPtr< T >::operator== ( T *  p) const
inline

The == comparison operator.

Parameters
p(IN) The pointer to compare.
Returns
Returns true if the pointer p is same as the one held by this object.

Member Data Documentation

template<typename T>
T* FCM::AutoPtr< T >::m_Ptr

Raw pointer


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