00001 /* 00002 // $Id: //open/dev/fennel/lucidera/bitmap/LbmBitOpExecStream.h#8 $ 00003 // Fennel is a library of data storage and processing components. 00004 // Copyright (C) 2006-2009 LucidEra, Inc. 00005 // Copyright (C) 2006-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_LbmBitOpExecStream_Included 00023 #define Fennel_LbmBitOpExecStream_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/LbmSegmentReader.h" 00029 #include "fennel/lucidera/bitmap/LbmSegmentWriter.h" 00030 00031 FENNEL_BEGIN_NAMESPACE 00032 00037 struct LbmBitOpExecStreamParams : public ConfluenceExecStreamParams 00038 { 00044 DynamicParamId rowLimitParamId; 00045 00051 DynamicParamId startRidParamId; 00052 }; 00053 00062 class FENNEL_LBM_EXPORT LbmBitOpExecStream 00063 : public ConfluenceExecStream 00064 { 00065 protected: 00071 DynamicParamId rowLimitParamId; 00072 00078 DynamicParamId startRidParamId; 00079 00083 TupleDatum rowLimitDatum; 00084 00088 TupleDatum startRidDatum; 00089 00093 RecordNum rowLimit; 00094 00098 LcsRid startRid; 00099 00103 boost::scoped_array<LbmSegmentReader> segmentReaders; 00104 00108 uint nInputs; 00109 00113 uint iInput; 00114 00118 boost::scoped_array<TupleData> bitmapSegTuples; 00119 00123 LbmSegmentWriter segmentWriter; 00124 00128 boost::scoped_array<FixedBuffer> outputBuf; 00129 00133 boost::scoped_array<FixedBuffer> byteSegBuf; 00134 00138 PBuffer pByteSegBuf; 00139 00143 uint bitmapBufSize; 00144 00148 TupleData outputTuple; 00149 00153 bool producePending; 00154 00158 LcsRid addRid; 00159 00163 PBuffer addByteSeg; 00164 00168 uint addLen; 00169 00173 int nFields; 00174 00184 ExecStreamResult producePendingOutput(uint iInput); 00185 00197 ExecStreamResult readInput( 00198 uint iInput, LcsRid &currRid, PBuffer &currByteSeg, uint &currLen); 00199 00208 bool flush(); 00209 00218 bool addSegments(); 00219 00224 void writeStartRidParamValue(); 00225 00231 virtual bool produceTuple(TupleData bitmapTuple); 00232 00233 public: 00234 virtual void prepare(LbmBitOpExecStreamParams const ¶ms); 00235 virtual void open(bool restart); 00236 virtual void closeImpl(); 00237 }; 00238 00239 FENNEL_END_NAMESPACE 00240 00241 #endif 00242 00243 // End LbmBitOpExecStream.h