Trader_T.cpp

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

Generated on Tue Feb 2 17:49:26 2010 for TAO_CosTrader by  doxygen 1.4.7