Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-tempseq
into lp:zorba.
Requested reviews:
Markos Zaharioudakis (markos-za)
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-tempseq/+merge/85602
Optimized and cleaned up SimpleTempSeq implementation and its usage.
--
https://code.launchpad.net/~zorba-coders/zorba/markos-tempseq/+merge/85602
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/store/api/shared_types.h'
--- src/store/api/shared_types.h 2011-09-22 21:50:20 +
+++ src/store/api/shared_types.h 2011-12-14 04:15:30 +
@@ -62,6 +62,9 @@
class TempSeq;
typedef rchandle TempSeq_t;
+class TempSeqIterator;
+typedef rchandle TempSeqIterator_t;
+
class Collection;
typedef rchandle Collection_t;
=== modified file 'src/store/api/store.h'
--- src/store/api/store.h 2011-10-12 10:12:26 +
+++ src/store/api/store.h 2011-12-14 04:15:30 +
@@ -72,15 +72,17 @@
* evaluated lazily. For XQueryP it might be necassary to set
* this to false.
*/
- virtual TempSeq_t createTempSeq(
-Iterator_t& iterator,
-bool copyNodes,
-bool lazy) = 0;
-
- /**
- * Creates a new TempSeq that is initialized with the given vector.
- */
- virtual TempSeq_t createTempSeq(const std::vector& item_v) = 0;
+ virtual TempSeq_t createTempSeq(const Iterator_t& iterator, bool lazy) = 0;
+
+ /**
+ * Creates a new TempSeq that is initialized with the given vector.
+ */
+ virtual TempSeq_t createTempSeq(std::vector& item_v) = 0;
+
+ /**
+ * Creates a new TempSeq that is initialized with the given vector.
+ */
+ virtual TempSeq_t createTempSeq(Item_t& item) = 0;
/**
* Creates a new, empty TempSeq.
=== modified file 'src/store/api/temp_seq.h'
--- src/store/api/temp_seq.h 2011-06-28 23:34:08 +
+++ src/store/api/temp_seq.h 2011-12-14 04:15:30 +
@@ -39,56 +39,13 @@
/**
* Initializes a temp sequence with the given input iterator
*/
- virtual void init(store::Iterator_t& iter, bool copy = false) = 0;
+ virtual void init(const store::Iterator_t& iter) = 0;
/**
* Appends the items from the iterator to the temp sequence
*/
- virtual void append(Iterator_t iter, bool copy) = 0;
-
- /**
- * Reads the whole Sequence from beginning to end; it is allowed to have several
- * concurrent iterators on the same TempSeq.
- *
- * @return Iterator which iterates over the complete TempSeq
- *
- */
- virtual Iterator_t getIterator() = 0;
-
- /**
- * Returns an iterator which reads just a part of the underlying TempSeq
- * Starts counting with 1.
- *
- * @param startPos The first item which the iterator returns. Starts counting with 1.
- * @param endPos The last item which the iterator returns
- * @return Iterator
- */
- virtual Iterator_t getIterator(
-xs_integer startPos,
-xs_integer endPos,
-bool streaming = false) = 0;
-
- /**
- * Gets an item at a certain position.
- *
- * Starts counting with 1.
- *
- * @param position (first position in XQuery is 1 and not 0!)
- * @return item
- */
- virtual void getItem(xs_integer position, Item_t& result) = 0;
-
-
- /**
- * Returns true if the item at the passed position is available.
- *
- * Starts counting with 1.
- *
- * @param position
- * @return
- */
- virtual bool containsItem(xs_integer position) = 0;
-
+ virtual void append(const Iterator_t& iter) = 0;
+
/**
* purge() allows the store to do proper garbage collection. If e.g. a let
* has created iterators for all his bindings he has to produce, it can
@@ -107,11 +64,54 @@
* @param upTo boundary for garbage collector
*/
virtual void purgeUpTo(xs_integer upTo) = 0;
-
+
/**
* @return Does this TempSeq save an empty sequence?
*/
virtual bool empty() = 0;
+
+ /**
+ * Gets an item at a certain position.
+ *
+ * Starts counting with 1.
+ *
+ * @param position (first position in XQuery is 1 and not 0!)
+ * @return item
+ */
+ virtual void getItem(xs_integer position, Item_t& result) = 0;
+
+
+ /**
+ * Returns true if the item at the passed position is available.
+ *
+ * Starts counting with 1.
+ *
+ * @param position
+ * @return
+ */
+ virtual bool containsItem(xs_integer position) = 0;
+
+ /**
+ * Reads the whole Sequence from beginning to end; it is allowed to have several
+ * concurrent iterators on the same TempSeq.
+ *
+ * @return Iterator which iterates over the complete TempSeq
+ *
+ */
+ virtual Iterator_t getIterator() const = 0;
+
+ /**
+ * Returns an iterator which reads just a part of the underlying TempSeq
+ * Starts counting with 1.
+ *
+ * @param startPos The first item which the iterator returns. Starts counting with 1.
+ * @param endPos The last item which the iterator returns
+ * @return Iterator
+ */
+ virtual I