1 /* 2 * Copyright 2006-2008 The FLWOR Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #ifndef XQP_PLAN_ITERATOR_WRAPPER_H 17 #define XQP_PLAN_ITERATOR_WRAPPER_H 18 19 #include "store/api/iterator.h" 20 #include "common/shared_types.h" 21 22 namespace zorba { 23 24 class PlanState; 25 26 /******************************************************************************* 27 This is a "helper" wrapper that is used when we need to pass a plan iterator 28 to the store. The wrapper wraps the plan iterator in order to provide a 29 simpler interface that the store can use. 30 31 The wrapper does not allocate a new state block, but it points to the same 32 block that contains the state of the wrapped plan iterator. 33 ********************************************************************************/ 34 class PlanIteratorWrapper : public store::Iterator 35 { 36 private: 37 const PlanIterator * theIterator; 38 PlanState * theStateBlock; 39 40 public: 41 PlanIteratorWrapper(const PlanIterator* iter, PlanState& planState); 42 43 virtual ~PlanIteratorWrapper(); 44 open()45 void open() {} 46 47 bool next(store::Item_t&); 48 reset()49 void reset() {} 50 close()51 void close() {} 52 }; 53 54 } /* namespace zorba */ 55 #endif 56 57 /* 58 * Local variables: 59 * mode: c++ 60 * End: 61 */ 62 /* vim:set et sw=2 ts=2: */ 63