Commit 7923aa4c authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[2107] make sure domain-tree nodes store data pointers as offset_ptrs.

not directly related to this branch, but we'll eventually need this.
the change is purely local to the domaintree.h; no need to update tests.
parent 6ca7b0d6
...@@ -229,17 +229,17 @@ public: ...@@ -229,17 +229,17 @@ public:
/// ///
/// You should not delete the data, it is deleted when the tree is /// You should not delete the data, it is deleted when the tree is
/// destroyed. /// destroyed.
T* getData() { return (data_); } T* getData() { return (data_.get()); }
/// \brief Return the data stored in this node (const). /// \brief Return the data stored in this node (const).
const T* getData() const { return (data_); } const T* getData() const { return (data_.get()); }
/// \brief return whether the node has related data. /// \brief return whether the node has related data.
/// ///
/// There can be empty nodes inside the DomainTree. They are usually the /// There can be empty nodes inside the DomainTree. They are usually the
/// non-terminal domains, but it is possible (yet probably meaningless) /// non-terminal domains, but it is possible (yet probably meaningless)
/// empty nodes anywhere. /// empty nodes anywhere.
bool isEmpty() const { return (data_ == NULL); } bool isEmpty() const { return (!data_); }
//@} //@}
/// \name Setter functions. /// \name Setter functions.
...@@ -259,7 +259,7 @@ public: ...@@ -259,7 +259,7 @@ public:
*old_data = data; *old_data = data;
} else { } else {
const DT deleter; const DT deleter;
deleter(mem_sgmt, data_); deleter(mem_sgmt, data_.get());
} }
data_ = data; data_ = data;
} }
...@@ -476,7 +476,7 @@ private: ...@@ -476,7 +476,7 @@ private:
} }
/// \brief Data stored here. /// \brief Data stored here.
T* data_; boost::interprocess::offset_ptr<T> data_;
/// \brief Internal or user-configurable flags of node's properties. /// \brief Internal or user-configurable flags of node's properties.
/// ///
...@@ -1390,7 +1390,7 @@ DomainTree<T, DT>::deleteHelper(util::MemorySegment& mem_sgmt, ...@@ -1390,7 +1390,7 @@ DomainTree<T, DT>::deleteHelper(util::MemorySegment& mem_sgmt,
// free this one and go back to its parent. // free this one and go back to its parent.
DomainTreeNode<T, DT>* node = root; DomainTreeNode<T, DT>* node = root;
root = root->getParent(); root = root->getParent();
deleter(mem_sgmt, node->data_); deleter(mem_sgmt, node->data_.get());
DomainTreeNode<T, DT>::destroy(mem_sgmt, node); DomainTreeNode<T, DT>::destroy(mem_sgmt, node);
--node_count_; --node_count_;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment