Merge lp:~zorba-coders/zorba/collection-claim-tree-ownership into lp:zorba

Proposed by Ghislain Fourny
Status: Merged
Approved by: Till Westmann
Approved revision: 10727
Merged at revision: 10727
Proposed branch: lp:~zorba-coders/zorba/collection-claim-tree-ownership
Merge into: lp:zorba
Diff against target: 78 lines (+27/-1)
4 files modified
src/store/naive/collection.cpp (+5/-0)
src/store/naive/collection.h (+4/-0)
src/store/naive/node_items.cpp (+10/-0)
src/store/naive/node_items.h (+8/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/collection-claim-tree-ownership
Reviewer Review Type Date Requested Status
Till Westmann Approve
Matthias Brantner Approve
Review via email: mp+98419@code.launchpad.net

Commit message

Collections can claim ownership of a node they own but that does not have the pointer.

Description of the change

Collections can claim ownership of a node they own but that does not have the pointer.

To post a comment you must log in.
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

No approved revision specified.

10727. By Ghislain Fourny

claimOwnership is now protected.

Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Till Westmann (tillw) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job collection-claim-tree-ownership-2012-03-20T16-13-02.165Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/store/naive/collection.cpp'
2--- src/store/naive/collection.cpp 2012-03-01 14:22:17 +0000
3+++ src/store/naive/collection.cpp 2012-03-20 14:26:18 +0000
4@@ -26,6 +26,11 @@
5 namespace zorba {
6 namespace simplestore {
7
8+void Collection::claimOwnership(zorba::simplestore::XmlTree* aTree)
9+{
10+ aTree->claimedByCollection(this);
11+}
12+
13 void Collection::getIndexes(
14 const store::Item* name,
15 std::vector<store::Index*>& indexes)
16
17=== modified file 'src/store/naive/collection.h'
18--- src/store/naive/collection.h 2012-03-08 18:51:25 +0000
19+++ src/store/naive/collection.h 2012-03-20 14:26:18 +0000
20@@ -110,6 +110,10 @@
21
22 void getActiveICs(std::vector<store::IC*>& ics);
23
24+ /**************************** Claim of ownership ****************************/
25+protected:
26+ virtual void claimOwnership(zorba::simplestore::XmlTree* aTree);
27+
28 }; /* class Collection */
29
30 } /* namespace simplestore */ } /* namespace zorba */
31
32=== modified file 'src/store/naive/node_items.cpp'
33--- src/store/naive/node_items.cpp 2012-03-14 15:28:15 +0000
34+++ src/store/naive/node_items.cpp 2012-03-20 14:26:18 +0000
35@@ -105,6 +105,16 @@
36 /*******************************************************************************
37
38 ********************************************************************************/
39+void XmlTree::claimedByCollection(Collection* collection)
40+{
41+ ZORBA_ASSERT(collection != NULL);
42+ theCollection = collection;
43+}
44+
45+
46+/*******************************************************************************
47+
48+********************************************************************************/
49 void XmlTree::setCollection(Collection* collection, xs_integer pos)
50 {
51 ZORBA_ASSERT(collection == NULL || theCollection == NULL);
52
53=== modified file 'src/store/naive/node_items.h'
54--- src/store/naive/node_items.h 2012-03-15 15:30:19 +0000
55+++ src/store/naive/node_items.h 2012-03-20 14:26:18 +0000
56@@ -180,7 +180,7 @@
57 ulong theId;
58 xs_integer thePos;
59
60- Collection * theCollection;
61+ Collection * theCollection;
62
63 XmlNode * theRootNode;
64
65@@ -223,6 +223,13 @@
66
67 const Collection* getCollection() const { return theCollection; }
68
69+private:
70+friend class zorba::simplestore::Collection;
71+ // Allows a collection to claim ownership of a node it already owns, but
72+ // which does not have the backpointer yet.
73+ void claimedByCollection(Collection* coll);
74+
75+public:
76 void setCollection(Collection* coll, xs_integer pos);
77
78 void setPosition(xs_integer pos) { thePos = pos; }

Subscribers

People subscribed via source and target branches