From 1a976d3c97f4a419d4f88a86684f0e92ebfe0247 Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Thu, 10 May 2012 10:44:58 +0200
Subject: [PATCH] moved code to namespace BaseLib in files: - FileFinder.h -
 FileTools.h - TimeMeasurementBase.h - quicksort.h

changes due to namespace changes in:
- PointVec.cpp
- Polygon.cpp
- AdjMat.cpp
- CRSMatrixReordered.cpp
---
 BaseLib/FileFinder.h                                     | 5 +++--
 BaseLib/FileTools.h                                      | 3 +++
 BaseLib/TimeMeasurementBase.h                            | 7 +++++--
 BaseLib/quicksort.h                                      | 9 ++++++++-
 GeoLib/PointVec.cpp                                      | 4 ++--
 GeoLib/Polygon.cpp                                       | 2 +-
 .../LinAlg/Sparse/NestedDissectionPermutation/AdjMat.cpp | 2 +-
 .../NestedDissectionPermutation/CRSMatrixReordered.cpp   | 2 +-
 8 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/BaseLib/FileFinder.h b/BaseLib/FileFinder.h
index 41ba7228a00..d518839e678 100644
--- a/BaseLib/FileFinder.h
+++ b/BaseLib/FileFinder.h
@@ -6,6 +6,7 @@
 #ifndef FILEFINDER_H
 #define FILEFINDER_H
 
+namespace BaseLib {
 /**
  * FileFinder stores a list of directories and will return the complete path
  * for a given filename if the corresponding file is found in any of these
@@ -46,9 +47,9 @@ public:
 	};
 
 private:
-
 	std::list<std::string> _directories;
+};
 
+} // end namespace BaseLib
 
-};
 #endif // FILEFINDER_H
diff --git a/BaseLib/FileTools.h b/BaseLib/FileTools.h
index ddf915b32b2..0b2b428f251 100644
--- a/BaseLib/FileTools.h
+++ b/BaseLib/FileTools.h
@@ -11,6 +11,7 @@
 // ** INCLUDES **
 #include <sys/stat.h>
 
+namespace BaseLib {
 /**
  * Returns true if given file exists. From http://www.techbytes.ca/techbyte103.html
  */
@@ -43,4 +44,6 @@ static bool IsFileExisting(std::string strFilename)
 	return(blnReturn);
 }
 
+} // end namespace BaseLib
+
 #endif // FILETOOLS_H
diff --git a/BaseLib/TimeMeasurementBase.h b/BaseLib/TimeMeasurementBase.h
index 36c081fe3db..6466dd7f31c 100644
--- a/BaseLib/TimeMeasurementBase.h
+++ b/BaseLib/TimeMeasurementBase.h
@@ -1,7 +1,9 @@
 #ifndef TIMEMEASUREMENT_H
 #define TIMEMEASUREMENT_H
 
-class TimeMeasurementBase 
+namespace BaseLib {
+
+class TimeMeasurementBase
 {
 public:
 	virtual void start () = 0;
@@ -10,5 +12,6 @@ public:
 	virtual ~TimeMeasurementBase () {};
 };
 
-#endif
+} // end namespace BaseLib
 
+#endif
diff --git a/BaseLib/quicksort.h b/BaseLib/quicksort.h
index 10a83c09899..411d9aed1da 100644
--- a/BaseLib/quicksort.h
+++ b/BaseLib/quicksort.h
@@ -14,6 +14,8 @@
 // Base
 #include "swap.h"
 
+namespace BaseLib {
+
 template <class T>
 unsigned partition_(T* array, unsigned beg, unsigned end)
 {
@@ -97,9 +99,13 @@ void quicksort(T1* array, size_t beg, size_t end, T2* second_array)
 	}
 }
 
+} // end namespace BaseLib
+
 // STL
 #include <vector>
 
+namespace BaseLib {
+
 template <typename T>
 class Quicksort {
 public:
@@ -219,7 +225,8 @@ private:
 			quicksort(perm, p+1, end, array);
 		}
 	}
-
 };
 
+} // end namespace BaseLib
+
 #endif /* QUICKSORT_H_ */
diff --git a/GeoLib/PointVec.cpp b/GeoLib/PointVec.cpp
index 1b0e5881420..fa966cbea69 100644
--- a/GeoLib/PointVec.cpp
+++ b/GeoLib/PointVec.cpp
@@ -156,7 +156,7 @@ void PointVec::makePntsUnique (std::vector<GEOLIB::Point*>* pnt_vec, std::vector
 	}
 
 	// sort the points
-	Quicksort<GEOLIB::Point*> (*pnt_vec, 0, n_pnts_in_file, perm);
+	BaseLib::Quicksort<GEOLIB::Point*> (*pnt_vec, 0, n_pnts_in_file, perm);
 
 	// unfortunately quicksort is not stable -
 	// sort identical points by id - to make sorting stable
@@ -199,7 +199,7 @@ void PointVec::makePntsUnique (std::vector<GEOLIB::Point*>* pnt_vec, std::vector
 	}
 
 	// reverse permutation
-	Quicksort<GEOLIB::Point*> (perm, 0, n_pnts_in_file, *pnt_vec);
+	BaseLib::Quicksort<GEOLIB::Point*> (perm, 0, n_pnts_in_file, *pnt_vec);
 
 	// remove the second, third, ... occurrence from vector
 	for (size_t k(0); k<n_pnts_in_file; k++) {
diff --git a/GeoLib/Polygon.cpp b/GeoLib/Polygon.cpp
index 12721118874..6fcbcbd6d57 100644
--- a/GeoLib/Polygon.cpp
+++ b/GeoLib/Polygon.cpp
@@ -334,7 +334,7 @@ void Polygon::splitPolygonAtPoint (std::list<GEOLIB::Polygon*>::iterator polygon
 		perm[k] = k;
 	}
 
-	quicksort (id_vec, 0, n, perm);
+	BaseLib::quicksort (id_vec, 0, n, perm);
 
 	for (size_t k(0); k<n-1; k++) {
 		if (id_vec[k] == id_vec[k+1]) {
diff --git a/MathLib/LinAlg/Sparse/NestedDissectionPermutation/AdjMat.cpp b/MathLib/LinAlg/Sparse/NestedDissectionPermutation/AdjMat.cpp
index bccd00a113a..d01e2272d1f 100644
--- a/MathLib/LinAlg/Sparse/NestedDissectionPermutation/AdjMat.cpp
+++ b/MathLib/LinAlg/Sparse/NestedDissectionPermutation/AdjMat.cpp
@@ -55,7 +55,7 @@ AdjMat* AdjMat::getMat(unsigned beg, unsigned end,
 
 	delete[] pos;
 	for (i = 0; i < nsize; ++i)
-		quickSort(jAn, iAn[i], iAn[i + 1]);
+		BaseLib::quickSort(jAn, iAn[i], iAn[i + 1]);
 	return new AdjMat(nsize, iAn, jAn, NULL);
 }
 
diff --git a/MathLib/LinAlg/Sparse/NestedDissectionPermutation/CRSMatrixReordered.cpp b/MathLib/LinAlg/Sparse/NestedDissectionPermutation/CRSMatrixReordered.cpp
index 08a18a4bc53..18093b91dbe 100644
--- a/MathLib/LinAlg/Sparse/NestedDissectionPermutation/CRSMatrixReordered.cpp
+++ b/MathLib/LinAlg/Sparse/NestedDissectionPermutation/CRSMatrixReordered.cpp
@@ -57,7 +57,7 @@ void CRSMatrixReordered::reorderMatrix(unsigned const*const op_perm, unsigned co
 
 	delete[] pos;
 	for (i = 0; i < size; ++i)
-		quicksort(jAn, static_cast<size_t>(iAn[i]), static_cast<size_t>(iAn[i + 1]), An);
+		BaseLib::quicksort(jAn, static_cast<size_t>(iAn[i]), static_cast<size_t>(iAn[i + 1]), An);
 
 	BaseLib::swap(iAn, _row_ptr);
 	BaseLib::swap(jAn, _col_idx);
-- 
GitLab