Transport_Selection_Guard.cpp

Go to the documentation of this file.
00001 // $Id: Transport_Selection_Guard.cpp 79335 2007-08-14 10:26:42Z johnnyw $
00002 
00003 #include "tao/Transport_Selection_Guard.h"
00004 #include "tao/TSS_Resources.h"
00005 
00006 ACE_RCSID (tao,
00007            Transport_Selection_Guard,
00008            "$Id: Transport_Selection_Guard.cpp 79335 2007-08-14 10:26:42Z johnnyw $")
00009 
00010 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00011 
00012 namespace TAO
00013 {
00014 
00015   Transport_Selection_Guard*
00016   Transport_Selection_Guard::current (TAO_ORB_Core* core, size_t tss_slot_id)
00017   {
00018     // @NOTE: (Iliyan) Started making this method aware of the core
00019     // and the tss slot that correspond to the "current" transport,
00020     // influenced by a general design preference to keep things
00021     // local. The idea was to make the current TSG part of the TSS
00022     // storage for a specific ORB Core, as opposed to using the global
00023     // TSS Resources. However, it really doesn't offer any benefit to
00024     // store a Transport pointer locally, for each ORB. There is
00025     // always only one current Transport per thread. Period. The
00026     // number of ORB Core instances in existence does not change that
00027     // fact, so keeping a separate pointer would have been an
00028     // over-kill.
00029     ACE_UNUSED_ARG (core);
00030     ACE_UNUSED_ARG (tss_slot_id);
00031 
00032 #if TAO_HAS_TRANSPORT_CURRENT == 1
00033 
00034     return TAO_TSS_Resources::instance ()->tsg_;
00035 
00036 #else  /* TAO_HAS_TRANSPORT_CURRENT != 1 */
00037 
00038     return 0;
00039 
00040 #endif  /* TAO_HAS_TRANSPORT_CURRENT == 1 */
00041   }
00042 
00043 
00044 
00045   /// Ctor
00046   Transport_Selection_Guard::Transport_Selection_Guard (TAO_Transport* t)
00047     :
00048 #if TAO_HAS_TRANSPORT_CURRENT == 1
00049 
00050     prev_ (TAO_TSS_Resources::instance ()->tsg_)
00051     ,
00052 
00053 #endif  /* TAO_HAS_TRANSPORT_CURRENT == 1 */
00054     curr_ (t)
00055   {
00056 #if TAO_HAS_TRANSPORT_CURRENT == 1
00057 
00058     TAO_TSS_Resources::instance ()->tsg_ = this;
00059 
00060 #endif  /* TAO_HAS_TRANSPORT_CURRENT == 1 */
00061 
00062   }
00063 
00064   /// Dtor
00065   Transport_Selection_Guard::~Transport_Selection_Guard (void)
00066   {
00067 
00068 #if TAO_HAS_TRANSPORT_CURRENT == 1
00069 
00070     TAO_TSS_Resources::instance ()->tsg_ = prev_;
00071     this->prev_ = 0;
00072 
00073 #endif  /* TAO_HAS_TRANSPORT_CURRENT == 1 */
00074     this->curr_ = 0;
00075   }
00076 
00077 } /* namespace TAO */
00078 
00079 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:37:53 2010 for TAO by  doxygen 1.4.7