Used by the Transport Current feature to keep track of which Transport is currently active. More...
#include <Transport_Selection_Guard.h>
Used by the Transport Current feature to keep track of which Transport is currently active.
Whenever a Transport is selected: during an upcall, or prior to a client invocation an instance of this class is created [on the stack, or as a member of another class] to keep track of the said Transport. The class implements the RAII idiom, which makes it possible to build a stack of these instances as the thread is doing nested upcalls or client invocations.
It utilizes TAO_TSS_Resources::tsg_ member pointer to keep track of stack-linked Transport_Selection_Guard instances.
If the Transport Current feature is disabled most methods are no-ops and add no overhead on the critical path.
See Also:
Definition at line 58 of file Transport_Selection_Guard.h.
TAO::Transport_Selection_Guard::Transport_Selection_Guard | ( | TAO_Transport * | t | ) |
Ctor.
Definition at line 46 of file Transport_Selection_Guard.cpp.
: #if TAO_HAS_TRANSPORT_CURRENT == 1 prev_ (TAO_TSS_Resources::instance ()->tsg_) , #endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */ curr_ (t) { #if TAO_HAS_TRANSPORT_CURRENT == 1 TAO_TSS_Resources::instance ()->tsg_ = this; #endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */ }
TAO::Transport_Selection_Guard::~Transport_Selection_Guard | ( | void | ) |
Dtor.
Definition at line 65 of file Transport_Selection_Guard.cpp.
{ #if TAO_HAS_TRANSPORT_CURRENT == 1 TAO_TSS_Resources::instance ()->tsg_ = prev_; this->prev_ = 0; #endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */ this->curr_ = 0; }
TAO::Transport_Selection_Guard::Transport_Selection_Guard | ( | const Transport_Selection_Guard & | ) | [private] |
Transport_Selection_Guard * TAO::Transport_Selection_Guard::current | ( | TAO_ORB_Core * | core, | |
size_t | tss_slot_id | |||
) | [static] |
Definition at line 16 of file Transport_Selection_Guard.cpp.
{ // @NOTE: (Iliyan) Started making this method aware of the core // and the tss slot that correspond to the "current" transport, // influenced by a general design preference to keep things // local. The idea was to make the current TSG part of the TSS // storage for a specific ORB Core, as opposed to using the global // TSS Resources. However, it really doesn't offer any benefit to // store a Transport pointer locally, for each ORB. There is // always only one current Transport per thread. Period. The // number of ORB Core instances in existence does not change that // fact, so keeping a separate pointer would have been an // over-kill. ACE_UNUSED_ARG (core); ACE_UNUSED_ARG (tss_slot_id); #if TAO_HAS_TRANSPORT_CURRENT == 1 return TAO_TSS_Resources::instance ()->tsg_; #else /* TAO_HAS_TRANSPORT_CURRENT != 1 */ return 0; #endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */ }
TAO_Transport* TAO::Transport_Selection_Guard::get | ( | void | ) | const [inline] |
bool TAO::Transport_Selection_Guard::operator! | ( | ) | const [inline, private] |
Definition at line 127 of file Transport_Selection_Guard.h.
{ return curr_ == 0; }
TAO_Transport& TAO::Transport_Selection_Guard::operator* | ( | void | ) | const [inline] |
TAO_Transport* TAO::Transport_Selection_Guard::operator-> | ( | void | ) | const [inline] |
Transport_Selection_Guard& TAO::Transport_Selection_Guard::operator= | ( | const Transport_Selection_Guard & | rhs | ) | [inline] |
Definition at line 98 of file Transport_Selection_Guard.h.
Transport_Selection_Guard& TAO::Transport_Selection_Guard::set | ( | TAO_Transport * | t | ) | [inline] |
Setter.
Definition at line 92 of file Transport_Selection_Guard.h.
{ this->curr_ = t; return *this; };
bool operator!= | ( | const Transport_Selection_Guard & | lhs, | |
const TAO_Transport * | rhs | |||
) | [friend] |
Definition at line 147 of file Transport_Selection_Guard.h.
{
return lhs.curr_ != rhs;
}
bool operator!= | ( | const TAO_Transport * | lhs, | |
const Transport_Selection_Guard & | rhs | |||
) | [friend] |
Definition at line 154 of file Transport_Selection_Guard.h.
{
return lhs != rhs.curr_;
}
bool operator!= | ( | const U * | lhs, | |
const Transport_Selection_Guard & | rhs | |||
) | [friend] |
Definition at line 182 of file Transport_Selection_Guard.h.
{
return lhs != rhs.curr_;
}
bool operator!= | ( | const Transport_Selection_Guard & | lhs, | |
const U * | rhs | |||
) | [friend] |
Definition at line 175 of file Transport_Selection_Guard.h.
{
return lhs.curr_ != rhs;
}
bool operator== | ( | const Transport_Selection_Guard & | lhs, | |
const U * | rhs | |||
) | [friend] |
Definition at line 161 of file Transport_Selection_Guard.h.
{
return lhs.curr_ == rhs;
}
bool operator== | ( | const TAO_Transport * | lhs, | |
const Transport_Selection_Guard & | rhs | |||
) | [friend] |
Definition at line 140 of file Transport_Selection_Guard.h.
{
return lhs == rhs.curr_;
}
bool operator== | ( | const U * | lhs, | |
const Transport_Selection_Guard & | rhs | |||
) | [friend] |
Definition at line 168 of file Transport_Selection_Guard.h.
{
return lhs == rhs.curr_;
}
bool operator== | ( | const Transport_Selection_Guard & | lhs, | |
const TAO_Transport * | rhs | |||
) | [friend] |
Definition at line 133 of file Transport_Selection_Guard.h.
{
return lhs.curr_ == rhs;
}
TAO_Transport* TAO::Transport_Selection_Guard::curr_ [private] |
The "real" Transport, i.e. the one selected at present.
Definition at line 123 of file Transport_Selection_Guard.h.
Transport_Selection_Guard* TAO::Transport_Selection_Guard::prev_ [private] |
This is pointing to the guard that was active prior to instantiating us.
Definition at line 118 of file Transport_Selection_Guard.h.