00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "tao/Transport.h"
00013
00014 #if TAO_HAS_TRANSPORT_CURRENT == 1
00015
00016 #include "tao/Transport_Selection_Guard.h"
00017 #include "tao/TransportCurrent/Current_Loader.h"
00018 #include "tao/TransportCurrent/Current_Impl.h"
00019
00020 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00021
00022
00023 namespace TAO
00024 {
00025 namespace Transport
00026 {
00027
00028
00029 Current_Impl::Current_Impl (TAO_ORB_Core* core, size_t tss_slot_id)
00030 : core_ (core)
00031 , tss_slot_id_ (tss_slot_id)
00032 {
00033 }
00034
00035
00036 Current_Impl::~Current_Impl (void)
00037 {
00038 }
00039
00040
00041
00042
00043 const TAO_Transport*
00044 Current_Impl::transport (void) const
00045 {
00046 Transport_Selection_Guard* topguard =
00047 Transport_Selection_Guard::current (this->core_, this->tss_slot_id_);
00048
00049 if (topguard == 0)
00050 throw NoContext();
00051
00052 return topguard->get ();
00053 }
00054
00055
00056 const TAO::Transport::Stats*
00057 Current_Impl::transport_stats (void) const
00058 {
00059 static const TAO::Transport::Stats dummy;
00060
00061 const TAO_Transport* t = this->transport ();
00062
00063 return (t==0 || t->stats () == 0) ? &dummy : t->stats ();
00064 }
00065
00066 CORBA::Long Current_Impl::id (void)
00067 {
00068 const TAO_Transport* t = this->transport ();
00069
00070 return (t==0) ? 0 : t->id ();
00071 }
00072
00073 CounterT Current_Impl::bytes_sent (void)
00074 {
00075 return transport_stats ()->bytes_sent ();
00076 }
00077
00078 CounterT Current_Impl::bytes_received (void)
00079 {
00080 return transport_stats ()->bytes_received ();
00081 }
00082
00083 CounterT Current_Impl::messages_sent (void)
00084 {
00085 return transport_stats ()->messages_sent ();
00086 }
00087
00088 CounterT Current_Impl::messages_received (void)
00089 {
00090 return transport_stats ()->messages_received ();
00091 }
00092
00093 TimeBase::TimeT Current_Impl::open_since (void)
00094 {
00095 TimeBase::TimeT msecs = 0;
00096 transport_stats ()->opened_since ().msec (msecs);
00097 return msecs;
00098 }
00099
00100 }
00101
00102 }
00103
00104 TAO_END_VERSIONED_NAMESPACE_DECL
00105
00106 #endif
00107