summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Event/EC_TPC_ProxySupplier.cpp
blob: 756de632952e31016a69a535b9be613ba88ac3e2 (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
// $Id$

#include "orbsvcs/Event/EC_TPC_ProxySupplier.h"

#if ! defined (__ACE_INLINE__)
#include "orbsvcs/Event/EC_TPC_ProxySupplier.inl"
#endif /* __ACE_INLINE__ */

ACE_RCSID(Event, EC_TPC_ProxySupplier, "$Id$")

#include "orbsvcs/Event/EC_Event_Channel_Base.h"
#include "orbsvcs/Event/EC_TPC_Dispatching.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

extern unsigned long TAO_EC_TPC_debug_level;

TAO_EC_TPC_ProxyPushSupplier::~TAO_EC_TPC_ProxyPushSupplier (void)
{

}

void
TAO_EC_TPC_ProxyPushSupplier:: disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  if (TAO_EC_TPC_debug_level > 0)
    ACE_DEBUG ((LM_DEBUG, "EC (%P|%t): enter EC_TPC_ProxySupplier::disconnect_push_supplier (%@): refcount=%u,consumer=%@\n",
				this,
				this->refcount_,
				this->consumer_.in()));

  if (this->is_connected_i ())
    {
      this->tpc_dispatching ()->remove_consumer (this->consumer_.in()
                                                 ACE_ENV_ARG_PARAMETER);
      ACE_CHECK;
    }
  BASECLASS::disconnect_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER);
  ACE_CHECK;

  if (TAO_EC_TPC_debug_level > 0)
    ACE_DEBUG ((LM_DEBUG, "EC (%P|%t): leave EC_TPC_ProxySupplier::disconnect_push_supplier (%@)\n", this));
}

TAO_EC_TPC_Dispatching*
TAO_EC_TPC_ProxyPushSupplier::tpc_dispatching ()
{
  TAO_EC_Dispatching* dispatcher = this->event_channel_->dispatching ();

  return dynamic_cast <TAO_EC_TPC_Dispatching*> (dispatcher);
}

void
TAO_EC_TPC_ProxyPushSupplier::connect_push_consumer (
      RtecEventComm::PushConsumer_ptr push_consumer,
      const RtecEventChannelAdmin::ConsumerQOS& qos
      ACE_ENV_ARG_DECL)
    ACE_THROW_SPEC ((CORBA::SystemException,
                     RtecEventChannelAdmin::AlreadyConnected,
                     RtecEventChannelAdmin::TypeError))
{
  BASECLASS::connect_push_consumer (push_consumer, qos ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  if (TAO_EC_TPC_debug_level > 0)
    ACE_DEBUG ((LM_DEBUG, "EC (%P|%t): EC_ProxySupplier(%@): refcount=%u,consumer=%@\n",
              this, this->refcount_, this->consumer_.in()));

  TAO_EC_TPC_Dispatching* tpcdispatcher = this->tpc_dispatching ();

  // the new dispatching task gets automatically created
  tpcdispatcher->add_consumer (push_consumer ACE_ENV_ARG_PARAMETER);
}

TAO_END_VERSIONED_NAMESPACE_DECL