summaryrefslogtreecommitdiff
path: root/TAO/examples/Event_Comm/Event_Comm.idl
blob: 92b24036dd6a7c442fcd34d39f95c49dc15010b2 (plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/* -*- C++ -*- */

//=============================================================================
/**
 *  @file    Event_Comm.idl
 *
 *  The CORBA IDL module for distributed event notification.
 *
 *
 *  @author Douglas C. Schmidt (d.schmidt@vanderbilt.edu) and Pradeep Gore (pradeep@cs.wustl.edu)
 */
//=============================================================================


#if !defined (_EVENT_COMM_IDL)
#define _EVENT_COMM_IDL

module Event_Comm
{
  // = TITLE
  //   The CORBA IDL module for distributed event notification.

  struct Event
  {
    // = TITLE
    //   Defines the interface for an event <Event>.
    //
    // = DESCRIPTION
    //   This is the type passed by the Notifier to the Consumer.
    //   Since it contains an <any>, it can hold any type.  Naturally,
    //   the consumer must understand how to interpret this!

    string tag_;
    // Tag for the event.  This is used by the <Notifier> to compare
    // with the <Consumer>s' filtering criteria.

    any value_;
    // An event can contain anything.

    Object object_ref_;
    // Object reference for callbacks.
  };

  interface Consumer
  {
    // = TITLE
    //   Defines the interface for a <Consumer> of events.

    void push (in Event event_instance);
    // Inform the <Consumer> that <event> has occurred.

    void disconnect (in string reason);
    // Disconnect the <Consumer> from the <Notifier>,
    // giving it the <reason>.
  };

  interface Notifier
  {
    // = TITLE
    //   Defines the interface for a <Notifier> of events.

    exception CannotSubscribe
    {
      // = TITLE
      //   This exception in thrown when a <subscribe> fails.

      string reason_;
    };

    exception CannotUnsubscribe
    {
      // = TITLE
      //   This exception in thrown when a <unsubscribe> fails.

      string reason_;
    };

    // = The following operations are intended for Suppliers.

    void disconnect (in string reason);
    // Disconnect all the receivers, giving them the <reason>.

    void push (in Event event_instance);
    // Send the <event> to all the consumers who have subscribed and
    // who match the filtering criteria.

    // = The following operations are intended for Consumers.

    void subscribe (in Consumer subscriber,
                    in string filtering_criteria) raises (CannotSubscribe);
    // Subscribe the <Consumer> to receive events that match the
    // regular expresssion <filtering_criteria> applied by the
    // <Notifier>.  If <filtering_criteria> is "" then all events are
    // matched.

    void unsubscribe (in Consumer unsubscriber,
                      in string filtering_criteria) raises (CannotUnsubscribe);
    // Unsubscribe the <Consumer> that matches the filtering criteria.
    // If <filtering_criteria> is "" then all <Consumers> with the
    // matching object reference are removed.
  };
};

#endif /* _EVENT_COMM_IDL */