Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
SiliconStudio.Quantum.ModelContainer Class Reference

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< IModelNodeModels [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...
 

Detailed Description

A container used to store models and resolve references between them.

Definition at line 16 of file ModelContainer.cs.

Constructor & Destructor Documentation

SiliconStudio.Quantum.ModelContainer.ModelContainer ( bool  instantiateGuidContainer = true)

Create a new instance of ModelContainer.

Parameters
instantiateGuidContainerIndicate 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.

Parameters
guidContainerA IGuidContainer to use to ensure the unicity of guid associated to data objects. Cannot be null

Definition at line 37 of file ModelContainer.cs.

Member Function Documentation

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.

Parameters
rootObjectThe data object.
typeThetype of the data object.
Returns
The Guid associated to the given object if available, or Guid.Empty otherwise.

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.

Parameters
rootObjectThe data object.
Returns
The IModelNode associated to the given object if available, or 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.

Parameters
guidThe Guid.
Returns
The IModelNode associated to the given Guid if available, or 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.

Parameters
rootObjectThe data object.
typeThe type of the data object.
Returns
The IModelNode associated to the given object.

Definition at line 100 of file ModelContainer.cs.

bool SiliconStudio.Quantum.ModelContainer.RemoveModelNode ( Guid  guid)

Removes a model that was previously registered.

Parameters
guidThe guid of the model to remove.
Returns
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.

Parameters
nodeThe node to update

Definition at line 141 of file ModelContainer.cs.

Property Documentation

IEnumerable<Guid> SiliconStudio.Quantum.ModelContainer.Guids
get

Gets an enumerable of the registered models.

Definition at line 52 of file ModelContainer.cs.

IEnumerable<IModelNode> SiliconStudio.Quantum.ModelContainer.Models
get

Gets an enumerable of the registered models.

Definition at line 47 of file ModelContainer.cs.

INodeBuilder SiliconStudio.Quantum.ModelContainer.NodeBuilder
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.


The documentation for this class was generated from the following file: