Added IDataReceiverSink and refactored to separate the EventSink from the GarbageData...
[lwes-dotnet/github-mirror.git] / Org.Lwes / Emitter / IEventEmitter.cs
blob9de907534e6fee13867bab9b6b886b127989d13e
1 //
2 // This file is part of the LWES .NET Binding (LWES.net)
3 //
4 // COPYRIGHT© 2009, Phillip Clark (phillip[at*flitbit[dot*org)
5 // original .NET implementation
6 //
7 // LWES.net is free software: you can redistribute it and/or modify
8 // it under the terms of the Lesser GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
12 // LWES.net is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // Lesser GNU General Public License for more details.
17 // You should have received a copy of the Lesser GNU General Public License
18 // along with LWES.net. If not, see <http://www.gnu.org/licenses/>.
20 namespace Org.Lwes.Emitter
22 using System;
23 using System.Net;
24 using System.Text;
26 using Org.Lwes.DB;
28 /// <summary>
29 /// Interface for classes that emit Events into the light-weight event system.
30 /// </summary>
31 /// <remarks>
32 /// This interface makes the use of the IDisposable pattern explicit; implementations
33 /// must guarantee that cleanup occured before returning from Dispose.
34 /// </remarks>
35 public interface IEventEmitter : IDisposable
37 /// <summary>
38 /// The ip address to which events are emitted.
39 /// </summary>
40 /// <exception cref="System.InvalidOperationException">thrown if the emitter has already been initialized</exception>
41 IPAddress Address
43 get; set;
46 /// <summary>
47 /// The character encoding used when performing event IO.
48 /// </summary>
49 /// <exception cref="System.InvalidOperationException">thrown if the emitter has already been initialized</exception>
50 SupportedEncoding Encoding
52 get;
53 set;
56 /// <summary>
57 /// Indicates whether the emitter has been initialized.
58 /// </summary>
59 bool IsInitialized
61 get;
64 /// <summary>
65 /// The ip port to which events are emitted.
66 /// </summary>
67 /// <exception cref="System.InvalidOperationException">thrown if the emitter has already been initialized</exception>
68 int Port
70 get; set;
73 /// <summary>
74 /// The event template database used by the emitter.
75 /// </summary>
76 /// <exception cref="System.InvalidOperationException">thrown if the emitter has already been initialized</exception>
77 IEventTemplateDB TemplateDB
79 get;
80 set;
83 /// <summary>
84 /// Indicates whether events issued from the emitter will validate
85 /// event contents.
86 /// </summary>
87 /// <exception cref="System.InvalidOperationException">thrown if the emitter has already been initialized</exception>
88 bool Validate
90 get;
91 set;
94 /// <summary>
95 /// Creates an event type identified by the event name.
96 /// </summary>
97 /// <param name="eventName">the event type's name</param>
98 /// <returns>a new LWES event instance</returns>
99 /// <exception cref="System.InvalidOperationException">thrown if the emitter has not been initialized</exception>
100 Event CreateEvent(string eventName);
102 /// <summary>
103 /// Creates an event type identified by the event name.
104 /// </summary>
105 /// <param name="eventName">the event type's name</param>
106 /// <param name="enc">encoding used when performing IO on the event</param>
107 /// <returns>a new LWES event instance</returns>
108 /// <exception cref="System.InvalidOperationException">thrown if the emitter has not been initialized</exception>
109 Event CreateEvent(string eventName, SupportedEncoding enc);
111 /// <summary>
112 /// Creates an event type identified by the event name.
113 /// </summary>
114 /// <param name="eventName">the event type's name</param>
115 /// <param name="validate">whether the event is validated</param>
116 /// <returns>a new LWES event instance</returns>
117 /// <exception cref="System.InvalidOperationException">thrown if the emitter has not been initialized</exception>
118 Event CreateEvent(string eventName, bool validate);
120 /// <summary>
121 /// Creates an event type identified by the event name.
122 /// </summary>
123 /// <param name="eventName">the event type's name</param>
124 /// <param name="validate">whether the event is validated</param>
125 /// <param name="enc">encoding used when performing IO on the event</param>
126 /// <returns>a new LWES event instance</returns>
127 /// <exception cref="System.InvalidOperationException">thrown if the emitter has not been initialized</exception>
128 Event CreateEvent(string eventName, bool validate, SupportedEncoding enc);
130 /// <summary>
131 /// Emits an event to the event system.
132 /// </summary>
133 /// <param name="evt">the event being emitted</param>
134 /// <exception cref="System.InvalidOperationException">thrown if the emitter has not been initialized</exception>
135 void Emit(Event evt);
137 /// <summary>
138 /// Initializes the emitter.
139 /// </summary>
140 void Initialize();