Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Strategies_T.i

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 // $Id: Strategies_T.i,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00003 
00004 template<class SVC_HANDLER> ASYS_INLINE
00005 ACE_Recycling_Strategy<SVC_HANDLER>::~ACE_Recycling_Strategy (void)
00006 {
00007 }
00008 
00009 template<class SVC_HANDLER> ASYS_INLINE int
00010 ACE_Recycling_Strategy<SVC_HANDLER>::assign_recycler (SVC_HANDLER *svc_handler,
00011                                                       ACE_Connection_Recycling_Strategy *recycler,
00012                                                       const void *recycling_act)
00013 {
00014   svc_handler->recycler (recycler, recycling_act);
00015   return 0;
00016 }
00017 
00018 template<class SVC_HANDLER> ASYS_INLINE int
00019 ACE_Recycling_Strategy<SVC_HANDLER>::prepare_for_recycling (SVC_HANDLER *svc_handler)
00020 {
00021   return svc_handler->recycle ();
00022 }
00023 
00024 template <class SVC_HANDLER> ASYS_INLINE
00025 ACE_Singleton_Strategy<SVC_HANDLER>::ACE_Singleton_Strategy (SVC_HANDLER *sh,
00026                                                              ACE_Thread_Manager *tm)
00027   : svc_handler_ (0),
00028     delete_svc_handler_ (1)
00029 {
00030   ACE_TRACE ("ACE_Singleton_Strategy<SVC_HANDLER>::ACE_Singleton_Strategy");
00031   if (this->open (sh, tm) == -1)
00032     ACE_ERROR ((LM_ERROR,
00033                 ACE_LIB_TEXT ("%p\n"),
00034                 ACE_LIB_TEXT ("ACE_Singleton_Strategy")));
00035 }
00036 
00037 template <class SVC_HANDLER> ASYS_INLINE
00038 ACE_Singleton_Strategy<SVC_HANDLER>::~ACE_Singleton_Strategy (void)
00039 {
00040   ACE_TRACE ("ACE_Singleton_Strategy<SVC_HANDLER>::~ACE_Singleton_Strategy");
00041   if (this->delete_svc_handler_ != 0)
00042     delete this->svc_handler_;
00043 }
00044 
00045 // Create a Singleton SVC_HANDLER by always returning the same
00046 // SVC_HANDLER.
00047 
00048 template <class SVC_HANDLER> ASYS_INLINE int
00049 ACE_Singleton_Strategy<SVC_HANDLER>::make_svc_handler (SVC_HANDLER *&sh)
00050 {
00051   ACE_TRACE ("ACE_Singleton_Strategy<SVC_HANDLER>::make_svc_handler");
00052   sh = this->svc_handler_;
00053   return 0;
00054 }
00055 
00056 template <class SVC_HANDLER> ASYS_INLINE int
00057 ACE_Creation_Strategy<SVC_HANDLER>::open (ACE_Thread_Manager *thr_mgr,
00058                                           ACE_Reactor *reactor)
00059 {
00060   ACE_TRACE ("ACE_Creation_Strategy<SVC_HANDLER>::open");
00061   this->thr_mgr_ = thr_mgr;
00062   this->reactor_ = reactor;
00063   return 0;
00064 }
00065 
00066 template <class SVC_HANDLER> ASYS_INLINE
00067 ACE_Creation_Strategy<SVC_HANDLER>::ACE_Creation_Strategy (ACE_Thread_Manager *thr_mgr,
00068                                                            ACE_Reactor *reactor)
00069 {
00070   ACE_TRACE ("ACE_Creation_Strategy<SVC_HANDLER>::ACE_Creation_Strategy");
00071   if (this->open (thr_mgr, reactor) == -1)
00072     ACE_ERROR ((LM_ERROR,
00073                 ACE_LIB_TEXT ("%p\n"),
00074                 ACE_LIB_TEXT ("ACE_Creation_Strategy")));
00075 }
00076 
00077 // Default behavior is to make a new SVC_HANDLER, passing in the
00078 // Thread_Manager (if any).
00079 
00080 template <class SVC_HANDLER> ASYS_INLINE int
00081 ACE_Creation_Strategy<SVC_HANDLER>::make_svc_handler (SVC_HANDLER *&sh)
00082 {
00083   ACE_TRACE ("ACE_Creation_Strategy<SVC_HANDLER>::make_svc_handler");
00084 
00085   if (sh == 0)
00086     ACE_NEW_RETURN (sh, SVC_HANDLER (this->thr_mgr_), -1);
00087   sh->reactor (this->reactor_);
00088   return 0;
00089 }
00090 
00091 template <class SVC_HANDLER> ASYS_INLINE
00092 ACE_Creation_Strategy<SVC_HANDLER>::~ACE_Creation_Strategy (void)
00093 {
00094   ACE_TRACE ("ACE_Creation_Strategy<SVC_HANDLER>::~ACE_Creation_Strategy");
00095 }
00096 
00097 template <class SVC_HANDLER> ASYS_INLINE
00098 ACE_DLL_Strategy<SVC_HANDLER>::ACE_DLL_Strategy (const char dll_name[],
00099                                                  const char factory_function[],
00100                                                  const char svc_name[],
00101                                                  ACE_Service_Repository *svc_rep,
00102                                                  ACE_Thread_Manager *thr_mgr)
00103 {
00104   ACE_TRACE ("ACE_DLL_Strategy<SVC_HANDLER>::ACE_DLL_Strategy");
00105   if (this->open (dll_name,
00106                   factory_function,
00107                   svc_name,
00108                   svc_rep,
00109                   thr_mgr) == -1)
00110     ACE_ERROR ((LM_ERROR,
00111                 ACE_LIB_TEXT ("%p\n"),
00112                 ACE_LIB_TEXT ("open")));
00113 }
00114 
00115 template <class SVC_HANDLER> ASYS_INLINE
00116 ACE_DLL_Strategy<SVC_HANDLER>::ACE_DLL_Strategy (void)
00117 {
00118   ACE_TRACE ("ACE_DLL_Strategy<SVC_HANDLER>::ACE_DLL_Strategy");
00119 }
00120 
00121 template <class SVC_HANDLER> ASYS_INLINE
00122 ACE_Concurrency_Strategy<SVC_HANDLER>::ACE_Concurrency_Strategy (int flags)
00123   : flags_ (flags)
00124 {
00125   ACE_TRACE ("ACE_Concurrency_Strategy<SVC_HANDLER>::~ACE_Concurrency_Strategy");
00126 }
00127 
00128 template <class SVC_HANDLER> ASYS_INLINE
00129 ACE_Concurrency_Strategy<SVC_HANDLER>::~ACE_Concurrency_Strategy (void)
00130 {
00131   ACE_TRACE ("ACE_Concurrency_Strategy<SVC_HANDLER>::~ACE_Concurrency_Strategy");
00132 }
00133 
00134 template <class SVC_HANDLER> ASYS_INLINE
00135 ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy (ACE_Reactor *reactor,
00136                                                            ACE_Reactor_Mask mask,
00137                                                            int flags)
00138 {
00139   ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy");
00140 
00141   if (this->open (reactor,
00142                   mask,
00143                   flags) == -1)
00144     ACE_ERROR ((LM_ERROR,
00145                 ACE_LIB_TEXT ("%p\n"),
00146                 ACE_LIB_TEXT ("ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy")));
00147 }
00148 
00149 template <class SVC_HANDLER> ASYS_INLINE
00150 ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy (int flags)
00151   : ACE_Concurrency_Strategy<SVC_HANDLER> (flags),
00152     reactor_ (0),
00153     mask_ (ACE_Event_Handler::NULL_MASK)
00154 {
00155   ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy");
00156 }
00157 
00158 template <class SVC_HANDLER> ASYS_INLINE
00159 ACE_Reactive_Strategy<SVC_HANDLER>::~ACE_Reactive_Strategy (void)
00160 {
00161   ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::~ACE_Reactive_Strategy");
00162 }
00163 
00164 template <class SVC_HANDLER> ASYS_INLINE
00165 ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy (ACE_Thread_Manager *thr_mgr,
00166                                                        long thr_flags,
00167                                                        int n_threads,
00168                                                        int flags)
00169 {
00170   ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy");
00171 
00172   if (this->open (thr_mgr,
00173                   thr_flags,
00174                   n_threads,
00175                   flags) == -1)
00176     ACE_ERROR ((LM_ERROR,
00177                 ACE_LIB_TEXT ("%p\n"),
00178                 ACE_LIB_TEXT ("ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy")));
00179 }
00180 
00181 template <class SVC_HANDLER> ASYS_INLINE
00182 ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy (int flags)
00183   : ACE_Concurrency_Strategy<SVC_HANDLER> (flags),
00184     thr_mgr_ (0),
00185     thr_flags_ (0),
00186     n_threads_ (1)
00187 {
00188   ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy");
00189 }
00190 
00191 template <class SVC_HANDLER> ASYS_INLINE
00192 ACE_Thread_Strategy<SVC_HANDLER>::~ACE_Thread_Strategy (void)
00193 {
00194   ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::~ACE_Thread_Strategy");
00195 }
00196 
00197 template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> ASYS_INLINE
00198 ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Accept_Strategy (ACE_Reactor *reactor)
00199   : reactor_ (reactor)
00200 {
00201   ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Accept_Strategy");
00202 }
00203 
00204 template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> ASYS_INLINE ACE_HANDLE
00205 ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::get_handle (void) const
00206 {
00207   ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::get_handle");
00208   return this->peer_acceptor_.get_handle ();
00209 }
00210 
00211 template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> ASYS_INLINE ACE_PEER_ACCEPTOR &
00212 ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::acceptor (void) const
00213 {
00214   ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::acceptor");
00215   return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_;
00216 }
00217 
00218 template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> ASYS_INLINE
00219 ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::~ACE_Accept_Strategy (void)
00220 {
00221   ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::~ACE_Accept_Strategy");
00222 
00223   // Close the underlying acceptor.
00224   this->peer_acceptor_.close ();
00225 }
00226 
00227 template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> ASYS_INLINE ACE_PEER_CONNECTOR &
00228 ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connector (void) const
00229 {
00230   ACE_TRACE ("ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connector");
00231   return (ACE_PEER_CONNECTOR &) this->connector_;
00232 }
00233 
00234 template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> ASYS_INLINE
00235 ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::ACE_Connect_Strategy (void)
00236 {
00237   ACE_TRACE ("ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::ACE_Connect_Strategy");
00238 }
00239 
00240 template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> ASYS_INLINE
00241 ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::~ACE_Connect_Strategy (void)
00242 {
00243   ACE_TRACE ("ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::~ACE_Connect_Strategy");
00244 }
00245 
00246 template <class SVC_HANDLER> ASYS_INLINE
00247 ACE_Process_Strategy<SVC_HANDLER>::ACE_Process_Strategy (size_t n_processes,
00248                                                          ACE_Event_Handler *acceptor,
00249                                                          ACE_Reactor *reactor,
00250                                                          int avoid_zombies)
00251 {
00252   ACE_TRACE ("ACE_Process_Strategy<SVC_HANDLER>::ACE_Process_Strategy");
00253   if (this->open (n_processes,
00254                   acceptor,
00255                   reactor,
00256                   avoid_zombies) == -1)
00257     ACE_ERROR ((LM_ERROR,
00258                 ACE_LIB_TEXT ("%p\n"),
00259                 ACE_LIB_TEXT ("ACE_Process_Strategy")));
00260 }
00261 
00262 template <class SVC_HANDLER> ASYS_INLINE
00263 ACE_Process_Strategy<SVC_HANDLER>::~ACE_Process_Strategy (void)
00264 {
00265   ACE_TRACE ("ACE_Process_Strategy<SVC_HANDLER>::~ACE_Process_Strategy");
00266 }
00267 
00268 template <class SVC_HANDLER> ASYS_INLINE
00269 ACE_Scheduling_Strategy<SVC_HANDLER>::ACE_Scheduling_Strategy (SVC_HANDLER *)
00270 {
00271   ACE_TRACE ("ACE_Scheduling_Strategy<SVC_HANDLER>::ACE_Scheduling_Strategy");
00272 }
00273 
00274 template <class SVC_HANDLER> ASYS_INLINE
00275 ACE_Scheduling_Strategy<SVC_HANDLER>::~ACE_Scheduling_Strategy (void)
00276 {
00277   ACE_TRACE ("ACE_Scheduling_Strategy<SVC_HANDLER>::~ACE_Scheduling_Strategy");
00278 }
00279 
00280 template <class SVC_HANDLER> ASYS_INLINE int
00281 ACE_Scheduling_Strategy<SVC_HANDLER>::suspend (void)
00282 {
00283   ACE_TRACE ("ACE_Scheduling_Strategy<SVC_HANDLER>::suspend");
00284   return -1;
00285 }
00286 
00287 template <class SVC_HANDLER> ASYS_INLINE int
00288 ACE_Scheduling_Strategy<SVC_HANDLER>::resume (void)
00289 {
00290   ACE_TRACE ("ACE_Scheduling_Strategy<SVC_HANDLER>::resume");
00291   return -1;
00292 }
00293 
00294 template <class SVC_HANDLER> ASYS_INLINE
00295 ACE_Schedule_All_Reactive_Strategy<SVC_HANDLER>::ACE_Schedule_All_Reactive_Strategy
00296   (SVC_HANDLER *scheduler)
00297   : ACE_Scheduling_Strategy<SVC_HANDLER> (scheduler)
00298 {
00299   ACE_TRACE ("ACE_Schedule_All_Reactive_Strategy<SVC_HANDLER>::ACE_Schedule_All_Reactive_Strategy");
00300 
00301   if (scheduler == 0 || scheduler->reactor () == 0)
00302     this->reactor_ = ACE_Reactor::instance ();
00303   else
00304     this->reactor_ = scheduler->reactor ();
00305 }
00306 
00307 template <class SVC_HANDLER> ASYS_INLINE int
00308 ACE_Schedule_All_Reactive_Strategy<SVC_HANDLER>::suspend (void)
00309 {
00310   ACE_TRACE ("ACE_Schedule_All_Reactive_Strategy<SVC_HANDLER>::suspend");
00311   return this->reactor_->suspend_handlers ();
00312 }
00313 
00314 template <class SVC_HANDLER> ASYS_INLINE int
00315 ACE_Schedule_All_Reactive_Strategy<SVC_HANDLER>::resume (void)
00316 {
00317   ACE_TRACE ("ACE_Schedule_All_Reactive_Strategy<SVC_HANDLER>::resume");
00318   return this->reactor_->resume_handlers ();
00319 }
00320 
00321 template <class SVC_HANDLER> ASYS_INLINE
00322 ACE_Schedule_All_Threaded_Strategy<SVC_HANDLER>::ACE_Schedule_All_Threaded_Strategy
00323   (SVC_HANDLER *scheduler)
00324   : ACE_Scheduling_Strategy<SVC_HANDLER> (scheduler)
00325 {
00326   ACE_TRACE ("ACE_Schedule_All_Threaded_Strategy<SVC_HANDLER>::ACE_Schedule_All_Threaded_Strategy");
00327 
00328   if (scheduler == 0 || scheduler->thr_mgr () == 0)
00329     this->thr_mgr_ = ACE_Thread_Manager::instance ();
00330   else
00331     this->thr_mgr_ = scheduler->thr_mgr ();
00332 }
00333 
00334 template <class SVC_HANDLER> ASYS_INLINE int
00335 ACE_Schedule_All_Threaded_Strategy<SVC_HANDLER>::suspend (void)
00336 {
00337   ACE_TRACE ("ACE_Schedule_All_Threaded_Strategy<SVC_HANDLER>::suspend");
00338   return this->thr_mgr_->suspend_all ();
00339 }
00340 
00341 template <class SVC_HANDLER> ASYS_INLINE int
00342 ACE_Schedule_All_Threaded_Strategy<SVC_HANDLER>::resume (void)
00343 {
00344   ACE_TRACE ("ACE_Schedule_All_Threaded_Strategy<SVC_HANDLER>::resume");
00345   return this->thr_mgr_->resume_all ();
00346 }
00347 
00348 template <class T> ASYS_INLINE
00349 ACE_Refcounted_Hash_Recyclable<T>::ACE_Refcounted_Hash_Recyclable (void)
00350   : ACE_Refcountable (0),
00351     ACE_Hashable (),
00352     ACE_Recyclable (ACE_RECYCLABLE_UNKNOWN),
00353     t_ ()
00354 {
00355 }
00356 
00357 template <class T> ASYS_INLINE
00358 ACE_Refcounted_Hash_Recyclable<T>::ACE_Refcounted_Hash_Recyclable (const T &t,
00359                                                                    int refcount,
00360                                                                    ACE_Recyclable_State state)
00361   : ACE_Refcountable (refcount),
00362     ACE_Hashable (),
00363     ACE_Recyclable (state),
00364     t_ (t)
00365 {
00366 }
00367 
00368 template <class T> ASYS_INLINE
00369 ACE_Refcounted_Hash_Recyclable<T>::~ACE_Refcounted_Hash_Recyclable (void)
00370 {
00371 }
00372 
00373 template <class T> ASYS_INLINE u_long
00374 ACE_Refcounted_Hash_Recyclable<T>::hash_i (void) const
00375 {
00376   return this->t_.hash ();
00377 }
00378 
00379 template <class T> ASYS_INLINE T &
00380 ACE_Refcounted_Hash_Recyclable<T>::subject (void)
00381 {
00382   return this->t_;
00383 }
00384 
00385 template <class T> ASYS_INLINE int
00386 ACE_Refcounted_Hash_Recyclable<T>::operator== (const ACE_Refcounted_Hash_Recyclable<T> &rhs) const
00387 {
00388   return this->recycle_state () == rhs.recycle_state () &&
00389          this->t_ == rhs.t_;
00390 }
00391 
00392 template <class T> ASYS_INLINE int
00393 ACE_Refcounted_Hash_Recyclable<T>::operator!= (const ACE_Refcounted_Hash_Recyclable<T> &rhs) const
00394 {
00395   return !this->operator== (rhs);
00396 }
00397 
00398 template <class SVC_HANDLER> ASYS_INLINE int
00399 ACE_NOOP_Creation_Strategy<SVC_HANDLER>::make_svc_handler (SVC_HANDLER *&)
00400 {
00401   ACE_TRACE ("ACE_NOOP_Creation_Strategy<SVC_HANDLER>::make_svc_handler");
00402   return 0;
00403 }
00404 
00405 template <class SVC_HANDLER> ASYS_INLINE int
00406 ACE_NOOP_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *,
00407                                                                   void *)
00408 {
00409   ACE_TRACE ("ACE_NOOP_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler");
00410   return 0;
00411 }
00412 
00413 template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX> ASYS_INLINE int
00414 ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::make_svc_handler
00415   (SVC_HANDLER *&sh)
00416 {
00417   return this->creation_strategy_->make_svc_handler (sh);
00418 }
00419 
00420 template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX> ASYS_INLINE int
00421 ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::activate_svc_handler
00422   (SVC_HANDLER *svc_handler)
00423 {
00424   return this->concurrency_strategy_->activate_svc_handler (svc_handler);
00425 }
00426 
00427 template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX> ASYS_INLINE int
00428 ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::assign_recycler
00429   (SVC_HANDLER *svc_handler,
00430    ACE_Connection_Recycling_Strategy *recycler,
00431    const void *recycling_act)
00432 {
00433   return this->recycling_strategy_->assign_recycler (svc_handler,
00434                                                      recycler,
00435                                                      recycling_act);
00436 }
00437 
00438 template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX> ASYS_INLINE int
00439 ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::prepare_for_recycling
00440   (SVC_HANDLER *svc_handler)
00441 {
00442   return this->recycling_strategy_->prepare_for_recycling (svc_handler);
00443 }

Generated on Mon Jun 16 11:21:29 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002