[GRASS-SVN] r58455 - in grass/trunk: include/iostream raster/r.terraflow raster/r.viewshed

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Dec 13 04:10:18 PST 2013


Author: glynn
Date: 2013-12-13 04:10:17 -0800 (Fri, 13 Dec 2013)
New Revision: 58455

Modified:
   grass/trunk/include/iostream/ami_stream.h
   grass/trunk/include/iostream/empq_impl.h
   grass/trunk/include/iostream/mem_stream.h
   grass/trunk/include/iostream/minmaxheap.h
   grass/trunk/include/iostream/queue.h
   grass/trunk/raster/r.terraflow/3scan.h
   grass/trunk/raster/r.terraflow/ccforest.h
   grass/trunk/raster/r.terraflow/common.cpp
   grass/trunk/raster/r.terraflow/common.h
   grass/trunk/raster/r.terraflow/direction.cpp
   grass/trunk/raster/r.terraflow/direction.h
   grass/trunk/raster/r.terraflow/nodata.cpp
   grass/trunk/raster/r.terraflow/nodata.h
   grass/trunk/raster/r.terraflow/sortutils.h
   grass/trunk/raster/r.terraflow/stats.h
   grass/trunk/raster/r.terraflow/streamutils.h
   grass/trunk/raster/r.terraflow/types.cpp
   grass/trunk/raster/r.terraflow/types.h
   grass/trunk/raster/r.terraflow/unionFind.h
   grass/trunk/raster/r.terraflow/water.cpp
   grass/trunk/raster/r.viewshed/rbbst.cpp
   grass/trunk/raster/r.viewshed/rbbst.h
   grass/trunk/raster/r.viewshed/statusstructure.cpp
   grass/trunk/raster/r.viewshed/statusstructure.h
Log:
Eliminate "using namespace std"


Modified: grass/trunk/include/iostream/ami_stream.h
===================================================================
--- grass/trunk/include/iostream/ami_stream.h	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/include/iostream/ami_stream.h	2013-12-13 12:10:17 UTC (rev 58455)
@@ -51,7 +51,12 @@
 
 #include <cstring>
 #include <iostream>
-using namespace std;
+using std::cout;
+using std::cerr;
+using std::endl;
+using std::ostream;
+using std::ofstream;
+using std::istream;
 
 extern "C" {
 #include <grass/gis.h>

Modified: grass/trunk/include/iostream/empq_impl.h
===================================================================
--- grass/trunk/include/iostream/empq_impl.h	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/include/iostream/empq_impl.h	2013-12-13 12:10:17 UTC (rev 58455)
@@ -39,7 +39,6 @@
 
 #include <ostream>
 #include <vector>
-using namespace std;
 
 #include "empq.h"
 

Modified: grass/trunk/include/iostream/mem_stream.h
===================================================================
--- grass/trunk/include/iostream/mem_stream.h	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/include/iostream/mem_stream.h	2013-12-13 12:10:17 UTC (rev 58455)
@@ -42,7 +42,6 @@
 
 #include <cstring>
 #include <iostream>
-using namespace std;
 
 template<class T>
 class MEM_STREAM {

Modified: grass/trunk/include/iostream/minmaxheap.h
===================================================================
--- grass/trunk/include/iostream/minmaxheap.h	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/include/iostream/minmaxheap.h	2013-12-13 12:10:17 UTC (rev 58455)
@@ -47,7 +47,6 @@
 #endif
 
 #include <sstream>
-using namespace std;
 
 #include "mm_utils.h"
 #include "ami_config.h"  //for SAVE_MEMORY flag

Modified: grass/trunk/include/iostream/queue.h
===================================================================
--- grass/trunk/include/iostream/queue.h	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/include/iostream/queue.h	2013-12-13 12:10:17 UTC (rev 58455)
@@ -38,7 +38,6 @@
 
 #include <assert.h>
 #include <iostream>
-using namespace std;
 
 template<class T> 
 class queue {

Modified: grass/trunk/raster/r.terraflow/3scan.h
===================================================================
--- grass/trunk/raster/r.terraflow/3scan.h	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.terraflow/3scan.h	2013-12-13 12:10:17 UTC (rev 58455)
@@ -20,7 +20,6 @@
 #define __3SCAN_H
 
 #include <iostream>
-using namespace std;
 
 #include <grass/iostream/ami.h>
 #include "types.h"

Modified: grass/trunk/raster/r.terraflow/ccforest.h
===================================================================
--- grass/trunk/raster/r.terraflow/ccforest.h	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.terraflow/ccforest.h	2013-12-13 12:10:17 UTC (rev 58455)
@@ -22,7 +22,6 @@
 
 #include <assert.h>
 #include <iostream>
-using namespace std;
 
 #include <grass/iostream/ami.h>
 

Modified: grass/trunk/raster/r.terraflow/common.cpp
===================================================================
--- grass/trunk/raster/r.terraflow/common.cpp	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.terraflow/common.cpp	2013-12-13 12:10:17 UTC (rev 58455)
@@ -30,7 +30,6 @@
 #endif
 
 #include <iostream>
-using namespace std;
 
 #include "common.h"
 

Modified: grass/trunk/raster/r.terraflow/common.h
===================================================================
--- grass/trunk/raster/r.terraflow/common.h	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.terraflow/common.h	2013-12-13 12:10:17 UTC (rev 58455)
@@ -22,7 +22,6 @@
 
 #include <sys/types.h>
 #include <iostream>
-using namespace std;
 
 #include <grass/iostream/ami.h>
 

Modified: grass/trunk/raster/r.terraflow/direction.cpp
===================================================================
--- grass/trunk/raster/r.terraflow/direction.cpp	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.terraflow/direction.cpp	2013-12-13 12:10:17 UTC (rev 58455)
@@ -53,11 +53,11 @@
   
   if(!is_nodata(elevwin.get())) {
     dir = 0;
-    if (elevwin.get(5) < elevwin.get() && !elevation_type_is_void(elevwin.get(5))) dir |= 1;
-    if (elevwin.get(3) < elevwin.get() && !elevation_type_is_void(elevwin.get(3))) dir |= 16;
+    if (elevwin.get(5) < elevwin.get() && !is_void(elevwin.get(5))) dir |= 1;
+    if (elevwin.get(3) < elevwin.get() && !is_void(elevwin.get(3))) dir |= 16;
     for(int i=0; i<3; i++) {
-      if(elevwin.get(i) < elevwin.get() && !elevation_type_is_void(elevwin.get(i))) dir |= 32<<i;
-      if(elevwin.get(i+6) < elevwin.get() && !elevation_type_is_void(elevwin.get(6+i))) dir |= 8>>i;
+      if(elevwin.get(i) < elevwin.get() && !is_void(elevwin.get(i))) dir |= 32<<i;
+      if(elevwin.get(i+6) < elevwin.get() && !is_void(elevwin.get(6+i))) dir |= 8>>i;
     }
   }
   

Modified: grass/trunk/raster/r.terraflow/direction.h
===================================================================
--- grass/trunk/raster/r.terraflow/direction.h	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.terraflow/direction.h	2013-12-13 12:10:17 UTC (rev 58455)
@@ -28,7 +28,6 @@
 #include <ostream.h>
 #endif
 
-using namespace std;
 
 #include <grass/iostream/ami.h>
 

Modified: grass/trunk/raster/r.terraflow/nodata.cpp
===================================================================
--- grass/trunk/raster/r.terraflow/nodata.cpp	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.terraflow/nodata.cpp	2013-12-13 12:10:17 UTC (rev 58455)
@@ -73,7 +73,7 @@
 
 
 int
-elevation_type_is_void(elevation_type el) {
+is_void(elevation_type el) {
   return (el == nodataType::ELEVATION_NODATA);
 }
 

Modified: grass/trunk/raster/r.terraflow/nodata.h
===================================================================
--- grass/trunk/raster/r.terraflow/nodata.h	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.terraflow/nodata.h	2013-12-13 12:10:17 UTC (rev 58455)
@@ -37,7 +37,7 @@
 int is_nodata(elevation_type el);
 int is_nodata(int x);
 int is_nodata(float x);
-int elevation_type_is_void(elevation_type el);
+int is_void(elevation_type el);
 
 
 class nodataType : public ijBaseType {

Modified: grass/trunk/raster/r.terraflow/sortutils.h
===================================================================
--- grass/trunk/raster/r.terraflow/sortutils.h	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.terraflow/sortutils.h	2013-12-13 12:10:17 UTC (rev 58455)
@@ -20,7 +20,6 @@
 #define SORTUTILS_H
 
 #include <fstream>
-using namespace std;
 
 #include <grass/iostream/ami.h>
 #include "common.h"

Modified: grass/trunk/raster/r.terraflow/stats.h
===================================================================
--- grass/trunk/raster/r.terraflow/stats.h	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.terraflow/stats.h	2013-12-13 12:10:17 UTC (rev 58455)
@@ -24,7 +24,6 @@
 
 #include <fstream>
 #include <iostream>
-using namespace std;
 
 #include <grass/iostream/ami.h>
 

Modified: grass/trunk/raster/r.terraflow/streamutils.h
===================================================================
--- grass/trunk/raster/r.terraflow/streamutils.h	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.terraflow/streamutils.h	2013-12-13 12:10:17 UTC (rev 58455)
@@ -20,7 +20,6 @@
 #define STREAMUTILS_H
 
 #include <fstream>
-using namespace std;
 
 #include <grass/iostream/ami.h>
 #include "types.h"

Modified: grass/trunk/raster/r.terraflow/types.cpp
===================================================================
--- grass/trunk/raster/r.terraflow/types.cpp	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.terraflow/types.cpp	2013-12-13 12:10:17 UTC (rev 58455)
@@ -37,8 +37,8 @@
 
 
 
-ostream&
-operator << (ostream& s, const ijBaseType &p) {
+std::ostream&
+operator << (std::ostream& s, const ijBaseType &p) {
   return s << "(" << p.i << "," << p.j << ")";
 }
 

Modified: grass/trunk/raster/r.terraflow/types.h
===================================================================
--- grass/trunk/raster/r.terraflow/types.h	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.terraflow/types.h	2013-12-13 12:10:17 UTC (rev 58455)
@@ -21,7 +21,6 @@
 
 #include <limits.h>
 #include <iostream>
-using namespace std;
 
 
 /* input parameters type */
@@ -118,7 +117,7 @@
   friend int operator!=(const ijBaseType &a, const ijBaseType &b) {
 	return (compare(a,b) != 0);
   }
-  friend ostream& operator << (ostream& s, const ijBaseType &p);
+  friend std::ostream& operator << (std::ostream& s, const ijBaseType &p);
   static int compare(const ijBaseType &a, const ijBaseType &b);
 };
 

Modified: grass/trunk/raster/r.terraflow/unionFind.h
===================================================================
--- grass/trunk/raster/r.terraflow/unionFind.h	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.terraflow/unionFind.h	2013-12-13 12:10:17 UTC (rev 58455)
@@ -23,7 +23,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <iostream>
-using namespace std;
 
 /* initial range guesstimate */
 #define UNION_INITIAL_SIZE 2000

Modified: grass/trunk/raster/r.terraflow/water.cpp
===================================================================
--- grass/trunk/raster/r.terraflow/water.cpp	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.terraflow/water.cpp	2013-12-13 12:10:17 UTC (rev 58455)
@@ -19,7 +19,6 @@
 
 #include <assert.h>
 #include <iostream>
-using namespace std;
 
 #include <grass/iostream/ami.h>
 

Modified: grass/trunk/raster/r.viewshed/rbbst.cpp
===================================================================
--- grass/trunk/raster/r.viewshed/rbbst.cpp	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.viewshed/rbbst.cpp	2013-12-13 12:10:17 UTC (rev 58455)
@@ -104,7 +104,7 @@
 }
 
 /*LT: not sure if this is correct */
-int rbtree_is_empty(RBTree * t)
+int is_empty(RBTree * t)
 {
     assert(t);
     return (t->root == NIL);

Modified: grass/trunk/raster/r.viewshed/rbbst.h
===================================================================
--- grass/trunk/raster/r.viewshed/rbbst.h	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.viewshed/rbbst.h	2013-12-13 12:10:17 UTC (rev 58455)
@@ -96,7 +96,7 @@
 double find_max_gradient_within_key(RBTree * rbt, double key, double angle, double gradient);
 
 /*LT: not sure if this is correct */
-int rbtree_is_empty(RBTree * t);
+int is_empty(RBTree * t);
 
 
 

Modified: grass/trunk/raster/r.viewshed/statusstructure.cpp
===================================================================
--- grass/trunk/raster/r.viewshed/statusstructure.cpp	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.viewshed/statusstructure.cpp	2013-12-13 12:10:17 UTC (rev 58455)
@@ -98,7 +98,7 @@
     G_verbose_message(_(" (key=%d, ptr=%d, total node=%d B)"),
 	   (int)sizeof(TreeValue),
 	   (int)sizeof(TreeNode *), (int)sizeof(TreeNode));
-    sizeBytes = sizeof(TreeNode) * max(hd->ncols, hd->nrows);
+    sizeBytes = sizeof(TreeNode) * std::max(hd->ncols, hd->nrows);
     G_verbose_message(_(" Total= %lld B"), sizeBytes);
     return sizeBytes;
 }
@@ -292,7 +292,7 @@
     assert(sl);
     /*note: if there is nothing in the status struccture, it means this
        cell is VISIBLE */
-    if (status_list_is_empty(sl))
+    if (is_empty(sl))
 	return SMALLEST_GRADIENT;
     /*it is also possible that the status structure is not empty, but
        there are no events with key < dist ---in this case it returns
@@ -301,9 +301,9 @@
 }
 
 /*returns true if it is empty */
-int status_list_is_empty(StatusList * sl)
+int is_empty(StatusList * sl)
 {
     assert(sl);
-    return (rbtree_is_empty(sl->rbt) ||
+    return (is_empty(sl->rbt) ||
 	    sl->rbt->root->value.maxGradient == SMALLEST_GRADIENT);
 }

Modified: grass/trunk/raster/r.viewshed/statusstructure.h
===================================================================
--- grass/trunk/raster/r.viewshed/statusstructure.h	2013-12-12 10:58:25 UTC (rev 58454)
+++ grass/trunk/raster/r.viewshed/statusstructure.h	2013-12-13 12:10:17 UTC (rev 58455)
@@ -89,7 +89,7 @@
 void delete_status_structure(StatusList * sl);
 
 /*returns true is it is empty */
-int status_list_is_empty(StatusList * sl);
+int is_empty(StatusList * sl);
 
 
 /*delete the statusNode with the given key */



More information about the grass-commit mailing list