RandomAccessRequest.h

Go to the documentation of this file.
00001 /*
00002 // $Id: //open/dev/fennel/device/RandomAccessRequest.h#12 $
00003 // Fennel is a library of data storage and processing components.
00004 // Copyright (C) 2005-2009 The Eigenbase Project
00005 // Copyright (C) 2005-2009 SQLstream, Inc.
00006 // Copyright (C) 2005-2009 LucidEra, Inc.
00007 // Portions Copyright (C) 1999-2009 John V. Sichi
00008 //
00009 // This program is free software; you can redistribute it and/or modify it
00010 // under the terms of the GNU General Public License as published by the Free
00011 // Software Foundation; either version 2 of the License, or (at your option)
00012 // any later version approved by The Eigenbase Project.
00013 //
00014 // This program is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with this program; if not, write to the Free Software
00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 */
00023 
00024 #ifndef Fennel_RandomAccessRequest_Included
00025 #define Fennel_RandomAccessRequest_Included
00026 
00027 #include "fennel/common/IntrusiveList.h"
00028 
00029 #ifdef HAVE_AIO_H
00030 #include <aio.h>
00031 struct aiocb;
00032 #endif
00033 
00034 #ifdef HAVE_LIBAIO_H
00035 #include <libaio.h>
00036 struct iocb;
00037 #endif
00038 
00039 #ifdef __MSVC__
00040 #include <windows.h>
00041 #endif
00042 
00043 FENNEL_BEGIN_NAMESPACE
00044 
00045 class RandomAccessDevice;
00046 
00051 class FENNEL_DEVICE_EXPORT RandomAccessRequestBinding
00052     : public IntrusiveListNode
00053 #ifdef USE_AIO_H
00054 , public aiocb
00055 #endif
00056 #ifdef USE_LIBAIO_H
00057 , public iocb
00058 #endif
00059 #ifdef __MSVC__
00060 , public OVERLAPPED
00061 #endif
00062 {
00063 public:
00064     explicit RandomAccessRequestBinding();
00065     virtual ~RandomAccessRequestBinding();
00066 
00070     virtual PBuffer getBuffer() const = 0;
00071 
00076     virtual uint getBufferSize() const = 0;
00077 
00084     virtual void notifyTransferCompletion(bool bSuccess) = 0;
00085 };
00086 
00094 class FENNEL_DEVICE_EXPORT RandomAccessRequest
00095 {
00096 public:
00097     enum Type {
00098         READ,
00099         WRITE
00100     };
00101 
00102     typedef IntrusiveList<RandomAccessRequestBinding> BindingList;
00103     typedef IntrusiveListIter<RandomAccessRequestBinding> BindingListIter;
00104     typedef IntrusiveListMutator<RandomAccessRequestBinding>
00105     BindingListMutator;
00106 
00111     RandomAccessDevice *pDevice;
00112 
00116     FileSize cbOffset;
00117 
00121     FileSize cbTransfer;
00122 
00127     Type type;
00128 
00132     BindingList bindingList;
00133 
00139     void execute();
00140 };
00141 
00142 FENNEL_END_NAMESPACE
00143 
00144 #endif
00145 
00146 // End RandomAccessRequest.h

Generated on Mon Jun 22 04:00:18 2009 for Fennel by  doxygen 1.5.1