class ScriptAssemblyManager

Stores data about managed serializable objects in specified assemblies.

Public

Methods

LoadAssemblyInfo

void LoadAssemblyInfo(const String &assemblyName)

Loads all information about managed serializable objects in an assembly with the specified name.

Assembly must be currently loaded. Once the data has been loaded you will be able to call GetSerializableObjectInfo() and HasSerializableObjectInfo() to retrieve information about those objects. If an assembly already had data loaded it will be rebuilt.

assemblyName
Name of the assembly to load the information about.
typeMappings
Contains information about managed objects that wrap native objects.

ClearAssemblyInfo

void ClearAssemblyInfo()

Clears any assembly data previously loaded with loadAssemblyInfo().

GetSerializableObjectInfo

bool GetSerializableObjectInfo(const String &ns, const String &typeName, SPtr<ManagedObjectInfo> &outInfo)

Returns managed serializable object info for a specific managed type.

ns
Namespace of the type.
typeName
Name of the type.
outInfo
Output object containing information about the type if the type was found, unmodified otherwise.

Returns: True if the type was found, false otherwise.

GetSerializableObjectInfo

SPtr<ManagedObjectInfo> GetSerializableObjectInfo(MonoReflectionType *objectType)

Returns managed serializable object info for a specific managed type.

Object must be serializable for this information to be present.

GetTypeInfo

SPtr<ManagedTypeInfo> GetTypeInfo(MonoClass *monoClass)

Generates or retrieves a type info object for the specified managed class, if the class is serializable.

GetScriptWrapperMetaData

const ScriptTypeMetaData *GetScriptWrapperMetaData(u32 typeId) const

Returns script wrapper object meta-data for the type as specified by the provided RTTI type ID.

GetScriptWrapperMetaData

const ScriptTypeMetaData *GetScriptWrapperMetaData(::MonoReflectionType *type) const

Returns script wrapper object meta-data for the type as specified by the script type.

HasSerializableObjectInfo

bool HasSerializableObjectInfo(const String &ns, const String &typeName)

Checks if the managed serializable object info for the specified type exists.

ns
Namespace of the type.
typeName
Name of the type.

Returns: True if the object info was found, false otherwise.

GetScriptAssemblies

Vector<String> GetScriptAssemblies() const

Returns names of all assemblies that currently have managed serializable object data loaded.

GetBuiltinClasses

const BuiltinScriptClasses &GetBuiltinClasses() const

Returns type information for various built-in classes.

GetReflectableFromManagedObject

SPtr<IReflectable> GetReflectableFromManagedObject(MonoObject *value)

Converts a managed object into an IReflectable object.

The system first checks if the managed object is just a wrapper for a reflectable object already, and if so returns the wrapped reflectable object. Otherwise the managed object is serialized and the serialized version of the object is returned. The provided object cannot be an array, list, dictionary, component or a resource.

GetManagedObjectFromReflectable

MonoObject *GetManagedObjectFromReflectable(const SPtr<IReflectable> &object)

Converts a reflectable object into a managed object.

The system first checks if the IReflectable is just a serialized managed object, in which case the object is deserialized and returned. Otherwise the system assumes the reflectable type is script exportable and attempts to retrieve or the script object wrapper for the object.

staticInstance

static T &Instance()

Returns a reference to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticInstancePtr

static T *InstancePtr()

Returns a pointer to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticShutDown

static void ShutDown()

Shuts down this module and frees any resources it is using.

staticIsStarted

static bool IsStarted()

Query if the module has been started.

Protected

Methods

~Module<T>

virtual ~Module<T>() = default

OnStartUp

virtual void OnStartUp()

Override if you want your module to be notified once it has been constructed and started.

OnShutDown

virtual void OnShutDown()

Override if you want your module to be notified just before it is deleted.

staticInstanceInternal

static T *&InstanceInternal()

Returns a singleton instance of this module.

staticIsDestroyed

static bool &IsDestroyed()

Checks has the Module been shut down.

staticIsStartedUp

static bool &IsStartedUp()

Checks has the Module been started up.

Private

Methods

ClearScriptObjects

void ClearScriptObjects()

Deletes all stored managed serializable object infos for all assemblies.

InitializeBaseTypes

void InitializeBaseTypes()

Initializes the base managed types.

These are the types we expect must exist in loaded assemblies as they're used for various common operations.

InitializeScriptWrapperMetaDataLookup

void InitializeScriptWrapperMetaDataLookup(MonoAssembly &assembly)

Creates a lookup that allows you to find script object wrapper type based on RTTI type ID or script type.

Should be called after an assembly is loaded or reloaded.

Fields

mAssemblyInfos

UnorderedMap<String, SPtr<ManagedAssemblyInfo>> mAssemblyInfos

mScriptWrapperMetaDataByTypeId

UnorderedMap<u32, ScriptTypeMetaData *> mScriptWrapperMetaDataByTypeId

mScriptWrapperMetaDataByScriptClass

UnorderedMap< ::MonoReflectionType *, ScriptTypeMetaData *> mScriptWrapperMetaDataByScriptClass

mBaseTypesInitialized

bool mBaseTypesInitialized

mBuiltin