← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug-1210677-geo into lp:zorba/geo-module

 

Chris Hillery has proposed merging lp:~zorba-coders/zorba/bug-1210677-geo into lp:zorba/geo-module.

Commit message:
Replace auto_ptr with unique_ptr

Requested reviews:
  Zorba Coders (zorba-coders)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-1210677-geo/+merge/184927


-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-1210677-geo/+merge/184927
Your team Zorba Coders is requested to review the proposed merge of lp:~zorba-coders/zorba/bug-1210677-geo into lp:zorba/geo-module.
=== modified file 'src/geo.xq.src/geo_functions.cpp'
--- src/geo.xq.src/geo_functions.cpp	2013-07-10 01:08:44 +0000
+++ src/geo.xq.src/geo_functions.cpp	2013-09-11 04:38:10 +0000
@@ -462,7 +462,7 @@
 	/// a linear ring (linestring with 1st point == last point)
   case geos::geom::GEOS_LINEARRING:
   {
-    std::auto_ptr<geos::geom::CoordinateSequence>  cs;
+    std::unique_ptr<geos::geom::CoordinateSequence>  cs;
     cs.reset(geos_geometry->getCoordinates());
     size_t    cs_size = cs->getSize();
     for(size_t i=0;i<cs_size;i++)
@@ -1609,7 +1609,7 @@
       theModule->getItemFactory()->createAttributeNode(pos_item, item_name, item_type, attr_value_item);
     }
     char *strtemp;
-    std::auto_ptr<geos::geom::CoordinateSequence>  cs;
+    std::unique_ptr<geos::geom::CoordinateSequence>  cs;
     cs.reset(geos_geometry->getCoordinates());
     size_t    cs_size = cs->getSize();
     strtemp = (char*)malloc((50+indent)*(cs_size+1) + 1);
@@ -1843,13 +1843,13 @@
 bool GeoFunction::isCurve(const geos::geom::MultiLineString *multiline) const
 {
   geos::geom::MultiLineString::const_iterator line_it;
-  std::auto_ptr<geos::geom::Point> end_point;
+  std::unique_ptr<geos::geom::Point> end_point;
   for(line_it = multiline->begin(); line_it != multiline->end(); line_it++)
   {
     const geos::geom::LineString   *linestring = dynamic_cast<const geos::geom::LineString*>(*line_it);
     if(end_point.get())
     {
-      std::auto_ptr<geos::geom::Point> start_point;
+      std::unique_ptr<geos::geom::Point> start_point;
       start_point.reset(linestring->getStartPoint());
       if(start_point->compareTo(end_point.get()))
         return false;
@@ -1869,16 +1869,16 @@
   unsigned int i;
   //see if last point of a segment is the first of the next
   const geos::geom::LineString *segment1 = dynamic_cast<const geos::geom::LineString *>(curve->getGeometryN(0));
-  std::auto_ptr<const geos::geom::CoordinateSequence> coords1(segment1->getCoordinates());
+  std::unique_ptr<const geos::geom::CoordinateSequence> coords1(segment1->getCoordinates());
   const geos::geom::LineString *segment2;
-  std::auto_ptr<const geos::geom::CoordinateSequence> coords2;
+  std::unique_ptr<const geos::geom::CoordinateSequence> coords2;
   for(i=1;i<num_segments;i++)
   {
     segment2 = dynamic_cast<const geos::geom::LineString *>(curve->getGeometryN(i));
     coords2.reset(segment2->getCoordinates());
     if(coords1->getAt(coords1->size()-1) != coords2->getAt(0))
       return false;
-    coords1 = coords2;
+    coords1 = std::move(coords2);
     segment1 = segment2;
   }
   //check if last point is the same as the first point of the curve
@@ -1899,7 +1899,7 @@
   if(!num_segments)
     return NULL;
   const geos::geom::LineString *segment;
-  std::auto_ptr<const geos::geom::CoordinateSequence> coords;
+  std::unique_ptr<const geos::geom::CoordinateSequence> coords;
   geos::geom::CoordinateSequence *linestring_coords = geos::geom::CoordinateArraySequenceFactory::instance()->create((std::size_t)0, 2);
   unsigned int i;
   for(i=0;i<num_segments;i++)
@@ -2208,7 +2208,7 @@
 #endif
       cl = geos::geom::CoordinateArraySequenceFactory::instance()->create((std::size_t)0, srs_dim);
     }
-    std::auto_ptr<const geos::geom::CoordinateSequence> coords(part->getCoordinates());
+    std::unique_ptr<const geos::geom::CoordinateSequence> coords(part->getCoordinates());
     cl->add(coords.get(), false, true);
 
     segments[0] = NULL;
@@ -2221,7 +2221,7 @@
         if(!segments[s])
           continue;
         const geos::geom::Geometry *segmn = segments[s];
-        std::auto_ptr<geos::geom::CoordinateSequence> coords(segmn->getCoordinates());
+        std::unique_ptr<geos::geom::CoordinateSequence> coords(segmn->getCoordinates());
         geos::geom::Coordinate point = coords->getAt(0);
         if(last_point == point)
         {
@@ -2264,7 +2264,7 @@
   gmlsf_types   geometric_type;
   geometric_type = getGeometryNodeType(args, 0, lItem);
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry(buildGeosGeometryFromItem(lItem, geometric_type, -1));
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry(buildGeosGeometryFromItem(lItem, geometric_type, -1));
 
   geos::geom::Dimension::DimensionType   dim_type = geos::geom::Dimension::DONTCARE;
   try{
@@ -2306,7 +2306,7 @@
     break;
   }
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry(buildGeosGeometryFromItem(lItem, geometric_type, -1));
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry(buildGeosGeometryFromItem(lItem, geometric_type, -1));
 
 #if GEOS_VERSION_MAJOR > 3 || (GEOS_VERSION_MAJOR == 3 && GEOS_VERSION_MINOR > 2)
   int   coord_dim = geos_geometry->getCoordinateDimension();
@@ -2520,9 +2520,9 @@
   }                                                                                     \
                                                                                         \
   zorba::Item srs_uri;                                                                  \
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry(buildGeosGeometryFromItem(lItem, geometric_type, -1, &srs_uri));  \
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry(buildGeosGeometryFromItem(lItem, geometric_type, -1, &srs_uri));  \
                                                                                         \
-  std::auto_ptr<geos::geom::Geometry>  geos_result;                                     \
+  std::unique_ptr<geos::geom::Geometry>  geos_result;                                     \
   try{                                                                                  \
     geos_result.reset(geos_geometry->geos_function_name());                             \
   }catch(std::exception &excep)                                                         \
@@ -2546,7 +2546,7 @@
 
 zorba::Item GeoFunction::getBoundary(geos::geom::Geometry *geos_geometry, zorba::Item srs_uri) const
 {
-  std::auto_ptr<geos::geom::Geometry>  geos_result;
+  std::unique_ptr<geos::geom::Geometry>  geos_result;
   if(geos_geometry->getUserData() == (void*)GMLSF_SURFACE)
   {
     geos::geom::LinearRing *exterior_ring;
@@ -2645,7 +2645,7 @@
     break;
   }
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry;
   zorba::Item srs_uri;
   geos_geometry.reset(buildGeosGeometryFromItem(lItem, geometric_type, -1, &srs_uri));
 
@@ -2690,7 +2690,7 @@
     break;
   }
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry;
   zorba::Item  srs_uri;
   geos_geometry.reset(buildGeosGeometryFromItem(lItem, geometric_type, -1, &srs_uri));
 
@@ -2726,7 +2726,7 @@
     break;
   }
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry;
   zorba::Item  srs_uri;
   geos_geometry.reset(buildGeosGeometryFromItem(lItem, geometric_type, -1, &srs_uri));
 
@@ -2807,7 +2807,7 @@
     break;
   }
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry;
   geos_geometry.reset(buildGeosGeometryFromItem(lItem, geometric_type, -1));
 
   std::string as_text;
@@ -2854,7 +2854,7 @@
     break;
   }
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry;
   geos_geometry.reset(buildGeosGeometryFromItem(lItem, geometric_type, -1));
 
   std::ostringstream as_binary;
@@ -2908,7 +2908,7 @@
       theModule->getItemFactory()->createBoolean(true)));
   }
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry;
   geos_geometry.reset(buildGeosGeometryFromItem(lItem, geotype, -1));
 
   bool is_empty = false;
@@ -2951,7 +2951,7 @@
     break;
   }
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry;
   geos_geometry.reset(buildGeosGeometryFromItem(lItem, geometric_type, -1));
 
   bool is_simple = false;
@@ -3001,7 +3001,7 @@
     break;
   }
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry;
   geos_geometry.reset(buildGeosGeometryFromItem(lItem, geometric_type, -1));
 
 #if GEOS_VERSION_MAJOR > 3 || (GEOS_VERSION_MAJOR == 3 && GEOS_VERSION_MINOR > 2)
@@ -3093,11 +3093,11 @@
     break;                                                                        \
   }                                                                               \
                                                                                   \
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry1;                                          \
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry1;                                          \
   zorba::Item srs_uri1;                                                           \
   geos_geometry1.reset(buildGeosGeometryFromItem(lItem1, geometric_type1, -1, &srs_uri1));            \
                                                                                   \
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry2;                                          \
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry2;                                          \
   zorba::Item srs_uri2;                                                           \
   geos_geometry2.reset(buildGeosGeometryFromItem(lItem2, geometric_type2, -1, &srs_uri2));            \
                                                                                   \
@@ -3182,11 +3182,11 @@
     break;                                                                        \
   }                                                                               \
                                                                                   \
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry1;                                          \
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry1;                                          \
   zorba::Item srs_uri1;                                                           \
   geos_geometry1.reset(buildGeosGeometryFromItem(lItem1, geometric_type1, -1, &srs_uri1));            \
                                                                                   \
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry2;                                          \
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry2;                                          \
   zorba::Item srs_uri2;                                                           \
   geos_geometry2.reset(buildGeosGeometryFromItem(lItem2, geometric_type2, -1, &srs_uri2));            \
                                                                                   \
@@ -3199,7 +3199,7 @@
     throwError("SRSNotIdenticalInBothGeometries", lErrorMessage.str());           \
   }                                                                               \
                                                                                   \
-  std::auto_ptr<geos::geom::Geometry>  geos_result;                               \
+  std::unique_ptr<geos::geom::Geometry>  geos_result;                               \
   try{                                                                            \
   geos_result.reset(geos_geometry1->geos_function_name(geos_geometry2.get()));          \
   }catch(std::exception &excep)                                                   \
@@ -3253,7 +3253,7 @@
     break;                                                                              \
   }                                                                                     \
                                                                                         \
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry;                                                 \
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry;                                                 \
   geos_geometry.reset(buildGeosGeometryFromItem(lItem, geometric_type, -1));                 \
                                                                                         \
   double  retval = 0;                                                                   \
@@ -3318,11 +3318,11 @@
     break;
   }
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry1;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry1;
   zorba::Item  srs_uri1;
   geos_geometry1.reset(buildGeosGeometryFromItem(lItem1, geometric_type1, -1, &srs_uri1));
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry2;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry2;
   zorba::Item  srs_uri2;
   geos_geometry2.reset(buildGeosGeometryFromItem(lItem2, geometric_type2, -1, &srs_uri2));
 
@@ -3409,11 +3409,11 @@
     break;
   }
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry1;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry1;
   zorba::Item  srs_uri1;
   geos_geometry1.reset(buildGeosGeometryFromItem(lItem1, geometric_type1, -1, &srs_uri1));
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry2;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry2;
   zorba::Item  srs_uri2;
   geos_geometry2.reset(buildGeosGeometryFromItem(lItem2, geometric_type2, -1, &srs_uri2));
 
@@ -3499,11 +3499,11 @@
     break;
   }
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry1;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry1;
   zorba::Item  srs_uri1;
   geos_geometry1.reset(buildGeosGeometryFromItem(lItem1, geometric_type1, -1, &srs_uri1));
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry2;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry2;
   zorba::Item  srs_uri2;
   geos_geometry2.reset(buildGeosGeometryFromItem(lItem2, geometric_type2, -1, &srs_uri2));
 
@@ -3555,7 +3555,7 @@
     break;
   }
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry1;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry1;
   zorba::Item srs_uri;
   geos_geometry1.reset(buildGeosGeometryFromItem(lItem1, geometric_type1, -1, &srs_uri));
 
@@ -3574,7 +3574,7 @@
   double distance;
   distance = lItem2.getDoubleValue();
 
-  std::auto_ptr<geos::geom::Geometry>  geos_result;
+  std::unique_ptr<geos::geom::Geometry>  geos_result;
   try{
   geos_result.reset(geos_geometry1->buffer(distance));
   }catch(std::exception &excep)
@@ -3628,7 +3628,7 @@
     break;                                                                              \
   }                                                                                     \
                                                                                         \
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry;                                   \
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry;                                   \
   geos_geometry.reset(buildGeosGeometryFromItem(lItem, geometric_type, -1));            \
   geos::geom::Point   *geos_point = dynamic_cast<geos::geom::Point*>(geos_geometry.get());    \
                                                                                         \
@@ -3683,7 +3683,7 @@
     }
     break;
   }
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry;
   geos_geometry.reset(buildGeosGeometryFromItem(lItem, geometric_type, -1));
 
   const geos::geom::Coordinate  *c;
@@ -3888,7 +3888,7 @@
     break;
   }
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry;
   geos_geometry.reset(buildGeosGeometryFromItem(lItem, geometric_type, -1));
 
   bool  retval = 0;
@@ -3962,7 +3962,7 @@
     break;
   }
 
-  std::auto_ptr<geos::geom::Geometry>  geos_geometry;
+  std::unique_ptr<geos::geom::Geometry>  geos_geometry;
   geos_geometry.reset(buildGeosGeometryFromItem(lItem, geometric_type, -1));
 
   bool  retval = 0;
@@ -4434,8 +4434,8 @@
   patches_children->open();
   unsigned int patch_nr = 0;
 
-  std::auto_ptr<geos::geom::Geometry> geos_geometry1(buildGeosGeometryFromItem(lItem1, geometric_type1, -1));
-  std::auto_ptr<geos::geom::Geometry> geos_geometry2(buildGeosGeometryFromItem(lItem2, GMLSF_POLYGON, -1));
+  std::unique_ptr<geos::geom::Geometry> geos_geometry1(buildGeosGeometryFromItem(lItem1, geometric_type1, -1));
+  std::unique_ptr<geos::geom::Geometry> geos_geometry2(buildGeosGeometryFromItem(lItem2, GMLSF_POLYGON, -1));
 
   const geos::geom::MultiPolygon *surface = dynamic_cast<const geos::geom::MultiPolygon*>(geos_geometry1.get());
   const geos::geom::Polygon *polygon = dynamic_cast<const geos::geom::Polygon*>(geos_geometry2.get());


Follow ups