Ghislain Fourny has proposed merging lp:~zorba-coders/zorba/treeid-fixes into 
lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/treeid-fixes/+merge/122054

Some fixes in TreeID API and some include cleanup.
-- 
https://code.launchpad.net/~zorba-coders/zorba/treeid-fixes/+merge/122054
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/store/naive/collection.h'
--- src/store/naive/collection.h	2012-08-29 11:12:58 +0000
+++ src/store/naive/collection.h	2012-08-30 12:43:18 +0000
@@ -16,10 +16,10 @@
 #ifndef ZORBA_SIMPLESTORE_COLLECTION
 #define ZORBA_SIMPLESTORE_COLLECTION
 
+#include "store/api/collection.h"
+
 #include "shared_types.h"
-
-#include "store/api/collection.h"
-
+#include "tree_id.h"
 
 namespace zorba { namespace simplestore {
 
@@ -87,7 +87,7 @@
 
   virtual ulong getId() const = 0;
 
-  virtual ulong createTreeId() = 0;
+  virtual TreeId createTreeId() = 0;
 
   /*********************** Indices ********************************************/
   static void getIndexes(

=== modified file 'src/store/naive/node_items.h'
--- src/store/naive/node_items.h	2012-08-29 11:12:58 +0000
+++ src/store/naive/node_items.h	2012-08-30 12:43:18 +0000
@@ -20,36 +20,35 @@
 #include <stack>
 #include <vector>
 
+#include <store/api/item.h>
+
+#include <diagnostics/assert.h>
 #include <zorba/config.h>
 #include <zorba/error.h>
+#ifndef ZORBA_NO_FULL_TEXT
+#include <zorba/locale.h>
+#include <zorba/tokenizer.h>
+#endif /* ZORBA_NO_FULL_TEXT */
+#include <zorbatypes/zstring.h>
+#include <zorbautils/fatal.h>
+#include <zorbautils/hashfun.h>
 
+#ifndef ZORBA_NO_FULL_TEXT
+#include "ft_token_store.h"
+#endif /* ZORBA_NO_FULL_TEXT */
+#include "item_vector.h"
+#include "nsbindings.h" // TODO remove by introducing explicit destructors
+#include "ordpath.h"
+#include "shared_types.h"
+#include "store.h"
 #include "store_defs.h"
-#include "shared_types.h"
 #include "text_node_content.h"
-#include "item_vector.h"
-#include "ordpath.h"
-#include "nsbindings.h" // TODO remove by introducing explicit destructors
 #include "tree_id.h"
-#include "simple_store.h"
 
 // Note: whether the EMBEDED_TYPE is defined or not is done in store_defs.h
 #ifndef EMBEDED_TYPE
 #include "hashmap_nodep.h"
-#endif
-
-#ifndef ZORBA_NO_FULL_TEXT
-#include <zorba/locale.h>
-#include <zorba/tokenizer.h>
-#include "ft_token_store.h"
-#endif /* ZORBA_NO_FULL_TEXT */
-
-#include "store/api/item.h"
-
-#include "diagnostics/assert.h"
-#include "zorbautils/fatal.h"
-#include "zorbautils/hashfun.h"
-
-#include "zorbatypes/zstring.h"
+#endif /* EMBEDED_TYPE */
 
 
 namespace zorba
@@ -1556,8 +1555,8 @@
   {
     if (col1 == 0)
     {
-      ulong tree1 = this->getTreeId();
-      ulong tree2 = other->getTreeId();
+      TreeId tree1 = this->getTreeId();
+      TreeId tree2 = other->getTreeId();
 
       if (tree1 < tree2)
         return -1;

=== modified file 'src/store/naive/simple_collection.cpp'
--- src/store/naive/simple_collection.cpp	2012-08-29 11:12:58 +0000
+++ src/store/naive/simple_collection.cpp	2012-08-30 12:43:18 +0000
@@ -49,7 +49,7 @@
   theNodeType(aNodeType)
 {
   theId = GET_STORE().createCollectionId();
-  theTreeIdGenerator = GET_STORE().getTreeIdGeneratorFactory().createTreeGenerator();
+  theTreeIdGenerator = GET_STORE().getTreeIdGeneratorFactory().createTreeGenerator(0);
 }
 
 
@@ -62,7 +62,7 @@
   theIsDynamic(false),
   theNodeType(NULL)
 {
-  theTreeIdGenerator = GET_STORE().getTreeIdGeneratorFactory().createTreeGenerator();
+  theTreeIdGenerator = GET_STORE().getTreeIdGeneratorFactory().createTreeGenerator(0);
 }
 
 

=== modified file 'src/store/naive/store.cpp'
--- src/store/naive/store.cpp	2012-08-29 11:12:58 +0000
+++ src/store/naive/store.cpp	2012-08-30 12:43:18 +0000
@@ -105,7 +105,6 @@
   theNodeFactory(NULL),
   thePULFactory(NULL),
   theTreeIdGeneratorFactory(NULL),
-  theTreeIdGenerator(NULL),
   theDocuments(DEFAULT_DOCUMENT_SET_SIZE, true),
   theCollections(0),
   theIndices(HashMapItemPointerCmp(0, NULL), DEFAULT_INDICES_SET_SIZE, true),
@@ -166,8 +165,6 @@
     
     theTreeIdGeneratorFactory = createTreeIdGeneratorFactory();
 
-    theTreeIdGenerator = theTreeIdGeneratorFactory->createTreeGenerator();
-
     theTraceLevel = store::Properties::instance()->storeTraceLevel();
 
     theCollections = createCollectionSet();
@@ -316,12 +313,6 @@
       destroyTreeIdGeneratorFactory(theTreeIdGeneratorFactory);
     }
 
-    if (theTreeIdGenerator)
-    {
-      delete theTreeIdGenerator;
-      theTreeIdGenerator = NULL;
-    }
-
     if (theQNamePool != NULL)
     {
       csize numTypes = theSchemaTypeNames.size();
@@ -407,7 +398,7 @@
 ********************************************************************************/
 TreeId Store::createTreeId()
 {
-  return theTreeIdGenerator->create();
+  return theTreeIdGeneratorFactory->getDefaultTreeIdGenerator().create();
 }
 
 

=== modified file 'src/store/naive/tree_id_generator.cpp'
--- src/store/naive/tree_id_generator.cpp	2012-03-28 22:09:36 +0000
+++ src/store/naive/tree_id_generator.cpp	2012-08-30 12:43:18 +0000
@@ -39,7 +39,8 @@
 /*******************************************************************************
 
 *******************************************************************************/
-TreeIdGenerator* SimpleTreeIdGeneratorFactory::createTreeGenerator()
+TreeIdGenerator* SimpleTreeIdGeneratorFactory::createTreeGenerator(
+    ulong aCollectionId)
 {
   return new SimpleTreeIdGenerator();
 }

=== modified file 'src/store/naive/tree_id_generator.h'
--- src/store/naive/tree_id_generator.h	2012-03-28 22:09:36 +0000
+++ src/store/naive/tree_id_generator.h	2012-08-30 12:43:18 +0000
@@ -64,7 +64,7 @@
 public:
   virtual ~TreeIdGeneratorFactory() {}
   
-  virtual TreeIdGenerator* createTreeGenerator() = 0;
+  virtual TreeIdGenerator* createTreeGenerator(ulong aCollectionId) = 0;
 
   virtual TreeIdGenerator& getDefaultTreeIdGenerator() = 0;
 };
@@ -79,7 +79,7 @@
   SimpleTreeIdGenerator theDefaultGenerator;
 
 public:
-  virtual TreeIdGenerator* createTreeGenerator();
+  virtual TreeIdGenerator* createTreeGenerator(ulong aCollectionId);
 
   virtual TreeIdGenerator& getDefaultTreeIdGenerator();
 };

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to