/**************************************************************************** * Copyright 2019 Nreal Techonology Limited. All rights reserved. * * This file is part of NRSDK. * * https://www.nreal.ai/ * *****************************************************************************/ namespace NRKernal { using System.Collections.Generic; /// A camera proxy factory. public class CameraProxyFactory { /// Dictionary of camera controllers. private static Dictionary m_CameraControllerDict = new Dictionary(); /// Creates RGB camera proxy. /// The new RGB camera proxy. public static NativeCameraProxy CreateRGBCameraProxy() { NativeCameraProxy controller; if (!m_CameraControllerDict.TryGetValue(NRRgbCamera.ID, out controller)) { controller = new NRRgbCamera(); m_CameraControllerDict.Add(NRRgbCamera.ID, controller); } return controller; } /// Gets an instance. /// The identifier. /// The instance. public static NativeCameraProxy GetInstance(string id) { if (!m_CameraControllerDict.ContainsKey(id)) { return null; } return m_CameraControllerDict[id]; } /// Regist camera proxy. /// The identifier. /// The proxy. public static void RegistCameraProxy(string id, NativeCameraProxy proxy) { m_CameraControllerDict[id] = proxy; } } }