00001 /* 00002 // $Id: //open/dev/fennel/lucidera/bitmap/LbmChopperExecStream.h#6 $ 00003 // Fennel is a library of data storage and processing components. 00004 // Copyright (C) 2005-2009 LucidEra, Inc. 00005 // Copyright (C) 2005-2009 The Eigenbase Project 00006 // 00007 // This program is free software; you can redistribute it and/or modify it 00008 // under the terms of the GNU General Public License as published by the Free 00009 // Software Foundation; either version 2 of the License, or (at your option) 00010 // any later version approved by The Eigenbase Project. 00011 // 00012 // This program is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with this program; if not, write to the Free Software 00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 */ 00021 00022 #ifndef Fennel_LbmChopperExecStream_Included 00023 #define Fennel_LbmChopperExecStream_Included 00024 00025 #include "fennel/tuple/TupleData.h" 00026 #include "fennel/exec/ConfluenceExecStream.h" 00027 #include "fennel/exec/DynamicParam.h" 00028 #include "fennel/lucidera/bitmap/LbmByteSegment.h" 00029 #include "fennel/lucidera/bitmap/LbmSeqSegmentReader.h" 00030 #include "fennel/lucidera/bitmap/LbmSegmentWriter.h" 00031 00032 FENNEL_BEGIN_NAMESPACE 00033 00038 struct LbmChopperExecStreamParams : public ConfluenceExecStreamParams 00039 { 00045 DynamicParamId ridLimitParamId; 00046 }; 00047 00061 class FENNEL_LBM_EXPORT LbmChopperExecStream 00062 : public ConfluenceExecStream 00063 { 00064 enum LbmChopperState { 00065 LBM_STATE_NONE = 0, 00066 LBM_STATE_READ, 00067 LBM_STATE_WRITE, 00068 LBM_STATE_PRODUCE, 00069 LBM_STATE_DONE 00070 }; 00071 00072 DynamicParamId ridLimitParamId; 00073 00077 RecordNum ridLimit; 00078 00082 LbmSeqSegmentReader segmentReader; 00083 00087 TupleData inputTuple; 00088 00092 LbmByteSegment inputSegment; 00093 00097 LbmSegmentWriter segmentWriter; 00098 00102 SegPageLock writerPageLock; 00103 00107 uint pageSize; 00108 00112 LbmChopperState state; 00113 00117 bool writePending; 00118 00122 bool producePending; 00123 00127 LcsRid currentSrid; 00128 00132 LcsRid currentEndRid; 00133 00138 ExecStreamResult readSegment(); 00139 00145 bool writeSegment(); 00146 00150 bool produceTuple(); 00151 00152 public: 00153 explicit LbmChopperExecStream(); 00154 virtual void prepare(LbmChopperExecStreamParams const ¶ms); 00155 virtual void open(bool restart); 00156 virtual ExecStreamResult execute(ExecStreamQuantum const &quantum); 00157 virtual void getResourceRequirements( 00158 ExecStreamResourceQuantity &minQuantity, 00159 ExecStreamResourceQuantity &optQuantity); 00160 virtual void closeImpl(); 00161 }; 00162 00163 FENNEL_END_NAMESPACE 00164 00165 #endif 00166 00167 // End LbmChopperExecStream.h