00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef Fennel_ReshapeExecStream_Included
00025 #define Fennel_ReshapeExecStream_Included
00026
00027 #include "fennel/common/FemEnums.h"
00028 #include "fennel/exec/ConduitExecStream.h"
00029 #include "fennel/exec/DynamicParam.h"
00030 #include "fennel/tuple/TupleProjectionAccessor.h"
00031
00032 #include <boost/shared_array.hpp>
00033
00034 FENNEL_BEGIN_NAMESPACE
00035
00040 struct FENNEL_EXEC_EXPORT ReshapeParameter
00041 {
00045 DynamicParamId dynamicParamId;
00046
00051 uint compareOffset;
00052
00057 bool outputParam;
00058
00059 ReshapeParameter(
00060 DynamicParamId dynamicParamIdInit,
00061 uint compareOffsetInit,
00062 bool outputParamInit) :
00063 dynamicParamId(dynamicParamIdInit),
00064 compareOffset(compareOffsetInit),
00065 outputParam(outputParamInit)
00066 {
00067 }
00068 };
00069
00073 struct FENNEL_EXEC_EXPORT ReshapeExecStreamParams
00074 : public ConduitExecStreamParams
00075 {
00081 CompOperator compOp;
00082
00086 boost::shared_array<FixedBuffer> pCompTupleBuffer;
00087
00094 TupleProjection inputCompareProj;
00095
00099 TupleProjection outputProj;
00100
00105 std::vector<ReshapeParameter> dynamicParameters;
00106 };
00107
00130 class FENNEL_EXEC_EXPORT ReshapeExecStream
00131 : public ConduitExecStream
00132 {
00136 CompOperator compOp;
00137
00141 std::vector<ReshapeParameter> dynamicParameters;
00142
00147 bool paramsRead;
00148
00153 TupleData paramCompareData;
00154
00159 TupleProjectionAccessor inputCompareProjAccessor;
00160
00165 TupleData inputCompareData;
00166
00170 boost::shared_array<FixedBuffer> compTupleBuffer;
00171
00175 TupleDescriptor compTupleDesc;
00176
00180 uint numCompDynParams;
00181
00185 TupleProjection lastKey;
00186
00190 TupleDescriptor lastKeyDesc;
00191
00195 TupleProjectionAccessor outputProjAccessor;
00196
00201 TupleDescriptor inputOutputDesc;
00202
00206 TupleData inputOutputData;
00207
00211 TupleDescriptor outputDesc;
00212
00216 TupleData outputData;
00217
00222 bool castRequired;
00223
00227 bool producePending;
00228
00239 void initCompareData(
00240 ReshapeExecStreamParams const ¶ms,
00241 TupleDescriptor const &inputDesc,
00242 TupleAccessor const &inputAccessor);
00243
00254 void copyCompareTuple(
00255 TupleDescriptor const &tupleDesc,
00256 TupleData &tupleData,
00257 PBuffer tupleBuffer);
00258
00271 bool checkCastTypes(
00272 const TupleProjection &compareProj,
00273 const TupleDescriptor &inputTupleDesc,
00274 const TupleDescriptor &outputTupleDesc);
00275
00285 bool nullFilter(const TupleProjection &compareProj, uint colno);
00286
00293 void readDynamicParams();
00294
00300 bool compareInput();
00301
00306 void castOutput();
00307
00308 public:
00309
00310 virtual void prepare(ReshapeExecStreamParams const ¶ms);
00311 virtual void open(bool restart);
00312 virtual ExecStreamResult execute(ExecStreamQuantum const &quantum);
00313 virtual void closeImpl();
00314 };
00315
00316 FENNEL_END_NAMESPACE
00317
00318 #endif
00319
00320