The IGenericResourceTarget resource object target interface. More...
#include "murl_graph_i_generic_resource_target.h"
Public Member Functions | |
virtual Bool | Init (IInitTracker *tracker)=0 |
Initialize the resource target. More... | |
virtual Bool | DeInit (IDeInitTracker *tracker)=0 |
De-Initialize the resource target. More... | |
virtual Bool | ConfigChanged (IConfigChangedTracker *tracker, Bool *hasResourceChanged=nullptr)=0 |
Called when the global configuration has changed. More... | |
virtual Bool | Update ()=0 |
Perform an update on the resource target. More... | |
virtual Bool | IsInitialized () const =0 |
Check if the resource target is initialized. More... | |
virtual Bool | IsModified () const =0 |
Check if the resource target is modified. More... | |
virtual Bool | SetInitialized (Bool initialized)=0 |
Manually set or reset the initialized state of the target. More... | |
virtual Bool | SetModified (Bool modified)=0 |
Manually set or reset the modified state of the target. More... | |
virtual UInt32 | GetMinNumberOfResources () const =0 |
Query the minimum number of resource objects. More... | |
virtual UInt32 | GetMaxNumberOfResources () const =0 |
Query the maximum number of resource objects. More... | |
virtual Bool | SetNumberOfResources (UInt32 numberOfResources)=0 |
Set the total number of resources. More... | |
virtual UInt32 | GetNumberOfResources () const =0 |
Get the total number of resources. More... | |
virtual Bool | SetResourceId (const String &resourceId, UInt32 index)=0 |
Set a single resource ID at a given index. More... | |
virtual const String & | GetResourceId (UInt32 index) const =0 |
Get the resource ID at a given index. More... | |
virtual Bool | SetResource (const ObjectType *object, UInt32 index)=0 |
Set (replace) a single resource for referencing at a given position. More... | |
virtual const ObjectType * | GetResource (UInt32 index) const =0 |
Get the resource at a given index. More... | |
Detailed Description
template<class ObjectType>
interface Murl::Graph::IGenericResourceTarget< ObjectType >
The IGenericResourceTarget resource object target interface.
A generic resource target is used to encapsulate (possibly) any number of resource objects, referenced by their unique package/resource ID or directly by pointer. It provides access methods to add, remove or query the set of resource objects that are referenced. By using an IGenericResourceTarget, a graph node's process of handling references to resource objects can be unified, the respective resource object references may be acquired by either specifying a resource ID in an XML scene graph file, or directly set from code when a resource is obtained via a Resource::ICollection from a Logic::IProcessor.
Member Function Documentation
◆ Init()
|
pure virtual |
Initialize the resource target.
To be able to reference resource objects via their unique IDs in a Resource::ICollection, a Graph::IInitTracker must be passed to the resource target, which holds a reference to the actual collection.
- Parameters
-
tracker The tracker used for node initialization.
- Returns
- true if successful.
◆ DeInit()
|
pure virtual |
De-Initialize the resource target.
- Parameters
-
tracker The tracker used for node de-initialization.
- Returns
- true if successful.
◆ ConfigChanged()
|
pure virtual |
Called when the global configuration has changed.
- Parameters
-
tracker The tracker used for change notifications. hasResourceChanged An optional pointer to a Bool value that will be set to true if any of the referenced resources has changed when the global configuration triggered a ConfigChanged event.
- Returns
- true if successful.
◆ Update()
|
pure virtual |
Perform an update on the resource target.
- Returns
- true if successful.
◆ IsInitialized()
|
pure virtual |
Check if the resource target is initialized.
- Returns
- true if initialized.
◆ IsModified()
|
pure virtual |
Check if the resource target is modified.
This method returns true, whenever the set of encapsulated resource references changes, either in size or by content. When modified, that state persists until a manual call to SetModified() with parameter false.
- Returns
- true if modified.
◆ SetInitialized()
|
pure virtual |
Manually set or reset the initialized state of the target.
- Parameters
-
initialized The initialized state.
- Returns
- true if successful.
◆ SetModified()
|
pure virtual |
Manually set or reset the modified state of the target.
- Parameters
-
modified The modified state.
- Returns
- true if successful.
◆ GetMinNumberOfResources()
|
pure virtual |
Query the minimum number of resource objects.
This method returns the defined minimum number of resource object references that must be present for the Init() call to be successful.
- Returns
- The required minimum number of resource objects for the target to be valid.
◆ GetMaxNumberOfResources()
|
pure virtual |
Query the maximum number of resource objects.
This method returns the defined maximum number of resource object references that can be present for the Init() call to be successful.
- Returns
- The required maximum number of resource objects for the target to be valid.
◆ SetNumberOfResources()
|
pure virtual |
Set the total number of resources.
The given value must be in the range from GetMinNumberOfResources() to GetMaxNumberOfResources().
- Parameters
-
numberOfResources The total number of resources in the target.
- Returns
- true if successful.
◆ GetNumberOfResources()
|
pure virtual |
Get the total number of resources.
- Returns
- The total number of resources in the target.
◆ SetResourceId()
|
pure virtual |
Set a single resource ID at a given index.
You need to make sure that the given index is in the range from 0 to GetNumberOfResources()-1, use SetNumberOfResources() to define the actual node count.
- Parameters
-
resourceId A string containing the full package name and ID to a resource object in the resource collection. index The index of the resource ID to set, in the range from 0 to GetNumberOfResources()-1.
- Returns
- true if successful.
◆ GetResourceId()
|
pure virtual |
Get the resource ID at a given index.
- Parameters
-
index The resource ID index in the range from 0 to GetNumberOfResources()-1.
- Returns
- The total number of resource IDs in the target.
◆ SetResource()
|
pure virtual |
Set (replace) a single resource for referencing at a given position.
You need to make sure that the given index is in the range from 0 to GetNumberOfResources()-1, use SetNumberOfResources() to define the actual node count.
- Parameters
-
object A pointer to the resource. index The zero-based position where to set the resource, in the range from 0 to GetNumberOfResources()-1.
- Returns
- true if successful.
◆ GetResource()
|
pure virtual |
Get the resource at a given index.
- Parameters
-
index The resource index in the range from 0 to GetNumberOfResources()-1.
- Returns
- The resource at the given index.
The documentation for this interface was generated from the following file:
- murl_graph_i_generic_resource_target.h