![]() |
Paradox Game Engine
v1.0.0 beta06
|
A container used to store models and resolve references between them. More...
Public Member Functions | |
ModelContainer (bool instantiateGuidContainer=true) | |
Create a new instance of ModelContainer. More... | |
ModelContainer (IGuidContainer guidContainer) | |
Create a new instance of ModelContainer. This constructor allows to provide a IGuidContainer, in order to share object Guid between different ModelContainer. More... | |
IModelNode | GetModelNode (object rootObject) |
Gets the model associated to a data object, if it exists. If the ModelContainer has been constructed without IGuidContainer, this method will throw an exception. More... | |
IModelNode | GetModelNode (Guid guid) |
Gets the model associated to the given Guid, if it exists. More... | |
Guid | GetGuid (object rootObject, Type type) |
Gets the Guid associated to a data object, if it exists. If the ModelContainer has been constructed without IGuidContainer, this method will throw an exception. More... | |
IModelNode | GetOrCreateModelNode (object rootObject, Type type) |
Gets the model associated to a data object, if it exists, or create a new model for the object otherwise. More... | |
bool | RemoveModelNode (Guid guid) |
Removes a model that was previously registered. More... | |
void | Clear () |
Removes all models that were previously registered. More... | |
void | UpdateReferences (IModelNode node) |
Refresh all references contained in the given node, creating new models for newly referenced objects. More... | |
int | CollectGarbage (IEnumerable< object > objectsToKeep) |
Properties | |
IEnumerable< IModelNode > | Models [get] |
Gets an enumerable of the registered models. More... | |
IEnumerable< Guid > | Guids [get] |
Gets an enumerable of the registered models. More... | |
INodeBuilder | NodeBuilder [get, set] |
Gets or set the visitor to use to create models. Default value is a DefaultModelBuilder constructed with default parameters. More... | |
A container used to store models and resolve references between them.
Definition at line 16 of file ModelContainer.cs.
SiliconStudio.Quantum.ModelContainer.ModelContainer | ( | bool | instantiateGuidContainer = true | ) |
Create a new instance of ModelContainer.
instantiateGuidContainer | Indicate whether to create a GuidContainer to store Guid per data object. This can be useful to retrieve an existing model from a data object. |
Definition at line 25 of file ModelContainer.cs.
SiliconStudio.Quantum.ModelContainer.ModelContainer | ( | IGuidContainer | guidContainer | ) |
Create a new instance of ModelContainer. This constructor allows to provide a IGuidContainer, in order to share object Guid between different ModelContainer.
guidContainer | A IGuidContainer to use to ensure the unicity of guid associated to data objects. Cannot be null |
Definition at line 37 of file ModelContainer.cs.
void SiliconStudio.Quantum.ModelContainer.Clear | ( | ) |
Removes all models that were previously registered.
Definition at line 128 of file ModelContainer.cs.
int SiliconStudio.Quantum.ModelContainer.CollectGarbage | ( | IEnumerable< object > | objectsToKeep | ) |
Definition at line 146 of file ModelContainer.cs.
Guid SiliconStudio.Quantum.ModelContainer.GetGuid | ( | object | rootObject, |
Type | type | ||
) |
Gets the Guid associated to a data object, if it exists. If the ModelContainer has been constructed without IGuidContainer, this method will throw an exception.
rootObject | The data object. |
type | Thetype of the data object. |
Definition at line 88 of file ModelContainer.cs.
IModelNode SiliconStudio.Quantum.ModelContainer.GetModelNode | ( | object | rootObject | ) |
Gets the model associated to a data object, if it exists. If the ModelContainer has been constructed without IGuidContainer, this method will throw an exception.
rootObject | The data object. |
null
otherwise.Definition at line 64 of file ModelContainer.cs.
IModelNode SiliconStudio.Quantum.ModelContainer.GetModelNode | ( | Guid | guid | ) |
Gets the model associated to the given Guid, if it exists.
guid | The Guid. |
null
otherwise.Definition at line 76 of file ModelContainer.cs.
IModelNode SiliconStudio.Quantum.ModelContainer.GetOrCreateModelNode | ( | object | rootObject, |
Type | type | ||
) |
Gets the model associated to a data object, if it exists, or create a new model for the object otherwise.
rootObject | The data object. |
type | The type of the data object. |
Definition at line 100 of file ModelContainer.cs.
bool SiliconStudio.Quantum.ModelContainer.RemoveModelNode | ( | Guid | guid | ) |
Removes a model that was previously registered.
guid | The guid of the model to remove. |
true
if a model has been actually removed, false
otherwise.Definition at line 116 of file ModelContainer.cs.
void SiliconStudio.Quantum.ModelContainer.UpdateReferences | ( | IModelNode | node | ) |
Refresh all references contained in the given node, creating new models for newly referenced objects.
node | The node to update |
Definition at line 141 of file ModelContainer.cs.
|
get |
Gets an enumerable of the registered models.
Definition at line 52 of file ModelContainer.cs.
|
get |
Gets an enumerable of the registered models.
Definition at line 47 of file ModelContainer.cs.
|
getset |
Gets or set the visitor to use to create models. Default value is a DefaultModelBuilder constructed with default parameters.
Definition at line 57 of file ModelContainer.cs.