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 00024 class ProjectOperator : public IQueryOperator { 00025 public: 00026 ProjectOperator(); 00027 ReturnCode initialize(IQueryOperator* child, int nAttributes, 00028 const RelationAttribute attributes[]); 00029 ~ProjectOperator(); 00030 ReturnCode openExecution(); 00031 ReturnCode closeExecution(); 00032 ReturnCode getNextRecord(Record* record); 00033 int getArity(); 00034 void getSchema(RelationAttributeInfo attributes[]) ; 00035 void printSubtree(int indent) ; 00036 private: 00037 RelationAttributeInfo* attributes_; 00038 int nAttributes_; 00039 int childRecordSize_; 00040 struct ProjectionSlot { 00041 int offset; 00042 int length; 00043 }; 00044 ProjectionSlot* slots_; 00045 IQueryOperator* child_; 00046 Record* childRecord_; 00047 }; 00048 00049 #endif // PROJECTION_H_