4 * @file Current_Impl.cpp
6 * @author Iliyan Jeliazkov <iliyan@ociweb.com>
9 #include "tao/Transport.h"
11 #if TAO_HAS_TRANSPORT_CURRENT == 1
13 #include "tao/Transport_Selection_Guard.h"
14 #include "tao/TransportCurrent/Current_Loader.h"
15 #include "tao/TransportCurrent/Current_Impl.h"
17 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
24 Current_Impl::Current_Impl (TAO_ORB_Core
* core
, size_t tss_slot_id
)
26 , tss_slot_id_ (tss_slot_id
)
31 Current_Impl::~Current_Impl ()
35 /// Obtains the current transport. Throws a NoContext exception
36 /// if, there was no "current" transport selected on the current
39 Current_Impl::transport () const
41 Transport_Selection_Guard
* topguard
=
42 Transport_Selection_Guard::current (this->core_
, this->tss_slot_id_
);
47 return topguard
->get ();
50 static const TAO::Transport::Stats dummy_transport_stats
;
52 /// Obtains the current transport's stats
53 const TAO::Transport::Stats
*
54 Current_Impl::transport_stats () const
56 static const TAO::Transport::Stats dummy
;
58 const TAO_Transport
* t
= this->transport ();
60 return (t
==0 || t
->stats () == 0) ? &dummy_transport_stats
: t
->stats ();
63 CORBA::Long
Current_Impl::id ()
65 const TAO_Transport
* t
= this->transport ();
67 return (t
==0) ? 0 : static_cast<CORBA::Long
> (t
->id ());
70 CounterT
Current_Impl::bytes_sent ()
72 return transport_stats ()->bytes_sent ();
75 CounterT
Current_Impl::bytes_received ()
77 return transport_stats ()->bytes_received ();
80 CounterT
Current_Impl::messages_sent ()
82 return transport_stats ()->messages_sent ();
85 CounterT
Current_Impl::messages_received ()
87 return transport_stats ()->messages_received ();
90 TimeBase::TimeT
Current_Impl::open_since ()
92 TimeBase::TimeT msecs
= 0;
93 transport_stats ()->opened_since ().msec (msecs
);
101 TAO_END_VERSIONED_NAMESPACE_DECL
103 #endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */