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

Asynch_IO.cpp

Go to the documentation of this file.
00001 #include "ace_pch.h"
00002 // $Id: Asynch_IO.cpp,v 1.1.1.4.2.1 2003/03/13 19:44:20 chad Exp $
00003 
00004 #include "ace/Asynch_IO.h"
00005 
00006 ACE_RCSID(ace, Asynch_IO, "$Id: Asynch_IO.cpp,v 1.1.1.4.2.1 2003/03/13 19:44:20 chad Exp $")
00007 
00008 #if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))
00009 // This only works on platforms with Asynchronous IO
00010 
00011 #include "ace/Proactor.h"
00012 #include "ace/Message_Block.h"
00013 #include "ace/INET_Addr.h"
00014 #include "ace/Asynch_IO_Impl.h"
00015 
00016 size_t
00017 ACE_Asynch_Result::bytes_transferred (void) const
00018 {
00019   return this->implementation ()->bytes_transferred ();
00020 }
00021 
00022 const void *
00023 ACE_Asynch_Result::act (void) const
00024 {
00025   return this->implementation ()->act ();
00026 }
00027 
00028 int
00029 ACE_Asynch_Result::success (void) const
00030 {
00031   return this->implementation ()->success ();
00032 }
00033 
00034 const void *
00035 ACE_Asynch_Result::completion_key (void) const
00036 {
00037   return this->implementation ()->completion_key ();
00038 }
00039 
00040 u_long
00041 ACE_Asynch_Result::error (void) const
00042 {
00043   return this->implementation ()->error ();
00044 }
00045 
00046 ACE_HANDLE
00047 ACE_Asynch_Result::event (void) const
00048 {
00049   return this->implementation ()->event ();
00050 }
00051 
00052 u_long
00053 ACE_Asynch_Result::offset (void) const
00054 {
00055   return this->implementation ()->offset ();
00056 }
00057 
00058 u_long
00059 ACE_Asynch_Result::offset_high (void) const
00060 {
00061   return this->implementation ()->offset_high ();
00062 }
00063 
00064 int
00065 ACE_Asynch_Result::priority (void) const
00066 {
00067   return this->implementation ()->priority ();
00068 }
00069 
00070 int
00071 ACE_Asynch_Result::signal_number (void) const
00072 {
00073   return this->implementation ()->signal_number ();
00074 }
00075 
00076 ACE_Asynch_Result::ACE_Asynch_Result (ACE_Asynch_Result_Impl *implementation)
00077   : implementation_ (implementation)
00078 {
00079 }
00080 
00081 ACE_Asynch_Result::~ACE_Asynch_Result (void)
00082 {
00083   // Proactor deletes the implementation when the <complete> finishes.  
00084 }
00085 
00086 ACE_Asynch_Result_Impl *
00087 ACE_Asynch_Result::implementation (void) const
00088 {
00089   return this->implementation_;
00090 }
00091 
00092 // *********************************************************************
00093 
00094 int
00095 ACE_Asynch_Operation::open (ACE_Handler &handler,
00096                             ACE_HANDLE handle,
00097                             const void *completion_key,
00098                             ACE_Proactor *proactor)
00099 {
00100   return this->implementation ()->open (handler,
00101                                         handle,
00102                                         completion_key,
00103                                         proactor);
00104 }
00105 
00106 int
00107 ACE_Asynch_Operation::cancel (void)
00108 {
00109   return this->implementation ()->cancel ();
00110 }
00111 
00112 ACE_Proactor *
00113 ACE_Asynch_Operation::proactor (void) const
00114 {
00115   return this->implementation ()->proactor ();
00116 }
00117 
00118 ACE_Asynch_Operation_Impl *
00119 ACE_Asynch_Operation::implementation (void) const
00120 {
00121   return this->implementation_;
00122 }
00123 
00124 ACE_Asynch_Operation::ACE_Asynch_Operation (void)
00125   : implementation_ (0)
00126 {
00127 }
00128 
00129 ACE_Asynch_Operation::~ACE_Asynch_Operation (void)
00130 {
00131   delete this->implementation_;
00132   this->implementation_ = 0;
00133 }
00134 
00135 void
00136 ACE_Asynch_Operation::implementation (ACE_Asynch_Operation_Impl *implementation)
00137 {
00138   this->implementation_ = implementation;
00139 }
00140 
00141 ACE_Proactor *
00142 ACE_Asynch_Operation::get_proactor (ACE_Proactor *user_proactor,
00143                                     ACE_Handler &handler) const
00144 {
00145   if (user_proactor == 0)
00146     {
00147       // Grab the singleton proactor if <handler->proactor> is zero
00148       user_proactor = handler.proactor ();
00149       if (user_proactor == 0)
00150         user_proactor = ACE_Proactor::instance ();
00151     }
00152 
00153   return user_proactor;
00154 }
00155 
00156 // ************************************************************
00157 
00158 ACE_Asynch_Read_Stream::ACE_Asynch_Read_Stream (void)
00159   : implementation_ (0)
00160 {
00161 }
00162 
00163 ACE_Asynch_Read_Stream::~ACE_Asynch_Read_Stream (void)
00164 {
00165 }
00166 
00167 int
00168 ACE_Asynch_Read_Stream::open (ACE_Handler &handler,
00169                               ACE_HANDLE handle,
00170                               const void *completion_key,
00171                               ACE_Proactor *proactor)
00172 {
00173   // Get a proactor for/from the user.
00174   proactor = this->get_proactor (proactor, handler);
00175 
00176   // Delete the old implementation.
00177   delete this->implementation_;
00178   this->implementation_ = 0;
00179 
00180   // Now let us get the implementation initialized.
00181   ACE_Asynch_Read_Stream_Impl *implementation = proactor->create_asynch_read_stream ();
00182   if (implementation == 0)
00183     return -1;
00184   
00185   // Set the implementation class
00186   this->implementation (implementation);
00187   
00188   // Call the <open> method of the base class. 
00189   return ACE_Asynch_Operation::open (handler,
00190                                      handle,
00191                                      completion_key,
00192                                      proactor);
00193 }
00194   
00195 int
00196 ACE_Asynch_Read_Stream::read (ACE_Message_Block &message_block,
00197                               size_t bytes_to_read,
00198                               const void *act,
00199                               int priority,
00200                               int signal_number)
00201 {
00202   return this->implementation ()->read (message_block,
00203                                         bytes_to_read,
00204                                         act,
00205                                         priority,
00206                                         signal_number);
00207 }
00208 
00209 #if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0))
00210 int
00211 ACE_Asynch_Read_Stream::readv (ACE_Message_Block &message_block,
00212                                size_t bytes_to_read,
00213                                const void *act,
00214                                int priority,
00215                                int signal_number)
00216 {
00217   return this->implementation ()->readv (message_block,
00218                                          bytes_to_read,
00219                                          act,
00220                                          priority,
00221                                          signal_number);
00222 }
00223 #endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) */
00224 
00225 ACE_Asynch_Read_Stream_Impl *
00226 ACE_Asynch_Read_Stream::implementation (void) const
00227 {
00228   return implementation_;
00229 }
00230 
00231 void
00232 ACE_Asynch_Read_Stream::implementation (ACE_Asynch_Read_Stream_Impl *implementation)
00233 {
00234   this->implementation_ = implementation;
00235 
00236   // Init the base class' implementation also.
00237   ACE_Asynch_Operation::implementation (this->implementation_);
00238 }
00239 
00240 // ************************************************************
00241 
00242 size_t
00243 ACE_Asynch_Read_Stream::Result::bytes_to_read (void) const
00244 {
00245   return this->implementation ()->bytes_to_read ();
00246 }
00247 
00248 ACE_Message_Block &
00249 ACE_Asynch_Read_Stream::Result::message_block (void) const
00250 {
00251   return this->implementation ()->message_block ();
00252 }
00253 
00254 ACE_HANDLE
00255 ACE_Asynch_Read_Stream::Result::handle (void) const
00256 {
00257   return this->implementation ()->handle ();
00258 }
00259 
00260 ACE_Asynch_Read_Stream::Result::Result (ACE_Asynch_Read_Stream_Result_Impl *implementation)
00261   : ACE_Asynch_Result (implementation), 
00262     implementation_ (implementation)
00263 {
00264 }
00265 
00266 ACE_Asynch_Read_Stream::Result::~Result (void)
00267 {
00268   // Proactor will delete the implementation after <complete> is
00269   // finished.
00270 }
00271 
00272 ACE_Asynch_Read_Stream_Result_Impl *
00273 ACE_Asynch_Read_Stream::Result::implementation (void) const
00274 {
00275   return this->implementation_;
00276 }
00277 
00278 // ***************************************************
00279 
00280 ACE_Asynch_Write_Stream::ACE_Asynch_Write_Stream (void)
00281   : implementation_ (0)
00282 {
00283 }
00284 
00285 ACE_Asynch_Write_Stream::~ACE_Asynch_Write_Stream (void)
00286 {
00287 }
00288 
00289 int
00290 ACE_Asynch_Write_Stream::open (ACE_Handler &handler,
00291                                ACE_HANDLE handle,
00292                                const void *completion_key,
00293                                ACE_Proactor *proactor)
00294 {
00295   // Get a proactor for/from the user.
00296   proactor = this->get_proactor (proactor, handler);
00297 
00298   // Delete the old implementation.
00299   delete this->implementation_;
00300   this->implementation_ = 0;
00301 
00302   // Now let us get the implementation initialized.
00303   ACE_Asynch_Write_Stream_Impl *implementation = proactor->create_asynch_write_stream ();
00304   if (implementation == 0)
00305     return -1;
00306   
00307   // Set the implementation class
00308   this->implementation (implementation);
00309   
00310   // Call the <open> method of the base class.
00311   return ACE_Asynch_Operation::open (handler,
00312                                      handle,
00313                                      completion_key,
00314                                      proactor);
00315 }
00316 
00317 int
00318 ACE_Asynch_Write_Stream::write (ACE_Message_Block &message_block,
00319                                 size_t bytes_to_write,
00320                                 const void *act,
00321                                 int priority,
00322                                 int signal_number)
00323 {
00324   return this->implementation ()->write (message_block,
00325                                          bytes_to_write,
00326                                          act,
00327                                          priority,
00328                                         signal_number);
00329 }
00330 
00331 #if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0))
00332 int
00333 ACE_Asynch_Write_Stream::writev (ACE_Message_Block &message_block,
00334                                  size_t bytes_to_write,
00335                                  const void *act,
00336                                  int priority,
00337                                  int signal_number)
00338 {
00339   return this->implementation ()->writev (message_block,
00340                                           bytes_to_write,
00341                                           act,
00342                                           priority,
00343                                           signal_number);
00344 }
00345 #endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) */
00346 
00347 ACE_Asynch_Write_Stream_Impl *
00348 ACE_Asynch_Write_Stream::implementation (void) const
00349 {
00350   return this->implementation_;
00351 }
00352 
00353 void
00354 ACE_Asynch_Write_Stream::implementation (ACE_Asynch_Write_Stream_Impl *implementation)
00355 {
00356   this->implementation_ = implementation;
00357 
00358   // Init the base class' implementation also.
00359   ACE_Asynch_Operation::implementation (this->implementation_);
00360 }
00361 
00362 // ************************************************************
00363 
00364 size_t
00365 ACE_Asynch_Write_Stream::Result::bytes_to_write (void) const
00366 {
00367   return this->implementation ()->bytes_to_write ();
00368 }
00369 
00370 ACE_Message_Block &
00371 ACE_Asynch_Write_Stream::Result::message_block (void) const
00372 {
00373   return this->implementation ()->message_block ();
00374 }
00375 
00376 ACE_HANDLE
00377 ACE_Asynch_Write_Stream::Result::handle (void) const
00378 {
00379   return this->implementation ()->handle ();
00380 }
00381 
00382 ACE_Asynch_Write_Stream::Result::Result (ACE_Asynch_Write_Stream_Result_Impl *implementation)
00383   : ACE_Asynch_Result (implementation),
00384     implementation_ (implementation)
00385 {
00386 }
00387 
00388 ACE_Asynch_Write_Stream::Result::~Result (void)
00389 {
00390   // Proactor will delte the implementation when the <complete> call
00391   // finishes.
00392 }
00393 
00394 ACE_Asynch_Write_Stream_Result_Impl *
00395 ACE_Asynch_Write_Stream::Result::implementation (void) const
00396 {
00397   return this->implementation_;
00398 }
00399 
00400 // ************************************************************
00401 
00402 ACE_Asynch_Read_File::ACE_Asynch_Read_File (void)
00403   : implementation_ (0)
00404 {
00405 } 
00406 
00407 ACE_Asynch_Read_File::~ACE_Asynch_Read_File (void)
00408 {
00409 } 
00410 
00411 int
00412 ACE_Asynch_Read_File::open (ACE_Handler &handler,
00413                             ACE_HANDLE handle,
00414                             const void *completion_key,
00415                             ACE_Proactor *proactor)
00416 {
00417   // Get a proactor for/from the user.
00418   proactor = this->get_proactor (proactor, handler);
00419 
00420   // Delete the old implementation.
00421   delete this->implementation_;
00422   this->implementation_ = 0;
00423 
00424   // Now let us get the implementation initialized.
00425   ACE_Asynch_Read_File_Impl *implementation = proactor->create_asynch_read_file ();
00426   if (implementation == 0)
00427     return -1;
00428   
00429   // Set the implementation class
00430   this->implementation (implementation);
00431   
00432   // Call the <open> method of the base class.
00433   return ACE_Asynch_Operation::open (handler,
00434                                      handle,
00435                                      completion_key,
00436                                      proactor);
00437 }
00438 
00439 int
00440 ACE_Asynch_Read_File::read (ACE_Message_Block &message_block,
00441                             size_t bytes_to_read,
00442                             u_long offset,
00443                             u_long offset_high,
00444                             const void *act,
00445                             int priority,
00446                             int signal_number)
00447 {
00448   return this->implementation ()->read (message_block,
00449                                         bytes_to_read,
00450                                         offset,
00451                                         offset_high,
00452                                         act,
00453                                         priority,
00454                                         signal_number);
00455 }
00456 
00457 #if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
00458 int
00459 ACE_Asynch_Read_File::readv (ACE_Message_Block &message_block,
00460                              size_t bytes_to_read,
00461                              u_long offset,
00462                              u_long offset_high,
00463                              const void *act,
00464                              int priority,
00465                              int signal_number)
00466 {
00467   return this->implementation ()->readv (message_block,
00468                                          bytes_to_read,
00469                                          offset,
00470                                          offset_high,
00471                                          act,
00472                                          priority,
00473                                          signal_number);
00474 }
00475 #endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
00476 
00477 ACE_Asynch_Read_File_Impl *
00478 ACE_Asynch_Read_File::implementation (void) const
00479 {
00480   return this->implementation_;
00481 }
00482 
00483 void
00484 ACE_Asynch_Read_File::implementation (ACE_Asynch_Read_File_Impl *implementation)
00485 {
00486   this->implementation_ = implementation;
00487 
00488   // Set also the base class' implementation.
00489   ACE_Asynch_Read_Stream::implementation (implementation);
00490 }
00491 
00492 // ************************************************************
00493 
00494 ACE_Asynch_Read_File::Result::Result (ACE_Asynch_Read_File_Result_Impl *implementation)
00495   : ACE_Asynch_Read_Stream::Result (implementation),
00496     implementation_ (implementation)
00497 {
00498 }
00499   
00500 ACE_Asynch_Read_File::Result::~Result (void)
00501 {
00502   // Proactor will delete the implementation when <complete> call
00503   // completes.
00504 }
00505 
00506 ACE_Asynch_Read_File_Result_Impl *
00507 ACE_Asynch_Read_File::Result::implementation (void) const
00508 {
00509   return this->implementation_;
00510 }
00511 
00512 // ************************************************************
00513 
00514 ACE_Asynch_Write_File::ACE_Asynch_Write_File (void)
00515   : implementation_ (0)
00516 {
00517 }
00518 
00519 ACE_Asynch_Write_File::~ACE_Asynch_Write_File (void)
00520 {
00521 }
00522 
00523 int
00524 ACE_Asynch_Write_File::open (ACE_Handler &handler,
00525                              ACE_HANDLE handle,
00526                              const void *completion_key,
00527                              ACE_Proactor *proactor)
00528 {
00529   // Get a proactor for/from the user.
00530   proactor = this->get_proactor (proactor, handler);
00531 
00532   // Delete the old implementation.
00533   delete this->implementation_;
00534   this->implementation_ = 0;
00535 
00536   // Now let us get the implementation initialized.
00537   ACE_Asynch_Write_File_Impl *implementation = proactor->create_asynch_write_file ();
00538   if (implementation == 0)
00539     return -1;
00540   
00541   // Set the implementation class
00542   this->implementation (implementation);
00543   
00544   // Call the <open> method of the base class.
00545   return ACE_Asynch_Operation::open (handler,
00546                                      handle,
00547                                      completion_key,
00548                                      proactor);
00549 }
00550 
00551 int
00552 ACE_Asynch_Write_File::write (ACE_Message_Block &message_block,
00553                               size_t bytes_to_write,
00554                               u_long offset,
00555                               u_long offset_high,
00556                               const void *act,
00557                               int priority,
00558                               int signal_number)
00559 {
00560   return this->implementation ()->write (message_block,
00561                                          bytes_to_write,
00562                                          offset,
00563                                          offset_high,
00564                                          act,
00565                                          priority,
00566                                          signal_number);
00567 }
00568 
00569 #if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
00570 int
00571 ACE_Asynch_Write_File::writev (ACE_Message_Block &message_block,
00572                                size_t bytes_to_write,
00573                                u_long offset,
00574                                u_long offset_high,
00575                                const void *act,
00576                                int priority,
00577                                int signal_number)
00578 {
00579   return this->implementation ()->writev (message_block,
00580                                           bytes_to_write,
00581                                           offset,
00582                                           offset_high,
00583                                           act,
00584                                           priority,
00585                                           signal_number);
00586 }
00587 #endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
00588 
00589 ACE_Asynch_Write_File_Impl *
00590 ACE_Asynch_Write_File::implementation (void) const
00591 {
00592   return this->implementation_;
00593 }
00594 
00595 void
00596 ACE_Asynch_Write_File::implementation (ACE_Asynch_Write_File_Impl *implementation)
00597 {
00598   this->implementation_ = implementation;
00599   
00600   // Init the base class' implementation also.
00601   ACE_Asynch_Write_Stream::implementation (implementation);
00602 }
00603 
00604 // ************************************************************
00605 
00606 ACE_Asynch_Write_File::Result::Result (ACE_Asynch_Write_File_Result_Impl *implementation)
00607   : ACE_Asynch_Write_Stream::Result (implementation),
00608     implementation_ (implementation)
00609 {
00610 }
00611 
00612 ACE_Asynch_Write_File::Result::~Result (void)
00613 {
00614   // Proactor will delete the implementation when the <complete> call
00615   // completes. 
00616 }
00617 
00618 ACE_Asynch_Write_File_Result_Impl *
00619 ACE_Asynch_Write_File::Result::implementation (void) const
00620 {
00621   return this->implementation_;
00622 }
00623 
00624 // *********************************************************************
00625 
00626 ACE_Asynch_Accept::ACE_Asynch_Accept (void)
00627   : implementation_ (0)
00628 {
00629 }
00630 
00631 ACE_Asynch_Accept::~ACE_Asynch_Accept (void)
00632 {
00633 }
00634 
00635 int
00636 ACE_Asynch_Accept::open (ACE_Handler &handler,
00637                          ACE_HANDLE handle,
00638                          const void *completion_key,
00639                          ACE_Proactor *proactor)
00640 {
00641   // Get a proactor for/from the user.
00642   proactor = this->get_proactor (proactor, handler);
00643 
00644   // Delete the old implementation.
00645   delete this->implementation_;
00646   this->implementation_ = 0;
00647 
00648   // Now let us get the implementation initialized.
00649   ACE_Asynch_Accept_Impl *implementation = proactor->create_asynch_accept ();
00650   if (implementation == 0)
00651     return -1;
00652   
00653   // Set the implementation class
00654   this->implementation (implementation);
00655   
00656   // Call the <open> method of the base class.
00657   return ACE_Asynch_Operation::open (handler,
00658                                      handle,
00659                                      completion_key,
00660                                      proactor);
00661 }
00662 
00663 int
00664 ACE_Asynch_Accept::accept (ACE_Message_Block &message_block,
00665                            size_t bytes_to_read,
00666                            ACE_HANDLE accept_handle,
00667                            const void *act,
00668                            int priority,
00669                            int signal_number)
00670 {
00671   return this->implementation ()->accept (message_block,
00672                                           bytes_to_read,
00673                                           accept_handle,
00674                                           act,
00675                                           priority,
00676                                           signal_number);
00677 }
00678 
00679 ACE_Asynch_Accept_Impl *
00680 ACE_Asynch_Accept::implementation (void)  const
00681 {
00682   return this->implementation_;
00683 }
00684 
00685 void
00686 ACE_Asynch_Accept::implementation (ACE_Asynch_Accept_Impl *implementation)
00687 {
00688   this->implementation_ = implementation;
00689   // Set the implementation in the base class.
00690   ACE_Asynch_Operation::implementation (implementation);
00691 }
00692 
00693 // ************************************************************
00694 
00695 size_t
00696 ACE_Asynch_Accept::Result::bytes_to_read (void) const
00697 {
00698   return this->implementation ()->bytes_to_read ();
00699 }
00700 
00701 ACE_Message_Block &
00702 ACE_Asynch_Accept::Result::message_block (void) const
00703 {
00704   return this->implementation ()->message_block ();
00705 }
00706 
00707 ACE_HANDLE
00708 ACE_Asynch_Accept::Result::listen_handle (void) const
00709 {
00710   return this->implementation ()->listen_handle ();
00711 }
00712 
00713 ACE_HANDLE
00714 ACE_Asynch_Accept::Result::accept_handle (void) const
00715 {
00716   return this->implementation ()->accept_handle ();
00717 }
00718 
00719 ACE_Asynch_Accept::Result::Result (ACE_Asynch_Accept_Result_Impl *implementation)
00720   : ACE_Asynch_Result (implementation),
00721     implementation_ (implementation)
00722 {
00723 }
00724 
00725 ACE_Asynch_Accept::Result::~Result (void)
00726 {
00727   // Proactor will delete the implementation when the <complete> call
00728   // completes.
00729 }
00730 
00731 ACE_Asynch_Accept_Result_Impl *
00732 ACE_Asynch_Accept::Result::implementation (void) const
00733 {
00734   return this->implementation_;
00735 }
00736 
00737 
00738 
00739 // *********************************************************************
00740 
00741 ACE_Asynch_Connect::ACE_Asynch_Connect (void)
00742   : implementation_ (0)
00743 {
00744 }
00745 
00746 ACE_Asynch_Connect::~ACE_Asynch_Connect (void)
00747 {
00748 }
00749 
00750 int
00751 ACE_Asynch_Connect::open (ACE_Handler &handler,
00752                           ACE_HANDLE handle,
00753                           const void *completion_key,
00754                           ACE_Proactor *proactor)
00755 {
00756   // Get a proactor for/from the user.
00757   proactor = this->get_proactor (proactor, handler);
00758 
00759   // Delete the old implementation.
00760   delete this->implementation_;
00761   this->implementation_ = 0;
00762 
00763   // Now let us get the implementation initialized.
00764   ACE_Asynch_Connect_Impl *implementation = proactor->create_asynch_connect ();
00765   if (implementation == 0)
00766     return -1;
00767   
00768   // Set the implementation class
00769   this->implementation (implementation);
00770   
00771   // Call the <open> method of the base class.
00772   return ACE_Asynch_Operation::open (handler,
00773                                      handle,
00774                                      completion_key,
00775                                      proactor);
00776 }
00777 
00778 int
00779 ACE_Asynch_Connect::connect (ACE_HANDLE connect_handle,
00780                              const ACE_Addr & remote_sap,
00781                              const ACE_Addr & local_sap,
00782                              int  reuse_addr,
00783                              const void *act,
00784                              int priority,
00785                              int signal_number)
00786 {
00787   return this->implementation ()->connect (connect_handle,
00788                                            remote_sap,
00789                                            local_sap,
00790                                            reuse_addr,
00791                                            act,
00792                                            priority,
00793                                            signal_number);
00794 }
00795 
00796 ACE_Asynch_Connect_Impl *
00797 ACE_Asynch_Connect::implementation (void)  const
00798 {
00799   return this->implementation_;
00800 }
00801 
00802 void
00803 ACE_Asynch_Connect::implementation (ACE_Asynch_Connect_Impl *implementation)
00804 {
00805   this->implementation_ = implementation;
00806   // Set the implementation in the base class.
00807   ACE_Asynch_Operation::implementation (implementation);
00808 }
00809 
00810 // ************************************************************
00811 
00812 ACE_Asynch_Connect::Result::Result (ACE_Asynch_Connect_Result_Impl *implementation)
00813   : ACE_Asynch_Result (implementation),
00814     implementation_ (implementation)
00815 {
00816 }
00817 
00818 ACE_Asynch_Connect::Result::~Result (void)
00819 {
00820   // Proactor will delete the implementation when the <complete> call
00821   // completes.
00822 }
00823 
00824 ACE_HANDLE
00825 ACE_Asynch_Connect::Result::connect_handle (void) const
00826 {
00827   return this->implementation ()->connect_handle ();
00828 }
00829 
00830 
00831 ACE_Asynch_Connect_Result_Impl *
00832 ACE_Asynch_Connect::Result::implementation (void) const
00833 {
00834   return this->implementation_;
00835 }
00836 
00837 // ************************************************************
00838 
00839 ACE_Asynch_Transmit_File::ACE_Asynch_Transmit_File (void)
00840   : implementation_ (0)
00841 {
00842 }
00843 
00844 ACE_Asynch_Transmit_File::~ACE_Asynch_Transmit_File (void)
00845 {
00846 }
00847 
00848 int
00849 ACE_Asynch_Transmit_File::open (ACE_Handler &handler,
00850                                 ACE_HANDLE handle,
00851                                 const void *completion_key,
00852                                 ACE_Proactor *proactor)
00853 {
00854   // Get a proactor for/from the user.
00855   proactor = this->get_proactor (proactor, handler);
00856 
00857   // Delete the old implementation.
00858   delete this->implementation_;
00859   this->implementation_ = 0;
00860 
00861   // Now let us get the implementation initialized.
00862   ACE_Asynch_Transmit_File_Impl *implementation = proactor->create_asynch_transmit_file ();
00863   if (implementation == 0)
00864     return -1;
00865   
00866   // Set the implementation class
00867   this->implementation (implementation);
00868   
00869   // Call the <open> method of the base class.
00870   return ACE_Asynch_Operation::open (handler,
00871                                      handle,
00872                                      completion_key,
00873                                      proactor);
00874 }
00875 
00876 int
00877 ACE_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
00878                                          Header_And_Trailer *header_and_trailer,
00879                                          size_t bytes_to_write,
00880                                          u_long offset,
00881                                          u_long offset_high,
00882                                          size_t bytes_per_send,
00883                                          u_long flags,
00884                                          const void *act,
00885                                          int priority,
00886                                          int signal_number)
00887 {
00888   return this->implementation ()->transmit_file (file,
00889                                                  header_and_trailer,
00890                                                  bytes_to_write,
00891                                                  offset,
00892                                                  offset_high,
00893                                                  bytes_per_send,
00894                                                  flags,
00895                                                  act,
00896                                                  priority,
00897                                                  signal_number);
00898 }
00899 
00900 ACE_Asynch_Transmit_File_Impl *
00901 ACE_Asynch_Transmit_File::implementation (void) const
00902 {
00903   return this->implementation_;
00904 }
00905 
00906 void
00907 ACE_Asynch_Transmit_File::implementation (ACE_Asynch_Transmit_File_Impl *implementation)
00908 {
00909   this->implementation_ = implementation;
00910   // Set the base class' implementation also.
00911   ACE_Asynch_Operation::implementation (this->implementation_);
00912 }
00913 
00914 // ***********************************************************************************
00915 
00916 ACE_HANDLE
00917 ACE_Asynch_Transmit_File::Result::socket (void) const
00918 {
00919   return this->implementation ()->socket ();
00920 }
00921 
00922 ACE_HANDLE
00923 ACE_Asynch_Transmit_File::Result::file (void) const
00924 {
00925   return this->implementation ()->file ();
00926 }
00927 
00928 ACE_Asynch_Transmit_File::Header_And_Trailer *
00929 ACE_Asynch_Transmit_File::Result::header_and_trailer (void) const
00930 {
00931   return this->implementation ()->header_and_trailer ();
00932 }
00933 
00934 size_t
00935 ACE_Asynch_Transmit_File::Result::bytes_to_write (void) const
00936 {
00937   return this->implementation ()->bytes_to_write ();
00938 }
00939 
00940 size_t
00941 ACE_Asynch_Transmit_File::Result::bytes_per_send (void) const
00942 {
00943   return this->implementation ()->bytes_per_send ();
00944 }
00945 
00946 u_long
00947 ACE_Asynch_Transmit_File::Result::flags (void) const
00948 {
00949   return this->implementation ()->flags ();
00950 }
00951 
00952 ACE_Asynch_Transmit_File::Result::Result (ACE_Asynch_Transmit_File_Result_Impl *implementation)
00953   : ACE_Asynch_Result (implementation),
00954     implementation_ (implementation)
00955 {
00956 }
00957 
00958 ACE_Asynch_Transmit_File::Result::~Result (void)
00959 {
00960 }
00961 
00962 ACE_Asynch_Transmit_File_Result_Impl *
00963 ACE_Asynch_Transmit_File::Result::implementation (void) const
00964 {
00965   return this->implementation_;
00966 }
00967 
00968 // ************************************************************
00969 
00970 ACE_Asynch_Transmit_File::Header_And_Trailer::Header_And_Trailer (ACE_Message_Block *header,
00971                                                                   size_t header_bytes,
00972                                                                   ACE_Message_Block *trailer,
00973                                                                   size_t trailer_bytes)
00974   : header_ (header),
00975     header_bytes_ (header_bytes),
00976     trailer_ (trailer),
00977     trailer_bytes_ (trailer_bytes)
00978 {
00979 }
00980 
00981 ACE_Asynch_Transmit_File::Header_And_Trailer::~Header_And_Trailer (void)
00982 {
00983 }
00984 
00985 void
00986 ACE_Asynch_Transmit_File::Header_And_Trailer::header_and_trailer (ACE_Message_Block *header,
00987                                                                   size_t header_bytes,
00988                                                                   ACE_Message_Block *trailer,
00989                                                                   size_t trailer_bytes)
00990 {
00991   this->header (header);
00992   this->header_bytes (header_bytes);
00993   this->trailer (trailer);
00994   this->trailer_bytes (trailer_bytes);
00995 }
00996 
00997 ACE_Message_Block *
00998 ACE_Asynch_Transmit_File::Header_And_Trailer::header (void) const
00999 {
01000   return this->header_;
01001 }
01002 
01003 void
01004 ACE_Asynch_Transmit_File::Header_And_Trailer::header (ACE_Message_Block *message_block)
01005 {
01006   this->header_ = message_block;
01007 }
01008 
01009 size_t
01010 ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (void) const
01011 {
01012   return this->header_bytes_;
01013 }
01014 
01015 void
01016 ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (size_t bytes)
01017 {
01018   this->header_bytes_ = bytes;
01019 }
01020 
01021 ACE_Message_Block *
01022 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (void) const
01023 {
01024   return this->trailer_;
01025 }
01026 
01027 void
01028 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (ACE_Message_Block *message_block)
01029 {
01030   this->trailer_ = message_block;
01031 }
01032 
01033 size_t
01034 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (void) const
01035 {
01036   return this->trailer_bytes_;
01037 }
01038 
01039 void
01040 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (size_t bytes)
01041 {
01042   this->trailer_bytes_ = bytes;
01043 }
01044 
01045 ACE_LPTRANSMIT_FILE_BUFFERS
01046 ACE_Asynch_Transmit_File::Header_And_Trailer::transmit_buffers (void)
01047 {
01048   // If both are zero, return zero
01049   if (this->header_ == 0 && this->trailer_ == 0)
01050     return 0;
01051   else
01052     {
01053       // Something is valid
01054 
01055       // If header is valid, set the fields
01056       if (this->header_ != 0)
01057         {
01058           this->transmit_buffers_.Head = this->header_->rd_ptr ();
01059 #if defined(ACE_WIN64)
01060           this->transmit_buffers_.HeadLength =
01061             ACE_static_cast (DWORD, this->header_bytes_);
01062 #else
01063           this->transmit_buffers_.HeadLength = this->header_bytes_;
01064 #endif /* ACE_WIN64 */
01065         }
01066       else
01067         {
01068           this->transmit_buffers_.Head = 0;
01069           this->transmit_buffers_.HeadLength = 0;
01070         }
01071 
01072       // If trailer is valid, set the fields
01073       if (this->trailer_ != 0)
01074         {
01075           this->transmit_buffers_.Tail = this->trailer_->rd_ptr ();
01076 #if defined(ACE_WIN64)
01077           this->transmit_buffers_.TailLength =
01078             ACE_static_cast (DWORD, this->trailer_bytes_);
01079 #else
01080           this->transmit_buffers_.TailLength = this->trailer_bytes_;
01081 #endif /* ACE_WIN64 */
01082         }
01083       else
01084         {
01085           this->transmit_buffers_.Tail = 0;
01086           this->transmit_buffers_.TailLength = 0;
01087         }
01088 
01089       // Return the transmit buffers
01090       return &this->transmit_buffers_;
01091     }
01092 }
01093 
01094 // *********************************************************************
01095 
01096 ACE_Handler::ACE_Handler (void)
01097   : proactor_ (0), handle_ (ACE_INVALID_HANDLE)
01098 {
01099 }
01100 
01101 ACE_Handler::ACE_Handler (ACE_Proactor *d)
01102   : proactor_ (d), handle_ (ACE_INVALID_HANDLE)
01103 {
01104 }
01105 
01106 ACE_Handler::~ACE_Handler (void)
01107 {
01108 }
01109 
01110 void
01111 ACE_Handler::handle_read_stream (const ACE_Asynch_Read_Stream::Result & /* result */)
01112 {
01113 }
01114 
01115 void
01116 ACE_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result & /* result */)
01117 {
01118 }
01119 
01120 void
01121 ACE_Handler::handle_write_dgram (const ACE_Asynch_Write_Dgram::Result & /* result */)
01122 {
01123 }
01124 
01125 void
01126 ACE_Handler::handle_read_dgram (const ACE_Asynch_Read_Dgram::Result & /* result */)
01127 {
01128 }
01129 
01130 void
01131 ACE_Handler::handle_accept (const ACE_Asynch_Accept::Result & /* result */)
01132 {
01133 }
01134 
01135 void
01136 ACE_Handler::handle_connect (const ACE_Asynch_Connect::Result & /* result */)
01137 {
01138 }
01139 
01140 void
01141 ACE_Handler::handle_transmit_file (const ACE_Asynch_Transmit_File::Result & /* result */)
01142 {
01143 }
01144 
01145 void
01146 ACE_Handler::handle_read_file (const ACE_Asynch_Read_File::Result & /* result */)
01147 {
01148 }
01149 
01150 void
01151 ACE_Handler::handle_write_file (const ACE_Asynch_Write_File::Result & /* result */)
01152 {
01153 }
01154 
01155 void
01156 ACE_Handler::handle_time_out (const ACE_Time_Value & /* tv */,
01157                               const void *           /* act */)
01158 {
01159 }
01160 
01161 void
01162 ACE_Handler::handle_wakeup (void)
01163 {
01164 }
01165 
01166 ACE_Proactor *
01167 ACE_Handler::proactor (void)
01168 {
01169   return this->proactor_;
01170 }
01171 
01172 void
01173 ACE_Handler::proactor (ACE_Proactor *p)
01174 {
01175   this->proactor_ = p;
01176 }
01177 
01178 ACE_HANDLE
01179 ACE_Handler::handle (void) const
01180 {
01181   return this->handle_;
01182 }
01183 
01184 void
01185 ACE_Handler::handle (ACE_HANDLE h)
01186 {
01187   this->handle_ = h;
01188 }
01189 
01190 // ************************************************************
01191 
01192 ACE_Service_Handler::ACE_Service_Handler (void)
01193 {
01194 }
01195 
01196 ACE_Service_Handler::~ACE_Service_Handler (void)
01197 {
01198 }
01199 
01200 void
01201 ACE_Service_Handler::addresses (const ACE_INET_Addr & /* remote_address */,
01202                                 const ACE_INET_Addr & /* local_address */ )
01203 {
01204 }
01205 
01206 void
01207 ACE_Service_Handler::act (const void *)
01208 {
01209 }
01210 
01211 void
01212 ACE_Service_Handler::open (ACE_HANDLE,
01213                            ACE_Message_Block &)
01214 {
01215 }
01216 
01217 
01218 // ************************************************************
01219 
01220 ACE_Asynch_Read_Dgram::ACE_Asynch_Read_Dgram (void)
01221   : implementation_ (0)
01222 {
01223 }
01224 
01225 ACE_Asynch_Read_Dgram::~ACE_Asynch_Read_Dgram (void)
01226 {
01227 }
01228 
01229 int
01230 ACE_Asynch_Read_Dgram::open (ACE_Handler &handler,
01231                              ACE_HANDLE handle,
01232                              const void *completion_key,
01233                              ACE_Proactor *proactor)
01234 {
01235   // Get a proactor for/from the user.
01236   proactor = this->get_proactor (proactor, handler);
01237 
01238   // Delete the old implementation.
01239   delete this->implementation_;
01240   this->implementation_ = 0;
01241 
01242   // Now let us get the implementation initialized.
01243   ACE_Asynch_Read_Dgram_Impl *implementation = proactor->create_asynch_read_dgram ();
01244   if (implementation == 0)
01245     return -1;
01246   
01247   // Set the implementation class
01248   this->implementation (implementation);
01249 
01250   // Call the <open> method of the base class. 
01251   return ACE_Asynch_Operation::open (handler,
01252                                      handle,
01253                                      completion_key,
01254                                      proactor);
01255 }
01256 
01257 ssize_t
01258 ACE_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block,
01259                              size_t &number_of_bytes_recvd,
01260                              int flags,
01261                              int protocol_family,
01262                              const void *act,
01263                              int priority,
01264                              int signal_number)
01265 {
01266   return this->implementation ()->recv (message_block,
01267                                         number_of_bytes_recvd,
01268                                         flags,
01269                                         protocol_family,
01270                                         act,
01271                                         priority,
01272                                         signal_number);
01273 }
01274 
01275 ACE_Asynch_Read_Dgram_Impl *
01276 ACE_Asynch_Read_Dgram::implementation (void) const
01277 {
01278   return implementation_;
01279 }
01280 
01281 void
01282 ACE_Asynch_Read_Dgram::implementation (ACE_Asynch_Read_Dgram_Impl *implementation)
01283 {
01284   this->implementation_ = implementation;
01285 
01286   // Init the bas class' implementation also.
01287   ACE_Asynch_Operation::implementation(this->implementation_);
01288 }
01289 
01290 // ************************************************************
01291 
01292 int
01293 ACE_Asynch_Read_Dgram::Result::remote_address (ACE_Addr& addr) const
01294 {
01295   return this->implementation ()->remote_address (addr);
01296 }
01297 
01298 ACE_Message_Block*
01299 ACE_Asynch_Read_Dgram::Result::message_block (void) const
01300 {
01301   return this->implementation ()->message_block ();
01302 }
01303 
01304 int
01305 ACE_Asynch_Read_Dgram::Result::flags (void) const
01306 {
01307   return this->implementation ()->flags ();
01308 }
01309 
01310 size_t
01311 ACE_Asynch_Read_Dgram::Result::bytes_to_read (void) const
01312 {
01313   return this->implementation ()->bytes_to_read ();
01314 }
01315 
01316 ACE_HANDLE
01317 ACE_Asynch_Read_Dgram::Result::handle (void) const
01318 {
01319   return this->implementation ()->handle();
01320 }
01321 
01322 ACE_Asynch_Read_Dgram::Result::Result (ACE_Asynch_Read_Dgram_Result_Impl *implementation)
01323 : ACE_Asynch_Result (implementation),
01324   implementation_ (implementation)
01325 {
01326 }
01327 
01328 ACE_Asynch_Read_Dgram::Result::~Result (void)
01329 {
01330 }
01331 
01332 ACE_Asynch_Read_Dgram_Result_Impl *
01333 ACE_Asynch_Read_Dgram::Result::implementation (void) const
01334 {
01335   return this->implementation_;
01336 }
01337 
01338 // ************************************************************
01339 
01340 
01341 ACE_Asynch_Write_Dgram::ACE_Asynch_Write_Dgram (void)
01342   : implementation_ (0)
01343 {
01344 }
01345 
01346 ACE_Asynch_Write_Dgram::~ACE_Asynch_Write_Dgram (void)
01347 {
01348 }
01349 
01350 int
01351 ACE_Asynch_Write_Dgram::open (ACE_Handler &handler,
01352                               ACE_HANDLE handle,
01353                               const void *completion_key,
01354                               ACE_Proactor *proactor)
01355 {
01356   // Get a proactor for/from the user.
01357   proactor = this->get_proactor (proactor, handler);
01358 
01359   // Delete the old implementation.
01360   delete this->implementation_;
01361   this->implementation_ = 0;
01362 
01363   // Now let us get the implementation initialized.
01364   ACE_Asynch_Write_Dgram_Impl *implementation = proactor->create_asynch_write_dgram ();
01365   if (implementation == 0)
01366     return -1;
01367   
01368   // Set the implementation class
01369   this->implementation (implementation);
01370   
01371   // Call the <open> method of the base class.
01372   return ACE_Asynch_Operation::open (handler,
01373                                      handle,
01374                                      completion_key,
01375                                      proactor);
01376 }
01377 
01378 ssize_t
01379 ACE_Asynch_Write_Dgram::send (ACE_Message_Block *message_block,
01380                               size_t &number_of_bytes_sent,
01381                               int flags,
01382                               const ACE_Addr& remote_addr,
01383                               const void *act,
01384                               int priority,
01385                               int signal_number)
01386 {
01387   return this->implementation ()->send (message_block,
01388                                         number_of_bytes_sent,
01389                                         flags,
01390                                         remote_addr,
01391                                         act,
01392                                         priority,
01393                                         signal_number);
01394 }
01395 
01396 ACE_Asynch_Write_Dgram_Impl *
01397 ACE_Asynch_Write_Dgram::implementation (void) const
01398 {
01399   return this->implementation_;
01400 }
01401 
01402 void
01403 ACE_Asynch_Write_Dgram::implementation (ACE_Asynch_Write_Dgram_Impl *implementation)
01404 {
01405   this->implementation_ = implementation;
01406 
01407   // Init the base class' implementation also.
01408   ACE_Asynch_Operation::implementation (this->implementation_);
01409 }
01410 
01411 // ************************************************************
01412 
01413 size_t
01414 ACE_Asynch_Write_Dgram::Result::bytes_to_write (void) const
01415 {
01416   return this->implementation ()->bytes_to_write ();
01417 }
01418 
01419 ACE_Message_Block*
01420 ACE_Asynch_Write_Dgram::Result::message_block () const
01421 {
01422   return this->implementation ()->message_block ();
01423 }
01424 
01425 int
01426 ACE_Asynch_Write_Dgram::Result::flags (void) const
01427 {
01428   return this->implementation ()->flags ();
01429 }
01430 
01431 ACE_HANDLE
01432 ACE_Asynch_Write_Dgram::Result::handle (void) const
01433 {
01434   return this->implementation ()->handle ();
01435 }
01436 
01437 ACE_Asynch_Write_Dgram_Result_Impl *
01438 ACE_Asynch_Write_Dgram::Result::implementation (void) const
01439 {
01440   return this->implementation_;
01441 }
01442 
01443 ACE_Asynch_Write_Dgram::Result::Result (ACE_Asynch_Write_Dgram_Result_Impl *implementation)
01444 : ACE_Asynch_Result (implementation),
01445   implementation_ (implementation)
01446 {
01447 }
01448 
01449 ACE_Asynch_Write_Dgram::Result::~Result (void)
01450 {
01451 }
01452 
01453 #endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */

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