summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.cpp
blob: ec7171ca5fefa372cd1fa73a5481037d4e443a33 (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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
// $Id$

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

#include "orbsvcs/AV/AVStreams_i.h"

// ----------------------------------------------------------------------
// TAO_Basic_StreamCtrl
// ----------------------------------------------------------------------

// Constructor
TAO_Basic_StreamCtrl::TAO_Basic_StreamCtrl (CORBA::ORB_var orb)
  : orb_ (orb)
{
}

TAO_Basic_StreamCtrl::~TAO_Basic_StreamCtrl (void)
{
}

// Stop the transfer of data of the stream
// Empty the_spec means apply operation to all flows
void 
TAO_Basic_StreamCtrl::stop (const AVStreams::flowSpec &the_spec,  
                            CORBA::Environment &env)
{
  if (CORBA::is_nil (stream_endpoint_a_.in ()))
    return;

  // Make the upcall into the application
  this->stream_endpoint_a_->stop (the_spec, env);
}

// Start the transfer of data in the stream. 
// Empty the_spec means apply operation to all flows
void
TAO_Basic_StreamCtrl::start (const AVStreams::flowSpec &the_spec,  
                             CORBA::Environment &env)
{
  if (CORBA::is_nil (this->stream_endpoint_a_.in ()))
    return;

  // Make the upcall into the application
  this->stream_endpoint_a_->start (the_spec, env);
}

// Tears down the stream. This will close the connection, and delete 
// the streamendpoint and vdev associated with this stream
// Empty the_spec means apply operation to all flows
void
TAO_Basic_StreamCtrl::destroy (const AVStreams::flowSpec &the_spec,  
                               CORBA::Environment &env)
{
  if (CORBA::is_nil (this->stream_endpoint_a_.in ()))
    return;

  // Make the upcall into the application
  this->stream_endpoint_a_->destroy (the_spec, env);
}

// Changes the QoS associated with the stream
// Empty the_spec means apply operation to all flows
CORBA::Boolean 
TAO_Basic_StreamCtrl::modify_QoS (AVStreams::streamQoS &new_qos, 
                                  const AVStreams::flowSpec &the_spec,  
                                  CORBA::Environment &env)
{
  ACE_UNUSED_ARG (new_qos);
  ACE_UNUSED_ARG (the_spec);
  ACE_UNUSED_ARG (env);
  return 0;
}

// Used by StreamEndPoint and VDev to inform StreamCtrl of events.
// E.g., loss of flow, reestablishment of flow, etc..
void
TAO_Basic_StreamCtrl::push_event (const char *the_event,  
                                  CORBA::Environment &env)
{
  ACE_DEBUG ((LM_DEBUG, 
              "\n(%P|%t) Recieved event \"%s\"",
              the_event));
  ACE_UNUSED_ARG (env);
}

// Used to control the flow protocol parameters.
void
TAO_Basic_StreamCtrl::set_FPStatus (const AVStreams::flowSpec &the_spec, 
                                    const char *fp_name, 
                                    const CORBA::Any &fp_settings,  
                                    CORBA::Environment &env)
{
  ACE_UNUSED_ARG (the_spec);
  ACE_UNUSED_ARG (fp_name);
  ACE_UNUSED_ARG (fp_settings);
  ACE_UNUSED_ARG (env);
}

// @@ Need to throw not-supported exception here
CORBA::Object_ptr 
TAO_Basic_StreamCtrl::get_flow_connection (const char *flow_name,  
                                           CORBA::Environment &env)
{
  ACE_UNUSED_ARG (flow_name);
  ACE_UNUSED_ARG (env);
  return 0;
}

// @@ Need to throw not-supported exception here
void
TAO_Basic_StreamCtrl::set_flow_connection (const char *flow_name, 
                                           CORBA::Object_ptr flow_connection,  
                                           CORBA::Environment &env)
{
  ACE_UNUSED_ARG (flow_name);
  ACE_UNUSED_ARG (flow_connection);
  ACE_UNUSED_ARG (env);
}

// ----------------------------------------------------------------------
// TAO_StreamCtrl
// ----------------------------------------------------------------------

TAO_StreamCtrl::TAO_StreamCtrl (CORBA::ORB_var orb)
  : TAO_Basic_StreamCtrl (orb)
{
}

TAO_StreamCtrl::~TAO_StreamCtrl (void)
{
}

// request the two MMDevices to create vdev and stream endpoints. save 
// the references returned.

// The interaction diagram for this method is on page 13 of the spec
CORBA::Boolean 
TAO_StreamCtrl::bind_devs (AVStreams::MMDevice_ptr a_party, 
                           AVStreams::MMDevice_ptr b_party, 
                           AVStreams::streamQoS &the_qos, 
                           const AVStreams::flowSpec &the_flows,  
                           CORBA::Environment &env)
{
  // Check to see if we have non-nil parties to bind!
  if (CORBA::is_nil (a_party) || 
      CORBA::is_nil (b_party))
    ACE_ERROR_RETURN ((LM_ERROR, 
                       "\n(%P|%t) TAO_StreamCtrl::bind_devs: "
                       "a_party or b_party is null!\n"),
                      1);
  
  // Request a_party to create the endpoint and vdev
  CORBA::Boolean met_qos;
  CORBA::String_var named_vdev;

  this->stream_endpoint_a_ =
    a_party-> create_A (this->_this (env),
                        this->vdev_a_.out (),
                        the_qos,
                        met_qos,
                        named_vdev.inout (),
                        the_flows,
                        env);
  TAO_CHECK_ENV_RETURN (env, 1);
  
  ACE_DEBUG ((LM_DEBUG,
              "\n(%P|%t) TAO_StreamCtrl::create_A: succeeded"));

  // Request b_party to create the endpoint and vdev

  this->stream_endpoint_b_ =
    b_party-> create_B (this->_this (env),
                        this->vdev_b_.out (),
                        the_qos,
                        met_qos,
                        named_vdev.inout (),
                        the_flows,
                        env);
  TAO_CHECK_ENV_RETURN (env, 1);
  
  ACE_DEBUG ((LM_DEBUG,
              "\n(%P|%t) TAO_StreamCtrl::create_B: succeeded"));
  
  ACE_DEBUG ((LM_DEBUG, 
              "\nstream_endpoint_b_ = %s",
              this->orb_->object_to_string (this->stream_endpoint_b_,
                                            env)));
  TAO_CHECK_ENV_RETURN (env, 1);

  // Tell the 2 VDev's about one another
  this->vdev_a_->set_peer (this->_this (env),
                           this->vdev_b_.in (),
                           the_qos,
                           the_flows,
                           env);

  TAO_CHECK_ENV_RETURN (env, 1);

  this->vdev_b_->set_peer (this->_this (env),
                           this->vdev_a_.in (),
                           the_qos,
                           the_flows,
                           env);

  TAO_CHECK_ENV_RETURN (env, 1);


  // Now connect the streams together. This will
  // establish the connection
  this->stream_endpoint_a_->connect (this->stream_endpoint_b_,
                                     the_qos,
                                     the_flows,
                                     env);
  TAO_CHECK_ENV_RETURN (env, 1);
  return 0;
}
  
// Used to establish a connection between two endpoints
// directly, i.e. without a MMDevice
CORBA::Boolean 
TAO_StreamCtrl::bind (AVStreams::StreamEndPoint_A_ptr a_party, 
                      AVStreams::StreamEndPoint_B_ptr b_party, 
                      AVStreams::streamQoS &the_qos, 
                      const AVStreams::flowSpec &the_flows,  
                      CORBA::Environment &env)
{
  if (CORBA::is_nil (a_party) || 
      CORBA::is_nil (b_party))
    ACE_ERROR_RETURN ((LM_ERROR, 
                       "(%P|%t) TAO_StreamCtrl::bind:"
                       "a_party or b_party null!"),
                      1);

  this->stream_endpoint_a_ = a_party;
  this->stream_endpoint_b_ = b_party;
  // Now connect the streams together
  this->stream_endpoint_a_->connect (this->stream_endpoint_b_,
                                     the_qos,
                                     the_flows,
                                     env);
  TAO_CHECK_ENV_RETURN (env, 1);
  return 0;
}

void 
TAO_StreamCtrl::unbind (CORBA::Environment &env)
{
  ACE_UNUSED_ARG (env);
}

void 
TAO_StreamCtrl::unbind_party (AVStreams::StreamEndPoint_ptr the_ep, 
                              const AVStreams::flowSpec &the_spec,  
                              CORBA::Environment &env)
{
  ACE_UNUSED_ARG (the_ep);
  ACE_UNUSED_ARG (the_spec);
  ACE_UNUSED_ARG (env);
}

// ----------------------------------------------------------------------
// TAO_StreamEndPoint
// ----------------------------------------------------------------------

TAO_StreamEndPoint::TAO_StreamEndPoint (void)
{
}

// Stop the physical flow of data on the stream
// Empty the_spec --> apply to all flows
void 
TAO_StreamEndPoint::stop (const AVStreams::flowSpec &the_spec,  
                          CORBA::Environment &env)
{
  // Make the upcall into the app
  this->handle_stop (the_spec, env);
}

// Start the physical flow of data on the stream
// Empty the_spec --> apply to all flows
void 
TAO_StreamEndPoint::start (const AVStreams::flowSpec &the_spec,  
                           CORBA::Environment &env)
{
  // Make the upcall into the app
  this->handle_start (the_spec, env);
}

// Close the connection
void 
TAO_StreamEndPoint::destroy (const AVStreams::flowSpec &the_spec,  
                             CORBA::Environment &env)
{
  // Make the upcall into the app
  this->handle_destroy (the_spec, env);
}

// Called by streamctrl, requesting us to call request_connection 
// on the responder (to initiate a connection)
CORBA::Boolean 
TAO_StreamEndPoint::connect (AVStreams::StreamEndPoint_ptr responder, 
                             AVStreams::streamQoS &qos_spec, 
                             const AVStreams::flowSpec &the_spec,  
                             CORBA::Environment &env)
{
  ACE_DEBUG ((LM_DEBUG, "(%P|%t) In TAO_StreamEndPoint::connect\n"));
  responder->request_connection (this->_this (env),
                                 0,
                                 qos_spec,
                                 the_spec,
                                 env);
  TAO_CHECK_ENV_RETURN (env, 1);
}
  
// Called by our peer endpoint, requesting us to establish
// a connection
CORBA::Boolean 
TAO_StreamEndPoint::request_connection (AVStreams::StreamEndPoint_ptr initiator, 
                                        CORBA::Boolean is_mcast, 
                                        AVStreams::streamQoS &qos, 
                                        AVStreams::flowSpec &the_spec,  
                                        CORBA::Environment &env)
{
  ACE_DEBUG ((LM_DEBUG, "\n(%P|%t) TAO_StreamEndPoint::request_connection called"));
  ACE_DEBUG ((LM_DEBUG, 
              "\n(%P|%t) TAO_StreamEndPoint::request_connection: "
              "flowspec has length = %d"
              "and the strings are:",
              the_spec.length ()));
  for (int i = 0; i < the_spec.length (); i++)
    ACE_DEBUG ((LM_DEBUG,
                the_spec [i]));

  return 0;
}
  
CORBA::Boolean 
TAO_StreamEndPoint::modify_QoS (AVStreams::streamQoS &new_qos, 
                                const AVStreams::flowSpec &the_flows,  
                                CORBA::Environment &env)
{
  return 0;
}
  
CORBA::Boolean 
TAO_StreamEndPoint::set_protocol_restriction (const AVStreams::protocolSpec &the_pspec,  
                                              CORBA::Environment &env)
{
  return 0;
}
  
void 
TAO_StreamEndPoint::disconnect (const AVStreams::flowSpec &the_spec,  
                                CORBA::Environment &env)
{
}
  
void 
TAO_StreamEndPoint::set_FPStatus (const AVStreams::flowSpec &the_spec, 
                                  const char *fp_name, 
                                  const CORBA::Any &fp_settings,  
                                  CORBA::Environment &env)
{
}

CORBA::Object_ptr 
TAO_StreamEndPoint::get_fep (const char *flow_name,  
                             CORBA::Environment &env)
{
  return 0;
}
  
char * 
TAO_StreamEndPoint::add_fep (CORBA::Object_ptr the_fep,  
                             CORBA::Environment &env)
{
  return 0;
}
  
void 
TAO_StreamEndPoint::remove_fep (const char *fep_name,  
                                CORBA::Environment &env)
{
}
  
void 
TAO_StreamEndPoint::set_negotiator (AVStreams::Negotiator_ptr new_negotiator,  
                                    CORBA::Environment &env)
{
}

void 
TAO_StreamEndPoint::set_key (const char *flow_name, 
                             const encryption_key & the_key,
                             CORBA::Environment &env)
{
}
  
void 
TAO_StreamEndPoint::set_source_id (CORBA::Long source_id,  
                                   CORBA::Environment &env)
{
}

TAO_StreamEndPoint::~TAO_StreamEndPoint (void)
{
}

// ----------------------------------------------------------------------
// TAO_Client_StreamEndPoint
// ----------------------------------------------------------------------

TAO_Client_StreamEndPoint::TAO_Client_StreamEndPoint (void)
{
  ACE_DEBUG ((LM_DEBUG, 
              "\n(%P|%t) TAO_Client_StreamEndPoint::TAO_Client_StreamEndPoint: created"));
}

CORBA::Boolean 
TAO_Client_StreamEndPoint::connect (AVStreams::StreamEndPoint_ptr responder, 
                                    AVStreams::streamQoS &qos_spec, 
                                    const AVStreams::flowSpec &the_spec,  
                                    CORBA::Environment &env)
{
  // Use the base class implementation of connect
  TAO_StreamEndPoint::connect (responder, 
                               qos_spec, 
                               the_spec,  
                               env);

  // Make the upcall to the app
  return this->handle_connection_established (responder, 
                                              qos_spec, 
                                              the_spec,  
                                              env);
  
}


CORBA::Boolean 
TAO_Client_StreamEndPoint::multiconnect (AVStreams::streamQoS &the_qos, 
                                    AVStreams::flowSpec &the_spec,  
                                    CORBA::Environment &env)
{
  return 0;
}
  
CORBA::Boolean 
TAO_Client_StreamEndPoint::connect_leaf (AVStreams::StreamEndPoint_B_ptr the_ep, 
                                    AVStreams::streamQoS &the_qos, 
                                    const AVStreams::flowSpec &the_flows,  
                                    CORBA::Environment &env)
{
  return 0;
}
  
void 
TAO_Client_StreamEndPoint::disconnect_leaf (AVStreams::StreamEndPoint_B_ptr the_ep, 
                                       const AVStreams::flowSpec &theSpec,  
                                       CORBA::Environment &env)
{
}
  
TAO_Client_StreamEndPoint::~TAO_Client_StreamEndPoint (void)
{
}

// ----------------------------------------------------------------------
// TAO_Server_StreamEndPoint
// ----------------------------------------------------------------------

TAO_Server_StreamEndPoint::TAO_Server_StreamEndPoint (void)
{
  ACE_DEBUG ((LM_DEBUG, 
              "\n(%P|%t) TAO_Server_StreamEndPoint::TAO_Server_StreamEndPoint: created"));
}

CORBA::Boolean 
TAO_Server_StreamEndPoint::request_connection (AVStreams::StreamEndPoint_ptr initiator, 
                                               CORBA::Boolean is_mcast, 
                                               AVStreams::streamQoS &qos, 
                                               AVStreams::flowSpec &the_spec,  
                                               CORBA::Environment &env)

{
  // Use the base class implementation of request_connection
  TAO_StreamEndPoint::request_connection (initiator, 
                                          is_mcast, 
                                          qos, 
                                          the_spec,  
                                          env);

  // Make the upcall to the app
  return this->handle_connection_requested (initiator, 
                                            is_mcast, 
                                            qos, 
                                            the_spec,  
                                            env);

}
CORBA::Boolean 
TAO_Server_StreamEndPoint::multiconnect (AVStreams::streamQoS &the_qos, 
                                         AVStreams::flowSpec &the_spec,  
                                         CORBA::Environment &env)
{
  return 0;
}

TAO_Server_StreamEndPoint::~TAO_Server_StreamEndPoint (void)
{
}

// ----------------------------------------------------------------------
// TAO_VDev
// ----------------------------------------------------------------------

TAO_VDev::TAO_VDev (void)
{
  ACE_DEBUG ((LM_DEBUG, 
              "\n(%P|%t) TAO_VDev::TAO_VDev: created"));
}

// StreamCtrl will call this to give us a reference to itself, and to
// our peer vdev..
CORBA::Boolean 
TAO_VDev::set_peer (AVStreams::StreamCtrl_ptr the_ctrl, 
                    AVStreams::VDev_ptr the_peer_dev, 
                    AVStreams::streamQoS &the_qos, 
                    const AVStreams::flowSpec &the_spec,  
                    CORBA::Environment &env)
{
  ACE_DEBUG ((LM_DEBUG,
              "(%P|%t) TAO_VDev::set_peer: called"));
  this->streamctrl_ = the_ctrl;
  this->peer_ = the_peer_dev;
  return 0;
}

CORBA::Boolean 
TAO_VDev::set_Mcast_peer (AVStreams::StreamCtrl_ptr the_ctrl, 
                          AVStreams::MCastConfigIf_ptr a_mcastconfigif, 
                          AVStreams::streamQoS &the_qos, 
                          const AVStreams::flowSpec &the_spec,  
                          CORBA::Environment &env)
{
  return 0;
}

void 
TAO_VDev::configure (const CosPropertyService::Property &the_config_mesg,  
                     CORBA::Environment &env)
{
}

void 
TAO_VDev::set_format (const char *flowName, 
                      const char *format_name,  
                      CORBA::Environment &env)
{
}

void 
TAO_VDev::set_dev_params (const char *flowName, 
                          const CosPropertyService::Properties &new_params,  
                          CORBA::Environment &env)
{
}

CORBA::Boolean 
TAO_VDev::modify_QoS (AVStreams::streamQoS &the_qos, 
                      const AVStreams::flowSpec &the_spec,  
                      CORBA::Environment &env)
{
  return 0;
}

TAO_VDev::~TAO_VDev (void)
{
}

// ----------------------------------------------------------------------
// TAO_MMDevice
// ----------------------------------------------------------------------



TAO_MMDevice::TAO_MMDevice ()
{
}

// create a streamctrl which is colocated with me, use that streamctrl
// to bind the peer_device with me.
AVStreams::StreamCtrl_ptr  
TAO_MMDevice ::bind (AVStreams::MMDevice_ptr peer_device,
                     AVStreams::streamQoS &the_qos,
                     CORBA::Boolean_out is_met,
                     const AVStreams::flowSpec &the_spec,
                     CORBA::Environment &env)
{
#if 0
  TAO_TRY
    {
      TAO_StreamCtrl *stream_ctrl = new TAO_StreamCtrl ();
      if (stream_ctrl == 0)
        return 0;
      stream_ctrl->bind_devs (peer_device,
                              AVStreams::StreamCtrl::_duplicate 
                              (this->_this (TAO_TRY_ENV)),
                              the_qos,
                              the_spec,
                              TAO_TRY_ENV);
      TAO_CHECK_ENV;
      return stream_ctrl;
    }
  TAO_CATCH (CORBA::SystemException, sysex)
    {
      TAO_TRY_ENV.print_exception ("System Exception");
      return -1;
    }
  TAO_CATCH (CORBA::UserException, userex)
    {
      TAO_TRY_ENV.print_exception ("User Exception");
      return -1;
    }
  TAO_ENDTRY;
#endif
  return 0;
}

AVStreams::StreamCtrl_ptr  
TAO_MMDevice::bind_mcast (AVStreams::MMDevice_ptr first_peer,
                          AVStreams::streamQoS &the_qos,
                          CORBA::Boolean_out is_met,
                          const AVStreams::flowSpec &the_spec,
                          CORBA::Environment &env)
{
  return 0;
}

void 
TAO_MMDevice::destroy (AVStreams::StreamEndPoint_ptr the_ep,
                       const char *vdev_name,
                       CORBA::Environment &env)
{
}

// need to throw notsupported exception
char * 
TAO_MMDevice::add_fdev (CORBA::Object_ptr the_fdev,
                        CORBA::Environment &env)
{
  return 0;
}

// need to throw notsupported exception
CORBA::Object_ptr 
TAO_MMDevice::get_fdev (const char *flow_name,  
                        CORBA::Environment &env)
{
  return 0;
}

// need to throw notsupported exception
void 
TAO_MMDevice::remove_fdev (const char *flow_name,  
                           CORBA::Environment &env)
{
}

TAO_MMDevice::~TAO_MMDevice (void)
{
}

template <class T>
TAO_Client_MMDevice <T>::TAO_Client_MMDevice ()
{
}

// We have been asked to create a new stream_endpoint and a vdev.
template <class T>
AVStreams::StreamEndPoint_A_ptr  
TAO_Client_MMDevice <T>::create_A (AVStreams::StreamCtrl_ptr the_requester, 
                                   AVStreams::VDev_out the_vdev, 
                                   AVStreams::streamQoS &the_qos, 
                                   CORBA::Boolean_out met_qos, 
                                   char *&named_vdev, 
                                   const AVStreams::flowSpec &the_spec,  
                                   CORBA::Environment &env)
{
  ACE_DEBUG ((LM_DEBUG, 
              "\n(%P|%t) TAO_MMDevice::create_A: called"));

  TAO_VDev *vdev = new TAO_VDev;
  the_vdev = AVStreams::VDev::_duplicate (vdev->_this (env));

  TAO_Client_StreamEndPoint *stream_endpoint_a = 
    new T;
  return AVStreams::StreamEndPoint_A::_duplicate 
    (stream_endpoint_a->_this (env));
}

template <class T>
AVStreams::StreamEndPoint_B_ptr  
TAO_Client_MMDevice <T>::create_B (AVStreams::StreamCtrl_ptr the_requester, 
                                   AVStreams::VDev_out the_vdev, 
                                   AVStreams::streamQoS &the_qos, 
                                   CORBA::Boolean_out met_qos, 
                                   char *&named_vdev, 
                                   const AVStreams::flowSpec &the_spec,  
                                   CORBA::Environment &env)
{
  ACE_ERROR_RETURN ((LM_ERROR, 
                     "(%P|%t) Cannot create a B device on the client side!\n"),
                    0);
}

template <class T>
TAO_Server_MMDevice <T>::TAO_Server_MMDevice ()
{
}

template <class T>
AVStreams::StreamEndPoint_A_ptr  
TAO_Server_MMDevice <T>::create_A (AVStreams::StreamCtrl_ptr the_requester, 
                                   AVStreams::VDev_out the_vdev, 
                                   AVStreams::streamQoS &the_qos, 
                                   CORBA::Boolean_out met_qos, 
                                   char *&named_vdev, 
                                   const AVStreams::flowSpec &the_spec,  
                                   CORBA::Environment &env)
{
  ACE_ERROR_RETURN ((LM_ERROR, 
                     "(%P|%t) Cannot create a A device on the server side!\n"),
                    0);
}

// We have been asked to create a new stream_endpoint and a vdev.
template <class T>
AVStreams::StreamEndPoint_B_ptr  
TAO_Server_MMDevice <T>::create_B (AVStreams::StreamCtrl_ptr the_requester, 
                                   AVStreams::VDev_out the_vdev, 
                                   AVStreams::streamQoS &the_qos, 
                                   CORBA::Boolean_out met_qos, 
                                   char *&named_vdev, 
                                   const AVStreams::flowSpec &the_spec,  
                                   CORBA::Environment &env)
{
  ACE_DEBUG ((LM_DEBUG, 
              "\n(%P|%t) TAO_MMDevice::create_B: called"));

  TAO_VDev *vdev = new TAO_VDev;
  the_vdev = AVStreams::VDev::_duplicate (vdev->_this (env));

  TAO_Server_StreamEndPoint *stream_endpoint_b = 
    new T;
  return AVStreams::StreamEndPoint_B::_duplicate 
    (stream_endpoint_b->_this (env));
}