12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace OpenSim.Framework
- {
- public class RegistryCore : IRegistryCore
- {
- protected Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
-
-
-
-
-
- public void RegisterInterface<T>(T iface)
- {
- lock (m_moduleInterfaces)
- {
- if (!m_moduleInterfaces.ContainsKey(typeof(T)))
- {
- m_moduleInterfaces.Add(typeof(T), iface);
- }
- }
- }
- public bool TryGet<T>(out T iface)
- {
- if (m_moduleInterfaces.ContainsKey(typeof(T)))
- {
- iface = (T)m_moduleInterfaces[typeof(T)];
- return true;
- }
- iface = default(T);
- return false;
- }
- public T Get<T>()
- {
- return (T)m_moduleInterfaces[typeof(T)];
- }
- public void StackModuleInterface<M>(M mod)
- {
- }
- public T[] RequestModuleInterfaces<T>()
- {
- return new T[] { default(T) };
- }
- }
- }
|