Template class controlling multiple replications created by XML <Instance> node. More...
#include "murl_logic_graph_instance_objects.h"
Public Member Functions | |
GraphInstanceObjects () | |
The default constructor. | |
Bool | SetNodeObserver (INodeObserverPtr nodeObserver) |
Set the node observer. More... | |
~GraphInstanceObjects () override | |
The destructor. | |
virtual Bool | Init (const Graph::IRoot *root, const String &pathName, const String &instanceName, const String &replicationName, const String &postfixName=String()) |
Initialize the object. More... | |
virtual Bool | Init (Graph::INamespace *namespaceNode, const String &instanceNodeIdPath) |
Initialize the object. More... | |
virtual Bool | Init (Logic::NamespaceNode namespaceNode, const String &instanceNodeIdPath) |
Initialize the object. More... | |
virtual Bool | DeInit () |
Deinitialize the object. More... | |
virtual Bool | IsInitialized () const |
Check if the object is initialized successful. More... | |
virtual Graph::IInstance * | GetInstanceNode () const |
Get the interface of the graph instance node. More... | |
virtual InstanceObjectType * | Obtain () |
Obtain a single InstanceObjectType object. More... | |
virtual void | ObtainAll () |
Obtain all InstanceObjectType object. | |
virtual Bool | Release (InstanceObjectType *object) |
Release a single InstanceObjectType object. More... | |
virtual void | ReleaseAll () |
Release all InstanceObjectType object. | |
void | SetObtained (UInt32 index, Bool isObtained) |
Set the obtained status of an InstanceObjectType object. More... | |
UInt32 | GetMaxObtained () const |
Get the highest obtained instance index. More... | |
UInt32 | GetNumberOfObtained () const |
Get the number of obtained instances. More... | |
UInt32 | GetNumberOfRemaining () const |
Get the number of non-obtained instances. More... | |
UInt32 | GetNumberOfInstances () const |
Get the number of instances. More... | |
const InstanceObjectType * | GetInstance (UInt32 index) const |
Get the const InstanceObjectType object by index. More... | |
const InstanceObjectType * | GetObtainedInstance (UInt32 index) const |
Get the const InstanceObjectType object by index if obtained. More... | |
InstanceObjectType * | GetInstance (UInt32 index) |
Get the InstanceObjectType object by index. More... | |
InstanceObjectType * | GetObtainedInstance (UInt32 index) |
Get the InstanceObjectType object by index if obtained. More... | |
Bool | IsObtained (UInt32 index) const |
Check if a InstanceObjectType object is obtained. More... | |
Public Member Functions inherited from Murl::Logic::BaseStepable | |
BaseStepable () | |
The default constructor. More... | |
~BaseStepable () override | |
The destructor. More... | |
operator IStepablePtr () | |
Conversion operator. More... | |
Public Member Functions inherited from Murl::Logic::Stepable | |
~Stepable () override | |
The destructor. | |
Bool | SetAppStepable (IAppStepablePtr appStepable) override |
Implementation of IStepable::SetAppStepable() method. More... | |
void | SetEnabled (Bool isEnabled) override |
Implementation of IStepable::SetEnabled() method. More... | |
Bool | IsEnabled () const override |
Implementation of IStepable::IsEnabled() method. More... | |
void | Reset () override |
Implementation of IStepable::Reset() method. | |
void | ProcessTick (const Logic::IState *state) override |
Implementation of IStepable::ProcessTick() method. More... | |
void | FinishTick (const Logic::IState *state) override |
Implementation of IStepable::FinishTick() method. More... | |
Protected Member Functions | |
void | OnSetEnabled (Bool isEnabled) override |
Overwrite of the BaseStepable::OnSetEnabled() method, calls SetEnabled() to all obtained InstanceObjectType objects. More... | |
void | OnReset () override |
Overwrite of the BaseStepable::OnReset() method, calls Reset() to all obtained InstanceObjectType objects. | |
void | OnProcessTick (const Logic::IState *state) override |
Overwrite of the BaseStepable::OnProcessTick() method, calls ProcessTick() to all obtained InstanceObjectType objects. More... | |
void | OnFinishTick (const Logic::IState *state) override |
Overwrite of the BaseStepable::OnFinishTick() method, calls FinishTick() to all obtained InstanceObjectType objects. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Murl::Logic::Stepable | |
static IStepablePtr | Create () |
Create a stepable object. More... | |
Detailed Description
template<class InstanceObjectType>
class Murl::Logic::GraphInstanceObjects< InstanceObjectType >
Template class controlling multiple replications created by XML <Instance> node.
A InstanceObjectType class must derive from the Logic::GraphReplication base class. See class Logic::GraphPositionInstance or Logic::GraphSoundInstance for example.
Member Function Documentation
◆ SetNodeObserver()
|
inline |
Set the node observer.
- Parameters
-
nodeObserver The node observer.
- Returns
- true if successful, false if the internal node observer is already in use.
◆ Init() [1/3]
|
inlinevirtual |
Initialize the object.
Create and initialize InstanceObjectType classes for each of the Graph::IInstance replications.
- Parameters
-
root The graph root node. pathName The full path to the Graph::IInstance excluding the replication name. instanceName The instance name excluding the path. replicationName The prefix of the {replication} name excluding the path. postfixName An optional postfix of the {replication} name excluding the path.
- Returns
- true if successful.
References Murl::SharedPointer< DataType >::Get(), Murl::Graph::IInstance::GetNumberOfReplications(), Murl::Logic::GraphNodeT< NodeType >::GetReference(), Murl::Logic::GraphInstanceObjects< InstanceObjectType >::IsInitialized(), Murl::ObjectArray< DataType >::SetCount(), and Murl::Util::UInt32ToString().
Referenced by Murl::Logic::GraphInstanceObjects< InstanceObjectType >::Init().
◆ Init() [2/3]
|
inlinevirtual |
Initialize the object.
Create and initialize InstanceObjectType classes for each of the Graph::IInstance replications.
- Parameters
-
namespaceNode The graph namespace node. instanceNodeIdPath The instance name with optional path.
- Returns
- true if successful.
References Murl::SharedPointer< DataType >::Get(), Murl::Graph::IInstance::GetNumberOfReplications(), Murl::Logic::GraphNodeT< NodeType >::GetReference(), Murl::Graph::IInstance::GetReplicationNode(), Murl::Logic::GraphInstanceObjects< InstanceObjectType >::Init(), Murl::Logic::GraphInstanceObjects< InstanceObjectType >::IsInitialized(), and Murl::ObjectArray< DataType >::SetCount().
◆ Init() [3/3]
|
inlinevirtual |
Initialize the object.
Create and initialize InstanceObjectType classes for each of the Graph::IInstance replications.
- Parameters
-
namespaceNode The logic namespace node. instanceNodeIdPath The instance name with optional path.
- Returns
- true if successful.
References Murl::Logic::GraphNodeT< NodeType >::GetNode(), and Murl::Logic::GraphInstanceObjects< InstanceObjectType >::Init().
◆ DeInit()
|
inlinevirtual |
Deinitialize the object.
Deinitialize all InstanceObjectType class instances.
- Returns
- true if successful.
References Murl::ObjectArray< DataType >::Empty(), Murl::ObjectArray< DataType >::GetCount(), and Murl::Logic::GraphInstanceObjects< InstanceObjectType >::IsInitialized().
◆ IsInitialized()
|
inlinevirtual |
Check if the object is initialized successful.
- Returns
- true if initialized successful.
References Murl::Logic::GraphNodeT< NodeType >::IsValid().
Referenced by Murl::Logic::GraphInstanceObjects< InstanceObjectType >::DeInit(), and Murl::Logic::GraphInstanceObjects< InstanceObjectType >::Init().
◆ GetInstanceNode()
|
inlinevirtual |
Get the interface of the graph instance node.
- Returns
- A pointer to the graph instance interface or null.
References Murl::Logic::GraphNodeT< NodeType >::GetNode().
◆ Obtain()
|
inlinevirtual |
Obtain a single InstanceObjectType object.
- Returns
- A pointer to the InstanceObjectType object or null.
References Murl::ObjectArray< DataType >::GetCount(), Murl::Logic::GraphInstanceObjects< InstanceObjectType >::IsObtained(), and Murl::Logic::GraphInstanceObjects< InstanceObjectType >::SetObtained().
◆ Release()
|
inlinevirtual |
Release a single InstanceObjectType object.
- Parameters
-
object A pointer to the InstanceObjectType.
- Returns
- true if successful.
References Murl::ObjectArray< DataType >::GetCount(), Murl::Logic::GraphInstanceObjects< InstanceObjectType >::GetInstance(), and Murl::Logic::GraphInstanceObjects< InstanceObjectType >::SetObtained().
◆ SetObtained()
|
inline |
Set the obtained status of an InstanceObjectType object.
A valid index is [0 .. GetNumberOfInstances() - 1].
- Parameters
-
index The zero-based index of the object. isObtained The obtained state.
References Murl::ObjectArray< DataType >::GetCount(), and Murl::Logic::GraphInstanceObjects< InstanceObjectType >::IsObtained().
Referenced by Murl::Logic::GraphInstanceObjects< InstanceObjectType >::Obtain(), and Murl::Logic::GraphInstanceObjects< InstanceObjectType >::Release().
◆ GetMaxObtained()
|
inline |
Get the highest obtained instance index.
This is an effective approach for iterating through all obtained instances.
- Returns
- The highest obtained instance index.
◆ GetNumberOfObtained()
|
inline |
Get the number of obtained instances.
- Returns
- The number of obtained instances.
◆ GetNumberOfRemaining()
|
inline |
Get the number of non-obtained instances.
- Returns
- The number of non-obtained instances.
References Murl::ObjectArray< DataType >::GetCount().
◆ GetNumberOfInstances()
|
inline |
Get the number of instances.
- Returns
- The number of instances.
References Murl::ObjectArray< DataType >::GetCount().
◆ GetInstance() [1/2]
|
inline |
Get the const InstanceObjectType object by index.
A valid index is [0 .. GetNumberOfInstances() - 1].
- Parameters
-
index The zero-based index of the object.
- Returns
- A const pointer to the InstanceObjectType object or null.
References Murl::ObjectArray< DataType >::GetCount().
Referenced by Murl::Logic::GraphInstanceObjects< InstanceObjectType >::Release().
◆ GetObtainedInstance() [1/2]
|
inline |
Get the const InstanceObjectType object by index if obtained.
A valid index is [0 .. GetNumberOfInstances() - 1].
- Parameters
-
index The zero-based index of the object.
- Returns
- A const pointer to the InstanceObjectType object or null if the object is not obtained.
References Murl::ObjectArray< DataType >::GetCount(), and Murl::Logic::GraphInstanceObjects< InstanceObjectType >::IsObtained().
◆ GetInstance() [2/2]
|
inline |
Get the InstanceObjectType object by index.
A valid index is [0 .. GetNumberOfInstances() - 1].
- Parameters
-
index The zero-based index of the object.
- Returns
- A pointer to the InstanceObjectType object or null.
References Murl::ObjectArray< DataType >::GetCount().
◆ GetObtainedInstance() [2/2]
|
inline |
Get the InstanceObjectType object by index if obtained.
A valid index is [0 .. GetNumberOfInstances() - 1].
- Parameters
-
index The zero-based index of the object.
- Returns
- A pointer to the InstanceObjectType object or null if the object is not obtained.
References Murl::ObjectArray< DataType >::GetCount(), and Murl::Logic::GraphInstanceObjects< InstanceObjectType >::IsObtained().
◆ IsObtained()
|
inline |
Check if a InstanceObjectType object is obtained.
A valid index is [0 .. GetNumberOfInstances() - 1].
- Parameters
-
index The zero-based index of the object.
- Returns
- true if obtained.
References Murl::ObjectArray< DataType >::GetCount().
Referenced by Murl::Logic::GraphInstanceObjects< InstanceObjectType >::GetObtainedInstance(), Murl::Logic::GraphInstanceObjects< InstanceObjectType >::Obtain(), Murl::Logic::GraphInstanceObjects< InstanceObjectType >::OnFinishTick(), Murl::Logic::GraphInstanceObjects< InstanceObjectType >::OnProcessTick(), Murl::Logic::GraphInstanceObjects< InstanceObjectType >::OnReset(), Murl::Logic::GraphInstanceObjects< InstanceObjectType >::OnSetEnabled(), and Murl::Logic::GraphInstanceObjects< InstanceObjectType >::SetObtained().
◆ OnSetEnabled()
|
inlineoverrideprotectedvirtual |
Overwrite of the BaseStepable::OnSetEnabled() method, calls SetEnabled() to all obtained InstanceObjectType objects.
- Parameters
-
isEnabled true if enabled.
Reimplemented from Murl::Logic::BaseStepable.
References Murl::Logic::GraphInstanceObjects< InstanceObjectType >::IsObtained(), and Murl::Logic::GraphNodeT< NodeType >::SetActive().
◆ OnProcessTick()
|
inlineoverrideprotectedvirtual |
Overwrite of the BaseStepable::OnProcessTick() method, calls ProcessTick() to all obtained InstanceObjectType objects.
- Parameters
-
state The IState object.
Reimplemented from Murl::Logic::BaseStepable.
References Murl::Logic::GraphInstanceObjects< InstanceObjectType >::IsObtained().
◆ OnFinishTick()
|
inlineoverrideprotectedvirtual |
Overwrite of the BaseStepable::OnFinishTick() method, calls FinishTick() to all obtained InstanceObjectType objects.
- Parameters
-
state The IState object.
Reimplemented from Murl::Logic::BaseStepable.
References Murl::Logic::GraphInstanceObjects< InstanceObjectType >::IsObtained().
The documentation for this class was generated from the following file:
- murl_logic_graph_instance_objects.h