using KinectConnection.enums; using System; using System.Collections.Generic; namespace KinectConnection { /// /// The kinect streams factory. /// public class KinectStreamsFactory { /// /// The stream factory dictionary. /// Maps a KinectStream to a function that creates the proper stream. /// private Dictionary> streamFactory; public KinectStreamsFactory(KinectManager kinect) { streamFactory = new Dictionary> { { KinectStreams.Color, () => new ColorImageStream() }, // Other streams ... }; } /// /// Indexer to get a KinectStream from the factory. /// This allows to create a stream from a KinectStreams enum. /// /// The kinect stream. /// The kinect stream instance. public KinectStream this[KinectStreams stream] { get { return streamFactory[stream](); } } } }