summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/AV/Endpoint_Strategy_T.h
blob: 72310f7e91e7259cd6668f64f49ef91002adab1b (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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
/* -*- C++ -*- */

// $Id$

// ============================================================================
//
// = LIBRARY
//   ORBSVCS AVStreams
//
// = FILENAME
//   Endpoint_Strategy_T.h
//
// = AUTHOR
//    Sumedh Mungee <sumedh@cs.wustl.edu>
//    Nagarajan Surendran <naga@cs.wustl.edu>
//
//
// ============================================================================


#ifndef TAO_AV_ENDPOINT_STRATEGY_T_H
#define TAO_AV_ENDPOINT_STRATEGY_T_H
#include "ace/pre.h"

#include "Endpoint_Strategy.h"

template <class T_StreamEndpoint, class T_VDev , class T_MediaCtrl>
class TAO_AV_Export TAO_AV_Endpoint_Reactive_Strategy
: public TAO_AV_Endpoint_Strategy
{
  // = DESCRIPTION
  //    Reactive strategy base class

protected:
  // Constructor

  TAO_AV_Endpoint_Reactive_Strategy (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
  // Constructor

  virtual ~TAO_AV_Endpoint_Reactive_Strategy (void);
  // Destructor.

  virtual int activate (void);
  // creates and activates the streamendpoint, vdev, and mediacontrol

  virtual int activate_stream_endpoint (CORBA::Environment &env) = 0;
  // activates the stream_endpoint with the POA

  virtual int activate_vdev (CORBA::Environment &env);
  // activates the vdev with the POA



  virtual int activate_mediactrl (CORBA::Environment &env);
  // activates the media controller with the POA

  virtual int make_vdev (T_VDev *&vdev);
  // Bridge method to create a vdev, a la Acceptor. Applications
  // can override this

  virtual int make_stream_endpoint (T_StreamEndpoint *&stream_endpoint);
  // Bridge method to create a stream_endpoint, a la Acceptor. Applications
  // can override this

  virtual int make_mediactrl (T_MediaCtrl *&media_ctrl);
  // Bridge method to create a media_ctrl, a la Acceptor. Applications
  // can override this


  char* activate_with_poa (PortableServer::Servant servant, CORBA::Environment &env);
  
  CORBA::ORB_ptr orb_;
  
  PortableServer::POA_var poa_;

};
// ----------------------------------------------------------------------

template <class T_StreamEndpoint, class T_VDev , class T_MediaCtrl>
class TAO_AV_Export TAO_AV_Endpoint_Reactive_Strategy_A
  : public TAO_AV_Endpoint_Reactive_Strategy<T_StreamEndpoint, T_VDev , T_MediaCtrl>
{
  // = DESCRIPTION
  //    Reactive strategy

public:

  TAO_AV_Endpoint_Reactive_Strategy_A (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
  // Constructor

  virtual ~TAO_AV_Endpoint_Reactive_Strategy_A (void);
  // Destructor.

  virtual int activate_stream_endpoint (CORBA::Environment &env);
  // Overrides the base class stream_endpoint activator, to activate
  // an "A" type endpoint

  virtual int create_A (AVStreams::StreamEndPoint_A_ptr &stream_endpoint,
                        AVStreams::VDev_ptr &vdev,
                        CORBA::Environment &env);
  // Called by the MMDevice, when it needs to create an A type endpoint

};

// ----------------------------------------------------------------------
template <class T_StreamEndpoint, class T_Vdev , class T_MediaCtrl>
class TAO_AV_Export TAO_AV_Endpoint_Reactive_Strategy_B
  : public TAO_AV_Endpoint_Reactive_Strategy <T_StreamEndpoint, T_Vdev, T_MediaCtrl>
{
  // = DESCRIPTION
  //    Reactive strategy
public:

  TAO_AV_Endpoint_Reactive_Strategy_B (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
  // Constructor

  virtual ~TAO_AV_Endpoint_Reactive_Strategy_B (void);
  // Destructor.

  virtual int activate_stream_endpoint (CORBA::Environment &env);
  // Overrides the base class stream_endpoint activator, to activate
  // a "B" type endpoint

  virtual int create_B (AVStreams::StreamEndPoint_B_ptr &stream_endpoint,
                        AVStreams::VDev_ptr &vdev,
                        CORBA::Environment &env);
  // Called by the MMDevice, when it needs to create a B type endpoint
};

// ----------------------------------------------------------------------

template <class T_StreamEndpoint, class T_VDev , class T_MediaCtrl>
class TAO_AV_Export TAO_AV_Child_Process
{
  // = DESCRIPTION
  //    Helper class for the child process created in TAO_AV_Endpoint_Process_Strategy

public:
  TAO_AV_Child_Process ();
  // Constructor

  virtual ~TAO_AV_Child_Process ();
  // Destructor

  int init (int argc, char **argv, CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
  // Initializes the ORB, creates and activates the
  // T_StreamEndpoint, T_VDev, T_MediaCtrl in the POA

  int run (ACE_Time_Value *tv = 0);
  // runs the ORB event loop

protected:
  int activate_objects (int argc,
                        char **argv,
                        CORBA::Environment &env);
  // Creates the objects and inserts them into the Naming
  // Service, so the parent can pick the IOR's and
  // return them to the client

  char* activate_with_poa (PortableServer::Servant servant, CORBA::Environment &env);
  //activate the servant with the poa

  int unbind_names (void);
  // Removes the vdev and streamendpoint names from the naming service.

  int bind_to_naming_service (CORBA::Environment &env);
  // Binds to the naming service

  int register_vdev (CORBA::Environment &env);
  // Registers vdev with the naming service

  int register_stream_endpoint (CORBA::Environment &env);
  // Registers stream_endpoint with the naming service

  int release_semaphore ();
  // Releases the semaphore on which the parent is waiting on

  virtual int make_vdev (T_VDev *&vdev);
  // Bridge method to create a vdev, a la Acceptor. Applications
  // can override this

  virtual int make_stream_endpoint (T_StreamEndpoint *&stream_endpoint);
  // Bridge method to create a stream_endpoint, a la Acceptor. Applications
  // can override this

  virtual int make_mediactrl (T_MediaCtrl *&media_ctrl);
  // Bridge method to create a media_ctrl, a la Acceptor. Applications
  // can override this

  CosNaming::NamingContext_var naming_context_;
  // The root Naming Context of the TAO naming service

  CosNaming::Name vdev_name_;
  // Name of the vdev

  CosNaming::Name stream_endpoint_name_;
  // Name of the stream_endpoint

  T_StreamEndpoint *stream_endpoint_;
  // The stream endpoint member

  T_VDev *vdev_;
  // The virtual device

  T_MediaCtrl *media_ctrl_;
  // Media controller

  pid_t pid_;
  // pid of this process

  char host_[MAXHOSTNAMELEN];
  // Name of the host.

  CORBA::ORB_ptr orb_;
  
  PortableServer::POA_ptr poa_;

};

// ----------------------------------------------------------------------

template <class T_StreamEndpoint, class T_VDev , class T_MediaCtrl>
class TAO_AV_Export TAO_AV_Child_Process_A
  : public TAO_AV_Child_Process <T_StreamEndpoint, T_VDev, T_MediaCtrl>
{
  // = DESCRIPTION
  //    Helper class for the child process created in TAO_AV_Child_Process

public:
  TAO_AV_Child_Process_A (void);
  // Constructor.

  virtual ~TAO_AV_Child_Process_A (void);
  // Destructor.
};

// ----------------------------------------------------------------------

template <class T_StreamEndpoint, class T_VDev , class T_MediaCtrl>
class TAO_AV_Export TAO_AV_Child_Process_B
  : public TAO_AV_Child_Process <T_StreamEndpoint, T_VDev, T_MediaCtrl>
{
  // = DESCRIPTION
  //    Helper class for the child process created in TAO_AV_Child_Process
public:
  TAO_AV_Child_Process_B (void);
  // Constructor.

  virtual ~TAO_AV_Child_Process_B (void);
  // Destructor.
};

#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "Endpoint_Strategy_T.cpp"
#endif /*ACE_TEMPLATES_REQUIRE_SOURCE */

#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Endpoint_Strategy_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */

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