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

Represents a managed pointer field. More...

#include <objmgr.h>

Inherits BazisLib::ObjectManager::ConstManagedPointer< _ServiceType >.

Collaboration diagram for BazisLib::ObjectManager::ParentServiceReference< _ServiceType >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ParentServiceReference (ManagedObjectBase *pObject, _ServiceType *pTarget)
 ParentServiceReference (ManagedObjectBase *pObject, const ConstManagedPointer< _ServiceType > &pTarget)
 ~ParentServiceReference ()
ParentServiceReferenceoperator= (_ServiceType *pObj)
ParentServiceReferenceoperator= (const ConstManagedPointer &ref)
ParentServiceReferenceoperator= (const ParentServiceReference &ref)
_ServiceType * operator-> () const
 operator bool ()
 operator bool () const

Private Member Functions

 ParentServiceReference (const ParentServiceReference &ref)
 Copy constructor is not allowed for parent service reference.
void EnsureCorrectAllocation ()
 Ensures that the object is a part of a heap-allocated managed object.
 operator _ServiceType * ()
ParentServiceReferenceAssign (_ServiceType *pObj, bool Release)
 Sets a new value for a parent service reference.

Private Attributes

ManagedObjectBasem_pObject

Friends

class ManagedPointer


Detailed Description

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

Represents a managed pointer field.

This template class is used to implement a managed pointer to a service that is stored as a field of the client class. For about Service and Client definitions, see the BazisLib::ObjectManager documentation. The basic idea for service references is to allow automatic reference counting and circular reference chain detection. Such reference establishes a link between the object that contains the reference (source) and the target. The source then becomes a client for the target. This means, that the target will never be deleted until the source is deleted. This also means that the target cannot become a client for the source. The ServiceObject::RegisterClient() method performs such check in the debug build. As this check requires additional time to be performed, it is not done in release version.

Parameters:
_ServiceType Specifies the service type to reference.
Remarks:
Never use this class directly in declarations. Instead, use the following macros:

Constructor & Destructor Documentation

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

Copy constructor is not allowed for parent service reference.

When a parent service reference is being copied, it means that the object containing the parent service reference is being copied. In that case, the new reference should contain an updated object pointer. This can be ensured by using a constructor that contains both old reference and new object parameters.

template<class _ServiceType >
BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::ParentServiceReference ( ManagedObjectBase pObject,
_ServiceType *  pTarget 
) [inline]

Here is the call graph for this function:

template<class _ServiceType >
BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::ParentServiceReference ( ManagedObjectBase pObject,
const ConstManagedPointer< _ServiceType > &  pTarget 
) [inline]

Here is the call graph for this function:

template<class _ServiceType >
BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::~ParentServiceReference (  )  [inline]


Member Function Documentation

template<class _ServiceType >
ParentServiceReference& BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::Assign ( _ServiceType *  pObj,
bool  Release 
) [inline, private]

Sets a new value for a parent service reference.

This method is internally used by the assignment operator

Parameters:
pObj Object to assign
Release If this parameter is true, the pointer will be released once after client registration. It is set to true only when an operator received an unmanaged pointer from user.

template<class _ServiceType >
void BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::EnsureCorrectAllocation (  )  [inline, private]

Ensures that the object is a part of a heap-allocated managed object.

template<class _ServiceType >
BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::operator _ServiceType * (  )  [inline, private]

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

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

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

template<class _ServiceType >
ParentServiceReference& BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::operator= ( const ParentServiceReference< _ServiceType > &  ref  )  [inline]

Here is the call graph for this function:

template<class _ServiceType >
ParentServiceReference& BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::operator= ( const ConstManagedPointer ref  )  [inline]

Here is the call graph for this function:

template<class _ServiceType >
ParentServiceReference& BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::operator= ( _ServiceType *  pObj  )  [inline]

Here is the call graph for this function:


Friends And Related Function Documentation

template<class _ServiceType >
friend class ManagedPointer [friend]


Member Data Documentation

template<class _ServiceType >
ManagedObjectBase* BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::m_pObject [private]


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