Trader_T.cpp

Go to the documentation of this file.
00001 // Trader_T.cpp,v 1.44 2006/03/14 06:14:35 jtc Exp
00002 
00003 #ifndef TAO_TRADER_CPP
00004 #define TAO_TRADER_CPP
00005 
00006 #include "orbsvcs/Trader/Trader_T.h"
00007 #include "orbsvcs/Trader/Trader_Interfaces.h"
00008 
00009 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00010 
00011 template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE>
00012 TAO_Trader<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>::
00013 TAO_Trader (TAO_Trader_Base::Trader_Components components)
00014 {
00015   ACE_DECLARE_NEW_CORBA_ENV;
00016 
00017   // @@ Seth, we need a way to propagate the exception out.  This will
00018   // not work on platforms using environment variable.
00019   for (int i = LOOKUP_IF; i <= LINK_IF; i++)
00020     this->ifs_[i] = 0;
00021 
00022   if (ACE_BIT_ENABLED (components, LOOKUP))
00023     {
00024       TAO_Lookup<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>* lookup;
00025 
00026       ACE_NEW (lookup,
00027                (TAO_Lookup<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>) (*this));
00028 
00029       this->trading_components ().lookup_if (lookup->_this (ACE_ENV_SINGLE_ARG_PARAMETER));
00030       ACE_CHECK;
00031       lookup->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
00032       ACE_CHECK;
00033 
00034       this->ifs_[LOOKUP_IF] = lookup;
00035     }
00036   if (ACE_BIT_ENABLED (components, REGISTER))
00037     {
00038       TAO_Register<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>* reg;
00039 
00040       ACE_NEW (reg,
00041                (TAO_Register<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>) (*this));
00042 
00043       this->trading_components ().register_if (reg->_this (ACE_ENV_SINGLE_ARG_PARAMETER));
00044       ACE_CHECK;
00045       reg->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
00046       ACE_CHECK;
00047 
00048       this->ifs_[REGISTER_IF] = reg;
00049     }
00050   if (ACE_BIT_ENABLED (components, ADMIN))
00051     {
00052       TAO_Admin<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>* admin;
00053 
00054       ACE_NEW (admin,
00055                (TAO_Admin<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>) (*this));
00056 
00057       this->trading_components ().admin_if (admin->_this (ACE_ENV_SINGLE_ARG_PARAMETER));
00058       ACE_CHECK;
00059       admin->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
00060       ACE_CHECK;
00061 
00062       this->ifs_[ADMIN_IF] = admin;
00063     }
00064   if (ACE_BIT_ENABLED (components, PROXY))
00065     {
00066       TAO_Proxy<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>* proxy;
00067 
00068       ACE_NEW (proxy,
00069                (TAO_Proxy<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>) (*this));
00070 
00071       this->trading_components ().proxy_if (proxy->_this (ACE_ENV_SINGLE_ARG_PARAMETER));
00072       ACE_CHECK;
00073       proxy->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
00074       ACE_CHECK;
00075 
00076       this->ifs_[PROXY_IF] = proxy;
00077     }
00078   if (ACE_BIT_ENABLED (components, LINK))
00079     {
00080       TAO_Link<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>* link;
00081 
00082       ACE_NEW (link,
00083                (TAO_Link<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>) (*this));
00084 
00085       this->trading_components ().link_if (link->_this (ACE_ENV_SINGLE_ARG_PARAMETER));
00086       ACE_CHECK;
00087       link->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
00088       ACE_CHECK;
00089 
00090       this->ifs_[LINK_IF] = link;
00091     }
00092 }
00093 
00094 template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE>
00095 TAO_Trader<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>::~TAO_Trader (void)
00096 {
00097   // Remove Trading Components from POA
00098 
00099   ACE_DECLARE_NEW_CORBA_ENV;
00100 
00101   for (int i = LOOKUP_IF; i <= LINK_IF; i++)
00102     {
00103       if (this->ifs_[i] != 0)
00104         {
00105           ACE_TRY
00106             {
00107               PortableServer::POA_var poa =
00108                 this->ifs_[i]->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
00109               ACE_TRY_CHECK;
00110 
00111               PortableServer::ObjectId_var id =
00112                 poa->servant_to_id (this->ifs_[i] ACE_ENV_ARG_PARAMETER);
00113               ACE_TRY_CHECK;
00114 
00115               poa->deactivate_object (id.in () ACE_ENV_ARG_PARAMETER);
00116               ACE_TRY_CHECK;
00117             }
00118           ACE_CATCHANY
00119             {
00120               // Don't let exceptions propagate out of this call since
00121               // it's the destructor!
00122             }
00123           ACE_ENDTRY;
00124         }
00125     }
00126 }
00127 
00128 template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE>
00129 TAO_Offer_Database<MAP_LOCK_TYPE>&
00130 TAO_Trader<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>::offer_database (void)
00131 {
00132   return this->offer_database_;
00133 }
00134 
00135 template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE> ACE_Lock &
00136 TAO_Trader<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>::lock (void)
00137 {
00138   return this->lock_;
00139 }
00140 
00141 template <class IF>
00142 TAO_Trader_Components<IF>::
00143 TAO_Trader_Components (const TAO_Trading_Components_i& comps)
00144   : comps_ (comps)
00145 {
00146 }
00147 
00148 template <class IF> CosTrading::Lookup_ptr
00149 TAO_Trader_Components<IF>::lookup_if (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00150   ACE_THROW_SPEC ((CORBA::SystemException))
00151 {
00152   return CosTrading::Lookup::_duplicate (this->comps_.lookup_if ());
00153 }
00154 
00155 template <class IF> CosTrading::Register_ptr
00156 TAO_Trader_Components<IF>::register_if (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00157   ACE_THROW_SPEC ((CORBA::SystemException))
00158 {
00159   return CosTrading::Register::_duplicate (this->comps_.register_if ());
00160 }
00161 
00162 template <class IF> CosTrading::Admin_ptr
00163 TAO_Trader_Components<IF>::admin_if (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00164   ACE_THROW_SPEC ((CORBA::SystemException))
00165 {
00166   return CosTrading::Admin::_duplicate (this->comps_.admin_if ());
00167 }
00168 
00169 template <class IF> CosTrading::Proxy_ptr
00170 TAO_Trader_Components<IF>::proxy_if (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00171   ACE_THROW_SPEC ((CORBA::SystemException))
00172 {
00173   return CosTrading::Proxy::_duplicate (this->comps_.proxy_if ());
00174 }
00175 
00176 template <class IF> CosTrading::Link_ptr
00177 TAO_Trader_Components<IF>::link_if (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00178   ACE_THROW_SPEC ((CORBA::SystemException))
00179 {
00180   return CosTrading::Link::_duplicate (this->comps_.link_if ());
00181 }
00182 template <class IF>
00183 TAO_Support_Attributes<IF>::
00184 TAO_Support_Attributes (const TAO_Support_Attributes_i& attrs)
00185   : attrs_ (attrs)
00186 {
00187 }
00188 
00189 template <class IF> CORBA::Boolean
00190 TAO_Support_Attributes<IF>::supports_modifiable_properties (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00191   ACE_THROW_SPEC ((CORBA::SystemException))
00192 {
00193   return this->attrs_.supports_modifiable_properties ();
00194 }
00195 
00196 template <class IF> CORBA::Boolean
00197 TAO_Support_Attributes<IF>::supports_dynamic_properties (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00198   ACE_THROW_SPEC ((CORBA::SystemException))
00199 {
00200   return this->attrs_.supports_dynamic_properties ();
00201 }
00202 
00203 template <class IF> CORBA::Boolean
00204 TAO_Support_Attributes<IF>::supports_proxy_offers (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00205   ACE_THROW_SPEC ((CORBA::SystemException))
00206 {
00207   return this->attrs_.supports_proxy_offers ();
00208 }
00209 
00210 template <class IF> CosTrading::TypeRepository_ptr
00211 TAO_Support_Attributes<IF>::type_repos (ACE_ENV_SINGLE_ARG_DECL_NOT_USED )
00212   ACE_THROW_SPEC ((CORBA::SystemException))
00213 {
00214   return CosTrading::TypeRepository::_duplicate (this->attrs_.type_repos ());
00215 }
00216 
00217 template <class IF>
00218 TAO_Import_Attributes<IF>::
00219 TAO_Import_Attributes (const TAO_Import_Attributes_i& attrs)
00220   : attrs_ (attrs)
00221 {
00222 }
00223 
00224 template <class IF> CORBA::ULong
00225 TAO_Import_Attributes<IF>::def_search_card (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00226   ACE_THROW_SPEC ((CORBA::SystemException))
00227 {
00228   return this->attrs_.def_search_card ();
00229 }
00230 
00231 template <class IF> CORBA::ULong
00232 TAO_Import_Attributes<IF>::max_search_card (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00233   ACE_THROW_SPEC ((CORBA::SystemException))
00234 {
00235   return this->attrs_.max_search_card ();
00236 }
00237 
00238 template <class IF> CORBA::ULong
00239 TAO_Import_Attributes<IF>::def_match_card (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00240   ACE_THROW_SPEC ((CORBA::SystemException))
00241 {
00242   return this->attrs_.def_match_card ();
00243 }
00244 
00245 template <class IF> CORBA::ULong
00246 TAO_Import_Attributes<IF>::max_match_card (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00247   ACE_THROW_SPEC ((CORBA::SystemException))
00248 {
00249   return this->attrs_.max_match_card ();
00250 }
00251 
00252 template <class IF> CORBA::ULong
00253 TAO_Import_Attributes<IF>::def_return_card (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00254   ACE_THROW_SPEC ((CORBA::SystemException))
00255 {
00256   return this->attrs_.def_return_card ();
00257 }
00258 
00259 template <class IF> CORBA::ULong
00260 TAO_Import_Attributes<IF>::max_return_card (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00261   ACE_THROW_SPEC ((CORBA::SystemException))
00262 {
00263   return this->attrs_.max_return_card ();
00264 }
00265 
00266 template <class IF> CORBA::ULong
00267 TAO_Import_Attributes<IF>::max_list (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00268   ACE_THROW_SPEC ((CORBA::SystemException))
00269 {
00270   return this->attrs_.max_list ();
00271 }
00272 
00273 template <class IF> CORBA::ULong
00274 TAO_Import_Attributes<IF>::def_hop_count (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00275   ACE_THROW_SPEC ((CORBA::SystemException))
00276 {
00277   return this->attrs_.def_hop_count ();
00278 }
00279 
00280 template <class IF> CORBA::ULong
00281 TAO_Import_Attributes<IF>::max_hop_count (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00282   ACE_THROW_SPEC ((CORBA::SystemException))
00283 {
00284   return this->attrs_.max_hop_count ();
00285 }
00286 
00287 template <class IF> CosTrading::FollowOption
00288 TAO_Import_Attributes<IF>::def_follow_policy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00289   ACE_THROW_SPEC ((CORBA::SystemException))
00290 {
00291   return this->attrs_.def_follow_policy ();
00292 }
00293 
00294 template <class IF> CosTrading::FollowOption
00295 TAO_Import_Attributes<IF>::max_follow_policy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00296   ACE_THROW_SPEC ((CORBA::SystemException))
00297 {
00298   return this->attrs_.max_follow_policy ();
00299 }
00300 
00301 template <class IF>
00302 TAO_Link_Attributes<IF>::
00303 TAO_Link_Attributes (const TAO_Link_Attributes_i& attrs)
00304   : attrs_ (attrs)
00305 {
00306 }
00307 
00308 template <class IF> CosTrading::FollowOption
00309 TAO_Link_Attributes<IF>::max_link_follow_policy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00310   ACE_THROW_SPEC ((CORBA::SystemException))
00311 {
00312   return this->attrs_.max_link_follow_policy ();
00313 }
00314 
00315 template <class ELEMENT_TYPE> int
00316 TAO_Element_Equal<ELEMENT_TYPE>::
00317 operator () (TAO_DynSequence_i& dyn_any,
00318              const ELEMENT_TYPE& element)
00319 {
00320   return 1;
00321 }
00322 
00323 TAO_END_VERSIONED_NAMESPACE_DECL
00324 
00325 #endif /* TAO_TRADER_CPP */

Generated on Thu Nov 9 13:59:58 2006 for TAO_CosTrader by doxygen 1.3.6