summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/AV/Endpoint_Strategy.h
blob: bb2938deb68187bbd55ed93cc5b95bb6ac91673b (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
/* -*- C++ -*- */

// $Id$

// ============================================================================
//
// = LIBRARY
//    cos
// 
// = FILENAME
//   Endpoint_Strategy.h
//
// = AUTHOR
//    Sumedh Mungee <sumedh@cs.wustl.edu>
//    
// 
// ============================================================================

#if !defined (TAO_AV_ENDPOINT_STRATEGY_H)
#define	TAO_AV_ENDPOINT_STRATEGY_H

#include "orbsvcs/AV/AVStreams_i.h"
#include "tao/TAO.h"

class TAO_ORBSVCS_Export TAO_AV_Endpoint_Strategy
// = DESCRIPTION
//    Base class to define various endpoint strategies
//    used by the MMDevice to create the Endpoint and Vdev
{
public:
  TAO_AV_Endpoint_Strategy (void);
  // Constructor
  
  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

  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 an B type endpoint

 protected:
  AVStreams::StreamEndPoint_A_ptr stream_endpoint_a_;
  // The "A" stream endpoint

  AVStreams::StreamEndPoint_B_ptr stream_endpoint_b_;
  // The "B" stream endpoint

  AVStreams::VDev_ptr vdev_;
  // The vdev

};

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

class TAO_ORBSVCS_Export TAO_AV_Endpoint_Process_Strategy
  : public virtual TAO_AV_Endpoint_Strategy
// = DESCRIPTION
//    Process-based strategy for creating endpoints
//    Abstract base class.
{
 public:
  TAO_AV_Endpoint_Process_Strategy (ACE_Process_Options *process_options);
  // Constructor. The process_options contain the name and arguments
  // for the process to be created

  virtual int activate (void);
  // creates a new child process, and waits on a semaphore
  // until the child process has finished creating the endpoints

 protected:
  virtual int bind_to_naming_service (CORBA::Environment &env);
  // Bind to the naming service

  virtual int get_stream_endpoint (CORBA::Environment &env) = 0;
  // Get the object reference for the newly created stream
  // endpoint (which will be in the child process)
  // Subclasses will define the functionality for this

  virtual int get_vdev (CORBA::Environment &env);
  // Get the Vdev object reference for the newly created
  // endpoint 

  CosNaming::NamingContext_var naming_context_;
  // Naming context

 private:
  ACE_Process_Options *process_options_;
  // Name and arguments for the process to be created
};  


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

class TAO_ORBSVCS_Export TAO_AV_Endpoint_Process_Strategy_A
  : public virtual TAO_AV_Endpoint_Process_Strategy
// = DESCRIPTION
//    Process-based strategy to create "A" type endpoints
{
 public:
  TAO_AV_Endpoint_Process_Strategy_A (ACE_Process_Options *process_options);
  // Constructor

 protected:  
  virtual int create_A (AVStreams::StreamEndPoint_A_ptr &stream_endpoint,
                        AVStreams::VDev_ptr &vdev,
                        CORBA::Environment &env);
  // Creates an "A" type stream endpoint, and a vdev

  virtual int get_stream_endpoint (CORBA::Environment &env);
  // Gets the "A" type stream endpoint from the child process
  
};  

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

class TAO_ORBSVCS_Export TAO_AV_Endpoint_Process_Strategy_B
  : public virtual TAO_AV_Endpoint_Process_Strategy
// = DESCRIPTION
//    Process-based strategy to create "B" type endpoints
{
 public:
  TAO_AV_Endpoint_Process_Strategy_B (ACE_Process_Options *process_options);
  // Constructor

 protected:
  virtual int create_B (AVStreams::StreamEndPoint_B_ptr &stream_endpoint,
                        AVStreams::VDev_ptr &vdev,
                        CORBA::Environment &env);
  // Creates a "B" type stream endpoint, and a vdev
  
  
  virtual int get_stream_endpoint (CORBA::Environment &env);
  
};  

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

template <class T_StreamEndpoint, class T_VDev , class T_MediaCtrl>
class TAO_ORBSVCS_Export TAO_AV_Endpoint_Reactive_Strategy_A
  : public virtual TAO_AV_Endpoint_Strategy
// = DESCRIPTION
//    Reactive strategy
{
 public:
  TAO_AV_Endpoint_Reactive_Strategy_A (TAO_ORB_Manager *orb_manager);

  virtual int create_A (void);
  
 private:
  TAO_ORB_Manager *orb_manager_;

};

// ----------------------------------------------------------------------
template <class T_StreamEndpoint, class T_Vdev , class T_MediaCtrl>
class TAO_ORBSVCS_Export TAO_AV_Endpoint_Reactive_Strategy_B
  : public virtual TAO_AV_Endpoint_Strategy
// = DESCRIPTION
//    Reactive strategy
{
 public:
  TAO_AV_Endpoint_Reactive_Strategy_B (TAO_ORB_Manager *);

  virtual int create_B (void);
  
 private:
  TAO_ORB_Manager *orb_manager_;

};

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

template <class T_StreamEndpoint, class T_VDev , class T_MediaCtrl>
class TAO_ORBSVCS_Export TAO_AV_Child_Process
// = DESCRIPTION
//    Helper class for the child process created in TAO_AV_Endpoint_Process_Strategy
{
public:
  TAO_AV_Child_Process ();
  int init (int argc, char **argv);
  int run (ACE_Time_Value *tv = 0);

 protected:
  char *stream_endpoint_name_;

  int activate_objects (int argc, 
                        char **argv,
                        CORBA::Environment &env);

  int bind_to_naming_service (CORBA::Environment &env);
  int register_vdev (CORBA::Environment &env);
  int register_stream_endpoint (CORBA::Environment &env);
  int register_with_naming_service (CORBA::Environment &env);
  int release_semaphore ();

  TAO_ORB_Manager orb_manager_;
  // The ORB Manager

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

  T_StreamEndPoint stream_endpoint_;
  // The stream endpoint member

  T_VDev vdev_;
  // The virtual device
};

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

template <class T_StreamEndpoint, class T_VDev , class T_MediaCtrl>
class TAO_ORBSVCS_Export TAO_AV_Child_Process_A
  : public virtual 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 ();

};

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

template <class T_StreamEndpoint, class T_VDev , class T_MediaCtrl>
class TAO_ORBSVCS_Export TAO_AV_Child_Process_B
  : public virtual 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 ();

};

#endif /* TAO_AV_ENDPOINT_STRATEGY_H */