#include <objmgr.h>
Inherits BazisLib::ObjectManager::ConstManagedPointer< _ServiceType >.
Public Member Functions | |
ParentServiceReference (ManagedObjectBase *pObject, _ServiceType *pTarget) | |
ParentServiceReference (ManagedObjectBase *pObject, const ConstManagedPointer< _ServiceType > &pTarget) | |
~ParentServiceReference () | |
ParentServiceReference & | operator= (_ServiceType *pObj) |
ParentServiceReference & | operator= (const ConstManagedPointer &ref) |
ParentServiceReference & | operator= (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 * () | |
ParentServiceReference & | Assign (_ServiceType *pObj, bool Release) |
Sets a new value for a parent service reference. | |
Private Attributes | |
ManagedObjectBase * | m_pObject |
Friends | |
class | ManagedPointer |
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.
_ServiceType | Specifies the service type to reference. |
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.
BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::ParentServiceReference | ( | ManagedObjectBase * | pObject, | |
_ServiceType * | pTarget | |||
) | [inline] |
BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::ParentServiceReference | ( | ManagedObjectBase * | pObject, | |
const ConstManagedPointer< _ServiceType > & | pTarget | |||
) | [inline] |
BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::~ParentServiceReference | ( | ) | [inline] |
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
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. |
void BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::EnsureCorrectAllocation | ( | ) | [inline, private] |
Ensures that the object is a part of a heap-allocated managed object.
BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::operator _ServiceType * | ( | ) | [inline, private] |
BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::operator bool | ( | ) | const [inline] |
Reimplemented from BazisLib::ObjectManager::ConstManagedPointer< _ServiceType >.
BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::operator bool | ( | ) | [inline] |
Reimplemented from BazisLib::ObjectManager::ConstManagedPointer< _ServiceType >.
_ServiceType* BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::operator-> | ( | ) | const [inline] |
Reimplemented from BazisLib::ObjectManager::ConstManagedPointer< _ServiceType >.
ParentServiceReference& BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::operator= | ( | const ParentServiceReference< _ServiceType > & | ref | ) | [inline] |
ParentServiceReference& BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::operator= | ( | const ConstManagedPointer & | ref | ) | [inline] |
ParentServiceReference& BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::operator= | ( | _ServiceType * | pObj | ) | [inline] |
friend class ManagedPointer [friend] |
ManagedObjectBase* BazisLib::ObjectManager::ParentServiceReference< _ServiceType >::m_pObject [private] |