BazisLib::ObjectManager::ConstManagedPointer< _ServiceType > Class Template Reference

Represents a read-only managed pointer for function parameters. Should only be used for creating references/pointers. More...

#include <objmgr.h>

Inherited by BazisLib::ObjectManager::ParentServiceReference< _ServiceType >.

List of all members.

Public Member Functions

 operator bool ()
 operator bool () const
_ServiceType * RetainAndGet () const
 Retains the object and returns an unmanaged pointer.
_ServiceType * operator-> () const

Private Member Functions

 ConstManagedPointer ()
 ConstManagedPointer (const ConstManagedPointer &ptr)
 ~ConstManagedPointer ()

Private Attributes

_ServiceType * m_pTarget

Friends

class ManagedPointer< _ServiceType >
class ParentServiceReference< _ServiceType >


Detailed Description

template<class _ServiceType>
class BazisLib::ObjectManager::ConstManagedPointer< _ServiceType >

Represents a read-only managed pointer for function parameters. Should only be used for creating references/pointers.

This class represents a read-only managed pointer and serves as a base for the ParentServiceReference and ManagedPointer template classes. The typical usage scheme for this class is the following:

void SomeFunctionOrMethod(const ConstManagedPointer &pObj)
{
	...
}
You can also use ManagedPointer class references as function parameters, however in case of passing a ParentServiceReference to such a function, a temporary ManagedPointer instance will be created, that will result in an extra Retain()/Release() call pair. That way, it is highly recommended to use this class in function/method parameters, as it is the common base for both ManagedPointer and ParentServiceReference. However, it does not provide any other logic except for querying operators.
Attention:
This class has non-working private constructors. They allow to ensure that no instance of this class will be created directly (except for a part of a friend child class). Also, this class does not contain any freeing/releasing logic. That way, DO NOT create instances of this class directly.

Constructor & Destructor Documentation

template<class _ServiceType >
BazisLib::ObjectManager::ConstManagedPointer< _ServiceType >::ConstManagedPointer (  )  [inline, private]

template<class _ServiceType >
BazisLib::ObjectManager::ConstManagedPointer< _ServiceType >::ConstManagedPointer ( const ConstManagedPointer< _ServiceType > &  ptr  )  [inline, private]

template<class _ServiceType >
BazisLib::ObjectManager::ConstManagedPointer< _ServiceType >::~ConstManagedPointer (  )  [inline, private]


Member Function Documentation

template<class _ServiceType >
BazisLib::ObjectManager::ConstManagedPointer< _ServiceType >::operator bool (  )  const [inline]

template<class _ServiceType >
BazisLib::ObjectManager::ConstManagedPointer< _ServiceType >::operator bool (  )  [inline]

template<class _ServiceType >
_ServiceType* BazisLib::ObjectManager::ConstManagedPointer< _ServiceType >::operator-> (  )  const [inline]

template<class _ServiceType >
_ServiceType* BazisLib::ObjectManager::ConstManagedPointer< _ServiceType >::RetainAndGet (  )  const [inline]

Retains the object and returns an unmanaged pointer.

As we have declared restrictions for unmanaged pointers (if a function received an unmanaged pointer, it should release it after usage, or, actually, initialize a managed one and forget the unmanaged), we do not allow direct casting from managed to unmanaged pointer. However, if an unmanaged pointer is required, it can be obtaied by this method.

Returns:
This method returns a retained unmanaged pointer to an object (or NULL). Be sure to release this pointer by calling Release() method, or initialize a managed pointer using it.


Friends And Related Function Documentation

template<class _ServiceType >
friend class ManagedPointer< _ServiceType > [friend]

template<class _ServiceType >
friend class ParentServiceReference< _ServiceType > [friend]


Member Data Documentation

template<class _ServiceType >
_ServiceType* BazisLib::ObjectManager::ConstManagedPointer< _ServiceType >::m_pTarget [private]


The documentation for this class was generated from the following file:
SourceForge.net Logo