Skip to content

Commit

Permalink
return reference instead of unique_ptr, per @dbaston
Browse files Browse the repository at this point in the history
  • Loading branch information
pramsey committed Aug 15, 2024
1 parent 5a2afd8 commit 220df45
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions include/geos/geom/prep/BasicPreparedGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ class BasicPreparedGeometry: public PreparedGeometry {
std::vector<const CoordinateXY*> representativePts;
mutable std::unique_ptr<RelateNG> relate_ng;

std::unique_ptr<RelateNG>& getRelateNG() const
RelateNG& getRelateNG() const
{
if (relate_ng == nullptr)
relate_ng = RelateNG::prepare(baseGeom);

return relate_ng;
return *relate_ng;
}

protected:
Expand Down
24 changes: 12 additions & 12 deletions src/geom/prep/BasicPreparedGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,73 +93,73 @@ BasicPreparedGeometry::isAnyTargetComponentInTest(const geom::Geometry* testGeom
bool
BasicPreparedGeometry::within(const geom::Geometry* g) const
{
return getRelateNG()->within(g);
return getRelateNG().within(g);
}

bool
BasicPreparedGeometry::contains(const geom::Geometry* g) const
{
return getRelateNG()->contains(g);
return getRelateNG().contains(g);
}

bool
BasicPreparedGeometry::containsProperly(const geom::Geometry* g) const
{
return getRelateNG()->relate(g, "T**FF*FF*");
return getRelateNG().relate(g, "T**FF*FF*");
}

bool
BasicPreparedGeometry::coveredBy(const geom::Geometry* g) const
{
return getRelateNG()->coveredBy(g);
return getRelateNG().coveredBy(g);
}

bool
BasicPreparedGeometry::covers(const geom::Geometry* g) const
{
return getRelateNG()->covers(g);
return getRelateNG().covers(g);
}

bool
BasicPreparedGeometry::crosses(const geom::Geometry* g) const
{
return getRelateNG()->crosses(g);
return getRelateNG().crosses(g);
}

bool
BasicPreparedGeometry::disjoint(const geom::Geometry* g) const
{
return getRelateNG()->disjoint(g);
return getRelateNG().disjoint(g);
}

bool
BasicPreparedGeometry::intersects(const geom::Geometry* g) const
{
return getRelateNG()->intersects(g);
return getRelateNG().intersects(g);
}

bool
BasicPreparedGeometry::overlaps(const geom::Geometry* g) const
{
return getRelateNG()->overlaps(g);
return getRelateNG().overlaps(g);
}

bool
BasicPreparedGeometry::touches(const geom::Geometry* g) const
{
return getRelateNG()->touches(g);
return getRelateNG().touches(g);
}

bool
BasicPreparedGeometry::relate(const geom::Geometry* g, const std::string& pat) const
{
return getRelateNG()->relate(g, pat);
return getRelateNG().relate(g, pat);
}

std::unique_ptr<IntersectionMatrix>
BasicPreparedGeometry::relate(const geom::Geometry* g) const
{
return getRelateNG()->relate(g);
return getRelateNG().relate(g);
}


Expand Down

0 comments on commit 220df45

Please sign in to comment.