![]() |
ezEngine Release 26.3
|
A thread-safe dependency tracking system for managing resource invalidation. More...
#include <DependencyTracker.h>
Public Member Functions | |
| void | AddResource (Resource *pResource, const ezSet< const Dependency * > &dependencies) |
| Adds a resource and its dependencies to the tracking system. | |
| void | RemoveResource (Resource *pResource) |
| Removes a resource from the tracking system. | |
| void | DependencyDestroyed (Dependency *pDependency) |
| Notifies the tracker that a dependency has been destroyed. | |
Public Attributes | |
| ezEvent< Resource * > | m_ResourceInvalidatedEvent |
| Event that is broadcast when a resource becomes invalid due to dependency destruction. | |
A thread-safe dependency tracking system for managing resource invalidation.
This template class tracks dependencies between resources and their dependencies to allow invalidating resources when their dependencies are destroyed. When a dependency is destroyed, all resources that depend on it are automatically identified and an invalidation event is broadcast for each affected resource.
| Resource | The type of resource being tracked (e.g. bind groups) |
| Dependency | The base type of the dependencies (e.g., ezGALResource) |
| void ezDependencyTracker< Resource, Dependency >::AddResource | ( | Resource * | pResource, |
| const ezSet< const Dependency * > & | dependencies | ||
| ) |
Adds a resource and its dependencies to the tracking system.
This method registers a resource along with all of its dependencies. The resource will be automatically invalidated if any of its dependencies are destroyed. Each resource can only be added once - attempting to add the same resource again will trigger an assertion in debug builds.
| pResource | Pointer to the resource to track |
| dependencies | Set of dependencies that this resource depends on |
| void ezDependencyTracker< Resource, Dependency >::DependencyDestroyed | ( | Dependency * | pDependency | ) |
Notifies the tracker that a dependency has been destroyed.
This method should be called when a dependency object is about to be destroyed. It will identify all resources that depend on this dependency, remove the dependency relationships, and broadcast invalidation events for each affected resource.
| pDependency | Pointer to the dependency that is being destroyed |
| void ezDependencyTracker< Resource, Dependency >::RemoveResource | ( | Resource * | pResource | ) |
Removes a resource from the tracking system.
This method removes the resource and all of its dependency relationships from the tracker. The resource will no longer receive invalidation events even if its former dependencies are destroyed.
| pResource | Pointer to the resource to remove from tracking |