DataDirector API
DDD_EventPublisher.h
Go to the documentation of this file.
1 /*! \file DDD_EventPublisher.h
2  \brief The DDD_EventPublisher class.
3 
4  \par Copyright Information
5 
6  Copyright (c) 2012 The DiSTI Corporation.<br>
7  11301 Corporate Blvd; Suite 100<br>
8  Orlando, Florida 32817<br>
9  USA<br>
10  <br>
11  All rights reserved.<br>
12 
13  This Software contains proprietary trade secrets of DiSTI and may not be
14 reproduced, in whole or part, in any form, or by any means of electronic,
15 mechanical, or otherwise, without the written permission of DiSTI. Said
16 permission may be derived through the purchase of applicable DiSTI product
17 licenses which detail the distribution rights of this content and any
18 Derivative Works based on this or other copyrighted DiSTI Software.
19 
20  NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26 
27  LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBLITY
33 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34 EXCEED FIVE DOLLARS (US$5.00).
35 
36  The aforementioned terms and restrictions are governed by the laws of the
37 State of Florida and the United States of America.
38 
39 */
40 
41 #ifndef _DDD_EVENT_PUBLISHER_H_
42 #define _DDD_EVENT_PUBLISHER_H_
43 
44 #include "DDD_Include.h"
45 #include "DDD_EventSubscriber.h"
46 #include "dynamic_ptr_array.h"
47 
48 
49 namespace disti
50 {
51 
52 /** \brief The DDD_EventPublisher class. Central class for publishing events. Contains all logic for registering subscribers,
53  unregistering event subscribers, dispatching events, and notifying even subscribers.
54  * \ingroup GroupEvents
55  */
56 class DDD_EXPORT DDD_EventPublisher
57 {
58  ///////////////////////////////////////////////////////////////////////////////////////
59  // AssetAdded Event
60  ///////////////////////////////////////////////////////////////////////////////////////
61 public:
63 
64  /* Register the provided object as an observer to the
65  * AssetAdded event
66  * \param subscriber Object to add as an observer
67  */
68  void Register(DDD_AssetAdded_Subscriber* subscriber);
69 
70  /* Unregister the provided object from the
71  * AssetAdded event
72  * \param subscriber Object to remove from the observer list
73  */
74  void Unregister(DDD_AssetAdded_Subscriber* subscriber);
75 
76  /* Helper function used to notify all observers that the
77  * AssetAdded event just happened
78  * \param asset Newly added asset
79  */
80  virtual void Dispatch_AssetAdded(DDD_AssetBase *asset);
81 protected:
82  AssetAddedSubscriberList _assetAddedSubscribers;
83  ///////////////////////////////////////////////////////////////////////////////////////
84 
85 
86  ///////////////////////////////////////////////////////////////////////////////////////
87  // ConnectionAdded Event
88  ///////////////////////////////////////////////////////////////////////////////////////
89 public:
91 
92  /* Register the provided object as an observer to the
93  * ConnectionAdded event
94  * \param subscriber Object to add as an observer
95  */
96  void Register(DDD_ConnectionAdded_Subscriber* subscriber);
97 
98  /* Unregister the provided object from the
99  * ConnectionAdded event
100  * \param subscriber Object to remove from the observer list
101  */
102  void Unregister(DDD_ConnectionAdded_Subscriber* subscriber);
103 
104  /* Helper function used to notify all observer that the
105  * ConnectionAdded event just happened
106  * \param connection Newly added connection
107  */
108  virtual void Dispatch_ConnectionAdded(DDD_Connection *connection);
109 protected:
110  ConnectionAddedSubscriberList _connectionAddedSubscribers;
111  ///////////////////////////////////////////////////////////////////////////////////////
112 
113 
114  ///////////////////////////////////////////////////////////////////////////////////////
115  // ConnectionDeleted Event
116  ///////////////////////////////////////////////////////////////////////////////////////
117 public:
119 
120  /* Register the provided object as an observer to the
121  * ConnectionDeleted event
122  * \param subscriber Object to add as an observer
123  */
124  void Register(DDD_ConnectionDeleted_Subscriber* subscriber);
125 
126  /* Unregister the provided object from the
127  * ConnectionDeleted event
128  * \param subscriber Object to remove from the observer list
129  */
130  void Unregister(DDD_ConnectionDeleted_Subscriber* subscriber);
131 
132  /* Helper function used to notify all observer that the
133  * ConnectionDeleted event just happened
134  * \param connection Newly added connection
135  */
136  virtual void Dispatch_ConnectionDeleted(DDD_Connection *connection);
137 protected:
138  ConnectionDeletedSubscriberList _connectionDeletedSubscribers;
139  ///////////////////////////////////////////////////////////////////////////////////////
140 
141 
142  ///////////////////////////////////////////////////////////////////////////////////////
143  // ConnectionSelected Event
144  ///////////////////////////////////////////////////////////////////////////////////////
145 public:
147 
148  /* Register the provided object as an observer to the
149  * ConverterSelected event
150  * \param subscriber Object to add as an observer
151  */
152  void Register(DDD_ConnectionSelected_Subscriber* subscriber);
153 
154  /* Unregister the provided object from the
155  * ConverterSelected event
156  * \param subscriber Object to remove from the observer list
157  */
158  void Unregister(DDD_ConnectionSelected_Subscriber* subscriber);
159 
160  /* Helper function used to notify all observers that the
161  * ConverterSelected event just happened
162  * \param converter Newly selected converter
163  */
164  virtual void Dispatch_ConnectionSelected(DDD_Connection *connection);
165 protected:
166  ConnectionSelectedSubscriberList _connectionSelectedSubscribers;
167  ///////////////////////////////////////////////////////////////////////////////////////
168 
169 
170  ///////////////////////////////////////////////////////////////////////////////////////
171  // AssetSelected Event
172  ///////////////////////////////////////////////////////////////////////////////////////
173 public:
175 
176  /* Register the provided object as an observer to the
177  * AssetSelected event
178  * \param subscriber Object to add as an observer
179  */
180  void Register(DDD_AssetSelected_Subscriber* subscriber);
181 
182  /* Unregister the provided object from the
183  * AssetSelected event
184  * \param subscriber Object to remove from the observer list
185  */
186  void Unregister(DDD_AssetSelected_Subscriber* subscriber);
187 
188  /* Helper function used to notify all observers that the
189  * AssetSelected event just happened
190  * \param asset Newly selected asset
191  */
192  virtual void Dispatch_AssetSelected(DDD_AssetBase *asset);
193 protected:
194  AssetSelectedSubscriberList _assetSelectedSubscribers;
195  ///////////////////////////////////////////////////////////////////////////////////////
196 
197  ///////////////////////////////////////////////////////////////////////////////////////
198  // AssetStarted Event
199  ///////////////////////////////////////////////////////////////////////////////////////
200 public:
202 
203  /* Register the provided object as an observer to the
204  * AssetStarted event
205  * \param subscriber Object to add as an observer
206  */
207  void Register(DDD_AssetStarted_Subscriber* subscriber);
208 
209  /* Unregister the provided object from the
210  * AssetStarted event
211  * \param subscriber Object to remove from the observer list
212  */
213  void Unregister(DDD_AssetStarted_Subscriber* subscriber);
214 
215  /* Helper function used to notify all observers that the
216  * AssetStarted event just happened
217  * \param start true = started; false = stopped
218  * \param asset pointer to asset that is to be started or stopped.
219  * NULL implies that multiple assets have been affected.
220  */
221  virtual void Dispatch_AssetStarted(bool started, DDD_AssetBase *asset);
222 protected:
223  AssetStartedSubscriberList _assetStartedSubscribers;
224  ///////////////////////////////////////////////////////////////////////////////////////
225 
226 
227 
228  ///////////////////////////////////////////////////////////////////////////////////////
229  // AssetDeleted Event
230  ///////////////////////////////////////////////////////////////////////////////////////
231 public:
233 
234  /* Register the provided object as an observer to the
235  * AssetDeleted event
236  * \param subscriber Object to add as an observer
237  */
238  void Register(DDD_AssetDeleted_Subscriber* subscriber);
239 
240  /* Unregister the provided object from the
241  * AssetDeleted event
242  * \param subscriber Object to remove from the observer list
243  */
244  void Unregister(DDD_AssetDeleted_Subscriber* subscriber);
245 
246  /* Helper function used to notfy all observers that the
247  * AssetDeleted event just happened
248  * \param asset Newly deleted asset
249  */
250  virtual void Dispatch_AssetDeleted(DDD_AssetBase *asset);
251 
252 protected:
253  AssetDeletedSubscriberList _assetDeletedSubscribers;
254  ///////////////////////////////////////////////////////////////////////////////////////
255 
256  ///////////////////////////////////////////////////////////////////////////////////////
257  // XMLConfigLoading Event
258  ///////////////////////////////////////////////////////////////////////////////////////
259 public:
260 
262 
263  /* Register the provided object as an observer to the
264  * XMLConfigLoading event
265  * \param subscriber Object to add as an observer
266  */
267  void Register(DDD_XMLConfigLoading_Subscriber* subscriber);
268 
269  /* Unregister the provided object from the
270  * XMLConfigLoading event
271  * \param subscriber Object to remove from the observer list
272  */
273  void Unregister(DDD_XMLConfigLoading_Subscriber* subscriber);
274 
275  /* Helper function used to notify all observeres that the
276  * XMLConfigLoading event just happened
277  * \param currentlyLoading True if loading just started and False if it just finished
278  */
279  virtual void Dispatch_XMLConfigLoading(bool currentlyLoading);
280 protected:
281  XMLConfigLoadingSubscriberList _xmlConfigLoadingSubscribers;
282  ///////////////////////////////////////////////////////////////////////////////////////
283 
284 
285  ///////////////////////////////////////////////////////////////////////////////////////
286  // ViewerRunning Event
287  ///////////////////////////////////////////////////////////////////////////////////////
288 public:
290 
291  /* Register the provided object as an observer to the
292  * ViewerRunning event
293  * \param subscriber Object to add as an observer
294  */
295  void Register(DDD_ViewerRunning_Subscriber* subscriber);
296 
297  /* Unregister the provided object from the
298  * ViewerRunning event
299  * \param subscriber Object to remove from the observer list
300  */
301  void Unregister(DDD_ViewerRunning_Subscriber* subscriber);
302 
303  /* Helper function used to notify all observers that the
304  * ViewerRunning event just happend
305  * \param running True if the viewr just started and False if it just stopped
306  */
307  virtual void Dispatch_ViewerRunning(bool running);
308 protected:
309  ViewerRunningSubscriberList _viewerRunningSubscribers;
310  ///////////////////////////////////////////////////////////////////////////////////////
311 
312 
313  ///////////////////////////////////////////////////////////////////////////////////////
314  // ConfigurationCleared Event
315  ///////////////////////////////////////////////////////////////////////////////////////
316 public:
318 
319  /* Register the provided object as an observer to the
320  * ConfigurationCleared event
321  * \param subscriber Object to add as an observer
322  */
323  void Register(DDD_ConfigurationCleared_Subscriber* subscriber);
324 
325  /* Unregister the provided object from the
326  * ConfigurationCleared event
327  * \param subscriber Object to remove from the observer list
328  */
329  void Unregister(DDD_ConfigurationCleared_Subscriber* subscriber);
330 
331  /* Helper function used to notif all observers that the
332  * ConfigurationCleared just happend
333  */
334  virtual void Dispatch_ConfigurationCleared(void);
335 protected:
336  ConfigurationClearedSubscriberList _configurationClearedSubscribers;
337  ///////////////////////////////////////////////////////////////////////////////////////
338 
339  ///////////////////////////////////////////////////////////////////////////////////////
340  // AssetShifted Event
341  ///////////////////////////////////////////////////////////////////////////////////////
342 public:
344 
345  /* Register the provided object as an observer to the
346  * AssetShifted event
347  * \param subscriber Object to add as an observer
348  */
349  void Register(DDD_AssetShifted_Subscriber* subscriber);
350 
351  /* Unregister the provided object from the
352  * AssetShifted event
353  * \param subscriber Object to remove from the observer list
354  */
355  void Unregister(DDD_AssetShifted_Subscriber* subscriber);
356 
357  /* Helper function used to notfy all observers that the
358  * AssetShifted event just happened
359  * \param asset pointer to asset that is to be shifted
360  * \param direction enum denoting asset's direction for shift.
361  */
362  virtual void Dispatch_AssetShifted(DDD_AssetBase *asset, DDD_AssetShifted_Subscriber::AssetShiftDirection direction);
363 
364 protected:
365  AssetShiftedSubscriberList _assetShiftedSubscribers;
366  ///////////////////////////////////////////////////////////////////////////////////////
367 
368  ///////////////////////////////////////////////////////////////////////////////////////
369  // ConnectionShifted Event
370  ///////////////////////////////////////////////////////////////////////////////////////
371 public:
373 
374  /* Register the provided object as an observer to the
375  * ConnectionShifted event
376  * \param subscriber Object to add as an observer
377  */
378  void Register(DDD_ConnectionShifted_Subscriber* subscriber);
379 
380  /* Unregister the provided object from the
381  * ConnectionShifted event
382  * \param subscriber Object to remove from the observer list
383  */
384  void Unregister(DDD_ConnectionShifted_Subscriber* subscriber);
385 
386  /* Helper function used to notfy all observers that the
387  * ConnectionShifted event just happened
388  * \param connection pointer to asset that is to be shifted
389  * \param direction enum denoting asset's direction for shift.
390  */
391  virtual void Dispatch_ConnectionShifted(DDD_Connection *connection, DDD_ConnectionShifted_Subscriber::ConnectionShiftDirection direction);
392 
393 protected:
394  ConnectionShiftedSubscriberList _connectionShiftedSubscribers;
395  ///////////////////////////////////////////////////////////////////////////////////////
396 
397 
398 
399 };
400 
401 }
402 
403 
404 #endif
405 
Abstract base class for subscribers of the AssetSelected event.
Definition: DDD_EventSubscriber.h:125
Abstract base class for subscribers of the AssetShifted event.
Definition: DDD_EventSubscriber.h:139
Abstract base class for subscribers of the ConfigurationCleared event.
Definition: DDD_EventSubscriber.h:173
Abstract base class for subscribers of the AssetStarted event.
Definition: DDD_EventSubscriber.h:158
A virtual interface class for all DataDirector assets.
Definition: DDD_AssetBase.h:115
Abstract base class for subscribers of the ConnectionSelected event.
Definition: DDD_EventSubscriber.h:214
Abstract base class for subscribers of the ConnectionDeleted event.
Definition: DDD_EventSubscriber.h:200
Abstract base classes for DataDirector event subscribers.
AssetShiftDirection
Definition: DDD_EventSubscriber.h:142
Abstract base class for subscribers of the AssetAdded event.
Definition: DDD_EventSubscriber.h:97
Abstract base class for subscribers of the XMLConfigLoading event.
Definition: DDD_EventSubscriber.h:260
ConnectionShiftDirection
Definition: DDD_EventSubscriber.h:231
Abstract base class for subscribers of the ConnectionShifted event.
Definition: DDD_EventSubscriber.h:228
The DDD_Connection class. Base class for connections between assets.
Definition: DDD_Connection.h:54
Abstract base class for subscribers of the ViewerRunning event.
Definition: DDD_EventSubscriber.h:247
Abstract base class for subscribers of the AssetDeleted event.
Definition: DDD_EventSubscriber.h:111
The DDD_EventPublisher class. Central class for publishing events. Contains all logic for registering...
Definition: DDD_EventPublisher.h:56
The disti::DynamicPtrArray class. A templated array of objects pointers capable of dynamically growin...
Abstract base class for subscribers of the ConnectionAdded event.
Definition: DDD_EventSubscriber.h:187
Definition: AttributeChangedEmitter.h:46