00001 /* 00002 * ProjectOperator.h 00003 * DavisDB 00004 * 00005 * Created by Mingmin Chen on 5/6/10. 00006 * Copyright 2010 UCD. All rights reserved. 00007 * 00008 */ 00009 00010 00011 #ifndef PROJECTION_H_ 00012 #define PROJECTION_H_ 00013 00014 #include "IQueryOperator.h" 00015 00016 class RelationAttribute; 00017 00021 class ProjectOperator : public IQueryOperator { 00022 public: 00023 ProjectOperator(); 00024 ReturnCode initialize(IQueryOperator* child, int nAttributes, 00025 const RelationAttribute attributes[]); 00026 ~ProjectOperator(); 00027 ReturnCode openExecution(); 00028 ReturnCode closeExecution(); 00029 ReturnCode getNextRecord(Record* record); 00030 int getArity(); 00031 void getSchema(RelationAttributeInfo attributes[]) ; 00032 void printSubtree(int indent) ; 00033 private: 00034 RelationAttributeInfo* attributes_; 00035 int nAttributes_; 00036 int childRecordSize_; 00037 struct ProjectionSlot { 00038 int offset; 00039 int length; 00040 }; 00041 ProjectionSlot* slots_; 00042 IQueryOperator* child_; 00043 Record* childRecord_; 00044 }; 00045 00046 #endif