2 #include "tao/Transport_Selection_Guard.h"
3 #include "tao/TSS_Resources.h"
5 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
9 Transport_Selection_Guard
*
10 Transport_Selection_Guard::current (TAO_ORB_Core
* core
, size_t tss_slot_id
)
12 // @NOTE: (Iliyan) Started making this method aware of the core
13 // and the tss slot that correspond to the "current" transport,
14 // influenced by a general design preference to keep things
15 // local. The idea was to make the current TSG part of the TSS
16 // storage for a specific ORB Core, as opposed to using the global
17 // TSS Resources. However, it really doesn't offer any benefit to
18 // store a Transport pointer locally, for each ORB. There is
19 // always only one current Transport per thread. Period. The
20 // number of ORB Core instances in existence does not change that
21 // fact, so keeping a separate pointer would have been an
23 ACE_UNUSED_ARG (core
);
24 ACE_UNUSED_ARG (tss_slot_id
);
26 #if TAO_HAS_TRANSPORT_CURRENT == 1
27 return TAO_TSS_Resources::instance ()->tsg_
;
28 #else /* TAO_HAS_TRANSPORT_CURRENT != 1 */
30 #endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */
34 Transport_Selection_Guard::Transport_Selection_Guard (TAO_Transport
* t
)
36 #if TAO_HAS_TRANSPORT_CURRENT == 1
37 prev_ (TAO_TSS_Resources::instance ()->tsg_
) ,
38 #endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */
41 #if TAO_HAS_TRANSPORT_CURRENT == 1
42 TAO_TSS_Resources::instance ()->tsg_
= this;
43 #endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */
47 Transport_Selection_Guard::~Transport_Selection_Guard (void)
49 #if TAO_HAS_TRANSPORT_CURRENT == 1
50 TAO_TSS_Resources::instance ()->tsg_
= prev_
;
52 #endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */
57 operator== (const Transport_Selection_Guard
& lhs
,
58 const TAO_Transport
* rhs
)
60 return lhs
.curr_
== rhs
;
64 operator== (const TAO_Transport
* lhs
,
65 const Transport_Selection_Guard
& rhs
)
67 return lhs
== rhs
.curr_
;
71 operator!= (const Transport_Selection_Guard
& lhs
,
72 const TAO_Transport
* rhs
)
74 return lhs
.curr_
!= rhs
;
78 operator!= (const TAO_Transport
* lhs
,
79 const Transport_Selection_Guard
& rhs
)
81 return lhs
!= rhs
.curr_
;
85 TAO_END_VERSIONED_NAMESPACE_DECL