summaryrefslogtreecommitdiff
path: root/TAO/CIAO/DAnCE/ciao/CIAO_DirectEvent.h
blob: 8df768b7e244893a8e16e2a030a966c7683f5bd1 (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
// -*- C++ -*-

//=============================================================================
/**
 *  @file CIAO_DirectEvent.h
 *
 *  $Id$
 *
 *  @author George Edwards <g.edwards@vanderbilt.edu>
 */
//=============================================================================

#ifndef CIAO_DIRECTEVENT_H
#define CIAO_DIRECTEVENT_H
#include /**/ "ace/pre.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "CIAO_EventServiceBase.h"
#include "CIAO_DirectEventS.h"

#include "ace/Array.h"

namespace CIAO
{

  /**
   * @class DirectEventService
   *
   * An implementation of EventServiceBase using direct communication.
   */
  class DirectEventService :
    public virtual EventServiceBase
  {

  public:

    DirectEventService (CORBA::ORB_ptr orb,
                        PortableServer::POA_ptr poa);

    virtual void connect_event_supplier (
        CIAO::Supplier_Config_ptr supplier_config
        ACE_ENV_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((
        CORBA::SystemException));

    virtual void connect_event_consumer (
        CIAO::Consumer_Config_ptr consumer_config
        ACE_ENV_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((
        CORBA::SystemException));

    virtual void disconnect_event_consumer (
        const char * connection_id
        ACE_ENV_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((
        CORBA::SystemException,
        Components::InvalidName,
        Components::InvalidConnection));

    virtual void disconnect_event_supplier (
        ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((
        CORBA::SystemException,
        Components::InvalidName,
        Components::InvalidConnection));

    virtual void push_event (
        Components::EventBase * ev
        ACE_ENV_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((
        CORBA::SystemException));

  private:

    // Reference to the ORB
    CORBA::ORB_var orb_;

    // Reference to the Root POA
    PortableServer::POA_var root_poa_;

    /**
     * @var ACE_Array<Components::EventConsumerBase_ptr> consumer_array_
     *
     * List of consumers.
     */
    /// @@ George, this is cool! Do you want to use a _var or _ptr?
    ACE_Array<Components::EventConsumerBase_var> consumer_array_;

  };


  /**
   * @class Direct_Consumer_Config_impl
   *
   * Implementation of the Direct_Consumer_Config IDL interface that
   * configures TAO's direct event mechanism. An object of this type will be
   * returned from @c CIAO::Container::create_consumer_config () when @c DIRECT
   * is specified as the event service type.
   */
  class Direct_Consumer_Config_impl :
    public virtual POA_CIAO::Direct_Consumer_Config,
    public virtual PortableServer::RefCountServantBase
  {

  public:

    Direct_Consumer_Config_impl (PortableServer::POA_ptr poa);

    virtual ~Direct_Consumer_Config_impl (void);

    virtual void consumer_id (const char * consumer_id
                              ACE_ENV_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException));

    virtual CONNECTION_ID consumer_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException));

    virtual void supplier_id (const char * supplier_id
                              ACE_ENV_ARG_DECL)
      ACE_THROW_SPEC ((CORBA::SystemException));

    virtual CONNECTION_ID supplier_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException));

    virtual void consumer (Components::EventConsumerBase_ptr consumer ACE_ENV_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException));

    virtual Components::EventConsumerBase_ptr consumer (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException));

    // @@ george, probably this should be const'ified?
    virtual EventServiceType service_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException));

    virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException));

  private:

    ACE_CString consumer_id_;

    ACE_CString supplier_id_;

    Components::EventConsumerBase_var consumer_;

    EventServiceType service_type_;

    PortableServer::POA_var poa_;

  };

  /**
   * @class Direct_Supplier_Config_impl
   *
   * Implementation of the Direct_Supplier_Config IDL interface that
   * configures TAO's direct event mechanism. An object of this type will be
   * returned from @c CIAO::Container::create_supplier_config () when @c DIRECT
   * is specified as the event service type.
   */
  class Direct_Supplier_Config_impl :
    public virtual POA_CIAO::Direct_Supplier_Config,
    public virtual PortableServer::RefCountServantBase
  {

  public:

    Direct_Supplier_Config_impl (PortableServer::POA_ptr poa);

    virtual ~Direct_Supplier_Config_impl (void);

    void supplier_id (const char * supplier_id ACE_ENV_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException));

    char * supplier_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException));

    EventServiceType service_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException));

    virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException));

  private:

    ACE_CString supplier_id_;

    EventServiceType service_type_;

    PortableServer::POA_var poa_;

  };

}

#include /**/ "ace/post.h"
#endif /* CIAO_DIRECTEVENT_H */