[geos-commits] r2724 - in trunk/source: headers/geos/index/strtree
index/strtree
svn_geos at osgeo.org
svn_geos at osgeo.org
Thu Nov 19 13:52:50 EST 2009
Author: strk
Date: 2009-11-19 13:52:45 -0500 (Thu, 19 Nov 2009)
New Revision: 2724
Modified:
trunk/source/headers/geos/index/strtree/AbstractNode.h
trunk/source/index/strtree/AbstractNode.cpp
Log:
Don not allocate the container of STRtree node childs on the heap
Modified: trunk/source/headers/geos/index/strtree/AbstractNode.h
===================================================================
--- trunk/source/headers/geos/index/strtree/AbstractNode.h 2009-11-19 16:40:29 UTC (rev 2723)
+++ trunk/source/headers/geos/index/strtree/AbstractNode.h 2009-11-19 18:52:45 UTC (rev 2724)
@@ -37,17 +37,22 @@
*/
class GEOS_DLL AbstractNode: public Boundable {
private:
- std::vector<Boundable*> *childBoundables;
+ std::vector<Boundable*> childBoundables;
int level;
public:
AbstractNode(int newLevel, int capacity=10);
virtual ~AbstractNode();
+
+ // TODO: change signature to return by ref,
+ // document ownership of the return
inline std::vector<Boundable*>* getChildBoundables() {
- return childBoundables;
+ return &childBoundables;
}
+ // TODO: change signature to return by ref,
+ // document ownership of the return
inline const std::vector<Boundable*>* getChildBoundables() const {
- return childBoundables;
+ return &childBoundables;
}
/**
Modified: trunk/source/index/strtree/AbstractNode.cpp
===================================================================
--- trunk/source/index/strtree/AbstractNode.cpp 2009-11-19 16:40:29 UTC (rev 2723)
+++ trunk/source/index/strtree/AbstractNode.cpp 2009-11-19 18:52:45 UTC (rev 2724)
@@ -31,24 +31,14 @@
* the root node will have the highest level
*/
AbstractNode::AbstractNode(int newLevel, int capacity) {
- childBoundables=new std::vector<Boundable*>();
- childBoundables->reserve(capacity);
+ childBoundables.reserve(capacity);
bounds=NULL;
level=newLevel;
}
AbstractNode::~AbstractNode() {
- delete childBoundables;
}
-/**
-* Returns either child AbstractNodes, or if this is a leaf node, real data (wrapped
-* in ItemBoundables).
-*/
-//vector<Boundable*>* AbstractNode::getChildBoundables() {
- //return childBoundables;
-//}
-
const void *
AbstractNode::getBounds() const
{
@@ -72,7 +62,7 @@
*/
void AbstractNode::addChildBoundable(Boundable *childBoundable) {
assert(bounds==NULL);
- childBoundables->push_back(childBoundable);
+ childBoundables.push_back(childBoundable);
}
} // namespace geos.index.strtree
More information about the geos-commits
mailing list