summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/performance-tests/RTEvent/lib/Loopback_Pair.cpp
blob: a4ce22f8232642db2ea5f2458d105f6ec0d6bc1b (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
/**
 * @file Loopback_Pair.cpp
 *
 * @author Carlos O'Ryan <coryan@uci.edu>
 */

#include "Loopback_Pair.h"
#include "Auto_Disconnect.h"

#if !defined(__ACE_INLINE__)
#include "Loopback_Pair.inl"
#endif /* __ACE_INLINE__ */

void
Loopback_Pair::init (CORBA::Long experiment_id,
                     CORBA::Long base_event_type,
                     PortableServer::POA_ptr supplier_poa,
                     PortableServer::POA_ptr consumer_poa)
{
  this->loopback_supplier_ = new Loopback_Supplier (experiment_id,
                                                    base_event_type + 1,
                                                    supplier_poa);
  this->loopback_consumer_ = new Loopback_Consumer (experiment_id,
                                                    base_event_type,
                                                    loopback_supplier_.in (),
                                                    consumer_poa);
}

void
Loopback_Pair::connect (RtecEventChannelAdmin::EventChannel_ptr ec)
{
  this->loopback_supplier_->connect (ec);
  Auto_Disconnect<Loopback_Supplier> loopback_supplier_disconnect (this->loopback_supplier_);

  this->loopback_consumer_->connect (ec);
  Auto_Disconnect<Loopback_Consumer> loopback_consumer_disconnect (this->loopback_consumer_);

  loopback_consumer_disconnect.release ();
  loopback_supplier_disconnect.release ();
}

void
Loopback_Pair::disconnect (void)
{
  Auto_Disconnect<Loopback_Supplier> loopback_supplier_disconnect (this->loopback_supplier_);
  Auto_Disconnect<Loopback_Consumer> loopback_consumer_disconnect (this->loopback_consumer_);
}