00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef TAO_TRANSPORT_SELECTION_GUARD_H
00014 #define TAO_TRANSPORT_SELECTION_GUARD_H
00015
00016 #include "ace/pre.h"
00017
00018 #include "tao/TAO_Export.h"
00019
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif
00023
00024 #include "tao/orbconf.h"
00025
00026 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00027
00028
00029 class TAO_Transport;
00030 class TAO_ORB_Core;
00031
00032 namespace TAO
00033 {
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 class TAO_Export Transport_Selection_Guard
00059 {
00060 public:
00061
00062 static Transport_Selection_Guard* current (TAO_ORB_Core* core,
00063 size_t tss_slot_id);
00064
00065 public:
00066
00067
00068 Transport_Selection_Guard (TAO_Transport* t);
00069
00070
00071 ~Transport_Selection_Guard (void);
00072
00073
00074 TAO_Transport* operator-> (void) const
00075 {
00076 return this->get ();
00077 };
00078
00079
00080 TAO_Transport& operator* (void) const
00081 {
00082 return *this->get ();
00083 };
00084
00085
00086 TAO_Transport* get (void) const
00087 {
00088 return this->curr_;
00089 };
00090
00091
00092 Transport_Selection_Guard& set (TAO_Transport* t)
00093 {
00094 this->curr_ = t;
00095 return *this;
00096 };
00097
00098 Transport_Selection_Guard& operator=(const Transport_Selection_Guard& rhs) {
00099 #if TAO_HAS_TRANSPORT_CURRENT == 1
00100 prev_ = rhs.prev_;
00101 #endif
00102 curr_ = rhs.curr_;
00103 return *this;
00104 }
00105
00106
00107 private:
00108 ACE_UNIMPLEMENTED_FUNC (Transport_Selection_Guard (const Transport_Selection_Guard&))
00109
00110 #if TAO_HAS_TRANSPORT_CURRENT == 1
00111
00112
00113
00114
00115 Transport_Selection_Guard* prev_;
00116
00117 #endif
00118
00119
00120 TAO_Transport* curr_;
00121
00122
00123 bool
00124 operator! () const
00125 {
00126 return curr_ == 0;
00127 }
00128
00129 inline friend bool
00130 operator== (const Transport_Selection_Guard& lhs,
00131 const TAO_Transport* rhs)
00132 {
00133 return lhs.curr_ == rhs;
00134 }
00135
00136 inline friend bool
00137 operator== (const TAO_Transport* lhs,
00138 const Transport_Selection_Guard& rhs)
00139 {
00140 return lhs == rhs.curr_;
00141 }
00142
00143 inline friend bool
00144 operator!= (const Transport_Selection_Guard& lhs,
00145 const TAO_Transport* rhs)
00146 {
00147 return lhs.curr_ != rhs;
00148 }
00149
00150 inline friend bool
00151 operator!= (const TAO_Transport* lhs,
00152 const Transport_Selection_Guard& rhs)
00153 {
00154 return lhs != rhs.curr_;
00155 }
00156
00157 template <class U> inline friend bool
00158 operator== (const Transport_Selection_Guard& lhs,
00159 const U* rhs)
00160 {
00161 return lhs.curr_ == rhs;
00162 }
00163
00164 template <class U> inline friend bool
00165 operator== (const U* lhs,
00166 const Transport_Selection_Guard& rhs)
00167 {
00168 return lhs == rhs.curr_;
00169 }
00170
00171 template <class U> inline friend bool
00172 operator!= (const Transport_Selection_Guard& lhs,
00173 const U* rhs)
00174 {
00175 return lhs.curr_ != rhs;
00176 }
00177
00178 template <class U> inline friend bool
00179 operator!= (const U* lhs,
00180 const Transport_Selection_Guard& rhs)
00181 {
00182 return lhs != rhs.curr_;
00183 }
00184
00185 };
00186
00187 }
00188
00189
00190
00191
00192 TAO_END_VERSIONED_NAMESPACE_DECL
00193
00194 #include "ace/post.h"
00195
00196 #endif