Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
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
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
00118
00119
00120 TS_INLINE void
00121 VIO::reenable()
00122 {
00123 if (vc_server)
00124 vc_server->reenable(this);
00125 }
00126
00127
00128
00129
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