-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGadgetChannel.cs
47 lines (42 loc) · 1.46 KB
/
GadgetChannel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
namespace Gadgetry.Channels;
/// <summary>
/// Static utilities for interacting with channels for a producer-consumer data model.
/// </summary>
public static class GadgetChannel
{
/// <summary>
/// Creates a new instance of the <see cref="GadgetChannel{TModel}"/> class with an associated identifier.
/// </summary>
/// <param name="identifier">An identifier for this <see cref="IGadgetChannel"/>.</param>
public static GadgetChannel<TModel> Create<TModel>(string identifier)
{
return new GadgetChannel<TModel>(identifier);
}
}
/// <summary>
/// Represents a hard-typed channel in a producer-consumer data model.
/// </summary>
public class GadgetChannel<TModel> : IGadgetChannel
{
/// <summary>
/// A collection of all <see cref="IGadgetChannelFeature"/> features associated with this <see cref="GadgetChannel{TModel}"/>.
/// </summary>
public IFeatureCollection<IGadgetChannelFeature> Features { get; } = new FeatureCollection<IGadgetChannelFeature>();
/// <summary>
/// An identifier for this <see cref="IGadgetChannel"/>.
/// </summary>
public string Identifier { get; }
/// <summary>
/// Creates a new instance of the <see cref="GadgetChannel{TModel}"/> class with an associated identifier.
/// </summary>
/// <param name="identifier">An identifier for this <see cref="IGadgetChannel"/>.</param>
internal GadgetChannel(string identifier)
{
Identifier = identifier;
}
/// <inheritdoc/>
public override string ToString()
{
return $"'{Identifier}'";
}
}