Cross-Platform C++

ot
class ObjectManager

#include "ot/base/ObjectManager.h"

Manages the lifetime of ManagedObject instances that need to exist for the duration of the application. OpenTop contains several classes that use global objects which can be created by application code or internally within the library. To enable these objects (and others) to be deleted at system termination, they are registered with a singleton ObjectManager which is responsible for keeping a reference to them until the process terminates.

The task of deleting objects at process termination is seldom strictly required because the underlying operating system will free any resources held by the process upon termination. However, it is sometimes useful in a development environment to help to detect memory leaks in long-running processes.

See also:
System::GetObjectManager()



Method Summary
 void registerObject(ManagedObject* pObject)
         Registers an instance of ManagedObject with this ObjectManager.
 void unregisterObject(ManagedObject* pObject)
         Removes the reference to pObject from the managed collection of object references.

Method Detail

registerObject

void registerObject(ManagedObject* pObject)
Registers an instance of ManagedObject with this ObjectManager. The ObjectManager adds a reference to the passed object to its collection of object references. In so doing, the reference count of the passed object is incremented to prevent it from being destroyed until system termination or until the object is removed by calling unregisterObject().

Parameters:
pObject - pointer to a ManagedObject whose lifetime needs to be managed by the ObjectManager
See also:
unregisterObject()

unregisterObject

void unregisterObject(ManagedObject* pObject)
Removes the reference to pObject from the managed collection of object references. It is not an error if the object designated by pObject does not exist in the managed collection.

Parameters:
pObject - pointer to a ManagedObject which will be removed from the managed collection of object references


Cross-Platform C++

Found a bug or missing feature? Please email us at support@elcel.com

Copyright © 2000-2003 ElCel Technology   Trademark Acknowledgements