• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

P_VIO.h

Go to the documentation of this file.
00001 /** @file
00002 
00003   A brief file description
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 
00025 #if !defined ( P_VIO_h)
00026 #define  P_VIO_h
00027 #include "I_VIO.h"
00028 
00029 TS_INLINE
00030 VIO::VIO(int aop)
00031   :_cont(NULL),
00032    nbytes(0),
00033    ndone(0),
00034    op(aop),
00035    buffer(),
00036    vc_server(0),
00037    mutex(0)
00038 { }
00039 
00040 /////////////////////////////////////////////////////////////
00041 //
00042 //  VIO::VIO()
00043 //
00044 /////////////////////////////////////////////////////////////
00045 TS_INLINE
00046 VIO::VIO()
00047   :_cont(0),
00048    nbytes(0),
00049    ndone(0),
00050    op(VIO::NONE),
00051    buffer(),
00052    vc_server(0),
00053    mutex(0)
00054 { }
00055 
00056 TS_INLINE Continuation *
00057 VIO::get_continuation()
00058 {
00059   return _cont;
00060 }
00061 TS_INLINE void
00062 VIO::set_writer(MIOBuffer * writer)
00063 {
00064   buffer.writer_for(writer);
00065 }
00066 TS_INLINE void
00067 VIO::set_reader(IOBufferReader * reader)
00068 {
00069   buffer.reader_for(reader);
00070 }
00071 TS_INLINE MIOBuffer *
00072 VIO::get_writer()
00073 {
00074   return buffer.writer();
00075 }
00076 TS_INLINE IOBufferReader *
00077 VIO::get_reader()
00078 {
00079   return (buffer.reader());
00080 }
00081 TS_INLINE int64_t
00082 VIO::ntodo()
00083 {
00084   return nbytes - ndone;
00085 }
00086 TS_INLINE void
00087 VIO::done()
00088 {
00089   if (buffer.reader())
00090     nbytes = ndone + buffer.reader()->read_avail();
00091   else
00092     nbytes = ndone;
00093 }
00094 
00095 /////////////////////////////////////////////////////////////
00096 //
00097 //  VIO::set_continuation()
00098 //
00099 /////////////////////////////////////////////////////////////
00100 TS_INLINE void
00101 VIO::set_continuation(Continuation * acont)
00102 {
00103   if (vc_server)
00104     vc_server->set_continuation(this, acont);
00105   if (acont) {
00106     mutex = acont->mutex;
00107     _cont = acont;
00108   } else {
00109     mutex = NULL;
00110     _cont = NULL;
00111   }
00112   return;
00113 }
00114 
00115 /////////////////////////////////////////////////////////////
00116 //
00117 //  VIO::reenable()
00118 //
00119 /////////////////////////////////////////////////////////////
00120 TS_INLINE void
00121 VIO::reenable()
00122 {
00123   if (vc_server)
00124     vc_server->reenable(this);
00125 }
00126 
00127 /////////////////////////////////////////////////////////////
00128 //
00129 //  VIO::reenable_re()
00130 //
00131 /////////////////////////////////////////////////////////////
00132 TS_INLINE void
00133 VIO::reenable_re()
00134 {
00135   if (vc_server)
00136     vc_server->reenable_re(this);
00137 }
00138 
00139 #endif /* #if !defined ( P_VIO_h) */

Generated by  doxygen 1.7.1